starlit  Diff

Differences From Artifact [60598b98d5]:

To Artifact [a436d8c893]:


161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
		local cols = def.cols or math.huge
		local startX = state.x
		local maxX = startX
		for _, w in ipairs(def) do idx = idx + 1
			local src, st = starlit.ui.build(w, state)
			-- TODO alignments
			rowH = math.max(rowH, st.h)
			if idx > cols or def.w and (state.x + state.spacing + st.w > def.w) then
				totalH = totalH + rowH
				state.x = startX
				rowH,idx = 0,0
				state.y = state.y + state.spacing + st.h
			end
			widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
			state.x=state.x + state.spacing + st.w
................................................................................
		widget('label[%s,%s;%s]',
			state.x, state.y + def.h*.5, txt)
	elseif def.kind == 'text' then
		-- TODO paragraph formatter
		widget('hypertext[%s,%s;%s,%s;%s;%s]',
			state.x, state.y, def.w, def.h, E(def.id), E(def.text))
	elseif def.kind == 'hbar' or def.kind == 'vbar' then -- TODO fancy image bars
		local cl = lib.color(state.color)
		local fg = state.fg or cl:readable(.8,1)
		local wfac, hfac = 1,1
		local clamp = math.min(math.max(def.fac or 0, 0), 1)
		if def.kind == 'hbar'
			then wfac = wfac * clamp
			else hfac = hfac * clamp
		end







|







 







|







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
		local cols = def.cols or math.huge
		local startX = state.x
		local maxX = startX
		for _, w in ipairs(def) do idx = idx + 1
			local src, st = starlit.ui.build(w, state)
			-- TODO alignments
			rowH = math.max(rowH, st.h)
			if idx > cols or (def.w and (state.x + state.spacing + st.w > def.w)) then
				totalH = totalH + rowH
				state.x = startX
				rowH,idx = 0,0
				state.y = state.y + state.spacing + st.h
			end
			widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
			state.x=state.x + state.spacing + st.w
................................................................................
		widget('label[%s,%s;%s]',
			state.x, state.y + def.h*.5, txt)
	elseif def.kind == 'text' then
		-- TODO paragraph formatter
		widget('hypertext[%s,%s;%s,%s;%s;%s]',
			state.x, state.y, def.w, def.h, E(def.id), E(def.text))
	elseif def.kind == 'hbar' or def.kind == 'vbar' then -- TODO fancy image bars
		local cl = lib.color(def.color or state.color)
		local fg = state.fg or cl:readable(.8,1)
		local wfac, hfac = 1,1
		local clamp = math.min(math.max(def.fac or 0, 0), 1)
		if def.kind == 'hbar'
			then wfac = wfac * clamp
			else hfac = hfac * clamp
		end