@takazudo/zdtp 0.1.0-next.0
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/CHANGELOG.md +107 -0
- package/LICENSE +21 -0
- package/README.md +1044 -0
- package/dist/apply/apply-token-overrides.d.ts +81 -0
- package/dist/apply/apply-token-overrides.d.ts.map +1 -0
- package/dist/apply/build-apply-overrides.d.ts +71 -0
- package/dist/apply/build-apply-overrides.d.ts.map +1 -0
- package/dist/apply/route-tokens-to-files.d.ts +65 -0
- package/dist/apply/route-tokens-to-files.d.ts.map +1 -0
- package/dist/apply/tier-resolver.d.ts +75 -0
- package/dist/apply/tier-resolver.d.ts.map +1 -0
- package/dist/apply-modal.d.ts +49 -0
- package/dist/apply-modal.d.ts.map +1 -0
- package/dist/astro/DesignTokenPanelHost.astro +76 -0
- package/dist/astro/host-adapter.d.ts +47 -0
- package/dist/astro/host-adapter.d.ts.map +1 -0
- package/dist/astro/host-adapter.js +81 -0
- package/dist/astro/index.d.ts +30 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +54 -0
- package/dist/bin/cors.d.ts +24 -0
- package/dist/bin/cors.d.ts.map +1 -0
- package/dist/bin/parse-args.d.ts +38 -0
- package/dist/bin/parse-args.d.ts.map +1 -0
- package/dist/bin/server.d.ts +23 -0
- package/dist/bin/server.d.ts.map +1 -0
- package/dist/bin/server.js +283 -0
- package/dist/color-schemes-CgzOBqGO.js +85 -0
- package/dist/components/color-picker/color-picker.d.ts +64 -0
- package/dist/components/color-picker/color-picker.d.ts.map +1 -0
- package/dist/components/color-picker/custom-slider.d.ts +25 -0
- package/dist/components/color-picker/custom-slider.d.ts.map +1 -0
- package/dist/components/color-picker/index.d.ts +3 -0
- package/dist/components/color-picker/index.d.ts.map +1 -0
- package/dist/config/cluster-config.d.ts +135 -0
- package/dist/config/cluster-config.d.ts.map +1 -0
- package/dist/config/color-scheme-utils.d.ts +105 -0
- package/dist/config/color-scheme-utils.d.ts.map +1 -0
- package/dist/config/color-schemes.d.ts +83 -0
- package/dist/config/color-schemes.d.ts.map +1 -0
- package/dist/config/panel-config.d.ts +258 -0
- package/dist/config/panel-config.d.ts.map +1 -0
- package/dist/controls/pill-slider-row.d.ts +37 -0
- package/dist/controls/pill-slider-row.d.ts.map +1 -0
- package/dist/controls/role-button.d.ts +18 -0
- package/dist/controls/role-button.d.ts.map +1 -0
- package/dist/controls/sanitize-css-value.d.ts +22 -0
- package/dist/controls/sanitize-css-value.d.ts.map +1 -0
- package/dist/controls/select-row.d.ts +26 -0
- package/dist/controls/select-row.d.ts.map +1 -0
- package/dist/controls/slider-row.d.ts +34 -0
- package/dist/controls/slider-row.d.ts.map +1 -0
- package/dist/controls/text-row.d.ts +28 -0
- package/dist/controls/text-row.d.ts.map +1 -0
- package/dist/controls/tier-ref-selector.d.ts +33 -0
- package/dist/controls/tier-ref-selector.d.ts.map +1 -0
- package/dist/controls/tooltip.d.ts +44 -0
- package/dist/controls/tooltip.d.ts.map +1 -0
- package/dist/export-modal.d.ts +33 -0
- package/dist/export-modal.d.ts.map +1 -0
- package/dist/highlight/find-elements.d.ts +113 -0
- package/dist/highlight/find-elements.d.ts.map +1 -0
- package/dist/highlight/highlight-orchestrator.d.ts +24 -0
- package/dist/highlight/highlight-orchestrator.d.ts.map +1 -0
- package/dist/highlight/highlight-overlay.d.ts +43 -0
- package/dist/highlight/highlight-overlay.d.ts.map +1 -0
- package/dist/highlight/highlight-settings-popover.d.ts +25 -0
- package/dist/highlight/highlight-settings-popover.d.ts.map +1 -0
- package/dist/highlight/highlight-state.d.ts +87 -0
- package/dist/highlight/highlight-state.d.ts.map +1 -0
- package/dist/highlight/highlight-toggle-button.d.ts +34 -0
- package/dist/highlight/highlight-toggle-button.d.ts.map +1 -0
- package/dist/import-modal.d.ts +33 -0
- package/dist/import-modal.d.ts.map +1 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5480 -0
- package/dist/load-routing-XyKgftpe.js +353 -0
- package/dist/manifest-DCReQE0k.js +24 -0
- package/dist/panel-config-DP2_P7dD.js +332 -0
- package/dist/panel.d.ts +3 -0
- package/dist/panel.d.ts.map +1 -0
- package/dist/route-tokens-to-files-1DvmWBdj.js +41 -0
- package/dist/server/create-apply-handler.d.ts +48 -0
- package/dist/server/create-apply-handler.d.ts.map +1 -0
- package/dist/server/index.d.ts +24 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +10 -0
- package/dist/server/load-routing.d.ts +39 -0
- package/dist/server/load-routing.d.ts.map +1 -0
- package/dist/server/path-safety.d.ts +36 -0
- package/dist/server/path-safety.d.ts.map +1 -0
- package/dist/server/serialize-write.d.ts +7 -0
- package/dist/server/serialize-write.d.ts.map +1 -0
- package/dist/state/persist.d.ts +39 -0
- package/dist/state/persist.d.ts.map +1 -0
- package/dist/state/tweak-state.d.ts +344 -0
- package/dist/state/tweak-state.d.ts.map +1 -0
- package/dist/tabs/_generic-item-editor.d.ts +23 -0
- package/dist/tabs/_generic-item-editor.d.ts.map +1 -0
- package/dist/tabs/color-tab.d.ts +55 -0
- package/dist/tabs/color-tab.d.ts.map +1 -0
- package/dist/tabs/font-tab.d.ts +22 -0
- package/dist/tabs/font-tab.d.ts.map +1 -0
- package/dist/tabs/generic-tab.d.ts +43 -0
- package/dist/tabs/generic-tab.d.ts.map +1 -0
- package/dist/tabs/size-tab.d.ts +20 -0
- package/dist/tabs/size-tab.d.ts.map +1 -0
- package/dist/tabs/spacing-tab.d.ts +23 -0
- package/dist/tabs/spacing-tab.d.ts.map +1 -0
- package/dist/testing.d.ts +81 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +23 -0
- package/dist/tokens/manifest.d.ts +148 -0
- package/dist/tokens/manifest.d.ts.map +1 -0
- package/dist/tokens/tier-model.d.ts +89 -0
- package/dist/tokens/tier-model.d.ts.map +1 -0
- package/dist/tweak-state-DSJa5csL.js +624 -0
- package/dist/utils/color-convert.d.ts +7 -0
- package/dist/utils/color-convert.d.ts.map +1 -0
- package/dist/utils/color-hsla.d.ts +9 -0
- package/dist/utils/color-hsla.d.ts.map +1 -0
- package/dist/utils/color-oklch.d.ts +51 -0
- package/dist/utils/color-oklch.d.ts.map +1 -0
- package/dist/utils/design-token-serde.d.ts +193 -0
- package/dist/utils/design-token-serde.d.ts.map +1 -0
- package/dist/utils/structural-equal.d.ts +22 -0
- package/dist/utils/structural-equal.d.ts.map +1 -0
- package/dist/zdtp.css +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-button.d.ts","sourceRoot":"","sources":["../../src/controls/role-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAelC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,GAAG,aAAa,KAAK,IAAI,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;qEAEiE;IACjE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,OAAO,EACP,SAAS,EACT,eAAe,EAAE,YAAY,EAC7B,SAAS,EACT,QAAY,EACZ,EAAE,EACF,KAAK,EACL,YAAY,EAAE,SAAS,GACxB,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CA4B/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip characters that could break out of a CSS property-value context.
|
|
3
|
+
*
|
|
4
|
+
* Used by `<TextRow>` for free-form token inputs like `--font-sans` /
|
|
5
|
+
* `--font-mono`. Dropped characters:
|
|
6
|
+
*
|
|
7
|
+
* - newlines (`\r`, `\n`) — would split the declaration in raw CSS text
|
|
8
|
+
* output and are treated as whitespace anyway by `style.setProperty`.
|
|
9
|
+
* - backslashes (`\\`) — CSS-escape prefix; strip so the raw string the
|
|
10
|
+
* user sees equals the raw string written back out on export.
|
|
11
|
+
* - semicolons (`;`) — safe for `style.setProperty` (it writes a single
|
|
12
|
+
* declaration) but would break the exported CSS snippet.
|
|
13
|
+
* - braces (`{`, `}`) — would close the surrounding `:root { … }` block
|
|
14
|
+
* when the bin writes a sanitised value back out to disk, corrupting the
|
|
15
|
+
* target CSS file. Always invalid in a property-value context.
|
|
16
|
+
*
|
|
17
|
+
* `style.setProperty` on its own is already injection-safe — it writes a single
|
|
18
|
+
* property/value pair and never parses the value as a rule. This sanitiser
|
|
19
|
+
* guards the **exported** CSS snippet and keeps stored state tidy.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sanitizeCssValue(input: string): string;
|
|
22
|
+
//# sourceMappingURL=sanitize-css-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-css-value.d.ts","sourceRoot":"","sources":["../../src/controls/sanitize-css-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TokenDef } from '../tokens/manifest';
|
|
2
|
+
/**
|
|
3
|
+
* One manifest-driven token row backed by a native `<select>`.
|
|
4
|
+
*
|
|
5
|
+
* [label] [ 400 ▾]
|
|
6
|
+
*
|
|
7
|
+
* Used for tokens whose value is one of a small, enumerated set — e.g.
|
|
8
|
+
* `--font-weight-*` (100..900). The selected option string is stored verbatim
|
|
9
|
+
* in persisted state (no numeric round-tripping; font-weight values are
|
|
10
|
+
* conventionally written as bare numbers in CSS).
|
|
11
|
+
*
|
|
12
|
+
* `onChange` is `(id, next)` — the row passes its own `token.id` back so the
|
|
13
|
+
* parent can use a single stable handler across every row, keeping React.memo
|
|
14
|
+
* effective.
|
|
15
|
+
*/
|
|
16
|
+
export interface SelectRowProps {
|
|
17
|
+
token: TokenDef;
|
|
18
|
+
/** Current persisted value (or the token's default if no override). */
|
|
19
|
+
value: string;
|
|
20
|
+
/** Called with the row's `token.id` and the newly selected option value. */
|
|
21
|
+
onChange: (id: string, next: string) => void;
|
|
22
|
+
}
|
|
23
|
+
declare function SelectRow({ token, value, onChange }: SelectRowProps): import("preact").JSX.Element;
|
|
24
|
+
declare const _default: typeof SelectRow;
|
|
25
|
+
export default _default;
|
|
26
|
+
//# sourceMappingURL=select-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-row.d.ts","sourceRoot":"","sources":["../../src/controls/select-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,QAAQ,CAAC;IAChB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,iBAAS,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,gCAuC5D;;AAID,wBAA+B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type TokenDef } from '../tokens/manifest';
|
|
2
|
+
/**
|
|
3
|
+
* One manifest-driven token row:
|
|
4
|
+
*
|
|
5
|
+
* [label] ... [ 1.25 rem] ← label + number input (unit suffix inside)
|
|
6
|
+
* [=========o==================] ← full-width range slider
|
|
7
|
+
*
|
|
8
|
+
* Range input and number input are two-way bound: dragging the slider fills
|
|
9
|
+
* the number input live, and typing a value moves the slider once it parses.
|
|
10
|
+
*
|
|
11
|
+
* The parent owns the persisted value (stored as a string like `"1.25rem"`);
|
|
12
|
+
* this row keeps a local "draft" string only for the number input, so users
|
|
13
|
+
* can type partial values (`"1."`) without the component thrashing.
|
|
14
|
+
*
|
|
15
|
+
* Read-only tokens render a disabled compact form that still shows the
|
|
16
|
+
* resolved value from the stylesheet.
|
|
17
|
+
*
|
|
18
|
+
* `onChange` is `(id, next)` — the row passes its own `token.id` back so the
|
|
19
|
+
* parent can use a single stable handler across every row, keeping React.memo
|
|
20
|
+
* effective.
|
|
21
|
+
*/
|
|
22
|
+
export interface SliderRowProps {
|
|
23
|
+
token: TokenDef;
|
|
24
|
+
/** Current persisted value (or the token's default if no override). */
|
|
25
|
+
value: string;
|
|
26
|
+
/** Called with the row's `token.id` and the new CSS string (e.g.
|
|
27
|
+
* `"0.75rem"`) whenever the user commits a change via slider or a
|
|
28
|
+
* parseable number input. */
|
|
29
|
+
onChange: (id: string, next: string) => void;
|
|
30
|
+
}
|
|
31
|
+
declare function SliderRow({ token, value, onChange }: SliderRowProps): import("preact").JSX.Element;
|
|
32
|
+
declare const _default: typeof SliderRow;
|
|
33
|
+
export default _default;
|
|
34
|
+
//# sourceMappingURL=slider-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-row.d.ts","sourceRoot":"","sources":["../../src/controls/slider-row.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAkC,MAAM,oBAAoB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,QAAQ,CAAC;IAChB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd;;kCAE8B;IAC9B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,iBAAS,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,gCA6E5D;;AAKD,wBAA+B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TokenDef } from '../tokens/manifest';
|
|
2
|
+
/**
|
|
3
|
+
* One manifest-driven token row backed by a free-form text input.
|
|
4
|
+
*
|
|
5
|
+
* [label] [ "Inter", system-ui, sans-serif ]
|
|
6
|
+
*
|
|
7
|
+
* Used for tokens whose value is a CSS string the user types directly — e.g.
|
|
8
|
+
* `--font-sans` / `--font-mono`. The stored value is sanitised (see
|
|
9
|
+
* `sanitize-css-value.ts`) before it leaves this component so newlines,
|
|
10
|
+
* backslashes, and semicolons never reach stored state or the exported CSS
|
|
11
|
+
* snippet. `style.setProperty` is already injection-safe on its own.
|
|
12
|
+
*
|
|
13
|
+
* `onChange` is `(id, next)` — the row passes its own `token.id` back so the
|
|
14
|
+
* parent can use a single stable handler across every row, keeping React.memo
|
|
15
|
+
* effective.
|
|
16
|
+
*/
|
|
17
|
+
export interface TextRowProps {
|
|
18
|
+
token: TokenDef;
|
|
19
|
+
/** Current persisted value (or the token's default if no override). */
|
|
20
|
+
value: string;
|
|
21
|
+
/** Called with the row's `token.id` and the sanitised new value on every
|
|
22
|
+
* edit. */
|
|
23
|
+
onChange: (id: string, next: string) => void;
|
|
24
|
+
}
|
|
25
|
+
declare function TextRow({ token, value, onChange }: TextRowProps): import("preact").JSX.Element;
|
|
26
|
+
declare const _default: typeof TextRow;
|
|
27
|
+
export default _default;
|
|
28
|
+
//# sourceMappingURL=text-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-row.d.ts","sourceRoot":"","sources":["../../src/controls/text-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAChB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd;gBACY;IACZ,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,iBAAS,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,YAAY,gCAuCxD;;AAID,wBAA6B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TabConfig } from '../tokens/tier-model';
|
|
2
|
+
/**
|
|
3
|
+
* Sentinel string passed to `onChange` when the user picks "Literal...".
|
|
4
|
+
* The parent component (Wave 5) interprets this as a request to flip the
|
|
5
|
+
* item back into its kind-specific editor (slider / text / select) writing a
|
|
6
|
+
* literal CSS override.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TIER_REF_LITERAL_SIGNAL: "__literal__";
|
|
9
|
+
export interface TierRefSelectorProps {
|
|
10
|
+
/** Full tab config — needed to look up the referenced tier and its items. */
|
|
11
|
+
tab: TabConfig;
|
|
12
|
+
/** The tier whose item is being edited (the "semantic" / reference tier). */
|
|
13
|
+
tierId: string;
|
|
14
|
+
/** The item being edited within `tierId`. */
|
|
15
|
+
itemId: string;
|
|
16
|
+
/**
|
|
17
|
+
* The current stored value for this item — an item id within the
|
|
18
|
+
* referenced (tier-1) tier. Empty string or an unrecognised id is treated
|
|
19
|
+
* as "pick the first item" (mirrors resolver fallback).
|
|
20
|
+
*/
|
|
21
|
+
value: string;
|
|
22
|
+
/**
|
|
23
|
+
* Called when the user commits a selection.
|
|
24
|
+
*
|
|
25
|
+
* - Picking a tier-1 item: `onChange(itemId, selectedRefItemId)`
|
|
26
|
+
* - Picking "Literal...": `onChange(itemId, TIER_REF_LITERAL_SIGNAL)`
|
|
27
|
+
*/
|
|
28
|
+
onChange: (itemId: string, next: string) => void;
|
|
29
|
+
}
|
|
30
|
+
declare function TierRefSelector({ tab, tierId, itemId, value, onChange }: TierRefSelectorProps): import("preact").JSX.Element;
|
|
31
|
+
declare const _default: typeof TierRefSelector;
|
|
32
|
+
export default _default;
|
|
33
|
+
//# sourceMappingURL=tier-ref-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tier-ref-selector.d.ts","sourceRoot":"","sources":["../../src/controls/tier-ref-selector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,sBAAsB,CAAC;AAM5E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAG,aAAsB,CAAC;AA0C9D,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,GAAG,EAAE,SAAS,CAAC;IACf,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAMD,iBAAS,eAAe,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,oBAAoB,gCA4NtF;;AAED,wBAAqC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip controller — single shared DOM tooltip for truncated token names.
|
|
3
|
+
*
|
|
4
|
+
* Architecture: Context + hook pattern with a single `.tokenpanel-tooltip`
|
|
5
|
+
* element rendered in a portal to `document.body` so that panel overflow
|
|
6
|
+
* clipping cannot hide it.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* // Wrap the tree:
|
|
10
|
+
* <TooltipProvider>
|
|
11
|
+
* <YourContent />
|
|
12
|
+
* </TooltipProvider>
|
|
13
|
+
*
|
|
14
|
+
* // Inside any descendant:
|
|
15
|
+
* const tooltipProps = useTooltip(label);
|
|
16
|
+
* <div {...tooltipProps}>...</div>
|
|
17
|
+
*/
|
|
18
|
+
import type { ComponentChildren, JSX } from 'preact';
|
|
19
|
+
interface TooltipProviderProps {
|
|
20
|
+
children: ComponentChildren;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* TooltipProvider — owns tooltip state and renders the single shared tooltip
|
|
24
|
+
* element via a portal to document.body.
|
|
25
|
+
*
|
|
26
|
+
* Escape and scroll-capture listeners are mounted once here and hide the
|
|
27
|
+
* tooltip globally.
|
|
28
|
+
*/
|
|
29
|
+
export declare function TooltipProvider({ children }: TooltipProviderProps): JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Returns event handler props to spread onto the tooltip trigger element.
|
|
32
|
+
*
|
|
33
|
+
* @param text - The full text to show in the tooltip.
|
|
34
|
+
* @returns An object of `onMouseEnter`, `onMouseLeave`, `onFocusIn`, `onFocusOut`
|
|
35
|
+
* handlers to spread onto the trigger element.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useTooltip(text: string): {
|
|
38
|
+
onMouseEnter: JSX.MouseEventHandler<HTMLElement>;
|
|
39
|
+
onMouseLeave: JSX.MouseEventHandler<HTMLElement>;
|
|
40
|
+
onFocusIn: JSX.FocusEventHandler<HTMLElement>;
|
|
41
|
+
onFocusOut: JSX.FocusEventHandler<HTMLElement>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/controls/tooltip.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AA4ErD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,oBAAoB,eAqDjE;AAMD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IACxC,YAAY,EAAE,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACjD,YAAY,EAAE,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACjD,SAAS,EAAE,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC9C,UAAU,EAAE,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD,CAoCA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export modal — renders the current `TweakState` as a design-tokens JSON
|
|
3
|
+
* document (default schema: `zudo-design-tokens/v1`; configurable via
|
|
4
|
+
* `panelConfig.schemaId`) with a diff-only toggle and a copy-to-clipboard
|
|
5
|
+
* button.
|
|
6
|
+
*
|
|
7
|
+
* Ported verbatim from zudo-doc's
|
|
8
|
+
* `src/components/design-token-tweak/export-modal.tsx`. Intentional deltas:
|
|
9
|
+
* - `serialize` is imported from this package's serde
|
|
10
|
+
* (`./utils/design-token-serde`).
|
|
11
|
+
* - `colorSchemes` / `initColorFromSchemeData` come from this package's
|
|
12
|
+
* config.
|
|
13
|
+
* - The filename hint is derived from `panelConfig.exportFilenameBase` via
|
|
14
|
+
* `exportFilename(...)` (default `zudo-design-tokens.json`).
|
|
15
|
+
* - Modal class names are derived from `panelConfig.modalClassPrefix` via
|
|
16
|
+
* `modalClass(...)` so a single config swap re-themes every dialog.
|
|
17
|
+
*
|
|
18
|
+
* Modal lifecycle uses the native `<dialog>` element via `showModal()` /
|
|
19
|
+
* `close()`. Every dismissal path (× button, backdrop click, Escape key, the
|
|
20
|
+
* programmatic "Close" button) routes through `dialog.close()` so the native
|
|
21
|
+
* `close` event — and thus `onClose` — fires exactly once per dismissal.
|
|
22
|
+
*/
|
|
23
|
+
import { type ColorTweakState, type TweakState } from './state/tweak-state';
|
|
24
|
+
export interface ExportModalProps {
|
|
25
|
+
onClose: () => void;
|
|
26
|
+
/** Full unified tweak state — the modal serializes all four categories. */
|
|
27
|
+
state: TweakState;
|
|
28
|
+
/** Color baseline used for diff-only output. Optional: callers without DOM
|
|
29
|
+
* access (tests) can omit and we'll treat the entire color block as changed. */
|
|
30
|
+
colorDefaults?: ColorTweakState;
|
|
31
|
+
}
|
|
32
|
+
export declare function ExportModal({ onClose, state, colorDefaults }: ExportModalProps): import("preact").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=export-modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-modal.d.ts","sourceRoot":"","sources":["../src/export-modal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,UAAU,EAEhB,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,2EAA2E;IAC3E,KAAK,EAAE,UAAU,CAAC;IAClB;qFACiF;IACjF,aAAa,CAAC,EAAE,eAAe,CAAC;CACjC;AAgBD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,gBAAgB,gCAoL9E"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* findElementsUsingToken — uses a sentinel-substitution probe to find every
|
|
3
|
+
* DOM element whose computed style reflects a given CSS custom property.
|
|
4
|
+
*
|
|
5
|
+
* ## How it works (high level)
|
|
6
|
+
*
|
|
7
|
+
* 1. **Type detection.** If `options.kind` is supplied, use it. Otherwise
|
|
8
|
+
* read `getComputedStyle(documentElement).getPropertyValue(cssVar)` and
|
|
9
|
+
* classify the resolved value via regex to determine which sentinel values
|
|
10
|
+
* and property lists to use.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Definer discovery (v2).** Walk all `document.styleSheets` looking for
|
|
13
|
+
* every `CSSStyleRule` that directly declares `cssVar` in its declaration
|
|
14
|
+
* block. Each matched `selectorText` becomes a "definer selector".
|
|
15
|
+
* Cross-origin sheets that throw on `.cssRules` are skipped with a warning.
|
|
16
|
+
*
|
|
17
|
+
* 3. **Override apply.** The sentinel value is written (via `setProperty` with
|
|
18
|
+
* `important` priority) on `:root` and on every element matched by a
|
|
19
|
+
* definer selector. This ensures cascade overrides (e.g. `[data-theme]`
|
|
20
|
+
* blocks) are also covered. Panel-internal elements are skipped.
|
|
21
|
+
*
|
|
22
|
+
* 4. **Force layout.** `void document.documentElement.offsetHeight` flushes
|
|
23
|
+
* style recalculation so computed styles are current.
|
|
24
|
+
*
|
|
25
|
+
* 5. **DOM walk.** Every element in `document.body` (including `body` itself)
|
|
26
|
+
* and their `::before` / `::after` pseudo-elements are inspected:
|
|
27
|
+
* - *Equality mode*: checks whether any type-relevant longhand equals the
|
|
28
|
+
* sentinel, or whether any compound property substring-contains it.
|
|
29
|
+
* - *Differential mode*: probes twice (sentinel A then B); elements whose
|
|
30
|
+
* computed properties differ between A and B are consumers. Catches
|
|
31
|
+
* calc/min/max/clamp transforms that equality mode misses.
|
|
32
|
+
*
|
|
33
|
+
* 6. **Restore.** Inline overrides are removed in LIFO order, fully
|
|
34
|
+
* synchronously — no `await`, `setTimeout`, or `requestAnimationFrame`
|
|
35
|
+
* between apply and restore.
|
|
36
|
+
*
|
|
37
|
+
* ## Known limitations
|
|
38
|
+
*
|
|
39
|
+
* - **Cross-origin stylesheets**: sheets from a different origin throw on
|
|
40
|
+
* `.cssRules` and are skipped (a warning is emitted). Tokens defined only in
|
|
41
|
+
* cross-origin sheets will not have their definer selectors discovered; the
|
|
42
|
+
* `:root` override is still applied, so root-level consumers are still found.
|
|
43
|
+
* - **adoptedStyleSheets**: not iterated; tokens defined only via the
|
|
44
|
+
* `adoptedStyleSheets` API will not be discovered.
|
|
45
|
+
* - **Shadow DOM**: elements inside shadow roots are not walked; tokens
|
|
46
|
+
* consumed inside shadow trees are not found.
|
|
47
|
+
* - **Pseudo-elements**: only `::before` and `::after` are checked. Other
|
|
48
|
+
* pseudo-elements (e.g. `::placeholder`, `::selection`, `::marker`) are not
|
|
49
|
+
* inspected.
|
|
50
|
+
* - **Browser min-font-size preference**: if `font-size` is overridden by the
|
|
51
|
+
* browser's minimum-font-size setting, the length sentinel (7.137951px) may
|
|
52
|
+
* be floored and equality mode will fail to detect `font-size` consumers.
|
|
53
|
+
* Differential mode is more robust in this case.
|
|
54
|
+
*/
|
|
55
|
+
export interface FindElementsResult {
|
|
56
|
+
elements: Element[];
|
|
57
|
+
warnings: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface FindElementsOptions {
|
|
60
|
+
/** Explicit token type. Skips auto-detection when supplied. */
|
|
61
|
+
kind?: 'color' | 'length' | 'number' | 'text' | 'easing' | 'time' | 'cursor' | 'content' | 'mask-image';
|
|
62
|
+
/**
|
|
63
|
+
* Probe mode.
|
|
64
|
+
* equality (default): single sentinel; fast; misses calc/min/max/clamp.
|
|
65
|
+
* differential: two sentinels; catches transforms; ~4–6× slower.
|
|
66
|
+
*/
|
|
67
|
+
mode?: 'equality' | 'differential';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Find all DOM elements whose computed style reflects the given CSS custom
|
|
71
|
+
* property.
|
|
72
|
+
*
|
|
73
|
+
* Uses a **sentinel-substitution probe**:
|
|
74
|
+
* 1. Override `cssVar` with a high-entropy sentinel value on `:root` and every
|
|
75
|
+
* stylesheet definer (v2 algorithm).
|
|
76
|
+
* 2. Force a style recalculation.
|
|
77
|
+
* 3. Walk the DOM checking which elements absorbed the sentinel.
|
|
78
|
+
* 4. Restore all overrides synchronously.
|
|
79
|
+
*
|
|
80
|
+
* @param cssVar The full custom-property name including leading dashes,
|
|
81
|
+
* e.g. `"--brand"`. Accepts `"var(--brand)"` defensively.
|
|
82
|
+
* @param options Optional configuration:
|
|
83
|
+
* - `kind`: explicit token type (`'color' | 'length' | 'number' | 'text' | 'easing' | 'time' | 'cursor' | 'content' | 'mask-image'`).
|
|
84
|
+
* `text` covers any property accepting an arbitrary custom-ident
|
|
85
|
+
* (font-family, animation-name, transition-property, will-change).
|
|
86
|
+
* `easing` covers timing-function properties (transition-timing-function,
|
|
87
|
+
* animation-timing-function). `time` covers duration and delay properties
|
|
88
|
+
* (transition-duration, transition-delay, animation-duration, animation-delay).
|
|
89
|
+
* `cursor` covers the cursor property using keyword sentinels (Chrome drops
|
|
90
|
+
* url() from cursor computed style). `content` covers the content property
|
|
91
|
+
* using quoted-string sentinels. `mask-image` covers the mask-image property
|
|
92
|
+
* using url() sentinels.
|
|
93
|
+
* When omitted the type is auto-detected from the resolved value on
|
|
94
|
+
* `documentElement`. `url()` resolved values auto-detect as `text` with
|
|
95
|
+
* a warning — supply kind:'cursor' or kind:'mask-image' explicitly for
|
|
96
|
+
* url()-typed tokens. If the token has no value on `:root` (empty resolved
|
|
97
|
+
* value) a warning is emitted and `color` is assumed.
|
|
98
|
+
* - `mode`: `'equality'` (default, fast) checks whether computed longhands
|
|
99
|
+
* equal the sentinel; `'differential'` probes twice (sentinels A and B)
|
|
100
|
+
* and marks consumers where any property differs — catches `calc()`,
|
|
101
|
+
* `min()`, `max()`, `clamp()` transforms that equality mode misses.
|
|
102
|
+
*
|
|
103
|
+
* ## Known limitations
|
|
104
|
+
*
|
|
105
|
+
* - Cross-origin stylesheets are skipped (a warning is emitted).
|
|
106
|
+
* - `adoptedStyleSheets` are not iterated.
|
|
107
|
+
* - Shadow DOM elements are not walked.
|
|
108
|
+
* - Only `::before` and `::after` pseudo-elements are checked.
|
|
109
|
+
* - Browser min-font-size preference may floor the length sentinel (7.137951px),
|
|
110
|
+
* causing equality mode to miss `font-size` consumers.
|
|
111
|
+
*/
|
|
112
|
+
export declare function findElementsUsingToken(cssVar: string, options?: FindElementsOptions): FindElementsResult;
|
|
113
|
+
//# sourceMappingURL=find-elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-elements.d.ts","sourceRoot":"","sources":["../../src/highlight/find-elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;IACxG;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;CACpC;AAkhBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,kBAAkB,CAiIpB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HighlightOrchestrator — integration layer for the highlight feature.
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities:
|
|
5
|
+
* 1. Lifts and persists HighlightState.
|
|
6
|
+
* 2. Provides HighlightContext to all descendants.
|
|
7
|
+
* 3. Mounts an overlay portal at document.body (above the panel-closed gate).
|
|
8
|
+
* 4. Observes document.head for stylesheet changes so newly injected CSS is
|
|
9
|
+
* picked up by re-resolving elements.
|
|
10
|
+
* 5. Handles astro:after-swap — recreates the portal mount and re-attaches the
|
|
11
|
+
* MutationObserver when Astro replaces the body/head.
|
|
12
|
+
*
|
|
13
|
+
* Self-contained — panel.tsx wraps its existing JSX in this component so the
|
|
14
|
+
* overlay persists even when the panel is closed.
|
|
15
|
+
*/
|
|
16
|
+
import type { ComponentChildren } from 'preact';
|
|
17
|
+
import type { TierValueKind } from '../tokens/tier-model';
|
|
18
|
+
type ProbeKind = 'color' | 'length' | 'number' | 'text' | 'easing' | 'cursor' | 'content' | 'mask-image';
|
|
19
|
+
export declare function tierKindToProbeKind(t: TierValueKind | undefined): ProbeKind | undefined;
|
|
20
|
+
export declare function HighlightOrchestrator({ children }: {
|
|
21
|
+
children: ComponentChildren;
|
|
22
|
+
}): import("preact").JSX.Element;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=highlight-orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-orchestrator.d.ts","sourceRoot":"","sources":["../../src/highlight/highlight-orchestrator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAqBhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;AAEzG,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAqBvF;AA8GD,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE,gCA0NlF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HighlightOverlay — absolutely-positioned div rings around host elements.
|
|
3
|
+
*
|
|
4
|
+
* Renders one overlay <div> per {element, slot} item, using
|
|
5
|
+
* getBoundingClientRect() + position:fixed so the outlines track the element
|
|
6
|
+
* regardless of page scroll or layout reflow.
|
|
7
|
+
*
|
|
8
|
+
* Reposition strategy
|
|
9
|
+
* -------------------
|
|
10
|
+
* A single RAF loop runs while items.length > 0. Each tick reads
|
|
11
|
+
* getBoundingClientRect() for every item and updates the corresponding overlay
|
|
12
|
+
* div's inline style IMPERATIVELY (direct DOM mutation — no Preact re-render
|
|
13
|
+
* per frame). This keeps animation cost O(items) DOM writes per frame rather
|
|
14
|
+
* than O(items) VDOM diffs.
|
|
15
|
+
*
|
|
16
|
+
* Hostile-host fallback
|
|
17
|
+
* ---------------------
|
|
18
|
+
* Some hosts reset `outline: none !important`. We also apply
|
|
19
|
+
* `box-shadow: inset 0 0 0 <w>px <color>` so the visual cue survives even
|
|
20
|
+
* when outline is killed.
|
|
21
|
+
*
|
|
22
|
+
* Self-contained — does NOT manage its own portal mount.
|
|
23
|
+
* The orchestrator (#232) owns where in the DOM this component is rendered.
|
|
24
|
+
*/
|
|
25
|
+
import type { JSX } from 'preact';
|
|
26
|
+
/**
|
|
27
|
+
* Inline copy of HighlightSlotSpec. After sub-issue #227 merges, the
|
|
28
|
+
* orchestrator (#232) can import from either source — the shapes are
|
|
29
|
+
* identical so TypeScript will accept either.
|
|
30
|
+
*/
|
|
31
|
+
export interface HighlightSlotSpec {
|
|
32
|
+
color: string;
|
|
33
|
+
outlineWidth: number;
|
|
34
|
+
}
|
|
35
|
+
export interface HighlightOverlayItem {
|
|
36
|
+
element: Element;
|
|
37
|
+
slot: HighlightSlotSpec;
|
|
38
|
+
}
|
|
39
|
+
export interface HighlightOverlayProps {
|
|
40
|
+
items: ReadonlyArray<HighlightOverlayItem>;
|
|
41
|
+
}
|
|
42
|
+
export declare function HighlightOverlay({ items }: HighlightOverlayProps): JSX.Element | null;
|
|
43
|
+
//# sourceMappingURL=highlight-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-overlay.d.ts","sourceRoot":"","sources":["../../src/highlight/highlight-overlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAMlC;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC5C;AAgDD,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAiErF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HighlightSettingsPopover — 2-column color-only grid + global outline px input.
|
|
3
|
+
*
|
|
4
|
+
* Header row: "Highlight outline settings" label (left) + global outline-width
|
|
5
|
+
* number input with "px" suffix (right).
|
|
6
|
+
*
|
|
7
|
+
* Slot list: 10 slots in a 2-column grid; each cell = [num] [ring swatch]
|
|
8
|
+
* [token name / "available"]. The ring opens the ColorPicker for per-slot
|
|
9
|
+
* color. Per-row slider and px readout are removed.
|
|
10
|
+
*
|
|
11
|
+
* Footer: "Disable all highlights" and "Reset to defaults" buttons.
|
|
12
|
+
*
|
|
13
|
+
* Must be rendered inside a HighlightContext.Provider. Gracefully returns
|
|
14
|
+
* null if context is absent.
|
|
15
|
+
*/
|
|
16
|
+
import type { JSX } from 'preact';
|
|
17
|
+
interface HighlightSettingsPopoverProps {
|
|
18
|
+
/** The anchor element (gear button) for initial positioning. */
|
|
19
|
+
anchorRef: React.RefObject<HTMLElement | null>;
|
|
20
|
+
/** Called when the popover requests to close. */
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function HighlightSettingsPopover({ anchorRef, onClose, }: HighlightSettingsPopoverProps): JSX.Element | null;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=highlight-settings-popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-settings-popover.d.ts","sourceRoot":"","sources":["../../src/highlight/highlight-settings-popover.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AASlC,UAAU,6BAA6B;IACrC,gEAAgE;IAChE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC/C,iDAAiD;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,OAAO,GACR,EAAE,6BAA6B,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA8JpD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Highlight state slice — reservation-sheet model.
|
|
3
|
+
*
|
|
4
|
+
* 10 colour slots ({color}) are pre-defined. A cssVar can be mapped to a slot
|
|
5
|
+
* (0..9) via toggleHighlight. The slot is reserved until the same cssVar is
|
|
6
|
+
* toggled off, giving a stable colour across inspect sessions (the
|
|
7
|
+
* "reservation-sheet" property: slot 2 always means the same colour regardless
|
|
8
|
+
* of toggle order).
|
|
9
|
+
*
|
|
10
|
+
* A single global `outlineWidth` applies to all overlay rings simultaneously.
|
|
11
|
+
*
|
|
12
|
+
* Persistence is split:
|
|
13
|
+
* slots → localStorage (survives full page reload — user colour edits kept)
|
|
14
|
+
* outlineWidth → localStorage (survives full page reload — user width setting kept)
|
|
15
|
+
* active → sessionStorage (cleared on reload — inspection set is ephemeral)
|
|
16
|
+
*/
|
|
17
|
+
export interface HighlightSlotSpec {
|
|
18
|
+
color: string;
|
|
19
|
+
}
|
|
20
|
+
export interface HighlightState {
|
|
21
|
+
/** Fixed-length array of 10 slot specs. */
|
|
22
|
+
slots: HighlightSlotSpec[];
|
|
23
|
+
/** Global outline width in px applied to all overlay rings. Default 2. */
|
|
24
|
+
outlineWidth: number;
|
|
25
|
+
/** cssVar → slotIndex (0..9) for every currently-highlighted token. */
|
|
26
|
+
active: Record<string, number>;
|
|
27
|
+
}
|
|
28
|
+
export declare const DEFAULT_HIGHLIGHT_SLOTS: HighlightSlotSpec[];
|
|
29
|
+
/**
|
|
30
|
+
* Return the lowest slot index (0..9) not present in `active`, or -1 if all
|
|
31
|
+
* 10 slots are already in use.
|
|
32
|
+
*/
|
|
33
|
+
export declare function allocateSlot(active: Record<string, number>): number;
|
|
34
|
+
/**
|
|
35
|
+
* Toggle highlight for `cssVar`.
|
|
36
|
+
*
|
|
37
|
+
* - If `cssVar` is already active, remove it (release the slot).
|
|
38
|
+
* - Otherwise allocate the lowest free slot and add the mapping.
|
|
39
|
+
* - If no slots are free, return `state` unchanged (referentially equal) and
|
|
40
|
+
* emit a console.warn.
|
|
41
|
+
*/
|
|
42
|
+
export declare function toggleHighlight(state: HighlightState, cssVar: string): HighlightState;
|
|
43
|
+
/**
|
|
44
|
+
* Reset slot specs to the defaults and restore global outlineWidth to 2.
|
|
45
|
+
* The `active` map is preserved — the user is resetting slot colours, not
|
|
46
|
+
* their inspection set.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resetSlots(state: HighlightState): HighlightState;
|
|
49
|
+
/**
|
|
50
|
+
* Clear all active highlights. Returns a new state with an empty `active` map;
|
|
51
|
+
* `slots` (colors) and `outlineWidth` are left untouched.
|
|
52
|
+
*/
|
|
53
|
+
export declare function clearAllActive(state: HighlightState): HighlightState;
|
|
54
|
+
/**
|
|
55
|
+
* Merge `partial` into the slot at `index`. Out-of-range index returns
|
|
56
|
+
* `state` unchanged.
|
|
57
|
+
*/
|
|
58
|
+
export declare function setSlot(state: HighlightState, index: number, partial: Partial<HighlightSlotSpec>): HighlightState;
|
|
59
|
+
/**
|
|
60
|
+
* Set the global outline width. Width is clamped to >= 1.
|
|
61
|
+
*/
|
|
62
|
+
export declare function setOutlineWidth(state: HighlightState, width: number): HighlightState;
|
|
63
|
+
/**
|
|
64
|
+
* Load highlight state from the split storage backends.
|
|
65
|
+
*
|
|
66
|
+
* - slots ← localStorage (key: `${storagePrefix}-highlight-slots`)
|
|
67
|
+
* - outlineWidth ← localStorage (key: `${storagePrefix}-highlight-outline-width`)
|
|
68
|
+
* - active ← sessionStorage (key: `${storagePrefix}-highlight-active`)
|
|
69
|
+
*
|
|
70
|
+
* On any parse / access failure the affected slice falls back to its default
|
|
71
|
+
* (`DEFAULT_HIGHLIGHT_SLOTS` / 2 / `{}`).
|
|
72
|
+
*
|
|
73
|
+
* Migration: existing localStorage `slots` arrays may carry a per-slot
|
|
74
|
+
* `outlineWidth` field — the extra field is simply ignored on load.
|
|
75
|
+
*/
|
|
76
|
+
export declare function loadHighlightState(): HighlightState;
|
|
77
|
+
/**
|
|
78
|
+
* Persist highlight state to the split storage backends.
|
|
79
|
+
*
|
|
80
|
+
* - slots → localStorage
|
|
81
|
+
* - outlineWidth → localStorage
|
|
82
|
+
* - active → sessionStorage
|
|
83
|
+
*
|
|
84
|
+
* Gracefully handles environments where storage is unavailable.
|
|
85
|
+
*/
|
|
86
|
+
export declare function saveHighlightState(state: HighlightState): void;
|
|
87
|
+
//# sourceMappingURL=highlight-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-state.d.ts","sourceRoot":"","sources":["../../src/highlight/highlight-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAMD,eAAO,MAAM,uBAAuB,EAAE,iBAAiB,EAWtD,CAAC;AAwBF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAMnE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAmBrF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAMhE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAEpE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAClC,cAAc,CAIhB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAGpF;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CA2CnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAkB9D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HighlightToggleButton — eye icon that toggles CSS-variable-based highlighting.
|
|
3
|
+
*
|
|
4
|
+
* Reads HighlightContext to determine active state and slot colour. When the
|
|
5
|
+
* context is null (component rendered outside the orchestrator's provider —
|
|
6
|
+
* e.g. in unit tests without a wrapper), the component renders nothing so
|
|
7
|
+
* rows degrade gracefully.
|
|
8
|
+
*
|
|
9
|
+
* HighlightContext is the single source of truth for the context type so both
|
|
10
|
+
* consumers (this button) and the orchestrator (#232) import from the same
|
|
11
|
+
* module.
|
|
12
|
+
*/
|
|
13
|
+
import type { JSX } from 'preact';
|
|
14
|
+
import type { HighlightState, HighlightSlotSpec } from './highlight-state';
|
|
15
|
+
export interface HighlightContextValue {
|
|
16
|
+
state: HighlightState;
|
|
17
|
+
toggle: (cssVar: string) => void;
|
|
18
|
+
/** Optional — when the orchestrator computes match counts it injects them here for title attributes. */
|
|
19
|
+
matchCounts?: Record<string, number>;
|
|
20
|
+
/** Optional — orchestrator may expose setSlot for slot colour editing. */
|
|
21
|
+
setSlot?: (index: number, partial: Partial<HighlightSlotSpec>) => void;
|
|
22
|
+
/** Optional — orchestrator may expose setOutlineWidth for global outline width editing. */
|
|
23
|
+
setOutlineWidth?: (width: number) => void;
|
|
24
|
+
/** Optional — orchestrator may expose reset to clear all active highlights. */
|
|
25
|
+
reset?: () => void;
|
|
26
|
+
/** Optional — orchestrator may expose disableAll to clear the active map while preserving slot colours. */
|
|
27
|
+
disableAll?: () => void;
|
|
28
|
+
}
|
|
29
|
+
export declare const HighlightContext: import("preact").Context<HighlightContextValue | null>;
|
|
30
|
+
export interface HighlightToggleButtonProps {
|
|
31
|
+
cssVar: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function HighlightToggleButton({ cssVar }: HighlightToggleButtonProps): JSX.Element | null;
|
|
34
|
+
//# sourceMappingURL=highlight-toggle-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-toggle-button.d.ts","sourceRoot":"","sources":["../../src/highlight/highlight-toggle-button.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAM3E,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,wGAAwG;IACxG,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACvE,2FAA2F;IAC3F,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,2GAA2G;IAC3G,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,wDAAoD,CAAC;AAMlF,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,EAAE,0BAA0B,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA+DhG"}
|