@kubex/zinc 1.1.68 → 1.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/custom-elements.json +1417 -275
  2. package/dist/vscode.html-custom-data.json +149 -27
  3. package/dist/web-types.json +351 -64
  4. package/dist/zn.d.ts +325 -14
  5. package/dist/zn.min.js +495 -374
  6. package/docs/pages/components/collapsible.md +6 -2
  7. package/docs/pages/components/preview-frame-demo.njk +33 -4
  8. package/docs/pages/components/preview-frame.md +20 -0
  9. package/docs/pages/components/theme-editor.md +269 -0
  10. package/docs/superpowers/plans/2026-08-03-theme-editor.md +1536 -0
  11. package/docs/superpowers/specs/2026-08-03-theme-editor-design.md +327 -0
  12. package/package.json +1 -1
  13. package/src/components/collapsible/collapsible.component.ts +21 -23
  14. package/src/components/collapsible/collapsible.scss +10 -0
  15. package/src/components/dropdown/dropdown.component.ts +9 -0
  16. package/src/components/editor/editor.component.ts +20 -21
  17. package/src/components/preview-frame/preview-frame.component.ts +126 -16
  18. package/src/components/preview-frame/preview-frame.scss +27 -0
  19. package/src/components/preview-frame/preview-frame.test.ts +253 -0
  20. package/src/components/theme-editor/index.ts +12 -0
  21. package/src/components/theme-editor/theme-editor.component.ts +761 -0
  22. package/src/components/theme-editor/theme-editor.scss +309 -0
  23. package/src/components/theme-editor/theme-editor.test.ts +1584 -0
  24. package/src/events/events.ts +2 -0
  25. package/src/events/zn-theme-change.ts +13 -0
  26. package/src/events/zn-theme-submit.ts +9 -0
  27. package/src/types/web-test-runner-commands.d.ts +6 -0
  28. package/src/zinc.ts +1 -0
  29. package/tsconfig.json +7 -1
  30. package/web-test-runner.config.js +3 -1
@@ -762,7 +762,7 @@
762
762
  },
763
763
  {
764
764
  "name": "zn-collapsible",
765
- "description": "Toggles between showing and hiding content when clicked\n---\n\n\n### **Slots:**\n - **header** - Clicking will toggle the show state of the data\n\n### **CSS Parts:**\n - **header** - The header row (toggle).\n- **caption** - The caption text.",
765
+ "description": "Toggles between showing and hiding content when clicked\n---\n\n\n### **Slots:**\n - **header** - Clicking will toggle the show state of the data\n\n### **CSS Parts:**\n - **header** - The header row (toggle).\n- **caption** - The caption text.\n- **content** - The expandable content wrapper.",
766
766
  "attributes": [
767
767
  { "name": "caption", "values": [] },
768
768
  { "name": "description", "values": [] },
@@ -1784,6 +1784,29 @@
1784
1784
  }
1785
1785
  ]
1786
1786
  },
1787
+ {
1788
+ "name": "zn-header",
1789
+ "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
1790
+ "attributes": [
1791
+ { "name": "full-location", "values": [] },
1792
+ { "name": "entity-id", "values": [] },
1793
+ { "name": "entity-id-show", "values": [] },
1794
+ { "name": "transparent", "values": [] },
1795
+ { "name": "caption", "values": [] },
1796
+ { "name": "icon", "values": [] },
1797
+ { "name": "navigation", "values": [{ "name": "array" }] },
1798
+ { "name": "full-width", "values": [] },
1799
+ { "name": "previous-path", "values": [] },
1800
+ { "name": "previous-target", "values": [] },
1801
+ { "name": "hide-breadcrumb", "values": [] }
1802
+ ],
1803
+ "references": [
1804
+ {
1805
+ "name": "Documentation",
1806
+ "url": "https://zinc.style/components/header"
1807
+ }
1808
+ ]
1809
+ },
1787
1810
  {
1788
1811
  "name": "zn-hover-container",
1789
1812
  "description": "The HoverContainer component is used to display additional information when a user hovers over or clicks\non an element.\n---\n\n\n### **Events:**\n - **zn-show** - Emitted when the hover-container is shown.\n- **zn-after-show** - Emitted after the hover-container is shown.\n- **zn-hide** - Emitted when the hover-container is hidden.\n- **zn-after-hide** - Emitted after the hover-container is hidden.\n\n### **Slots:**\n - _default_ - The content of the hover-container\n- **anchor** - The anchor the hover-container is attached to.",
@@ -1821,29 +1844,6 @@
1821
1844
  }
