Widget Registry
Public Made by Adomby adom
The reviewed registry of widgets renderable from plain markdown on any wiki page
adom-table: allowlist `colorby` (colour a column from the data) #3
Adds one more attribute to adom-table: colorby. Follow-on to PR #2 (mark), which you
merged 20h ago — thank you. attrs goes to 9, still under the cap of 12.
What it does
colorby="owner:owner_color"
column:field — colour the text of column, and a small leading dot, using the CSS colour
carried in each row's field. The colour comes from the data, not from a palette inside
the widget. Only #rgb / #rrggbb is accepted; anything else is dropped rather than written
into a style attribute, so a data file cannot inject CSS through it.
Why data-driven and not a built-in palette
A generic table cannot know a team's colours, and baking them in would drift from every other
rendering of the same data. adom/repo-ownership paints its ownership.svg export from one
COLORS map and now feeds the same map into the table, so the page and the picture cannot
disagree about who is which colour.
Why it exists
Converting that page's hand-built frame to adom-table silently dropped its per-owner colour
coding — every person had a coloured dot and name, and the widget rendered 19 people in one
grey. Ray spotted the table had gone black and white. Same class of loss as mark: escaping
every cell is right, but it left the widget unable to carry any signal a reader was relying on.
Already shipped
Live in adom/component-widgets (widgets/adom-table.js, commit aa39b4b9) and served now
by /widget-script/adom-table.js. Backward compatible: with no colorby the widget renders
exactly as before. Without this registry entry the attribute is dropped from a ::adom-table{}
tag, so ::tag users cannot reach it; repo-ownership uses the widget through its own section
and is unaffected either way.
Related
adom/wiki#166 — worth knowing if you ever try ::adom-table on a private page: the data
never arrives. An in-frame fetch does not carry the reader's session, so src 404s for real
readers while any API-token check says 200. That holds for a plain unsandboxed section frame
too, not just the sandboxed ::tag frame. repo-ownership now inlines its data instead.
Not merging this myself — the registry is yours and the review is the point.
Diff Skip to comments (1)
@@ -1,23 +1,24 @@⋯ 18 unchanged lines ⋯ "element": "adom-footprint-variants", "attrs": ["src", "variant", "heading"] }, { "name": "adom-table", "mode": "frontend", "script": "https://wiki.adom.inc/adom/component-widgets/render/widgets/adom-table.js",- "element": "adom-table", "attrs": ["src", "columns", "heading", "filter", "facet", "sort", "dim", "mark"] }+ "element": "adom-table", "attrs": ["src", "columns", "heading", "filter", "facet", "sort", "dim", "mark", "colorby"] } ]+@@ -1,58 +1,59 @@⋯ 54 unchanged lines ⋯ | `::adom-heatsink-via{src="..."}` | thermal via layout | | `::adom-symbol-variants{src="..."}` | alternate schematic-symbol layouts (2-column, square, grouped, chip outline), generated in the browser | | `::adom-footprint-variants{src="..."}` | footprint-variant family (baseline, heatsink vias, 300 µm solder balls, rounded pads), parsed live from the page's `.kicad_mod` files; takes an adom-footprint `variants.json` `src` — loads from john/footprint-widgets |-| `::adom-table{src="..."}` | any JSON array as a filterable, sortable table — generic, not component-specific; `columns` `heading` `filter` `facet` `sort` `dim` `mark` |+| `::adom-table{src="..."}` | any JSON array as a filterable, sortable table — generic, not component-specific; `columns` `heading` `filter` `facet` `sort` `dim` `mark` `colorby` |+
Comments
Log in to comment.