@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.
Files changed (130) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1044 -0
  4. package/dist/apply/apply-token-overrides.d.ts +81 -0
  5. package/dist/apply/apply-token-overrides.d.ts.map +1 -0
  6. package/dist/apply/build-apply-overrides.d.ts +71 -0
  7. package/dist/apply/build-apply-overrides.d.ts.map +1 -0
  8. package/dist/apply/route-tokens-to-files.d.ts +65 -0
  9. package/dist/apply/route-tokens-to-files.d.ts.map +1 -0
  10. package/dist/apply/tier-resolver.d.ts +75 -0
  11. package/dist/apply/tier-resolver.d.ts.map +1 -0
  12. package/dist/apply-modal.d.ts +49 -0
  13. package/dist/apply-modal.d.ts.map +1 -0
  14. package/dist/astro/DesignTokenPanelHost.astro +76 -0
  15. package/dist/astro/host-adapter.d.ts +47 -0
  16. package/dist/astro/host-adapter.d.ts.map +1 -0
  17. package/dist/astro/host-adapter.js +81 -0
  18. package/dist/astro/index.d.ts +30 -0
  19. package/dist/astro/index.d.ts.map +1 -0
  20. package/dist/astro/index.js +54 -0
  21. package/dist/bin/cors.d.ts +24 -0
  22. package/dist/bin/cors.d.ts.map +1 -0
  23. package/dist/bin/parse-args.d.ts +38 -0
  24. package/dist/bin/parse-args.d.ts.map +1 -0
  25. package/dist/bin/server.d.ts +23 -0
  26. package/dist/bin/server.d.ts.map +1 -0
  27. package/dist/bin/server.js +283 -0
  28. package/dist/color-schemes-CgzOBqGO.js +85 -0
  29. package/dist/components/color-picker/color-picker.d.ts +64 -0
  30. package/dist/components/color-picker/color-picker.d.ts.map +1 -0
  31. package/dist/components/color-picker/custom-slider.d.ts +25 -0
  32. package/dist/components/color-picker/custom-slider.d.ts.map +1 -0
  33. package/dist/components/color-picker/index.d.ts +3 -0
  34. package/dist/components/color-picker/index.d.ts.map +1 -0
  35. package/dist/config/cluster-config.d.ts +135 -0
  36. package/dist/config/cluster-config.d.ts.map +1 -0
  37. package/dist/config/color-scheme-utils.d.ts +105 -0
  38. package/dist/config/color-scheme-utils.d.ts.map +1 -0
  39. package/dist/config/color-schemes.d.ts +83 -0
  40. package/dist/config/color-schemes.d.ts.map +1 -0
  41. package/dist/config/panel-config.d.ts +258 -0
  42. package/dist/config/panel-config.d.ts.map +1 -0
  43. package/dist/controls/pill-slider-row.d.ts +37 -0
  44. package/dist/controls/pill-slider-row.d.ts.map +1 -0
  45. package/dist/controls/role-button.d.ts +18 -0
  46. package/dist/controls/role-button.d.ts.map +1 -0
  47. package/dist/controls/sanitize-css-value.d.ts +22 -0
  48. package/dist/controls/sanitize-css-value.d.ts.map +1 -0
  49. package/dist/controls/select-row.d.ts +26 -0
  50. package/dist/controls/select-row.d.ts.map +1 -0
  51. package/dist/controls/slider-row.d.ts +34 -0
  52. package/dist/controls/slider-row.d.ts.map +1 -0
  53. package/dist/controls/text-row.d.ts +28 -0
  54. package/dist/controls/text-row.d.ts.map +1 -0
  55. package/dist/controls/tier-ref-selector.d.ts +33 -0
  56. package/dist/controls/tier-ref-selector.d.ts.map +1 -0
  57. package/dist/controls/tooltip.d.ts +44 -0
  58. package/dist/controls/tooltip.d.ts.map +1 -0
  59. package/dist/export-modal.d.ts +33 -0
  60. package/dist/export-modal.d.ts.map +1 -0
  61. package/dist/highlight/find-elements.d.ts +113 -0
  62. package/dist/highlight/find-elements.d.ts.map +1 -0
  63. package/dist/highlight/highlight-orchestrator.d.ts +24 -0
  64. package/dist/highlight/highlight-orchestrator.d.ts.map +1 -0
  65. package/dist/highlight/highlight-overlay.d.ts +43 -0
  66. package/dist/highlight/highlight-overlay.d.ts.map +1 -0
  67. package/dist/highlight/highlight-settings-popover.d.ts +25 -0
  68. package/dist/highlight/highlight-settings-popover.d.ts.map +1 -0
  69. package/dist/highlight/highlight-state.d.ts +87 -0
  70. package/dist/highlight/highlight-state.d.ts.map +1 -0
  71. package/dist/highlight/highlight-toggle-button.d.ts +34 -0
  72. package/dist/highlight/highlight-toggle-button.d.ts.map +1 -0
  73. package/dist/import-modal.d.ts +33 -0
  74. package/dist/import-modal.d.ts.map +1 -0
  75. package/dist/index.d.ts +105 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +5480 -0
  78. package/dist/load-routing-XyKgftpe.js +353 -0
  79. package/dist/manifest-DCReQE0k.js +24 -0
  80. package/dist/panel-config-DP2_P7dD.js +332 -0
  81. package/dist/panel.d.ts +3 -0
  82. package/dist/panel.d.ts.map +1 -0
  83. package/dist/route-tokens-to-files-1DvmWBdj.js +41 -0
  84. package/dist/server/create-apply-handler.d.ts +48 -0
  85. package/dist/server/create-apply-handler.d.ts.map +1 -0
  86. package/dist/server/index.d.ts +24 -0
  87. package/dist/server/index.d.ts.map +1 -0
  88. package/dist/server/index.js +10 -0
  89. package/dist/server/load-routing.d.ts +39 -0
  90. package/dist/server/load-routing.d.ts.map +1 -0
  91. package/dist/server/path-safety.d.ts +36 -0
  92. package/dist/server/path-safety.d.ts.map +1 -0
  93. package/dist/server/serialize-write.d.ts +7 -0
  94. package/dist/server/serialize-write.d.ts.map +1 -0
  95. package/dist/state/persist.d.ts +39 -0
  96. package/dist/state/persist.d.ts.map +1 -0
  97. package/dist/state/tweak-state.d.ts +344 -0
  98. package/dist/state/tweak-state.d.ts.map +1 -0
  99. package/dist/tabs/_generic-item-editor.d.ts +23 -0
  100. package/dist/tabs/_generic-item-editor.d.ts.map +1 -0
  101. package/dist/tabs/color-tab.d.ts +55 -0
  102. package/dist/tabs/color-tab.d.ts.map +1 -0
  103. package/dist/tabs/font-tab.d.ts +22 -0
  104. package/dist/tabs/font-tab.d.ts.map +1 -0
  105. package/dist/tabs/generic-tab.d.ts +43 -0
  106. package/dist/tabs/generic-tab.d.ts.map +1 -0
  107. package/dist/tabs/size-tab.d.ts +20 -0
  108. package/dist/tabs/size-tab.d.ts.map +1 -0
  109. package/dist/tabs/spacing-tab.d.ts +23 -0
  110. package/dist/tabs/spacing-tab.d.ts.map +1 -0
  111. package/dist/testing.d.ts +81 -0
  112. package/dist/testing.d.ts.map +1 -0
  113. package/dist/testing.js +23 -0
  114. package/dist/tokens/manifest.d.ts +148 -0
  115. package/dist/tokens/manifest.d.ts.map +1 -0
  116. package/dist/tokens/tier-model.d.ts +89 -0
  117. package/dist/tokens/tier-model.d.ts.map +1 -0
  118. package/dist/tweak-state-DSJa5csL.js +624 -0
  119. package/dist/utils/color-convert.d.ts +7 -0
  120. package/dist/utils/color-convert.d.ts.map +1 -0
  121. package/dist/utils/color-hsla.d.ts +9 -0
  122. package/dist/utils/color-hsla.d.ts.map +1 -0
  123. package/dist/utils/color-oklch.d.ts +51 -0
  124. package/dist/utils/color-oklch.d.ts.map +1 -0
  125. package/dist/utils/design-token-serde.d.ts +193 -0
  126. package/dist/utils/design-token-serde.d.ts.map +1 -0
  127. package/dist/utils/structural-equal.d.ts +22 -0
  128. package/dist/utils/structural-equal.d.ts.map +1 -0
  129. package/dist/zdtp.css +1 -0
  130. package/package.json +102 -0
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Color-cluster type contract.
3
+ *
4
+ * Defines the JSON-serializable shape every host-supplied color cluster must
5
+ * conform to. The package itself ships ZERO baked-in cluster data — consumers
6
+ * provide their own `colorCluster` (and optional `secondaryColorCluster`) via
7
+ * `configurePanel({ ... })`.
8
+ *
9
+ * **JSON-serializable**
10
+ *
11
+ * `ColorClusterDataConfig` deliberately holds NO function-typed fields. The
12
+ * palette CSS-var name is materialised at use sites by the
13
+ * `resolvePaletteCssVar(cluster, i)` helper below, NOT by a function field
14
+ * baked into the cluster. This is the JSON-roundtrip property hosts rely on:
15
+ * a cluster can cross an Astro frontmatter → prop boundary, or persist to
16
+ * disk, without losing fidelity.
17
+ *
18
+ * The cluster also carries `colorSchemes` and `panelSettings` so a host
19
+ * doesn't need to vend its own scheme registry through separate imports —
20
+ * everything the color tab needs to render is reachable from
21
+ * `panelConfig.colorCluster`.
22
+ */
23
+ import type { ColorScheme } from './color-schemes';
24
+ /**
25
+ * Base-role keys that a cluster may declare. Subset is allowed (a cluster may
26
+ * ship zero base roles when its design system doesn't expose them as tokens).
27
+ * The state shape on disk still carries all 5 numeric fields for envelope
28
+ * round-trip compatibility — they're inert when the cluster doesn't reference
29
+ * them.
30
+ */
31
+ export type BaseRoleKey = 'background' | 'foreground' | 'cursor' | 'selectionBg' | 'selectionFg';
32
+ /**
33
+ * Panel-level scheme settings carried INSIDE the cluster (rather than on a
34
+ * separate import). Lets `getActiveSchemeName` / `initColorFromScheme` read
35
+ * everything from the cluster argument.
36
+ */
37
+ export interface ClusterPanelSettings {
38
+ /** Scheme name to seed state from when `colorMode` is `false`. */
39
+ colorScheme: string;
40
+ /**
41
+ * Optional light/dark pairing. When set, the panel resolves the active
42
+ * scheme by reading `data-theme` on `<html>`.
43
+ */
44
+ colorMode: false | {
45
+ defaultMode: 'light' | 'dark';
46
+ lightScheme: string;
47
+ darkScheme: string;
48
+ };
49
+ }
50
+ /**
51
+ * JSON-serializable color-cluster data. Every field is a primitive,
52
+ * plain object, or array; no functions, no class instances.
53
+ *
54
+ * `colorSchemes` and `panelSettings` are required (not optional) so the
55
+ * shape is uniform across primary / secondary clusters. Scheme-less clusters
56
+ * supply `colorSchemes: {}` and a stub `panelSettings` — both unused by call
57
+ * sites that seed state without ever consulting a scheme registry.
58
+ */
59
+ export interface ColorClusterDataConfig {
60
+ /** Stable id — used for debugging / logging only. */
61
+ id: string;
62
+ /**
63
+ * Optional human-visible label rendered in the Color tab section headings.
64
+ * When absent, the tab falls back to `id.toUpperCase()`. Hosts that ship
65
+ * their own naming can override here without forking the panel.
66
+ */
67
+ label?: string;
68
+ /** Expected palette size. Used for init + v1 validation. */
69
+ paletteSize: number;
70
+ /** Map of base-role name → CSS custom-property name. Partial: a cluster
71
+ * declares only the roles it actually has. */
72
+ baseRoles: Partial<Record<BaseRoleKey, string>>;
73
+ /**
74
+ * Palette-slot CSS-var template. The token `{n}` is replaced with the
75
+ * palette index by `resolvePaletteCssVar` below. Examples:
76
+ * `--brand-p{n}`, `--demo-palette-{n}`.
77
+ */
78
+ paletteCssVarTemplate: string;
79
+ /** Semantic token name → default palette index. */
80
+ semanticDefaults: Record<string, number>;
81
+ /** Semantic token name → CSS custom-property name. */
82
+ semanticCssNames: Record<string, string>;
83
+ /** Fallback indices used when a scheme doesn't declare a base role. */
84
+ baseDefaults: Partial<Record<BaseRoleKey, number>>;
85
+ /** Fallback shikiTheme when a scheme lacks one. */
86
+ defaultShikiTheme: string;
87
+ /**
88
+ * Bundled scheme registry. The Scheme… dropdown in the color tab lists
89
+ * these. Pass `{}` for clusters that don't use schemes.
90
+ */
91
+ colorSchemes: Record<string, ColorScheme>;
92
+ /** Panel-level scheme settings — drives `getActiveSchemeName`. */
93
+ panelSettings: ClusterPanelSettings;
94
+ }
95
+ /**
96
+ * Materialise the palette-slot CSS-var name for a cluster. Pure and
97
+ * side-effect-free so it's safe to call from any layer (apply, clear,
98
+ * tab UI, tests).
99
+ */
100
+ export declare function resolvePaletteCssVar(cluster: {
101
+ paletteCssVarTemplate: string;
102
+ }, index: number): string;
103
+ import type { TabConfig } from '../tokens/tier-model';
104
+ /**
105
+ * Derive a `ColorClusterDataConfig` from a color `TabConfig`.
106
+ *
107
+ * - Palette items: the first tier whose items all have `kind: 'color'`.
108
+ * Each item's `cssVar` becomes a palette slot; `paletteCssVarTemplate` is
109
+ * synthesised as `"{item.cssVar}"` with `{n}` replaced by the slot index.
110
+ * Because item cssVars are explicit (e.g. `--zfb-palette-0`) rather
111
+ * than template-based, we derive the template from the first item by
112
+ * replacing the terminal digit sequence with `{n}`.
113
+ *
114
+ * - Semantic items: the first tier with `referencesTier` set pointing at the
115
+ * palette tier. Each item's `id` → `cssVar` mapping becomes `semanticCssNames`;
116
+ * the item's `default` (a palette item id) is looked up to produce the index
117
+ * for `semanticDefaults`.
118
+ *
119
+ * - Metadata comes from `tab.colorExtras` (required on a color tab).
120
+ *
121
+ * Returns `undefined` when the tab has no `colorExtras` (not a color tab).
122
+ */
123
+ export declare function resolveColorClusterFromTab(tab: TabConfig): ColorClusterDataConfig | undefined;
124
+ /**
125
+ * Find the primary color tab (id 'color') in the host's tabs array and
126
+ * derive its `ColorClusterDataConfig`. Returns `undefined` when no color tab
127
+ * exists or it has no `colorExtras`.
128
+ */
129
+ export declare function resolvePrimaryColorCluster(tabs: readonly TabConfig[]): ColorClusterDataConfig | undefined;
130
+ /**
131
+ * Find the secondary color tab (id 'color-secondary') and derive its
132
+ * `ColorClusterDataConfig`. Returns `null` when no secondary color tab exists.
133
+ */
134
+ export declare function resolveSecondaryColorClusterFromTabs(tabs: readonly TabConfig[]): ColorClusterDataConfig | null;
135
+ //# sourceMappingURL=cluster-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster-config.d.ts","sourceRoot":"","sources":["../../src/config/cluster-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC;AAEjG;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,KAAK,GAAG;QAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/F;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;mDAC+C;IAC/C,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mDAAmD;IACnD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,sDAAsD;IACtD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,uEAAuE;IACvE,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,mDAAmD;IACnD,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1C,kEAAkE;IAClE,aAAa,EAAE,oBAAoB,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE;IAAE,qBAAqB,EAAE,MAAM,CAAA;CAAE,EAC1C,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAYD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,SAAS,GACb,sBAAsB,GAAG,SAAS,CAyEpC;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,SAAS,SAAS,EAAE,GACzB,sBAAsB,GAAG,SAAS,CAIpC;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,SAAS,SAAS,EAAE,GACzB,sBAAsB,GAAG,IAAI,CAI/B"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Color-scheme utilities for the design-token panel.
3
+ *
4
+ * Port adaptations:
5
+ *
6
+ * - The upstream `@/config/settings` import is removed. Only `colorScheme` and
7
+ * `colorMode` were ever consumed; both are inlined here as `panelSettings`
8
+ * so the panel package stays self-contained.
9
+ * - `SEMANTIC_CSS_NAMES` points at this package's `--zd-semantic-*` CSS
10
+ * custom properties (example tokens shipped with the package). Upstream
11
+ * keys with no counterpart here (mermaid*, chat*, imageOverlay*,
12
+ * matchedKeyword*) are dropped.
13
+ * - `SEMANTIC_DEFAULTS_ZD` mirrors the `--zd-semantic-*: var(--zd-pN)`
14
+ * mappings in the bundled tokens, so the panel's defaults on first open
15
+ * match the example CSS exactly.
16
+ */
17
+ import { type ColorScheme, type ColorRef } from './color-schemes';
18
+ /**
19
+ * Minimal local replacement for the upstream `settings` object. The panel only
20
+ * ever reads `colorScheme` and `colorMode`; the rest of the upstream settings
21
+ * surface (i18n, sitemap, sidebars, …) is irrelevant here.
22
+ *
23
+ * If a future host wants to swap the active scheme without editing this
24
+ * file, expose a setter or wire it through state — for now hard-coding to
25
+ * `Default Dark` matches the example CSS in `tokens.css`.
26
+ */
27
+ export declare const panelSettings: {
28
+ colorScheme: "Default Dark";
29
+ colorMode: false | {
30
+ defaultMode: "light" | "dark";
31
+ lightScheme: string;
32
+ darkScheme: string;
33
+ };
34
+ };
35
+ /**
36
+ * Default mapping: semantic token name → palette index.
37
+ *
38
+ * Mirrors the `--zd-semantic-*: var(--zd-pN)` declarations a host
39
+ * design-system tokens file is expected to ship. See the external Astro
40
+ * example repo for a working integration:
41
+ * https://github.com/Takazudo/zudo-design-token-panel-example-astro
42
+ */
43
+ export declare const SEMANTIC_DEFAULTS_ZD: Record<string, number>;
44
+ /**
45
+ * Backwards-compatible alias for callers that just want `SEMANTIC_DEFAULTS`
46
+ * without thinking about the suffix. Identical contents.
47
+ */
48
+ export declare const SEMANTIC_DEFAULTS: Record<string, number>;
49
+ /**
50
+ * Example default mapping for a secondary cluster: semantic token name →
51
+ * palette index. This is an example shape that hosts can copy or replace
52
+ * via `setPanelColorPresets` / `configurePanel` — not a normative table.
53
+ *
54
+ * Note the differences from the primary defaults:
55
+ * - Palette is 9 slots (pa0..pa8), not 16.
56
+ * - No `cursor` / `selectionBg` / `selectionFg` base roles.
57
+ * - Semantic table is shorter and uses kebab-case CSS var names
58
+ * (`--app-secondary-bg-deep`, etc.) — keys here stay camelCase to match
59
+ * the `semanticMappings` shape used by the panel.
60
+ */
61
+ export declare const SEMANTIC_DEFAULTS_SECONDARY: Record<string, number>;
62
+ /**
63
+ * Example mapping of semantic token name → CSS custom property for a
64
+ * secondary cluster. Hosts can override the prefix and shape via
65
+ * `configurePanel`.
66
+ */
67
+ export declare const SEMANTIC_CSS_NAMES_SECONDARY: Record<string, string>;
68
+ /**
69
+ * Semantic token name → CSS custom property in this package's example
70
+ * design system.
71
+ *
72
+ * Source of truth: the `tokens.css` shipped by a host consumer. See the
73
+ * external Astro example repo for the canonical shape:
74
+ * https://github.com/Takazudo/zudo-design-token-panel-example-astro
75
+ */
76
+ export declare const SEMANTIC_CSS_NAMES: Record<string, string>;
77
+ export declare const lightDarkPairings: {
78
+ light: string;
79
+ dark: string;
80
+ label: string;
81
+ }[];
82
+ export declare function getActiveScheme(): ColorScheme;
83
+ /**
84
+ * Resolve a `ColorRef` to a concrete color string.
85
+ *
86
+ * - `number` → `palette[value]`
87
+ * - `string` → used as-is (treated as a literal CSS color)
88
+ * - `undefined` → `fallback`
89
+ */
90
+ export declare function resolveColor(value: ColorRef | undefined, palette: string[], fallback: string): string;
91
+ /**
92
+ * Resolve all semantic tokens for a scheme, falling back to the
93
+ * `SEMANTIC_DEFAULTS_ZD` palette slot when the scheme doesn't override the
94
+ * token.
95
+ */
96
+ export declare function resolveSemanticColors(scheme: ColorScheme): Record<string, string>;
97
+ /**
98
+ * Project a scheme to a flat list of `[cssVar, value]` pairs ready to inject
99
+ * onto `:root`. Mirrors the upstream shape: base tokens (bg / fg / cursor /
100
+ * selection), the full palette, then every semantic token.
101
+ */
102
+ export declare function schemeToCssPairs(scheme: ColorScheme): [string, string][];
103
+ export declare function generateCssCustomProperties(): string;
104
+ export declare function generateLightDarkCssProperties(): string;
105
+ //# sourceMappingURL=color-scheme-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-scheme-utils.d.ts","sourceRoot":"","sources":["../../src/config/color-scheme-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;;eAGpB,KAAK,GACL;QAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAC/E,CAAC;AAMF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiBvD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,wBAAuB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAU9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAU/D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiBrD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;GAE7B,CAAC;AAMF,wBAAgB,eAAe,IAAI,WAAW,CAU7C;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,MAAM,GACf,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQjF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAexE;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAKpD;AAED,wBAAgB,8BAA8B,IAAI,MAAM,CA4BvD"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Color-scheme types and bundled presets.
3
+ *
4
+ * Ported from zudo-doc (`/src/config/color-schemes.ts`).
5
+ *
6
+ * Differences from upstream:
7
+ * - `shikiTheme` is typed as `string` (no Astro dependency).
8
+ * - The `semantic` object exposes only the keys that this package has CSS
9
+ * variables for (see `color-scheme-utils.ts → SEMANTIC_CSS_NAMES`).
10
+ * Upstream keys with no counterpart here (mermaid*, chat*,
11
+ * imageOverlay*, matchedKeyword*) are dropped.
12
+ * - Adds package-specific semantic keys: `bg`, `fg`, `link`, `price`, `sold`.
13
+ */
14
+ /** A color reference: palette index (number) or direct color value (string) */
15
+ export type ColorRef = number | string;
16
+ export interface ColorScheme {
17
+ background: ColorRef;
18
+ foreground: ColorRef;
19
+ cursor: ColorRef;
20
+ selectionBg: ColorRef;
21
+ selectionFg: ColorRef;
22
+ palette: [
23
+ string,
24
+ string,
25
+ string,
26
+ string,
27
+ string,
28
+ string,
29
+ string,
30
+ string,
31
+ string,
32
+ string,
33
+ string,
34
+ string,
35
+ string,
36
+ string,
37
+ string,
38
+ string
39
+ ];
40
+ /**
41
+ * Shiki theme name. Loosely typed as a free-form string so we don't pull
42
+ * in the Astro types (this package isn't an Astro app — this field is
43
+ * preserved for symmetry with upstream presets and for any future
44
+ * code-block tooling).
45
+ */
46
+ shikiTheme: string;
47
+ /**
48
+ * Optional semantic overrides — when omitted, defaults from
49
+ * `SEMANTIC_DEFAULTS_ZD` (in `color-scheme-utils.ts`) are used.
50
+ *
51
+ * Each field accepts a palette index (number) or a direct color value
52
+ * (string).
53
+ */
54
+ semantic?: {
55
+ bg?: ColorRef;
56
+ fg?: ColorRef;
57
+ surface?: ColorRef;
58
+ muted?: ColorRef;
59
+ accent?: ColorRef;
60
+ accentHover?: ColorRef;
61
+ link?: ColorRef;
62
+ codeBg?: ColorRef;
63
+ codeFg?: ColorRef;
64
+ success?: ColorRef;
65
+ danger?: ColorRef;
66
+ warning?: ColorRef;
67
+ info?: ColorRef;
68
+ price?: ColorRef;
69
+ sold?: ColorRef;
70
+ };
71
+ }
72
+ /**
73
+ * Bundled color schemes shipped with the panel. Each scheme provides a
74
+ * 16-color palette plus optional semantic overrides. The Scheme… dropdown in
75
+ * the color tab lists these by name.
76
+ *
77
+ * Ported from upstream zudo-doc/src/config/color-schemes.ts (Default Light /
78
+ * Default Dark) — palette and semantic mappings are unchanged because they
79
+ * follow the standard p0–p15 convention and `SEMANTIC_DEFAULTS_ZD` re-uses the
80
+ * same indices.
81
+ */
82
+ export declare const colorSchemes: Record<string, ColorScheme>;
83
+ //# sourceMappingURL=color-schemes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-schemes.d.ts","sourceRoot":"","sources":["../../src/config/color-schemes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,EAAE,QAAQ,CAAC;IACjB,WAAW,EAAE,QAAQ,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;IACtB,OAAO,EAAE;QACP,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;KACP,CAAC;IACF;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE;QACT,EAAE,CAAC,EAAE,QAAQ,CAAC;QACd,EAAE,CAAC,EAAE,QAAQ,CAAC;QACd,OAAO,CAAC,EAAE,QAAQ,CAAC;QACnB,KAAK,CAAC,EAAE,QAAQ,CAAC;QACjB,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,WAAW,CAAC,EAAE,QAAQ,CAAC;QACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;QACnB,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;QACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,KAAK,CAAC,EAAE,QAAQ,CAAC;QACjB,IAAI,CAAC,EAAE,QAAQ,CAAC;KACjB,CAAC;CACH;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAiFpD,CAAC"}
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Panel-level runtime configuration.
3
+ *
4
+ * Centralises every project-specific identifier (storage-key prefix, console
5
+ * namespace, modal class prefix, schema id, export filename) plus the
6
+ * host-supplied token manifest and color cluster. A single `configurePanel`
7
+ * call swaps the panel for any host.
8
+ *
9
+ * Plumbing approach
10
+ * -----------------
11
+ * Module-level singleton (NOT Preact context). The panel is a single-instance
12
+ * dev tool, config is set once before the adapter mounts, and every read site
13
+ * is happy to pay a function call to read the current config.
14
+ *
15
+ * Idempotency
16
+ * -----------
17
+ * `configurePanel` is one-shot. Calling it twice with structurally-equal
18
+ * values is a silent no-op (a freshly-parsed inline JSON config can be
19
+ * byte-equal to the previous call but referentially distinct, e.g. on Astro
20
+ * view-transition reruns). Calling with structurally-different values throws.
21
+ *
22
+ * Default fallback
23
+ * ----------------
24
+ * `getPanelConfig()` returns `DEFAULT_PANEL_CONFIG` when `configurePanel` has
25
+ * never been called. The defaults ship intentionally minimal — a sentinel
26
+ * that lets the package import / boot in environments where `configurePanel`
27
+ * has not yet run, but with empty token manifests and a stub color cluster
28
+ * so the UI surfaces "no tokens configured" rather than rendering against
29
+ * arbitrary host-irrelevant data. Hosts MUST call `configurePanel(...)` to
30
+ * see useful behaviour.
31
+ */
32
+ import type { ColorScheme } from './color-schemes';
33
+ import type { TabConfig } from '../tokens/tier-model';
34
+ /**
35
+ * Apply-routing map.
36
+ *
37
+ * Maps a CSS-var prefix family (without the leading `--`, without the trailing
38
+ * `-`) to the repo-relative source-file path the apply pipeline edits when an
39
+ * override matches that prefix. Hosts MUST supply their own map (or omit the
40
+ * field — the apply button is then disabled).
41
+ *
42
+ * Why a map (not a function): the routing has to round-trip through Astro
43
+ * frontmatter → island JSON, same as the rest of `PanelConfig`
44
+ * (JSON-serializable constraint).
45
+ */
46
+ export type ApplyRoutingMap = Record<string, string>;
47
+ /**
48
+ * The portable PanelConfig shape.
49
+ */
50
+ export interface PanelConfig {
51
+ /** Base for every derived storage key. */
52
+ storagePrefix: string;
53
+ /** Console API namespace — installed as `window[consoleNamespace].showDesignPanel` etc. by the host adapter. */
54
+ consoleNamespace: string;
55
+ /** BEM-style prefix used by every modal in the panel (export / import / apply). */
56
+ modalClassPrefix: string;
57
+ /** `$schema` value emitted into export JSON and required on import. */
58
+ schemaId: string;
59
+ /** Default filename base — exports save as `${exportFilenameBase}.json`. */
60
+ exportFilenameBase: string;
61
+ /**
62
+ * Optional host-supplied color-scheme presets.
63
+ *
64
+ * Surfaces additional named `ColorScheme` entries in the Color tab's
65
+ * "Scheme..." dropdown, in addition to the bundled
66
+ * `colorCluster.colorSchemes` registry. The two are merged at render
67
+ * time; on key collision the cluster's bundled scheme wins.
68
+ */
69
+ colorPresets?: Record<string, ColorScheme>;
70
+ /**
71
+ * Optional dev-API endpoint URL used by the Apply modal. When the host
72
+ * wires the panel into a project that ships the design-tokens-apply route,
73
+ * supply the URL here; the Apply button POSTs its diff payload to it. When
74
+ * undefined / omitted, the Apply button stays disabled with a tooltip.
75
+ */
76
+ applyEndpoint?: string;
77
+ /**
78
+ * Optional CSS-var prefix → source-file routing map. Drives
79
+ * `routeTokensToFiles` / the dev-API handler. Omit to disable apply
80
+ * entirely (the Apply button is gated on `applyEndpoint` AND a non-empty
81
+ * routing map).
82
+ */
83
+ applyRouting?: ApplyRoutingMap;
84
+ /**
85
+ * Host-supplied tab configuration for the data-driven tab strip.
86
+ *
87
+ * `panel.tsx` renders the tab strip from this array.
88
+ *
89
+ * - Reserved ids (`color`, `font`, `spacing`, `size`) dispatch to their
90
+ * dedicated tab components.
91
+ * - Any other id dispatches to `GenericTab`, which renders the tab's
92
+ * `tiers` using kind-appropriate editors.
93
+ *
94
+ * Hosts MUST supply this field. The color tab (id 'color') reads its
95
+ * palette and semantic data from the tier model via `colorExtras` +
96
+ * `TierItem[]` on the TabConfig. A secondary color tab can be supplied
97
+ * under the reserved id 'color-secondary'.
98
+ */
99
+ tabs: readonly TabConfig[];
100
+ /**
101
+ * Optional id rename map applied during `loadPersistedState` migration.
102
+ * Keys are old ids found in persisted state; values are either:
103
+ *
104
+ * - A `string` — new canonical id; the value moves to that key.
105
+ * - `null` — drop the id entirely. Use this for legacy ids that have no
106
+ * replacement in the current manifest (otherwise stray overrides
107
+ * persist indefinitely as dead localStorage data: the apply pipeline
108
+ * silently ignores ids missing from the active manifest, but every
109
+ * save round-trips the dead key back to disk).
110
+ *
111
+ * Defaults to an empty map (no renaming, no drops) so hosts whose
112
+ * manifest ids are already stable (e.g. `zudo-doc`, whose canonical
113
+ * typography ids are the same names that an earlier zdtp-internal port
114
+ * step treated as "old" labels) are not corrupted: an override on a
115
+ * stable id was being remapped to a non-existent id and silently
116
+ * dropped.
117
+ *
118
+ * zdtp's own astro wiring opts in by passing the legacy zdtp-internal map
119
+ * (`ZDTP_LEGACY_TYPOGRAPHY_RENAME_MAP`, exported from the package root)
120
+ * via this field, preserving the historical rename + drop behaviour for
121
+ * callers that depend on it.
122
+ */
123
+ legacyIdRenameMap?: Record<string, string | null>;
124
+ }
125
+ /**
126
+ * Default config — minimal stub values. Hosts MUST call `configurePanel(...)`
127
+ * with real values to see useful behaviour.
128
+ */
129
+ export declare const DEFAULT_PANEL_CONFIG: PanelConfig;
130
+ /**
131
+ * Configure the panel runtime. Call exactly once per page lifecycle, before
132
+ * the adapter is imported / mounted. Idempotent: calling twice with
133
+ * structurally-equal values is a silent no-op; calling twice with structurally
134
+ * different values throws so config conflicts surface immediately instead of
135
+ * silently corrupting one of the two callers' assumptions.
136
+ *
137
+ * The re-init guard MUST use structural deep-equality, NOT referential
138
+ * identity. The Astro host-adapter parses the inline JSON config on every
139
+ * script run, including post view-transition reruns; that produces a
140
+ * freshly-parsed object that is byte-for-byte identical to the previous call
141
+ * but referentially distinct.
142
+ */
143
+ export declare function configurePanel(config: PanelConfig): void;
144
+ /**
145
+ * Register a callback to run once configurePanel has been called with the
146
+ * host's config. Used by src/index.tsx to defer reapplyPersistedOverrides and
147
+ * reapplyFromStorage until AFTER the host has supplied the correct storagePrefix.
148
+ *
149
+ * H2 fix for issue #111: module-init in index.tsx previously ran reapply
150
+ * synchronously — before configurePanel — using DEFAULT_PANEL_CONFIG's prefix,
151
+ * causing a default-prefix panel to mount and clobber host-prefix storage keys
152
+ * on the first toggle when contaminated localStorage was present.
153
+ *
154
+ * Idempotent: if the same hook reference is registered twice, the second call
155
+ * is a no-op. If configurePanel has already been called, the hook fires
156
+ * immediately so late registrants don't miss the trigger.
157
+ */
158
+ export declare function registerPostConfigureHook(hook: () => void): void;
159
+ /**
160
+ * Read the active panel config. Returns the value passed to `configurePanel`
161
+ * if one was supplied, else `DEFAULT_PANEL_CONFIG`.
162
+ */
163
+ export declare function getPanelConfig(): PanelConfig;
164
+ /**
165
+ * Test-only: clear the singleton so unit tests can exercise different configs
166
+ * in isolation.
167
+ */
168
+ export declare function __resetPanelConfigForTests(): void;
169
+ export { resolvePrimaryColorCluster, resolveSecondaryColorClusterFromTabs, } from './cluster-config';
170
+ import type { ColorClusterDataConfig } from './cluster-config';
171
+ /**
172
+ * Resolve the active primary color cluster from the panel config's tabs array.
173
+ *
174
+ * Returns `undefined` when no color tab is configured or it has no
175
+ * `colorExtras` (e.g. the default empty config).
176
+ *
177
+ * @deprecated Prefer `resolvePrimaryColorCluster(cfg.tabs)` directly.
178
+ */
179
+ export declare function resolveActiveColorCluster(cfg?: PanelConfig): ColorClusterDataConfig | undefined;
180
+ /**
181
+ * Resolve the active secondary color cluster from the panel config's tabs.
182
+ *
183
+ * Returns `null` when no 'color-secondary' tab is configured. Callers MUST
184
+ * treat this as "do not render / apply / clear secondary cluster".
185
+ */
186
+ export declare function resolveSecondaryColorCluster(cfg?: PanelConfig): ColorClusterDataConfig | null;
187
+ /** Storage key for the v2 unified envelope (color + spacing + typography + size + position + secondary cluster). */
188
+ export declare function storageKey_stateV2(cfg: PanelConfig): string;
189
+ /**
190
+ * Storage key for the v3 unified envelope. Adds `tabs: Record<tabId, TabOverrides>` alongside
191
+ * the existing color/spacing/typography/size slices so generic host-coined tabs can persist
192
+ * their overrides without schema changes. v2 → v3 migration runs on first load and writes
193
+ * this key, then deletes the v2 key.
194
+ */
195
+ export declare function storageKey_stateV3(cfg: PanelConfig): string;
196
+ /** Legacy v1 key (Color-only flat state). Migrated into v2 on first load, then deleted. */
197
+ export declare function storageKey_stateV1(cfg: PanelConfig): string;
198
+ /** Mirror of the panel's `open` boolean (synchronous mount-time read). */
199
+ export declare function storageKey_open(cfg: PanelConfig): string;
200
+ /** Drag position `{ top, left }` so the panel reappears where the user left it. */
201
+ export declare function storageKey_position(cfg: PanelConfig): string;
202
+ /** User-resized panel size `{ width, height }` (pixels). Lives alongside position. */
203
+ export declare function storageKey_size(cfg: PanelConfig): string;
204
+ /** Tab-grid density preference (one of `0` / `1` / `2`). Lives alongside size/position. */
205
+ export declare function storageKey_density(cfg: PanelConfig): string;
206
+ /**
207
+ * Adapter-level visibility-intent flag.
208
+ *
209
+ * NOTE: This key uses a literal `:` separator (NOT `-`). Every other derived
210
+ * key uses `-`. The colon is a historical artifact preserved for storage-key
211
+ * continuity.
212
+ */
213
+ export declare function storageKey_visible(cfg: PanelConfig): string;
214
+ /** DOM id of the root element the Preact panel tree mounts into. */
215
+ export declare function panelRootId(cfg: PanelConfig): string;
216
+ /**
217
+ * BEM-style modal class. Pass an empty `suffix` for the base block, or
218
+ * `'--export'` / `'__title'` etc. for elements / modifiers.
219
+ */
220
+ export declare function modalClass(cfg: PanelConfig, suffix: string): string;
221
+ /** Default download filename for export. */
222
+ export declare function exportFilename(cfg: PanelConfig): string;
223
+ /**
224
+ * Runtime validation at the host-adapter trust boundary. The Astro inline
225
+ * `<script type="application/json">` payload is untrusted-by-the-types:
226
+ * TypeScript believes the field is `PanelConfig`, but any developer typo /
227
+ * serialization regression / future Astro lifecycle change can produce a
228
+ * malformed parse. Catching that at the entry point surfaces a single clear
229
+ * error instead of cryptic downstream failures.
230
+ *
231
+ * Throws with a message naming the offending field. Returns nothing — caller
232
+ * narrows the value via TS's control-flow analysis post-call.
233
+ */
234
+ export declare function assertValidPanelConfig(value: unknown): asserts value is PanelConfig;
235
+ /**
236
+ * Resolve the active `applyRouting` map. Returns an empty object when the host
237
+ * has not configured one — callers MUST treat empty as "apply disabled".
238
+ */
239
+ export declare function resolveApplyRouting(cfg?: PanelConfig): ApplyRoutingMap;
240
+ /**
241
+ * Lazily attach a host-supplied color-preset map AFTER `configurePanel(...)`.
242
+ *
243
+ * Why a second entry point exists: `colorPresets` can be the largest
244
+ * JSON-serializable field on `PanelConfig`. Including it in the inline SSR
245
+ * config blob (the `<script type="application/json">` payload the host-adapter
246
+ * parses on every page) means every page render ships the entire preset
247
+ * library, even though it's only consulted when the user opens the panel's
248
+ * "Scheme..." dropdown. Calling `setPanelColorPresets()` from a deferred
249
+ * dynamic-import in the host wrapper keeps the preset data out of the initial
250
+ * HTML payload — lazy-loaded only when the panel actually mounts.
251
+ *
252
+ * Idempotent: setting the same map twice is a no-op. Setting a different
253
+ * non-empty map overwrites the previous one (no throw, unlike
254
+ * `configurePanel`) — the dropdown source-of-truth is whichever bundle
255
+ * landed last.
256
+ */
257
+ export declare function setPanelColorPresets(presets: Record<string, ColorScheme>): void;
258
+ //# sourceMappingURL=panel-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel-config.d.ts","sourceRoot":"","sources":["../../src/config/panel-config.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,37 @@
1
+ import type { TokenDef } from '../tokens/manifest';
2
+ /**
3
+ * Slider row variant with a "Pill" checkbox on top.
4
+ *
5
+ * [x] Pill (9999px)
6
+ * [label] ... [9999 px] ← inputs disabled while pill is on
7
+ * [=========o==================]
8
+ *
9
+ * When the checkbox is ON the token value is pinned to `token.pill.value`
10
+ * (e.g. `"9999px"` for the full-radius sentinel) and the underlying slider /
11
+ * number input go read-only so the user can't accidentally de-pill via typing.
12
+ *
13
+ * When the checkbox is OFF the row behaves as a normal `SliderRow` — the user
14
+ * can drag or type any value in the manifest's min/max range.
15
+ *
16
+ * Toggling between modes preserves the last custom value (kept in a ref so we
17
+ * don't round-trip it through state / persistence) — this is the "without data
18
+ * loss" requirement from the Size sub-issue: you can flip Pill off to tweak
19
+ * 16px, flip back on for the sentinel, flip off again and land on 16px.
20
+ *
21
+ * `onChange` is `(id, next)` — the row passes its own `token.id` back so the
22
+ * parent can use a single stable handler across every row, keeping React.memo
23
+ * effective.
24
+ */
25
+ export interface PillSliderRowProps {
26
+ /** Token must carry `token.pill` metadata. */
27
+ token: TokenDef;
28
+ /** Current persisted value (the manifest default if no override yet). */
29
+ value: string;
30
+ /** Called with the row's `token.id` and the new CSS string whenever pill
31
+ * toggles or slider commits. */
32
+ onChange: (id: string, next: string) => void;
33
+ }
34
+ declare function PillSliderRow({ token, value, onChange }: PillSliderRowProps): import("preact").JSX.Element;
35
+ declare const _default: typeof PillSliderRow;
36
+ export default _default;
37
+ //# sourceMappingURL=pill-slider-row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pill-slider-row.d.ts","sourceRoot":"","sources":["../../src/controls/pill-slider-row.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,KAAK,EAAE,QAAQ,CAAC;IAChB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd;qCACiC;IACjC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,iBAAS,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,kBAAkB,gCAuDpE;;AAID,wBAAmC"}
@@ -0,0 +1,18 @@
1
+ import type { JSX } from 'preact';
2
+ export interface RoleButtonProps {
3
+ children: JSX.Element | JSX.Element[] | string;
4
+ onClick: (e: MouseEvent | KeyboardEvent) => void;
5
+ className?: string;
6
+ /** When true, visually and semantically disables the control without
7
+ * removing it from the tab order (unlike the native `disabled` attribute).
8
+ * Callers should also apply reduced-opacity styling via CSS. */
9
+ 'aria-disabled'?: boolean;
10
+ /** Arbitrary extra aria-* props (e.g. aria-haspopup, aria-expanded). */
11
+ ariaProps?: Record<string, string | boolean | undefined>;
12
+ tabIndex?: number;
13
+ id?: string;
14
+ title?: string;
15
+ 'aria-label'?: string;
16
+ }
17
+ export declare function RoleButton({ children, onClick, className, 'aria-disabled': ariaDisabled, ariaProps, tabIndex, id, title, 'aria-label': ariaLabel, }: RoleButtonProps): JSX.Element;
18
+ //# sourceMappingURL=role-button.d.ts.map