1822
1845
  ]
1823
1846
  },
1824
- {
1825
- "name": "zn-header",
1826
- "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
1827
- "attributes": [
1828
- { "name": "full-location", "values": [] },
1829
- { "name": "entity-id", "values": [] },
1830
- { "name": "entity-id-show", "values": [] },
1831
- { "name": "transparent", "values": [] },
1832
- { "name": "caption", "values": [] },
1833
- { "name": "icon", "values": [] },
1834
- { "name": "navigation", "values": [{ "name": "array" }] },
1835
- { "name": "full-width", "values": [] },
1836
- { "name": "previous-path", "values": [] },
1837
- { "name": "previous-target", "values": [] },
1838
- { "name": "hide-breadcrumb", "values": [] }
1839
- ],
1840
- "references": [
1841
- {
1842
- "name": "Documentation",
1843
- "url": "https://zinc.style/components/header"
1844
- }
1845
- ]
1846
- },
1847
1847
  {
1848
1848
  "name": "zn-icon",
1849
1849
  "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
@@ -2955,7 +2955,7 @@
2955
2955
  },
2956
2956
  {
2957
2957
  "name": "zn-preview-frame",
2958
- "description": "Embeds a live preview iframe and drives the hp-preview postMessage\nprotocol: answers the frame's ready handshake with a config payload fetched\nfrom data-uri, auto-saves watched forms on change, and refreshes the\npreview after each save.\n---\n\n\n### **Events:**\n - **zn-error** - Emitted when the preview reports a render error or a save fails.\n\n### **Methods:**\n - **refresh()** - Re-fetches the payload and pushes a fresh config to the preview.\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **iframe** - The preview iframe.\n- **error** - The error overlay.",
2958
+ "description": "Embeds a live preview iframe and drives the hp-preview postMessage\nprotocol: answers the frame's ready handshake with a config payload fetched\nfrom data-uri, auto-saves watched forms on change, refreshes the preview\nafter each save (its own, or a shell-driven save of a `refresh-on` form),\nand accepts a theme payload via setTheme() that is retained and replayed\nafter every ready handshake.\n---\n\n\n### **Events:**\n - **zn-error** - Emitted when the preview reports a render error or a save fails.\n\n### **Methods:**\n - **refresh()** - Re-fetches the payload and pushes a fresh config to the preview.\n- **setTheme(theme: _Record<string, unknown>_)** - Pushes a theme payload into the preview. The payload is retained and\nre-posted after every ready handshake, so a frame reload doesn't drop an\nin-progress theme.\n\n### **CSS Properties:**\n - **--zn-preview-frame-dot-spacing** - Spacing of the backdrop dot grid (`backdrop=\"dots\"`). Defaults to 20px. _(default: undefined)_\n- **--zn-preview-frame-dot-opacity** - Opacity of the backdrop dots (`backdrop=\"dots\"`). Defaults to 0.08. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **stage** - The device-width wrapper around the iframe.\n- **iframe** - The preview iframe.\n- **error** - The error overlay.",
2959
2959
  "attributes": [
2960
2960
  {
2961
2961
  "name": "src",
@@ -2977,6 +2977,11 @@
2977
2977
  "description": "Selector (resolved against the component's root node) for the forms to watch.\nDefaults to only forms explicitly opted in via a `data-auto-save` attribute —\nunmarked forms keep normal submit behavior and are never intercepted,\nauto-saved, or used to trigger a preview refresh. Override to widen the scope.",
2978
2978
  "values": []
2979
2979
  },
2980
+ {
2981
+ "name": "refresh-on",
2982
+ "description": "Selector for forms whose saves are left to the shell but should still\nrefresh the preview. These are never intercepted: the shell submits them\n(so its own response handling — alerts, refreshes — runs as normal) and the\npreview re-fetches its config once the shell reports the save complete.\nSet empty to disable.",
2983
+ "values": []
2984
+ },
2980
2985
  {
2981
2986
  "name": "debounce",
2982
2987
  "description": "Debounce in ms between a form change and its auto-save.",
@@ -2984,13 +2989,28 @@
2984
2989
  },
2985
2990
  {
2986
2991
  "name": "zoom",
2987
- "description": "Zooms the previewed page out (0–1]. The frame always fills the panel;\nzoom shrinks the content browser-style, so 0.4 shows the page at 40%\nsize with correspondingly more of it visible. 1 = natural size.",
2992
+ "description": "Zooms the previewed page out (0–1]. The frame always fills the panel;\nzoom shrinks the content browser-style, so 0.4 shows the page at 40%\nsize with correspondingly more of it visible. 1 = natural size.\nIgnored when `fill` is set.",
2988
2993
  "values": []
2989
2994
  },
2990
2995
  {
2991
2996
  "name": "min-height",
2992
- "description": "The visible height (in CSS pixels) of the preview panel. Fixed rather\nthan measured, because a measured height would feed back into the\nscaled iframe's layout box and grow unbounded.",
2997
+ "description": "The visible height (in CSS pixels) of the preview panel. Fixed rather\nthan measured, because a measured height would feed back into the\nscaled iframe's layout box and grow unbounded. With `fill` set, this\nbecomes a `min-height` floor instead of the height.",
2993
2998
  "values": []
2999
+ },
3000
+ {
3001
+ "name": "fill",
3002
+ "description": "Fills the panel's own column height instead of using a fixed\n`min-height` pixel height — for hosts (like zn-theme-editor) whose\nlayout already stretches the column to match a taller sibling.\n`zoom` is ignored when set: its oversize maths depends on a known\npixel height, which `fill` deliberately doesn't have.",
3003
+ "values": []
3004
+ },
3005
+ {
3006
+ "name": "device",
3007
+ "description": "Constrains and centres the preview to a device width: `desktop` (100%),\n`tablet` (768px) or `mobile` (390px). The iframe element itself is\nnarrowed, so the embedded page's own media queries fire.",
3008
+ "values": [{ "name": "PreviewFrameDevice" }]
3009
+ },
3010
+ {
3011
+ "name": "backdrop",
3012
+ "description": "Backdrop behind the stage: `dots` (default) is the canvas dot grid; `panel` is a plain `rgb(var(--zn-panel))` fill.",
3013
+ "values": [{ "name": "dots" }, { "name": "panel" }]
2994
3014
  }
2995
3015
  ],
2996
3016
  "references": [
@@ -4119,6 +4139,108 @@
4119
4139
  }
4120
4140
  ]
