@kubex/zinc 1.1.68 → 1.1.70
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.
- package/dist/custom-elements.json +1719 -282
- package/dist/vscode.html-custom-data.json +160 -29
- package/dist/web-types.json +395 -70
- package/dist/zn.d.ts +395 -16
- package/dist/zn.min.js +580 -408
- package/docs/pages/components/collapsible.md +6 -2
- package/docs/pages/components/icon-picker.md +14 -0
- package/docs/pages/components/input.md +19 -1
- package/docs/pages/components/preview-frame-demo.njk +33 -4
- package/docs/pages/components/preview-frame.md +20 -0
- package/docs/pages/components/theme-editor.md +303 -0
- package/docs/superpowers/plans/2026-08-03-theme-editor.md +1536 -0
- package/docs/superpowers/specs/2026-08-03-theme-editor-design.md +327 -0
- package/package.json +1 -1
- package/src/components/collapsible/collapsible.component.ts +21 -23
- package/src/components/dropdown/dropdown.component.ts +9 -0
- package/src/components/editor/editor.component.ts +20 -21
- package/src/components/file/file.component.ts +15 -0
- package/src/components/icon-picker/icon-picker.component.ts +150 -16
- package/src/components/icon-picker/icon-picker.scss +32 -0
- package/src/components/input/input.component.ts +44 -21
- package/src/components/input/input.scss +134 -42
- package/src/components/input/input.test.ts +45 -0
- package/src/components/preview-frame/preview-frame.component.ts +126 -16
- package/src/components/preview-frame/preview-frame.scss +27 -0
- package/src/components/preview-frame/preview-frame.test.ts +253 -0
- package/src/components/theme-editor/index.ts +12 -0
- package/src/components/theme-editor/theme-editor.component.ts +918 -0
- package/src/components/theme-editor/theme-editor.scss +309 -0
- package/src/components/theme-editor/theme-editor.test.ts +1752 -0
- package/src/events/events.ts +2 -0
- package/src/events/zn-theme-change.ts +13 -0
- package/src/events/zn-theme-submit.ts +9 -0
- package/src/types/web-test-runner-commands.d.ts +6 -0
- package/src/zinc.ts +1 -0
- package/tsconfig.json +7 -1
- package/web-test-runner.config.js +3 -1
package/dist/zn.d.ts
CHANGED
|
@@ -1390,6 +1390,7 @@ declare module "components/collapsible/collapsible.component" {
|
|
|
1390
1390
|
*
|
|
1391
1391
|
* @csspart header - The header row (toggle).
|
|
1392
1392
|
* @csspart caption - The caption text.
|
|
1393
|
+
* @csspart content - The expandable content wrapper.
|
|
1393
1394
|
*/
|
|
1394
1395
|
export default class ZnCollapsible extends ZincElement {
|
|
1395
1396
|
static styles: CSSResultGroup;
|
|
@@ -1879,7 +1880,7 @@ declare module "components/input/input.component" {
|
|
|
1879
1880
|
*
|
|
1880
1881
|
* @slot label - The input's label. Alternatively, you can use the `label` attribute.
|
|
1881
1882
|
* @slot label-tooltip - Used to add text that is displayed in a tooltip next to the label. Alternatively, you can use the `label-tooltip` attribute.
|
|
1882
|
-
* @slot context-note - Used to add contextual text that is displayed above the input, on the right. Alternatively, you can use the `context-note` attribute.
|
|
1883
|
+
* @slot context-note - Used to add contextual text that is displayed above the input, on the right. Alternatively, you can use the `context-note` attribute. Range inputs display their live value here unless this is set.
|
|
1883
1884
|
* @slot prefix - Used to prepend a presentational icon or similar element to the input.
|
|
1884
1885
|
* @slot suffix - Used to append a presentational icon or similar element to the input.
|
|
1885
1886
|
* @slot clear-icon - An icon to use in lieu of the default clear icon.
|
|
@@ -1897,6 +1898,12 @@ declare module "components/input/input.component" {
|
|
|
1897
1898
|
* @csspart clear-button - The clear button.
|
|
1898
1899
|
* @csspart password-toggle-button - The password toggle button.
|
|
1899
1900
|
* @csspart suffix - The container that wraps the suffix.
|
|
1901
|
+
*
|
|
1902
|
+
* @cssproperty --zn-range-track-height - The height of a range input's track.
|
|
1903
|
+
* @cssproperty --zn-range-track-color - The color of a range input's track.
|
|
1904
|
+
* @cssproperty --zn-range-thumb-size - The diameter of a range input's thumb.
|
|
1905
|
+
* @cssproperty --zn-range-thumb-color - The color of a range input's thumb.
|
|
1906
|
+
* @cssproperty --zn-range-thumb-ring-width - The width of the ring drawn around a range input's thumb.
|
|
1900
1907
|
*/
|
|
1901
1908
|
export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
1902
1909
|
static styles: import("lit").CSSResult;
|
|
@@ -1918,7 +1925,7 @@ declare module "components/input/input.component" {
|
|
|
1918
1925
|
* The type of input. Works the same as native `<input>` element. But only a subset of types is supported. Defaults
|
|
1919
1926
|
* to `text`
|
|
1920
1927
|
*/
|
|
1921
|
-
type: 'color' | 'currency' | 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';
|
|
1928
|
+
type: 'color' | 'currency' | 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'range' | 'search' | 'tel' | 'text' | 'time' | 'url';
|
|
1922
1929
|
/** The name of the input, submitted as a name/value pair with form data. */
|
|
1923
1930
|
name: string;
|
|
1924
1931
|
/** The current value of the input, submitted as a name/value pair with form data. */
|
|
@@ -1964,6 +1971,11 @@ declare module "components/input/input.component" {
|
|
|
1964
1971
|
noSpinButtons: boolean;
|
|
1965
1972
|
/** The color format to display for color inputs. Only applies when type is 'color'. **/
|
|
1966
1973
|
colorFormat: 'hex' | 'rgb' | 'hsl' | 'oklch';
|
|
1974
|
+
/**
|
|
1975
|
+
* Appended to the value that range inputs display above the track, on the right, e.g. `rem`. Only applies when type
|
|
1976
|
+
* is 'range' and no `context-note` is set.
|
|
1977
|
+
*/
|
|
1978
|
+
valueSuffix: string;
|
|
1967
1979
|
/**
|
|
1968
1980
|
* By default, form-controls are associated with the nearest containing `<form>` element. This attribute allows you
|
|
1969
1981
|
* to place the form control outside a form and associate it with the form that has this `id`. The form must be
|
|
@@ -2045,6 +2057,7 @@ declare module "components/input/input.component" {
|
|
|
2045
2057
|
private handleColorSwatchClick;
|
|
2046
2058
|
private handleColorPickerChange;
|
|
2047
2059
|
private focusInput;
|
|
2060
|
+
protected firstUpdated(): void;
|
|
2048
2061
|
handleDisabledChange(): void;
|
|
2049
2062
|
handleStepChange(): void;
|
|
2050
2063
|
handleValueChange(): Promise<void>;
|
|
@@ -4696,6 +4709,9 @@ declare module "components/icon-picker/icon-picker.component" {
|
|
|
4696
4709
|
helpText: string;
|
|
4697
4710
|
disabled: boolean;
|
|
4698
4711
|
required: boolean;
|
|
4712
|
+
triggerSubmit: boolean;
|
|
4713
|
+
allowUpload: boolean;
|
|
4714
|
+
accept: string;
|
|
4699
4715
|
form: string;
|
|
4700
4716
|
defaultValue: string;
|
|
4701
4717
|
private _dialogOpen;
|
|
@@ -4705,9 +4721,19 @@ declare module "components/icon-picker/icon-picker.component" {
|
|
|
4705
4721
|
private _pendingIcon;
|
|
4706
4722
|
private _pendingLibrary;
|
|
4707
4723
|
private _pendingColor;
|
|
4724
|
+
private _pendingFile;
|
|
4725
|
+
private _pendingFileUrl;
|
|
4726
|
+
private _mode;
|
|
4727
|
+
private _file;
|
|
4728
|
+
private _fileUrl;
|
|
4708
4729
|
private _dialog;
|
|
4730
|
+
private _fileInput;
|
|
4709
4731
|
get value(): string;
|
|
4710
4732
|
set value(val: string);
|
|
4733
|
+
/** The chosen file when the user uploaded an image instead of picking an icon. */
|
|
4734
|
+
get file(): File | null;
|
|
4735
|
+
/** True when the current value renders as an image (an uploaded file or a URL) rather than a library icon. */
|
|
4736
|
+
get isImageValue(): boolean;
|
|
4711
4737
|
get validity(): ValidityState;
|
|
4712
4738
|
get validationMessage(): string;
|
|
4713
4739
|
checkValidity(): boolean;
|
|
@@ -4721,6 +4747,10 @@ declare module "components/icon-picker/icon-picker.component" {
|
|
|
4721
4747
|
private closeDialog;
|
|
4722
4748
|
private handleConfirm;
|
|
4723
4749
|
private handleCancel;
|
|
4750
|
+
private handleFileSelect;
|
|
4751
|
+
private discardPendingFile;
|
|
4752
|
+
private clearFile;
|
|
4753
|
+
disconnectedCallback(): void;
|
|
4724
4754
|
private handleSearchInput;
|
|
4725
4755
|
private filterIcons;
|
|
4726
4756
|
private handleIconSelect;
|
|
@@ -7266,6 +7296,12 @@ declare module "components/file/file.component" {
|
|
|
7266
7296
|
private handleClearClick;
|
|
7267
7297
|
/** Clear the current value after the user confirms. */
|
|
7268
7298
|
private confirmClear;
|
|
7299
|
+
/**
|
|
7300
|
+
* Programmatically clears the selected file and any external `src` without
|
|
7301
|
+
* confirmation. Unlike a user-initiated clear, this does not flag the control
|
|
7302
|
+
* to submit an empty value.
|
|
7303
|
+
*/
|
|
7304
|
+
clear(): void;
|
|
7269
7305
|
private updatePreview;
|
|
7270
7306
|
/**
|
|
7271
7307
|
* Returns the URL currently shown in the droparea — the locally-selected file's object URL
|
|
@@ -10388,11 +10424,19 @@ declare module "components/page-builder/index" {
|
|
|
10388
10424
|
declare module "components/preview-frame/preview-frame.component" {
|
|
10389
10425
|
import { type CSSResultGroup } from 'lit';
|
|
10390
10426
|
import ZincElement from "internal/zinc-element";
|
|
10427
|
+
const DEVICE_WIDTHS: {
|
|
10428
|
+
readonly desktop: "100%";
|
|
10429
|
+
readonly tablet: "768px";
|
|
10430
|
+
readonly mobile: "390px";
|
|
10431
|
+
};
|
|
10432
|
+
export type PreviewFrameDevice = keyof typeof DEVICE_WIDTHS;
|
|
10391
10433
|
/**
|
|
10392
10434
|
* @summary Embeds a live preview iframe and drives the hp-preview postMessage
|
|
10393
10435
|
* protocol: answers the frame's ready handshake with a config payload fetched
|
|
10394
|
-
* from data-uri, auto-saves watched forms on change,
|
|
10395
|
-
*
|
|
10436
|
+
* from data-uri, auto-saves watched forms on change, refreshes the preview
|
|
10437
|
+
* after each save (its own, or a shell-driven save of a `refresh-on` form),
|
|
10438
|
+
* and accepts a theme payload via setTheme() that is retained and replayed
|
|
10439
|
+
* after every ready handshake.
|
|
10396
10440
|
* @documentation https://zinc.style/components/preview-frame
|
|
10397
10441
|
* @status experimental
|
|
10398
10442
|
* @since 1.0
|
|
@@ -10400,8 +10444,12 @@ declare module "components/preview-frame/preview-frame.component" {
|
|
|
10400
10444
|
* @event zn-error - Emitted when the preview reports a render error or a save fails.
|
|
10401
10445
|
*
|
|
10402
10446
|
* @csspart base - The component's base wrapper.
|
|
10447
|
+
* @csspart stage - The device-width wrapper around the iframe.
|
|
10403
10448
|
* @csspart iframe - The preview iframe.
|
|
10404
10449
|
* @csspart error - The error overlay.
|
|
10450
|
+
*
|
|
10451
|
+
* @cssproperty --zn-preview-frame-dot-spacing - Spacing of the backdrop dot grid (`backdrop="dots"`). Defaults to 20px.
|
|
10452
|
+
* @cssproperty --zn-preview-frame-dot-opacity - Opacity of the backdrop dots (`backdrop="dots"`). Defaults to 0.08.
|
|
10405
10453
|
*/
|
|
10406
10454
|
export default class ZnPreviewFrame extends ZincElement {
|
|
10407
10455
|
static styles: CSSResultGroup;
|
|
@@ -10418,24 +10466,52 @@ declare module "components/preview-frame/preview-frame.component" {
|
|
|
10418
10466
|
* auto-saved, or used to trigger a preview refresh. Override to widen the scope.
|
|
10419
10467
|
*/
|
|
10420
10468
|
watch: string;
|
|
10469
|
+
/**
|
|
10470
|
+
* Selector for forms whose saves are left to the shell but should still
|
|
10471
|
+
* refresh the preview. These are never intercepted: the shell submits them
|
|
10472
|
+
* (so its own response handling — alerts, refreshes — runs as normal) and the
|
|
10473
|
+
* preview re-fetches its config once the shell reports the save complete.
|
|
10474
|
+
* Set empty to disable.
|
|
10475
|
+
*/
|
|
10476
|
+
refreshOn: string;
|
|
10421
10477
|
/** Debounce in ms between a form change and its auto-save. */
|
|
10422
10478
|
debounce: number;
|
|
10423
10479
|
/**
|
|
10424
10480
|
* Zooms the previewed page out (0–1]. The frame always fills the panel;
|
|
10425
10481
|
* zoom shrinks the content browser-style, so 0.4 shows the page at 40%
|
|
10426
10482
|
* size with correspondingly more of it visible. 1 = natural size.
|
|
10483
|
+
* Ignored when `fill` is set.
|
|
10427
10484
|
*/
|
|
10428
10485
|
zoom: number;
|
|
10429
10486
|
/**
|
|
10430
10487
|
* The visible height (in CSS pixels) of the preview panel. Fixed rather
|
|
10431
10488
|
* than measured, because a measured height would feed back into the
|
|
10432
|
-
* scaled iframe's layout box and grow unbounded.
|
|
10489
|
+
* scaled iframe's layout box and grow unbounded. With `fill` set, this
|
|
10490
|
+
* becomes a `min-height` floor instead of the height.
|
|
10433
10491
|
*/
|
|
10434
10492
|
minHeight: number;
|
|
10493
|
+
/**
|
|
10494
|
+
* Fills the panel's own column height instead of using a fixed
|
|
10495
|
+
* `min-height` pixel height — for hosts (like zn-theme-editor) whose
|
|
10496
|
+
* layout already stretches the column to match a taller sibling.
|
|
10497
|
+
* `zoom` is ignored when set: its oversize maths depends on a known
|
|
10498
|
+
* pixel height, which `fill` deliberately doesn't have.
|
|
10499
|
+
*/
|
|
10500
|
+
fill: boolean;
|
|
10501
|
+
/**
|
|
10502
|
+
* Constrains and centres the preview to a device width: `desktop` (100%),
|
|
10503
|
+
* `tablet` (768px) or `mobile` (390px). The iframe element itself is
|
|
10504
|
+
* narrowed, so the embedded page's own media queries fire.
|
|
10505
|
+
*/
|
|
10506
|
+
device: PreviewFrameDevice;
|
|
10507
|
+
/** Backdrop behind the stage: `dots` (default) is the canvas dot grid; `panel` is a plain `rgb(var(--zn-panel))` fill. */
|
|
10508
|
+
backdrop: 'dots' | 'panel';
|
|
10435
10509
|
frame: HTMLIFrameElement;
|
|
10436
10510
|
private error;
|
|
10437
10511
|
private _generation;
|
|
10512
|
+
private _theme;
|
|
10438
10513
|
private readonly _watchedForms;
|
|
10514
|
+
private readonly _refreshForms;
|
|
10439
10515
|
private readonly _debounceTimers;
|
|
10440
10516
|
private readonly _formObserver;
|
|
10441
10517
|
connectedCallback(): void;
|
|
@@ -10443,8 +10519,16 @@ declare module "components/preview-frame/preview-frame.component" {
|
|
|
10443
10519
|
private readonly _onMessage;
|
|
10444
10520
|
/** Re-fetches the payload and pushes a fresh config to the preview. */
|
|
10445
10521
|
refresh(): Promise<void>;
|
|
10522
|
+
/**
|
|
10523
|
+
* Pushes a theme payload into the preview. The payload is retained and
|
|
10524
|
+
* re-posted after every ready handshake, so a frame reload doesn't drop an
|
|
10525
|
+
* in-progress theme.
|
|
10526
|
+
*/
|
|
10527
|
+
setTheme(theme: Record<string, unknown>): void;
|
|
10528
|
+
private _postTheme;
|
|
10446
10529
|
private _sendConfig;
|
|
10447
10530
|
private _attachForms;
|
|
10531
|
+
private readonly _onShellSave;
|
|
10448
10532
|
private _detachForm;
|
|
10449
10533
|
private readonly _onChange;
|
|
10450
10534
|
private readonly _onSubmit;
|
|
@@ -10463,6 +10547,280 @@ declare module "components/preview-frame/index" {
|
|
|
10463
10547
|
}
|
|
10464
10548
|
}
|
|
10465
10549
|
}
|
|
10550
|
+
declare module "events/zn-error" {
|
|
10551
|
+
export type ZnErrorEvent = CustomEvent<{
|
|
10552
|
+
status?: number;
|
|
10553
|
+
message?: string;
|
|
10554
|
+
}>;
|
|
10555
|
+
global {
|
|
10556
|
+
interface GlobalEventHandlersEventMap {
|
|
10557
|
+
'zn-error': ZnErrorEvent;
|
|
10558
|
+
}
|
|
10559
|
+
}
|
|
10560
|
+
}
|
|
10561
|
+
declare module "components/theme-editor/theme-editor.component" {
|
|
10562
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
10563
|
+
import ZincElement from "internal/zinc-element";
|
|
10564
|
+
import ZnButton from "components/button/index";
|
|
10565
|
+
import ZnCollapsible from "components/collapsible/index";
|
|
10566
|
+
import ZnIcon from "components/icon/index";
|
|
10567
|
+
import ZnNavbar from "components/navbar/index";
|
|
10568
|
+
import ZnOption from "components/option/index";
|
|
10569
|
+
import ZnPreviewFrame from "components/preview-frame/index";
|
|
10570
|
+
import ZnSelect from "components/select/index";
|
|
10571
|
+
import ZnTabs from "components/tabs/index";
|
|
10572
|
+
export type ThemeEditorMode = 'light' | 'dark';
|
|
10573
|
+
export type ThemeEditorDevice = 'desktop' | 'tablet' | 'mobile';
|
|
10574
|
+
export interface ThemeEditorGroup {
|
|
10575
|
+
/** The slot name controls are assigned to with `slot="<name>"`. */
|
|
10576
|
+
name: string;
|
|
10577
|
+
caption: string;
|
|
10578
|
+
description?: string;
|
|
10579
|
+
/** Renders expanded initially. */
|
|
10580
|
+
open?: boolean;
|
|
10581
|
+
}
|
|
10582
|
+
export interface ThemeEditorSection extends ThemeEditorGroup {
|
|
10583
|
+
/**
|
|
10584
|
+
* Nests a collapsible per group inside this section's tab instead of the
|
|
10585
|
+
* section's own controls directly. A non-empty `groups` on ANY section
|
|
10586
|
+
* switches every section to `zn-tabs`, regardless of `section-layout`.
|
|
10587
|
+
*/
|
|
10588
|
+
groups?: ThemeEditorGroup[];
|
|
10589
|
+
}
|
|
10590
|
+
export interface ThemeEditorSource {
|
|
10591
|
+
label: string;
|
|
10592
|
+
src: string;
|
|
10593
|
+
}
|
|
10594
|
+
/**
|
|
10595
|
+
* @summary A theme editor: slotted form controls drive a live preview frame,
|
|
10596
|
+
* with a toolbar for the preview's light/dark mode and device width.
|
|
10597
|
+
* @documentation https://zinc.style/components/theme-editor
|
|
10598
|
+
* @status experimental
|
|
10599
|
+
* @since 1.0
|
|
10600
|
+
*
|
|
10601
|
+
* @dependency zn-collapsible
|
|
10602
|
+
* @dependency zn-preview-frame
|
|
10603
|
+
* @dependency zn-icon
|
|
10604
|
+
* @dependency zn-button
|
|
10605
|
+
* @dependency zn-tabs
|
|
10606
|
+
* @dependency zn-navbar
|
|
10607
|
+
* @dependency zn-select
|
|
10608
|
+
*
|
|
10609
|
+
* @event zn-theme-change - Emitted when the values, mode or device change.
|
|
10610
|
+
* @event zn-theme-submit - Emitted on submit (button click), carrying the
|
|
10611
|
+
* current values. With `action` set, only fires after a successful save.
|
|
10612
|
+
* @event zn-error - Emitted when a save fails. Also seen for preview render
|
|
10613
|
+
* failures: the frame's zn-error is composed and not stopped, so it bubbles
|
|
10614
|
+
* out through the editor too.
|
|
10615
|
+
*
|
|
10616
|
+
* @slot - Ungrouped theme controls, rendered above any sections. Controls
|
|
10617
|
+
* assigned `slot="<name>"` matching a `sections` entry (or, when nested, a
|
|
10618
|
+
* `groups` entry) render inside that section/group instead. Harvesting and
|
|
10619
|
+
* change detection walk every slot's full assigned subtree, not just direct
|
|
10620
|
+
* children.
|
|
10621
|
+
*
|
|
10622
|
+
* With `sections` left unset, the structure is instead derived from the
|
|
10623
|
+
* controls' own attributes: `group="<label>"` becomes a tab and
|
|
10624
|
+
* `category="<label>"` a collapsible within it, and the control is slotted
|
|
10625
|
+
* into that collapsible automatically. Either attribute works alone - a
|
|
10626
|
+
* control with only `group` sits directly in its tab, and one with only
|
|
10627
|
+
* `category` becomes its own top-level section. Setting `sections`
|
|
10628
|
+
* explicitly disables the derivation entirely.
|
|
10629
|
+
* @slot toolbar - Actions in the toolbar, right-aligned beside the device
|
|
10630
|
+
* controls. Where a save button belongs.
|
|
10631
|
+
* @slot footer - Actions pinned beneath the controls. The built-in submit button
|
|
10632
|
+
* lives in the toolbar, not here.
|
|
10633
|
+
*
|
|
10634
|
+
* @csspart base - The component's base wrapper.
|
|
10635
|
+
* @csspart controls - The left-hand controls column, full height.
|
|
10636
|
+
* @csspart controls-header - The controls column's header row: `controls-caption` on the left, the light/dark mode toggle on the right.
|
|
10637
|
+
* @csspart 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.
|
|
10638
|
+
* @csspart section - A rendered section's or group's collapsible (`section-layout="collapsible"`, or any nested group).
|
|
10639
|
+
* @csspart footer - The footer wrapper beneath the controls.
|
|
10640
|
+
* @csspart preview - The preview column.
|
|
10641
|
+
* @csspart error - The inline error strip.
|
|
10642
|
+
* @csspart preview__base - The frame's base wrapper (forwarded from zn-preview-frame).
|
|
10643
|
+
* @csspart preview__stage - The frame's device-width wrapper (forwarded from zn-preview-frame).
|
|
10644
|
+
* @csspart preview__iframe - The frame's iframe (forwarded from zn-preview-frame).
|
|
10645
|
+
* @csspart preview__error - The frame's own error overlay (forwarded from zn-preview-frame).
|
|
10646
|
+
*
|
|
10647
|
+
* @cssproperty --zn-theme-editor-controls-width - Width of the controls column.
|
|
10648
|
+
*/
|
|
10649
|
+
export default class ZnThemeEditor extends ZincElement {
|
|
10650
|
+
static styles: CSSResultGroup;
|
|
10651
|
+
static dependencies: {
|
|
10652
|
+
'zn-collapsible': typeof ZnCollapsible;
|
|
10653
|
+
'zn-preview-frame': typeof ZnPreviewFrame;
|
|
10654
|
+
'zn-icon': typeof ZnIcon;
|
|
10655
|
+
'zn-button': typeof ZnButton;
|
|
10656
|
+
'zn-tabs': typeof ZnTabs;
|
|
10657
|
+
'zn-navbar': typeof ZnNavbar;
|
|
10658
|
+
'zn-select': typeof ZnSelect;
|
|
10659
|
+
'zn-option': typeof ZnOption;
|
|
10660
|
+
};
|
|
10661
|
+
/** URL of the preview shell page; forwarded to the frame. */
|
|
10662
|
+
src: string;
|
|
10663
|
+
/** Expected origin of the iframe; forwarded to the frame. */
|
|
10664
|
+
frameOrigin: string;
|
|
10665
|
+
/** Optional endpoint returning the base hp-preview:config payload. */
|
|
10666
|
+
dataUri: string;
|
|
10667
|
+
/** Which mode the preview renders in. Travels in the theme payload. */
|
|
10668
|
+
mode: ThemeEditorMode;
|
|
10669
|
+
/** Preview viewport width. Resizes the frame only; not part of the payload. */
|
|
10670
|
+
device: ThemeEditorDevice;
|
|
10671
|
+
/** Minimum height of the preview row, in pixels; forwarded to the frame as its own floor. */
|
|
10672
|
+
minHeight: number;
|
|
10673
|
+
/** Debounce in ms between a control change and the push to the preview. */
|
|
10674
|
+
debounce: number;
|
|
10675
|
+
/** Optional endpoint the values are POSTed to. Empty = no persistence. */
|
|
10676
|
+
action: string;
|
|
10677
|
+
/** Debounce in ms between a control change and the save POST. */
|
|
10678
|
+
saveDebounce: number;
|
|
10679
|
+
/**
|
|
10680
|
+
* Groups controls into named sections. Empty/unset falls back to deriving the
|
|
10681
|
+
* structure from the controls' own `group`/`category` attributes, and renders
|
|
10682
|
+
* one ungrouped column when they carry neither. A section with a non-empty
|
|
10683
|
+
* `groups` nests a collapsible per group inside a `zn-tabs` tab for that
|
|
10684
|
+
* section - see `groups` on `ThemeEditorSection`.
|
|
10685
|
+
*/
|
|
10686
|
+
sections: ThemeEditorSection[];
|
|
10687
|
+
/**
|
|
10688
|
+
* Presentation for flat, group-less `sections`: stacked `zn-collapsible`s
|
|
10689
|
+
* (default) or a `zn-tabs` strip. Ignored once any section has `groups` -
|
|
10690
|
+
* nested sections always render as tabs.
|
|
10691
|
+
*/
|
|
10692
|
+
sectionLayout: 'collapsible' | 'tabs';
|
|
10693
|
+
/** 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. */
|
|
10694
|
+
sources: ThemeEditorSource[];
|
|
10695
|
+
/** Collapses the controls column. */
|
|
10696
|
+
controlsCollapsed: boolean;
|
|
10697
|
+
/** Presents the editor as its own bordered, rounded panel with a plain preview backdrop, rather than embedded in a dotted canvas. */
|
|
10698
|
+
standalone: boolean;
|
|
10699
|
+
/** Caption in the controls column's header row. Empty (default) renders no text; the row itself always renders. */
|
|
10700
|
+
controlsCaption: string;
|
|
10701
|
+
/** Caption at the left of the toolbar, opposite the device and mode controls. Empty (default) renders no text. */
|
|
10702
|
+
previewCaption: string;
|
|
10703
|
+
/** Label for the built-in submit button. Empty (default) renders no button. */
|
|
10704
|
+
submitLabel: string;
|
|
10705
|
+
/** Disables the debounced auto-save; saving then happens only via submit. Preview pushes are unaffected. */
|
|
10706
|
+
manual: boolean;
|
|
10707
|
+
frame: ZnPreviewFrame;
|
|
10708
|
+
private controlsSlot;
|
|
10709
|
+
private sectionSlots;
|
|
10710
|
+
protected error: string;
|
|
10711
|
+
private _submitting;
|
|
10712
|
+
private _sourceIndex;
|
|
10713
|
+
private readonly hasSlotController;
|
|
10714
|
+
private _pushTimer?;
|
|
10715
|
+
private _saveTimer?;
|
|
10716
|
+
private _saving;
|
|
10717
|
+
private _saveQueued;
|
|
10718
|
+
private _saveWaiters;
|
|
10719
|
+
private readonly _narrowQuery;
|
|
10720
|
+
private _wasNarrow;
|
|
10721
|
+
private _mounted;
|
|
10722
|
+
private _lastControls;
|
|
10723
|
+
private readonly _controlsObserverConfig;
|
|
10724
|
+
private readonly _controlsObserver;
|
|
10725
|
+
private _modeValues;
|
|
10726
|
+
private _suppressDepth;
|
|
10727
|
+
private _openedInitialCollapsible;
|
|
10728
|
+
/** The current per-mode value sets. Returns copies. */
|
|
10729
|
+
get values(): {
|
|
10730
|
+
light: Record<string, unknown>;
|
|
10731
|
+
dark: Record<string, unknown>;
|
|
10732
|
+
};
|
|
10733
|
+
/** The active mode's values - what gets pushed to the preview frame. */
|
|
10734
|
+
get activeValues(): Record<string, unknown>;
|
|
10735
|
+
/** The default slot plus every rendered section slot. */
|
|
10736
|
+
private _controlSlots;
|
|
10737
|
+
/** Walks every control slot (default and sections) for every enabled, named control. */
|
|
10738
|
+
private _harvestNamed;
|
|
10739
|
+
/** Whether a direct child is assigned to the named slot — an empty section renders no chrome. */
|
|
10740
|
+
private _hasAssignedControls;
|
|
10741
|
+
private _isBooleanControl;
|
|
10742
|
+
private _readControlValue;
|
|
10743
|
+
/** Seeds light/dark entries for any control name not already present. */
|
|
10744
|
+
private _seed;
|
|
10745
|
+
/** Writes a mode's value set back into the controls so they display it. */
|
|
10746
|
+
private _writeBack;
|
|
10747
|
+
/** Harvests the controls' current displayed values into a mode's set. */
|
|
10748
|
+
private _harvestInto;
|
|
10749
|
+
connectedCallback(): void;
|
|
10750
|
+
disconnectedCallback(): void;
|
|
10751
|
+
private readonly _onNarrowChange;
|
|
10752
|
+
protected firstUpdated(): void;
|
|
10753
|
+
/** Pushes the active mode's values into the preview and announces it. */
|
|
10754
|
+
private _push;
|
|
10755
|
+
private _queueSave;
|
|
10756
|
+
private _save;
|
|
10757
|
+
/** Resolves once a save actually carrying the current values has settled. */
|
|
10758
|
+
private _awaitSave;
|
|
10759
|
+
/**
|
|
10760
|
+
* Pushes only if the deep set of named controls (the same set harvesting
|
|
10761
|
+
* walks, so it includes controls nested inside sections) has changed since
|
|
10762
|
+
* the last push. Comparison is by element identity only, never by value.
|
|
10763
|
+
*/
|
|
10764
|
+
private _pushIfControlsChanged;
|
|
10765
|
+
/** Harvests and queues a save for a pending debounced edit, then cancels its timer. */
|
|
10766
|
+
private _flushPendingEdit;
|
|
10767
|
+
private readonly _onSubmit;
|
|
10768
|
+
private _announce;
|
|
10769
|
+
private _fail;
|
|
10770
|
+
private readonly _onControlChange;
|
|
10771
|
+
private readonly _onSlotChange;
|
|
10772
|
+
private readonly _setDevice;
|
|
10773
|
+
private readonly _toggleMode;
|
|
10774
|
+
private readonly _onFrameError;
|
|
10775
|
+
private _sourcesSafe;
|
|
10776
|
+
private _frameSrc;
|
|
10777
|
+
private readonly _onSourceChange;
|
|
10778
|
+
private _sectionsSafe;
|
|
10779
|
+
private _groupsFor;
|
|
10780
|
+
/** Whether any direct child carries the `group`/`category` structure attributes. */
|
|
10781
|
+
private _hasStructureAttributes;
|
|
10782
|
+
/** Attribute-derived structure applies only when `sections` is left unset. */
|
|
10783
|
+
private _usesDerivedSections;
|
|
10784
|
+
/**
|
|
10785
|
+
* Builds the tab/collapsible tree from the controls' own `group` (tab) and
|
|
10786
|
+
* `category` (collapsible) attributes, alongside the slot name each control
|
|
10787
|
+
* needs assigning to. Only direct children are considered, since `slot` only
|
|
10788
|
+
* works one level deep. Slot names are slugged from the labels and made
|
|
10789
|
+
* unique across the whole tree, so two tabs can each hold a "Colors"
|
|
10790
|
+
* category without their slots colliding.
|
|
10791
|
+
*/
|
|
10792
|
+
private _derive;
|
|
10793
|
+
/** Explicit `sections` when set, otherwise the attribute-derived tree. */
|
|
10794
|
+
private _effectiveSections;
|
|
10795
|
+
private _assignDerivedSlots;
|
|
10796
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
10797
|
+
/** Whether any section has a populated `groups` - the switch to nested tabs+collapsibles. */
|
|
10798
|
+
private _hasNestedGroups;
|
|
10799
|
+
private _visibleGroups;
|
|
10800
|
+
/** Configured sections that have an assigned control, or (nested) a populated group - shared by every presentation. */
|
|
10801
|
+
private _visibleSections;
|
|
10802
|
+
private _renderSections;
|
|
10803
|
+
private _renderGroups;
|
|
10804
|
+
/** Every collapsible inside a tab's panel, in document order. */
|
|
10805
|
+
private _tabCollapsibles;
|
|
10806
|
+
/** Expands the first collapsible, unless one is already open. */
|
|
10807
|
+
private _expandFirst;
|
|
10808
|
+
private _openFirstCollapsible;
|
|
10809
|
+
protected updated(changed: PropertyValues): void;
|
|
10810
|
+
private _renderTabs;
|
|
10811
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10812
|
+
}
|
|
10813
|
+
}
|
|
10814
|
+
declare module "components/theme-editor/index" {
|
|
10815
|
+
import ZnThemeEditor from "components/theme-editor/theme-editor.component";
|
|
10816
|
+
export * from "components/theme-editor/theme-editor.component";
|
|
10817
|
+
export default ZnThemeEditor;
|
|
10818
|
+
global {
|
|
10819
|
+
interface HTMLElementTagNameMap {
|
|
10820
|
+
'zn-theme-editor': ZnThemeEditor;
|
|
10821
|
+
}
|
|
10822
|
+
}
|
|
10823
|
+
}
|
|
10466
10824
|
declare module "utilities/form" {
|
|
10467
10825
|
export { clearFormStoreValues } from "internal/form";
|
|
10468
10826
|
}
|
|
@@ -10629,6 +10987,35 @@ declare module "events/zn-page-selection-change" {
|
|
|
10629
10987
|
}
|
|
10630
10988
|
}
|
|
10631
10989
|
}
|
|
10990
|
+
declare module "events/zn-theme-change" {
|
|
10991
|
+
import type { ThemeEditorDevice, ThemeEditorMode } from "components/theme-editor/theme-editor.component";
|
|
10992
|
+
export type ZnThemeChangeEvent = CustomEvent<{
|
|
10993
|
+
values: {
|
|
10994
|
+
light: Record<string, unknown>;
|
|
10995
|
+
dark: Record<string, unknown>;
|
|
10996
|
+
};
|
|
10997
|
+
mode: ThemeEditorMode;
|
|
10998
|
+
device: ThemeEditorDevice;
|
|
10999
|
+
}>;
|
|
11000
|
+
global {
|
|
11001
|
+
interface GlobalEventHandlersEventMap {
|
|
11002
|
+
'zn-theme-change': ZnThemeChangeEvent;
|
|
11003
|
+
}
|
|
11004
|
+
}
|
|
11005
|
+
}
|
|
11006
|
+
declare module "events/zn-theme-submit" {
|
|
11007
|
+
export type ZnThemeSubmitEvent = CustomEvent<{
|
|
11008
|
+
values: {
|
|
11009
|
+
light: Record<string, unknown>;
|
|
11010
|
+
dark: Record<string, unknown>;
|
|
11011
|
+
};
|
|
11012
|
+
}>;
|
|
11013
|
+
global {
|
|
11014
|
+
interface GlobalEventHandlersEventMap {
|
|
11015
|
+
'zn-theme-submit': ZnThemeSubmitEvent;
|
|
11016
|
+
}
|
|
11017
|
+
}
|
|
11018
|
+
}
|
|
10632
11019
|
declare module "events/events" {
|
|
10633
11020
|
export type { ZnAfterHideEvent } from "events/zn-after-hide";
|
|
10634
11021
|
export type { ZnAfterShowEvent } from "events/zn-after-show";
|
|
@@ -10649,6 +11036,8 @@ declare module "events/events" {
|
|
|
10649
11036
|
export type { ZnFlowConnectEvent } from "events/zn-flow-connect";
|
|
10650
11037
|
export type { ZnPageChangeEvent } from "events/zn-page-change";
|
|
10651
11038
|
export type { ZnPageSelectionChangeEvent } from "events/zn-page-selection-change";
|
|
11039
|
+
export type { ZnThemeChangeEvent } from "events/zn-theme-change";
|
|
11040
|
+
export type { ZnThemeSubmitEvent } from "events/zn-theme-submit";
|
|
10652
11041
|
}
|
|
10653
11042
|
declare module "zinc" {
|
|
10654
11043
|
export { default as Button } from "components/button/index";
|
|
@@ -10763,6 +11152,7 @@ declare module "zinc" {
|
|
|
10763
11152
|
export { default as PagePaletteItem } from "components/page-builder/modules/page-palette-item/index";
|
|
10764
11153
|
export { default as PageSectionCard } from "components/page-builder/modules/page-section-card/index";
|
|
10765
11154
|
export { default as PreviewFrame } from "components/preview-frame/index";
|
|
11155
|
+
export { default as ThemeEditor } from "components/theme-editor/index";
|
|
10766
11156
|
export { default as ZincElement } from "internal/zinc-element";
|
|
10767
11157
|
export * from "utilities/on";
|
|
10768
11158
|
export * from "utilities/query";
|
|
@@ -10875,17 +11265,6 @@ declare module "events/zn-element-added" {
|
|
|
10875
11265
|
}
|
|
10876
11266
|
}
|
|
10877
11267
|
}
|
|
10878
|
-
declare module "events/zn-error" {
|
|
10879
|
-
export type ZnErrorEvent = CustomEvent<{
|
|
10880
|
-
status?: number;
|
|
10881
|
-
message?: string;
|
|
10882
|
-
}>;
|
|
10883
|
-
global {
|
|
10884
|
-
interface GlobalEventHandlersEventMap {
|
|
10885
|
-
'zn-error': ZnErrorEvent;
|
|
10886
|
-
}
|
|
10887
|
-
}
|
|
10888
|
-
}
|
|
10889
11268
|
declare module "events/zn-expand" {
|
|
10890
11269
|
export type ZnExpandEvent = CustomEvent<Record<PropertyKey, never>>;
|
|
10891
11270
|
global {
|