Repository navigation
feat(ui): the kit offers a full set of widgets, and its properties card follows the Support Code by itself - #204
derek-miller wants to merge 5 commits into
Conversation
…, labels, rows, switches, popovers, forms and layout helpers
…icture grid components
There was a problem hiding this comment.
Approving with two nits. The riskiest path is the Support Code hook: the follower runs under its own pcall, after the driver's onChange, and its error print leaves out the typed value. The indented --#ifdef in serve() matches preprocess.py's ^\s*--\s*#ifdef pattern, so an OSS build drops both the require and the hook. Beyond CI, I ran make render-checks for ui and ui-expressions and mutated a scratch render. Each of these broke a test: dropping the hook, skipping the followers, an unguarded follower, collapse's setAll keeping hand-set groups, menu ignoring Escape, combobox's ArrowUp wrap and search filter, color's Esc keeping the pick, pickgrid taking a paste inside an input, and set() losing the mark. The local build leg stops at dp3's encrypt step because of this host's M2Crypto/OpenSSL mismatch, so I'm relying on CI's build legs for that.
| end | ||
|
|
||
| --- Calls `callback(open)` as the window opens and closes, alongside the driver's `onChange`, for a library whose view | ||
| --- changes with it: lib.ui.tab-properties' card, whose Log Level list does. |
There was a problem hiding this comment.
Nit: naming the one caller (lib.ui.tab-properties' card) will go stale once a second library follows. "for a library whose view changes with the window" says the same and stays true.
There was a problem hiding this comment.
Fixed in 89e19a2: the doc now says "for a library whose view changes with the window", with no caller named.
| var isOpen = key === openKey; | ||
| var label = Kit.str(options.label); | ||
| var html = | ||
| '<div class="kit-combo' + (isOpen ? " open" : "") + (options.className ? " " + options.className : "") + '" data-combo="' + Kit.esc(key) + '"' + |
There was a problem hiding this comment.
Nit: collapse and menu put their hooks under data-kit-* (data-kit-collapse, data-kit-menu), but this one is a bare data-combo, which is more likely to collide with a page's own attribute. data-kit-combo would match the other two.
There was a problem hiding this comment.
Fixed in 89e19a2: the hook is data-kit-combo, matching data-kit-collapse and data-kit-menu; the combobox test follows.
…', and follow's doc names no caller
There was a problem hiding this comment.
Both nits are fixed. The combobox now uses data-kit-combo everywhere it is written or queried (the markup, control(), and the click and keydown delegates), and no data-combo is left anywhere in the tree, so the hook and its lookups can't drift apart. follow's doc no longer names a caller.
The UI kit now offers a full set of widgets, Bootstrap-style, so a custom Composer tab picks what it needs instead of carrying its own copy. The kit's properties card also follows the Support Code's window by itself.
Derek, on the kit v2 adoption PRs: "even if there were styles that are generic that we could fold into the template that would be fine too. Think of it like bootstrap where it offers a full site's styles for all kinds of widgets, you dont have to use them all but they are there." He picked all three tiers below, with one look for each widget where the pages' versions differed.
The card and the Support Code. Every DriverCentral driver with the properties card has to send the card its list again as the Support Code opens and closes the Lua window, since Log Level's choices change and no property handler runs. Each driver wired that by hand, and one got it wrong: zigbee3's open card kept offering Trace and Ultra after the hour ended.
lib.support-codegainsfollow(fn), called alongside the driver's ownonChange, each caught as before so the typed code never prints.TabProperties:serve()follows the window in a DriverCentral build and resends PROPERTIES.onChangeis only for what else it shows.Tier 1, style.css. Chip colors, the
.btn-linkbutton and.input-validjoin the base. New.kit-*widgets:detailssection, a short highlightTier 2 and 3, components. Each is a JS and CSS pair in
src/lib/ui, onKit, embedded only by a page that uses it:collapse: groups that fold under a caret with Expand all, their state kept by key across a string-rendered page's redraws.menu:Kit.splitButton, a button with an arrow and its menu; a pick, a click elsewhere or Escape closes it.combobox: a searchable dropdown that stays open across redraws, with keyboard choice.color: the color picker that replaces Edge's (whose dropper misreads Composer's window), with offered and recent colors, hex, sliders and a dropper.pickgrid:Kit.pickGrid, a picture grid to pick from, andKit.dropZone, a file drop, choose and paste zone.Template. The scope test's BASE list takes the new base selectors and its pairs check takes the five components;
make render-ui-js, the build check, theuiandui-expressionssnapshots and copier's help text list them.Tests. Node, on the shared fake DOM: collapse, menu, combobox, color and pickgrid, each failing under a deliberate break. Lua: the Support Code's followers (told on opening and closing, a raising one reported without the code), and the card's resend, which fails without the hook. Locally,
make render-checkspasses forui,ui-expressionsanddefault,make build-checksforuiandui-expressions, andmake invalid-combinations.What uses it. The four kit adoption PRs (finitelabs/control4-finite-labs-essentials#89, finitelabs/control4-influxdb#97, finitelabs/control4-dynamic-buttons#48, finitelabs/control4-zigbee3#433) are re-rolled onto this tag. Their pages drop about 1,000 lines between them and each driver drops its hand-wired Support Code push. Their doc screenshots are reshot, and every tab feature is checked live on dev before their merge asks.