4121
4141
  },
4142
+ {
4143
+ "name": "zn-theme-editor",
4144
+ "description": "A theme editor: slotted form controls drive a live preview frame,\nwith a toolbar for the preview's light/dark mode and device width.\n---\n\n\n### **Events:**\n - **zn-theme-change** - Emitted when the values, mode or device change.\n- **zn-theme-submit** - Emitted on submit (button click), carrying the current values. With `action` set, only fires after a successful save.\n- **zn-error** - Emitted when a save fails. Also seen for preview render failures: the frame's zn-error is composed and not stopped, so it bubbles out through the editor too.\n\n### **Slots:**\n - _default_ - Ungrouped theme controls, rendered above any sections. Controls assigned `slot=\"<name>\"` matching a `sections` entry (or, when nested, a `groups` entry) render inside that section/group instead. Harvesting and change detection walk every slot's full assigned subtree, not just direct children.\n- **toolbar** - Actions in the toolbar, right-aligned beside the device controls. Where a save button belongs.\n- **footer** - Actions pinned beneath the controls. The built-in submit button lives in the toolbar, not here.\n\n### **CSS Properties:**\n - **--zn-theme-editor-controls-width** - Width of the controls column. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **controls** - The left-hand controls column, full height.\n- **controls-header** - The controls column's header row: `controls-caption` on the left, the light/dark mode toggle on the right.\n- **toolbar** - The preview column's header row: `preview-caption` on the left, the device switcher (and sources/submit) on the right. Spans the preview column only.\n- **section** - A rendered section's or group's collapsible (`section-layout=\"collapsible\"`, or any nested group).\n- **footer** - The footer wrapper beneath the controls.\n- **preview** - The preview column.\n- **error** - The inline error strip.\n- **preview__base** - The frame's base wrapper (forwarded from zn-preview-frame).\n- **preview__stage** - The frame's device-width wrapper (forwarded from zn-preview-frame).\n- **preview__iframe** - The frame's iframe (forwarded from zn-preview-frame).\n- **preview__error** - The frame's own error overlay (forwarded from zn-preview-frame).",
4145
+ "attributes": [
4146
+ {
4147
+ "name": "src",
4148
+ "description": "URL of the preview shell page; forwarded to the frame.",
4149
+ "values": []
4150
+ },
4151
+ {
4152
+ "name": "frame-origin",
4153
+ "description": "Expected origin of the iframe; forwarded to the frame.",
4154
+ "values": []
4155
+ },
4156
+ {
4157
+ "name": "data-uri",
4158
+ "description": "Optional endpoint returning the base hp-preview:config payload.",
4159
+ "values": []
4160
+ },
4161
+ {
4162
+ "name": "mode",
4163
+ "description": "Which mode the preview renders in. Travels in the theme payload.",
4164
+ "values": [{ "name": "ThemeEditorMode" }]
4165
+ },
4166
+ {
4167
+ "name": "device",
4168
+ "description": "Preview viewport width. Resizes the frame only; not part of the payload.",
4169
+ "values": [{ "name": "ThemeEditorDevice" }]
4170
+ },
4171
+ {
4172
+ "name": "min-height",
4173
+ "description": "Minimum height of the preview row, in pixels; forwarded to the frame as its own floor.",
4174
+ "values": []
4175
+ },
4176
+ {
4177
+ "name": "debounce",
4178
+ "description": "Debounce in ms between a control change and the push to the preview.",
4179
+ "values": []
4180
+ },
4181
+ {
4182
+ "name": "action",
4183
+ "description": "Optional endpoint the values are POSTed to. Empty = no persistence.",
4184
+ "values": []
4185
+ },
4186
+ {
4187
+ "name": "save-debounce",
4188
+ "description": "Debounce in ms between a control change and the save POST.",
4189
+ "values": []
4190
+ },
4191
+ {
4192
+ "name": "sections",
4193
+ "description": "Groups controls into named sections. Empty/unset renders one ungrouped\ncolumn. A section with a non-empty `groups` nests a collapsible per\ngroup inside a `zn-tabs` tab for that section - see `groups` on\n`ThemeEditorSection`.",
4194
+ "values": [{ "name": "ThemeEditorSection[]" }]
4195
+ },
4196
+ {
4197
+ "name": "section-layout",
4198
+ "description": "Presentation for flat, group-less `sections`: stacked `zn-collapsible`s\n(default) or a `zn-tabs` strip. Ignored once any section has `groups` -\nnested sections always render as tabs.",
4199
+ "values": [{ "name": "collapsible" }, { "name": "tabs" }]
4200
+ },
4201
+ {
4202
+ "name": "sources",
4203
+ "description": "Dropdown of preview sources, `{label, src}`, rendered in the toolbar. Empty/unset renders no dropdown; the first entry wins over an explicit `src` when non-empty.",
4204
+ "values": [{ "name": "ThemeEditorSource[]" }]
4205
+ },
4206
+ {
4207
+ "name": "controls-collapsed",
4208
+ "description": "Collapses the controls column.",
4209
+ "values": []
4210
+ },
4211
+ {
4212
+ "name": "standalone",
4213
+ "description": "Presents the editor as its own bordered, rounded panel with a plain preview backdrop, rather than embedded in a dotted canvas.",
4214
+ "values": []
4215
+ },
4216
+ {
4217
+ "name": "controls-caption",
4218
+ "description": "Caption in the controls column's header row. Empty (default) renders no text; the row itself always renders.",
4219
+ "values": []
4220
+ },
4221
+ {
4222
+ "name": "preview-caption",
4223
+ "description": "Caption at the left of the toolbar, opposite the device and mode controls. Empty (default) renders no text.",
4224
+ "values": []
4225
+ },
4226
+ {
4227
+ "name": "submit-label",
4228
+ "description": "Label for the built-in submit button. Empty (default) renders no button.",
4229
+ "values": []
4230
+ },
4231
+ {
4232
+ "name": "manual",
4233
+ "description": "Disables the debounced auto-save; saving then happens only via submit. Preview pushes are unaffected.",
4234
+ "values": []
4235
+ }
4236
+ ],
4237
+ "references": [
4238
+ {
4239
+ "name": "Documentation",
4240
+ "url": "https://zinc.style/components/theme-editor"
4241
+ }
4242
+ ]
4243
+ },
4122
4244
  {
4123
4245
  "name": "zn-tile",
4124
4246
  "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",