@takazudo/zdtp 0.4.2 → 0.4.3
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 +32 -0
- package/README.md +20 -15
- package/dist/apply/apply-token-overrides.d.ts +0 -1
- package/dist/apply/build-apply-overrides.d.ts +0 -1
- package/dist/apply/route-tokens-to-files.d.ts +0 -1
- package/dist/apply/tier-resolver.d.ts +0 -1
- package/dist/apply-modal.d.ts +0 -1
- package/dist/astro/DesignTokenPanelHost.astro +2 -4
- package/dist/astro/host-adapter.d.ts +0 -1
- package/dist/astro/host-adapter.js +16 -16
- package/dist/astro/index.d.ts +0 -1
- package/dist/astro/index.js +1 -1
- package/dist/{autoload-state-DsvvPDih.js → autoload-state-B1MWY_Pp.js} +1 -1
- package/dist/bin/cors.d.ts +0 -1
- package/dist/bin/parse-args.d.ts +0 -1
- package/dist/bin/server.d.ts +0 -1
- package/dist/bin/server.js +1 -1
- package/dist/components/color-picker/color-field.d.ts +0 -1
- package/dist/components/color-picker/color-picker.d.ts +12 -3
- package/dist/components/color-picker/custom-slider.d.ts +0 -1
- package/dist/components/color-picker/index.d.ts +0 -1
- package/dist/components/palette-chart/index.d.ts +0 -1
- package/dist/components/palette-chart/palette-chart.d.ts +0 -1
- package/dist/config/cluster-config.d.ts +0 -1
- package/dist/config/color-scheme-utils.d.ts +0 -1
- package/dist/config/color-schemes.d.ts +0 -1
- package/dist/config/panel-config.d.ts +11 -1
- package/dist/controls/dismiss-layer.d.ts +55 -0
- package/dist/controls/pill-slider-row.d.ts +0 -1
- package/dist/controls/role-button.d.ts +0 -1
- package/dist/controls/sanitize-css-value.d.ts +0 -1
- package/dist/controls/select-row.d.ts +0 -1
- package/dist/controls/slider-row.d.ts +0 -1
- package/dist/controls/text-row.d.ts +0 -1
- package/dist/controls/tier-ref-selector.d.ts +0 -1
- package/dist/controls/token-label.d.ts +0 -1
- package/dist/controls/tooltip.d.ts +0 -1
- package/dist/controls/use-dialog-backdrop-close.d.ts +32 -0
- package/dist/element-path/build-element-path.d.ts +0 -1
- package/dist/element-path/element-path-context.d.ts +0 -1
- package/dist/element-path/element-path-orchestrator.d.ts +0 -1
- package/dist/element-path/element-path-state.d.ts +0 -1
- package/dist/element-path/element-path-toast.d.ts +0 -1
- package/dist/element-path/element-path-toggle-button.d.ts +0 -1
- package/dist/element-path/index.d.ts +0 -1
- package/dist/element-path/inspector-overlay.d.ts +0 -1
- package/dist/export-modal.d.ts +0 -1
- package/dist/highlight/find-elements.d.ts +0 -1
- package/dist/highlight/highlight-orchestrator.d.ts +0 -1
- package/dist/highlight/highlight-overlay.d.ts +0 -1
- package/dist/highlight/highlight-settings-popover.d.ts +0 -1
- package/dist/highlight/highlight-state.d.ts +0 -1
- package/dist/highlight/highlight-toggle-button.d.ts +0 -1
- package/dist/import-modal.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2475 -2334
- package/dist/{load-routing-XyKgftpe.js → load-routing-DtNTKoLW.js} +1 -1
- package/dist/panel-config-3tBEHjvZ.js +493 -0
- package/dist/panel.d.ts +0 -1
- package/dist/server/create-apply-handler.d.ts +0 -1
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.js +1 -1
- package/dist/server/load-routing.d.ts +0 -1
- package/dist/server/path-safety.d.ts +0 -1
- package/dist/server/serialize-write.d.ts +0 -1
- package/dist/state/autoload-state.d.ts +0 -1
- package/dist/state/persist.d.ts +0 -3
- package/dist/state/tweak-state.d.ts +29 -6
- package/dist/styles/z-index-tokens.d.ts +35 -0
- package/dist/tabs/_generic-item-editor.d.ts +0 -1
- package/dist/tabs/color-tab.d.ts +0 -1
- package/dist/tabs/font-tab.d.ts +0 -1
- package/dist/tabs/generic-tab.d.ts +0 -1
- package/dist/tabs/palette/palette-check-view.d.ts +0 -1
- package/dist/tabs/palette/palette-edit-view.d.ts +0 -1
- package/dist/tabs/palette/palette-readout.d.ts +0 -1
- package/dist/tabs/palette/palette-tab.d.ts +0 -1
- package/dist/tabs/size-tab.d.ts +0 -1
- package/dist/tabs/spacing-tab.d.ts +0 -1
- package/dist/testing.d.ts +0 -1
- package/dist/testing.js +2 -2
- package/dist/tokens/manifest.d.ts +0 -1
- package/dist/tokens/tier-model.d.ts +0 -1
- package/dist/{tweak-state-DzZVbY25.js → tweak-state-BEx1SHu7.js} +329 -335
- package/dist/utils/color-convert.d.ts +0 -1
- package/dist/utils/color-hsla.d.ts +0 -1
- package/dist/utils/color-oklch.d.ts +0 -1
- package/dist/utils/copy-to-clipboard.d.ts +0 -1
- package/dist/utils/design-token-serde.d.ts +0 -1
- package/dist/utils/palette-curve.d.ts +0 -1
- package/dist/utils/structural-equal.d.ts +0 -1
- package/dist/utils/use-portal-mount.d.ts +0 -1
- package/dist/utils/wcag-contrast.d.ts +0 -1
- package/dist/zdtp.css +1 -1
- package/package.json +24 -11
- package/dist/apply/apply-token-overrides.d.ts.map +0 -1
- package/dist/apply/build-apply-overrides.d.ts.map +0 -1
- package/dist/apply/route-tokens-to-files.d.ts.map +0 -1
- package/dist/apply/tier-resolver.d.ts.map +0 -1
- package/dist/apply-modal.d.ts.map +0 -1
- package/dist/astro/host-adapter.d.ts.map +0 -1
- package/dist/astro/index.d.ts.map +0 -1
- package/dist/bin/cors.d.ts.map +0 -1
- package/dist/bin/parse-args.d.ts.map +0 -1
- package/dist/bin/server.d.ts.map +0 -1
- package/dist/components/color-picker/color-field.d.ts.map +0 -1
- package/dist/components/color-picker/color-picker.d.ts.map +0 -1
- package/dist/components/color-picker/custom-slider.d.ts.map +0 -1
- package/dist/components/color-picker/index.d.ts.map +0 -1
- package/dist/components/palette-chart/index.d.ts.map +0 -1
- package/dist/components/palette-chart/palette-chart.d.ts.map +0 -1
- package/dist/config/cluster-config.d.ts.map +0 -1
- package/dist/config/color-scheme-utils.d.ts.map +0 -1
- package/dist/config/color-schemes.d.ts.map +0 -1
- package/dist/config/panel-config.d.ts.map +0 -1
- package/dist/controls/pill-slider-row.d.ts.map +0 -1
- package/dist/controls/role-button.d.ts.map +0 -1
- package/dist/controls/sanitize-css-value.d.ts.map +0 -1
- package/dist/controls/select-row.d.ts.map +0 -1
- package/dist/controls/slider-row.d.ts.map +0 -1
- package/dist/controls/text-row.d.ts.map +0 -1
- package/dist/controls/tier-ref-selector.d.ts.map +0 -1
- package/dist/controls/token-label.d.ts.map +0 -1
- package/dist/controls/tooltip.d.ts.map +0 -1
- package/dist/element-path/build-element-path.d.ts.map +0 -1
- package/dist/element-path/element-path-context.d.ts.map +0 -1
- package/dist/element-path/element-path-orchestrator.d.ts.map +0 -1
- package/dist/element-path/element-path-state.d.ts.map +0 -1
- package/dist/element-path/element-path-toast.d.ts.map +0 -1
- package/dist/element-path/element-path-toggle-button.d.ts.map +0 -1
- package/dist/element-path/index.d.ts.map +0 -1
- package/dist/element-path/inspector-overlay.d.ts.map +0 -1
- package/dist/export-modal.d.ts.map +0 -1
- package/dist/highlight/find-elements.d.ts.map +0 -1
- package/dist/highlight/highlight-orchestrator.d.ts.map +0 -1
- package/dist/highlight/highlight-overlay.d.ts.map +0 -1
- package/dist/highlight/highlight-settings-popover.d.ts.map +0 -1
- package/dist/highlight/highlight-state.d.ts.map +0 -1
- package/dist/highlight/highlight-toggle-button.d.ts.map +0 -1
- package/dist/import-modal.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/panel-config-DyVRQ2n1.js +0 -415
- package/dist/panel.d.ts.map +0 -1
- package/dist/server/create-apply-handler.d.ts.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/load-routing.d.ts.map +0 -1
- package/dist/server/path-safety.d.ts.map +0 -1
- package/dist/server/serialize-write.d.ts.map +0 -1
- package/dist/state/autoload-state.d.ts.map +0 -1
- package/dist/state/persist.d.ts.map +0 -1
- package/dist/state/tweak-state.d.ts.map +0 -1
- package/dist/tabs/_generic-item-editor.d.ts.map +0 -1
- package/dist/tabs/color-tab.d.ts.map +0 -1
- package/dist/tabs/font-tab.d.ts.map +0 -1
- package/dist/tabs/generic-tab.d.ts.map +0 -1
- package/dist/tabs/palette/palette-check-view.d.ts.map +0 -1
- package/dist/tabs/palette/palette-edit-view.d.ts.map +0 -1
- package/dist/tabs/palette/palette-readout.d.ts.map +0 -1
- package/dist/tabs/palette/palette-tab.d.ts.map +0 -1
- package/dist/tabs/size-tab.d.ts.map +0 -1
- package/dist/tabs/spacing-tab.d.ts.map +0 -1
- package/dist/testing.d.ts.map +0 -1
- package/dist/tokens/manifest.d.ts.map +0 -1
- package/dist/tokens/tier-model.d.ts.map +0 -1
- package/dist/utils/color-convert.d.ts.map +0 -1
- package/dist/utils/color-hsla.d.ts.map +0 -1
- package/dist/utils/color-oklch.d.ts.map +0 -1
- package/dist/utils/copy-to-clipboard.d.ts.map +0 -1
- package/dist/utils/design-token-serde.d.ts.map +0 -1
- package/dist/utils/palette-curve.d.ts.map +0 -1
- package/dist/utils/structural-equal.d.ts.map +0 -1
- package/dist/utils/use-portal-mount.d.ts.map +0 -1
- package/dist/utils/wcag-contrast.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- **Dismiss-layer arbitration for layered surfaces.** A shared dismiss-layer stack routes Escape to only the topmost open layer (nested popover → popover → panel), and all three modals gained gesture-aware backdrop dismissal (press+release must both land outside), fixing one-Escape-closes-everything, trigger-click reopen races, and text-selection drags closing modals ([#446](https://github.com/Takazudo/zudo-design-token-panel/issues/446)) (9119c7e, 8257b19)
|
|
8
|
+
- **CSS isolation architecture.** Panel z-indexes are now a semantic token scale shared by CSS and TSX (shell renders above common host chrome), a `box-sizing` reset is scoped to the panel subtree, panel geometry moved from rem to px so host root font-size cannot warp the panel, and `color-scheme` is declared on panel surfaces ([#448](https://github.com/Takazudo/zudo-design-token-panel/issues/448)) (62f8e4c)
|
|
9
|
+
- **Visual-regression test tier.** 8 Playwright baselines (palette chart, color-picker swatch + popover, panel chrome — light + dark) with a documented `test:vrt:update` flow, wired into CI ([#454](https://github.com/Takazudo/zudo-design-token-panel/issues/454)) (5241e02)
|
|
10
|
+
- **Real lint + doc-link gates.** oxlint wired for the panel and linkinator + html-validate for the doc site — the CI Lint step is no longer a no-op ([#443](https://github.com/Takazudo/zudo-design-token-panel/issues/443)) (4812160)
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `configurePanel` re-runs no longer throw when combined with `setPanelColorPresets` (Astro view-transitions + lazy color presets recipe); sink instances seed from `panelSettings.colorScheme` instead of the host `data-theme`; palette cssVar templates and `colorExtras` are validated at configure time ([#440](https://github.com/Takazudo/zudo-design-token-panel/issues/440)) (afe8a36, 87df039, 4d5e611)
|
|
15
|
+
- `applyTokenOverrides` no longer rewrites the wrong declaration when one custom-property name is a suffix of another — `zdtp-server` could corrupt CSS files on disk ([#441](https://github.com/Takazudo/zudo-design-token-panel/issues/441)) (3be6865)
|
|
16
|
+
- Highlight subsystem: match cache is evicted on stylesheet changes (stale detached elements no longer stay highlighted), percentage values are classified as lengths, and a highlight probe runs one full-DOM walk instead of three ([#442](https://github.com/Takazudo/zudo-design-token-panel/issues/442)) (fc07e41)
|
|
17
|
+
- PaletteSelector listbox is fully keyboard-operable; ApplyModal's `onApplied` cleanup contract now holds on every dismissal route ([#446](https://github.com/Takazudo/zudo-design-token-panel/issues/446)) (8257b19)
|
|
18
|
+
- State persistence: changing a palette's size no longer discards spacing/typography/size/tab overrides; restored positions are viewport-clamped and finite; fresh-mount toggle intent; window-resize handling debounced; imported palette values pass the seed-time sanitizer; dead `panelPosition` path removed ([#447](https://github.com/Takazudo/zudo-design-token-panel/issues/447)) (8f67382)
|
|
19
|
+
- Astro soft navigation unmounts/remounts **all** registered panel instances (was: default only — other instances leaked listeners per navigation and vanished until re-toggled), and persisted overrides are reapplied for every instance, including hidden ones ([#449](https://github.com/Takazudo/zudo-design-token-panel/issues/449), [#457](https://github.com/Takazudo/zudo-design-token-panel/issues/457)) (908d6df, 8ce3d8b)
|
|
20
|
+
- CSS accessibility: `:focus-visible` styles for every native form control (host `outline: none` resets can no longer hide focus), raw color literals replaced by `--tokentweak-*` tokens, 24×24 minimum hit areas, `prefers-reduced-motion` support ([#450](https://github.com/Takazudo/zudo-design-token-panel/issues/450)) (fa36675)
|
|
21
|
+
- The panel's SVG defensive reset now survives a hostile `svg { fill: red !important }` host rule ([#452](https://github.com/Takazudo/zudo-design-token-panel/issues/452)) (6ac7129)
|
|
22
|
+
- Packaging: exports map gained `default` conditions and a `./package.json` export, broken declaration maps are no longer shipped, and a post-build check fails the build if any exports entry does not resolve against `dist/` ([#444](https://github.com/Takazudo/zudo-design-token-panel/issues/444)) (13862a4)
|
|
23
|
+
- `release.yml` `dry_run` builds the package again, as its description advertises (8ce3d8b)
|
|
24
|
+
|
|
25
|
+
### Other Changes
|
|
26
|
+
|
|
27
|
+
- Docs now describe the real stylesheet mechanism — the panel self-injects its CSS via an inline import; no consumer CSS import is required — and stale pre-rename `packages/zudo-design-token-panel/` paths are purged ([#445](https://github.com/Takazudo/zudo-design-token-panel/issues/445)) (54756a2)
|
|
28
|
+
- CI overhaul: PR branch filters cover live `base/**` branches, tests gate main pushes and `v*` release tags, Playwright browsers are cached, duplicate builds removed, concurrency cancellation + job timeouts everywhere ([#443](https://github.com/Takazudo/zudo-design-token-panel/issues/443)) (dbf5704)
|
|
29
|
+
- New automated hostile-host isolation gate (Level 5): the panel's computed styles and viewport-fixed positioning are asserted inside a hostile host page, including a transform-ancestor scenario ([#452](https://github.com/Takazudo/zudo-design-token-panel/issues/452)) (6ac7129)
|
|
30
|
+
- 17 browser-mode gesture tests for panel drag-to-move / resize incl. viewport clamping and persistence ([#453](https://github.com/Takazudo/zudo-design-token-panel/issues/453)) (a4b25af)
|
|
31
|
+
- Test-suite hygiene: the DOM-policy static gate covers every panel TSX file and the full blocked-tag list, the palette drag browser test asserts for real, shared effect-flush helper, and a `test:unit` script runs the non-browser projects without Chromium ([#451](https://github.com/Takazudo/zudo-design-token-panel/issues/451)) (ebe0018, 8a7ee63, 4682139, 9b6c989)
|
|
32
|
+
- Browser test files now run serially — parallel files share one origin and raced each other's localStorage (fd37774)
|
|
33
|
+
- Deps: bump @takazudo/* toolchain (zfb next.76, zudo-doc 2.5.0) (62b62f6)
|
|
34
|
+
|
|
3
35
|
## 0.4.2
|
|
4
36
|
|
|
5
37
|
### Features
|
package/README.md
CHANGED
|
@@ -292,7 +292,8 @@ The `<DesignTokenPanelHost>` component AND a paired `<script>` block that loads
|
|
|
292
292
|
import { ClientRouter } from 'astro:transitions';
|
|
293
293
|
import DesignTokenPanelHost from '@takazudo/zdtp/astro/DesignTokenPanelHost.astro';
|
|
294
294
|
import { myPanelConfig } from '../lib/my-panel-config';
|
|
295
|
-
import
|
|
295
|
+
// No CSS import needed — the panel self-injects its stylesheet on first mount.
|
|
296
|
+
// import '@takazudo/zdtp/styles'; // optional: pull CSS into your own pipeline
|
|
296
297
|
---
|
|
297
298
|
|
|
298
299
|
<!doctype html>
|
|
@@ -325,18 +326,20 @@ window.myapp.toggleDesignPanel();
|
|
|
325
326
|
|
|
326
327
|
Or wire a hidden keyboard shortcut / dev-only button to call the same helper.
|
|
327
328
|
|
|
328
|
-
### 4.1.4
|
|
329
|
+
### 4.1.4 Stylesheet (self-injected — no consumer import required)
|
|
330
|
+
|
|
331
|
+
The panel injects its own stylesheet at runtime. When the panel first mounts, `ensurePanelStyles()` (called from `ensureMounted()` in `src/index.tsx`) appends a `<style>` element to `document.head` carrying the bundled CSS. The CSS is embedded in the JS bundle as a string via a `?inline` import, so it survives Vite library mode's build step and reaches the browser without any consumer-side stylesheet import.
|
|
332
|
+
|
|
333
|
+
**You do not need to import `@takazudo/zdtp/styles`** — the panel is visually self-contained out of the box.
|
|
329
334
|
|
|
330
|
-
The
|
|
335
|
+
The `./styles` (alias `./styles.css`) sub-export still resolves to `./dist/zdtp.css` and remains available if you prefer to pull the CSS into your own stylesheet pipeline (e.g. for SSR hydration, PostCSS processing, or bundler-level deduplication). This import is now optional:
|
|
331
336
|
|
|
332
337
|
```ts
|
|
333
|
-
//
|
|
338
|
+
// Optional — pull CSS into your own pipeline if needed
|
|
334
339
|
import '@takazudo/zdtp/styles';
|
|
335
340
|
```
|
|
336
341
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
If you skip this line, the panel's JS will still run, `window.<ns>.showDesignPanel()` will mount `#…-design-token-panel-root`, and the shell DOM will render — but with no chrome rules applied (transparent background, default page font), so it appears invisible. See §13 for further notes on bundler behaviour.
|
|
342
|
+
If the panel looks unstyled after mounting, the most likely cause is that the panel module itself failed to load (network error, bundler misconfiguration, missing `preact` peer). The stylesheet is self-injected by the same JS that mounts the panel — if the JS ran, the CSS is present. See §12 for further notes on bundler behaviour.
|
|
340
343
|
|
|
341
344
|
### 4.1.5 Why the host-adapter import lives in your wrapper
|
|
342
345
|
|
|
@@ -1033,23 +1036,25 @@ The CSS variables the panel **writes to** (the `cssVar` field on each `TokenDef`
|
|
|
1033
1036
|
|
|
1034
1037
|
## 12. Bundler notes
|
|
1035
1038
|
|
|
1036
|
-
The package builds in **Vite library mode
|
|
1037
|
-
|
|
1038
|
-
Net effect: the consumer MUST add a one-line side-effect import to their static module graph, as described in §3.4. The `./styles` sub-export is the canonical entry:
|
|
1039
|
+
The package builds in **Vite library mode**. Normally, Vite library mode extracts every `import './something.css'` from the source and emits a combined stylesheet (`dist/zdtp.css`), removing the import statements from the emitted JS files. This package works around that limitation via a `?inline` import:
|
|
1039
1040
|
|
|
1040
1041
|
```ts
|
|
1041
|
-
|
|
1042
|
+
// src/index.tsx (shipped in dist/index.js)
|
|
1043
|
+
import panelCss from './styles/panel.css?inline'; // string — survives Vite library build
|
|
1042
1044
|
```
|
|
1043
1045
|
|
|
1044
|
-
|
|
1046
|
+
The `?inline` import is NOT stripped by Vite library mode — it emits the CSS as a JavaScript string constant inside `dist/index.js`. When `ensureMounted()` is called, `ensurePanelStyles()` uses that string to append a `<style>` element to `document.head`. **The panel is therefore visually self-contained: consumers do not need to import the stylesheet.**
|
|
1047
|
+
|
|
1048
|
+
The `./styles` sub-export (`dist/zdtp.css`) is still emitted alongside the JS bundle (via a retained side-effect import in `src/index.tsx`). It remains available for consumers who prefer to pull the CSS into their own pipeline (SSR hydration, PostCSS, bundler deduplication):
|
|
1045
1049
|
|
|
1046
1050
|
```ts
|
|
1051
|
+
// Optional — only needed if you want the CSS in your own pipeline
|
|
1052
|
+
import '@takazudo/zdtp/styles';
|
|
1053
|
+
// Alias with explicit extension:
|
|
1047
1054
|
import '@takazudo/zdtp/styles.css';
|
|
1048
1055
|
```
|
|
1049
1056
|
|
|
1050
|
-
If
|
|
1051
|
-
|
|
1052
|
-
(Historical note: an earlier draft of this section claimed `sideEffects` alone was sufficient and consumers did not need to import CSS. That was incorrect — Vite library mode's CSS-extraction behaviour means `sideEffects` is necessary but not sufficient. The §3.4 + this section now reflect the actual contract.)
|
|
1057
|
+
If the panel appears unstyled, the JS module itself failed to load — the stylesheet is self-injected by the same code that mounts the panel. Adding a styles import will not fix a module-load failure.
|
|
1053
1058
|
|
|
1054
1059
|
### 12.1 Host-adapter side-effect import (paired-unit contract)
|
|
1055
1060
|
|
|
@@ -78,4 +78,3 @@ export declare function applyTokenOverridesOrThrow(source: string, overrides: Re
|
|
|
78
78
|
* source contains at least one top-level `:root { ... }` block.
|
|
79
79
|
*/
|
|
80
80
|
export declare function hasTopLevelRootBlock(source: string): boolean;
|
|
81
|
-
//# sourceMappingURL=apply-token-overrides.d.ts.map
|
|
@@ -70,4 +70,3 @@ import type { TabConfig } from '../tokens/tier-model';
|
|
|
70
70
|
* non-color token resolution works without a live panel config singleton.
|
|
71
71
|
*/
|
|
72
72
|
export declare function buildApplyOverrides(state: TweakState, colorDefaults: ColorTweakState | undefined, cluster?: ColorClusterConfig, tabs?: readonly TabConfig[]): Record<string, string>;
|
|
73
|
-
//# sourceMappingURL=build-apply-overrides.d.ts.map
|
|
@@ -62,4 +62,3 @@ export declare const TOKEN_SOURCE_FILES: Readonly<ApplyRoutingMap>;
|
|
|
62
62
|
* instead of silently no-oping.
|
|
63
63
|
*/
|
|
64
64
|
export declare function routeTokensToFiles(overrides: Record<string, string>, routing?: ApplyRoutingMap): RouteResult;
|
|
65
|
-
//# sourceMappingURL=route-tokens-to-files.d.ts.map
|
|
@@ -72,4 +72,3 @@ export declare function resolveTierItemValue(tab: TabConfig, tierId: string, ite
|
|
|
72
72
|
* - Ref → returns `var(--targetCssVar)` (e.g. `var(--zfb-easing-ease-in)`).
|
|
73
73
|
*/
|
|
74
74
|
export declare function emitTierItemCssValue(resolved: ResolvedTierItem): string;
|
|
75
|
-
//# sourceMappingURL=tier-resolver.d.ts.map
|
package/dist/apply-modal.d.ts
CHANGED
|
@@ -9,10 +9,8 @@
|
|
|
9
9
|
* ---
|
|
10
10
|
* import DesignTokenPanelHost from '@takazudo/zdtp/astro/DesignTokenPanelHost.astro';
|
|
11
11
|
* import { panelConfig } from './my-design-token-config';
|
|
12
|
-
* //
|
|
13
|
-
* //
|
|
14
|
-
* // so consumers must re-pull the extracted stylesheet explicitly.
|
|
15
|
-
* import '@takazudo/zdtp/styles';
|
|
12
|
+
* // No CSS import needed — the panel self-injects its stylesheet on first mount.
|
|
13
|
+
* // Optional: import '@takazudo/zdtp/styles'; // pull CSS into your own pipeline
|
|
16
14
|
* ---
|
|
17
15
|
* <DesignTokenPanelHost config={panelConfig} />
|
|
18
16
|
* <script>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { c as h, g as u, a as g, b as w, d as y, e as P } from "../panel-config-
|
|
2
|
-
import { g as d, Z as b } from "../tweak-state-
|
|
3
|
-
import { s as _, l as A, a as c, c as k, b as I } from "../autoload-state-
|
|
4
|
-
const
|
|
1
|
+
import { c as h, g as u, a as g, b as w, d as y, e as P } from "../panel-config-3tBEHjvZ.js";
|
|
2
|
+
import { g as d, Z as b } from "../tweak-state-BEx1SHu7.js";
|
|
3
|
+
import { s as _, l as A, a as c, c as k, b as I } from "../autoload-state-B1MWY_Pp.js";
|
|
4
|
+
const l = "tokenpanel-config";
|
|
5
5
|
function E() {
|
|
6
6
|
if (typeof document > "u")
|
|
7
7
|
throw new Error(
|
|
8
8
|
"[design-token-panel] host-adapter loaded without a document; expected to run in a browser context."
|
|
9
9
|
);
|
|
10
|
-
const n = document.getElementById(
|
|
10
|
+
const n = document.getElementById(l);
|
|
11
11
|
if (!n)
|
|
12
12
|
throw new Error(
|
|
13
|
-
`[design-token-panel] Inline config script #${
|
|
13
|
+
`[design-token-panel] Inline config script #${l} not found. Ensure <DesignTokenPanelHost config={...} /> is rendered on this page before the host script runs.`
|
|
14
14
|
);
|
|
15
15
|
const o = n.textContent ?? "";
|
|
16
16
|
let e;
|
|
@@ -18,7 +18,7 @@ function E() {
|
|
|
18
18
|
e = JSON.parse(o);
|
|
19
19
|
} catch (a) {
|
|
20
20
|
throw new Error(
|
|
21
|
-
`[design-token-panel] Failed to parse inline config from #${
|
|
21
|
+
`[design-token-panel] Failed to parse inline config from #${l}: ${a.message}`
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
return P(e), e;
|
|
@@ -46,7 +46,7 @@ function v(n, o) {
|
|
|
46
46
|
return !1;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function i(n) {
|
|
50
50
|
return n.modulePromise === null && (n.modulePromise = import("@takazudo/zdtp").then((o) => {
|
|
51
51
|
try {
|
|
52
52
|
const e = u(), a = o.__panelConfigForTest();
|
|
@@ -64,22 +64,22 @@ async function l(n) {
|
|
|
64
64
|
function D(n, o, e, a, t) {
|
|
65
65
|
const s = n[o] ?? {};
|
|
66
66
|
s.showDesignPanel = async () => {
|
|
67
|
-
c(t, !0), await
|
|
67
|
+
c(t, !0), await i(e), a.open();
|
|
68
68
|
}, s.hideDesignPanel = async () => {
|
|
69
|
-
await
|
|
69
|
+
await i(e), a.close();
|
|
70
70
|
}, s.toggleDesignPanel = async () => {
|
|
71
|
-
await
|
|
71
|
+
await i(e), a.toggle();
|
|
72
72
|
let r = !1;
|
|
73
73
|
try {
|
|
74
|
-
r = window.localStorage.getItem(d(t))
|
|
74
|
+
r = window.localStorage.getItem(d(t)) === "1";
|
|
75
75
|
} catch {
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
r && c(t, !0);
|
|
78
78
|
}, s.enableAutoload = async () => {
|
|
79
|
-
(await
|
|
79
|
+
(await i(e)).enableAutoload(t);
|
|
80
80
|
}, s.disableAutoload = async () => {
|
|
81
81
|
if (e.modulePromise !== null) {
|
|
82
|
-
(await
|
|
82
|
+
(await i(e)).disableAutoload(t);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
k(t), I(!1, t);
|
|
@@ -98,5 +98,5 @@ function D(n, o, e, a, t) {
|
|
|
98
98
|
if (D(s, t.consoleNamespace, r, a, t), r.bound) return;
|
|
99
99
|
r.bound = !0;
|
|
100
100
|
const f = g(t), p = w(t), m = y(t);
|
|
101
|
-
(T(f) || v(p, m) || _(t) || A(t)) &&
|
|
101
|
+
(T(f) || v(p, m) || _(t) || A(t)) && i(r);
|
|
102
102
|
})();
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -30,4 +30,3 @@ export { colorSchemes } from '../config/color-schemes';
|
|
|
30
30
|
export { panelSettings, SEMANTIC_CSS_NAMES, SEMANTIC_DEFAULTS_ZD } from '../config/color-scheme-utils';
|
|
31
31
|
export { GROUP_ORDER, FONT_GROUP_ORDER, SIZE_GROUP_ORDER, GROUP_TITLES } from '../tokens/manifest';
|
|
32
32
|
export type { TokenDef, TokenManifest } from '../tokens/manifest';
|
|
33
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/astro/index.js
CHANGED
package/dist/bin/cors.d.ts
CHANGED
package/dist/bin/parse-args.d.ts
CHANGED
|
@@ -35,4 +35,3 @@ export declare const HELP_TEXT = "Usage: zdtp-server [options]\n\nRun a small No
|
|
|
35
35
|
* `ParsedArgs` record. Throws on malformed input — the bin handles the throw.
|
|
36
36
|
*/
|
|
37
37
|
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
38
|
-
//# sourceMappingURL=parse-args.d.ts.map
|
package/dist/bin/server.d.ts
CHANGED
package/dist/bin/server.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { realpathSync as H } from "node:fs";
|
|
3
3
|
import { createServer as C } from "node:http";
|
|
4
4
|
import { resolve as d } from "node:path";
|
|
5
|
-
import { l as x, c as N } from "../load-routing-
|
|
5
|
+
import { l as x, c as N } from "../load-routing-DtNTKoLW.js";
|
|
6
6
|
function g(t, e) {
|
|
7
7
|
return typeof t != "string" || t.length === 0 || e.length === 0 ? !1 : e.includes(t);
|
|
8
8
|
}
|
|
@@ -35,4 +35,3 @@ export interface ColorFieldProps {
|
|
|
35
35
|
*/
|
|
36
36
|
export declare function ColorField({ value, onChange, valueFormat, label, cssVar, readonly: isReadonly, }: ColorFieldProps): import("preact").JSX.Element;
|
|
37
37
|
export default ColorField;
|
|
38
|
-
//# sourceMappingURL=color-field.d.ts.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Issue #175 (Wave 2 of the OKLCH Picker epic, issue #174-base).
|
|
9
9
|
*
|
|
10
|
-
* Design rules (see packages/
|
|
10
|
+
* Design rules (see packages/zdtp/CLAUDE.md):
|
|
11
11
|
* - All interactive elements use <div role="button" tabIndex={0}> with
|
|
12
12
|
* explicit Enter/Space onKeyDown handlers. Native button and heading tags
|
|
13
13
|
* are not used (hostile-host policy).
|
|
@@ -75,8 +75,18 @@ export declare function getFixedPopoverStyle(anchor: HTMLElement | null, estW: n
|
|
|
75
75
|
*
|
|
76
76
|
* Deliberately does NOT close on scroll — a scroll event on the host page
|
|
77
77
|
* should not dismiss an in-flight color edit.
|
|
78
|
+
*
|
|
79
|
+
* `anchorRef` (F11): the popover's trigger element lives OUTSIDE `containerRef`.
|
|
80
|
+
* A pointerdown on the trigger while the popover is open must NOT trigger the
|
|
81
|
+
* outside-close, otherwise it races the trigger's own click-to-toggle: the
|
|
82
|
+
* pointerdown closes, then the click reopens, so the trigger can never dismiss
|
|
83
|
+
* its own popover. Excluding the anchor lets the click toggle it shut.
|
|
84
|
+
*
|
|
85
|
+
* Escape is arbitrated by the shared dismiss-layer stack (F10): only the
|
|
86
|
+
* topmost open popover consumes a single Escape, so one keypress never also
|
|
87
|
+
* tears down the panel underneath.
|
|
78
88
|
*/
|
|
79
|
-
export declare function usePopoverClose(containerRef: React.RefObject<HTMLElement | null>, onClose: () => void): void;
|
|
89
|
+
export declare function usePopoverClose(containerRef: React.RefObject<HTMLElement | null>, onClose: () => void, anchorRef?: React.RefObject<HTMLElement | null>): void;
|
|
80
90
|
/**
|
|
81
91
|
* ColorPicker — popover body only.
|
|
82
92
|
*
|
|
@@ -85,4 +95,3 @@ export declare function usePopoverClose(containerRef: React.RefObject<HTMLElemen
|
|
|
85
95
|
*/
|
|
86
96
|
export declare function ColorPicker({ color, onChange, valueFormat, label, defaultMode, anchorRef, onClose, }: ColorPickerProps): JSX.Element;
|
|
87
97
|
export default ColorPicker;
|
|
88
|
-
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -132,4 +132,3 @@ export declare function resolvePrimaryColorCluster(tabs: readonly TabConfig[]):
|
|
|
132
132
|
* `ColorClusterDataConfig`. Returns `null` when no secondary color tab exists.
|
|
133
133
|
*/
|
|
134
134
|
export declare function resolveSecondaryColorClusterFromTabs(tabs: readonly TabConfig[]): ColorClusterDataConfig | null;
|
|
135
|
-
//# sourceMappingURL=cluster-config.d.ts.map
|
|
@@ -102,4 +102,3 @@ export declare function resolveSemanticColors(scheme: ColorScheme): Record<strin
|
|
|
102
102
|
export declare function schemeToCssPairs(scheme: ColorScheme): [string, string][];
|
|
103
103
|
export declare function generateCssCustomProperties(): string;
|
|
104
104
|
export declare function generateLightDarkCssProperties(): string;
|
|
105
|
-
//# sourceMappingURL=color-scheme-utils.d.ts.map
|
|
@@ -337,6 +337,17 @@ export declare function registerPostConfigureHook(hook: () => void): void;
|
|
|
337
337
|
* called `configurePanel`.
|
|
338
338
|
*/
|
|
339
339
|
export declare function getPanelConfig(): PanelConfig;
|
|
340
|
+
/**
|
|
341
|
+
* Return the configs of ALL registered panel instances, in registration order.
|
|
342
|
+
* Returns an empty array when no instance has been configured yet.
|
|
343
|
+
*
|
|
344
|
+
* Used by the Astro lifecycle handlers (unmountForSwap / reapplyFromStorage)
|
|
345
|
+
* to loop every mounted instance rather than only the default one. Without
|
|
346
|
+
* this, non-default panels have their DOM roots removed by Astro's body swap
|
|
347
|
+
* WITHOUT `render(null, root)` being called, so their useEffect cleanups never
|
|
348
|
+
* fire and window/document listeners accumulate per soft navigation.
|
|
349
|
+
*/
|
|
350
|
+
export declare function getAllPanelConfigs(): PanelConfig[];
|
|
340
351
|
/**
|
|
341
352
|
* Resolve the registered config for a SPECIFIC instance by its `storagePrefix`
|
|
342
353
|
* (=== `instanceId`), or `null` when no such instance is registered.
|
|
@@ -483,4 +494,3 @@ export declare function resolveApplyRouting(cfg?: PanelConfig): ApplyRoutingMap;
|
|
|
483
494
|
* registry level and merged into the first instance to be configured.
|
|
484
495
|
*/
|
|
485
496
|
export declare function setPanelColorPresets(presets: Record<string, ColorScheme>): void;
|
|
486
|
-
//# sourceMappingURL=panel-config.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dismiss-layer stack — shared Escape arbitration for the panel's layered
|
|
3
|
+
* popovers (#446).
|
|
4
|
+
*
|
|
5
|
+
* Problem it solves
|
|
6
|
+
* -----------------
|
|
7
|
+
* The panel stacks several dismissable surfaces on top of each other:
|
|
8
|
+
* a ColorPicker popover, the HighlightSettingsPopover (which can itself host a
|
|
9
|
+
* nested ColorPicker), and the PaletteSelector listbox — plus the panel shell
|
|
10
|
+
* underneath. Each surface used to register its OWN `document` keydown listener
|
|
11
|
+
* that closed it on Escape. Because they were all bound to `document`, a single
|
|
12
|
+
* Escape fired EVERY listener at once: the popover closed AND the panel torn
|
|
13
|
+
* down, and with a nested picker all three layers collapsed on one keypress.
|
|
14
|
+
*
|
|
15
|
+
* The fix is a single, shared arbiter. Every dismissable JS-managed popover
|
|
16
|
+
* registers a layer here instead of adding its own key listener. One
|
|
17
|
+
* capture-phase `keydown` listener on `document` routes Escape to exactly ONE
|
|
18
|
+
* layer — the topmost — and marks the event handled via `preventDefault()`.
|
|
19
|
+
* Base surfaces that keep their own listener (the panel shell) bail when they
|
|
20
|
+
* see `event.defaultPrevented`, so one Escape never closes two layers.
|
|
21
|
+
*
|
|
22
|
+
* Native `<dialog>` modals (Export / Import / Apply) are intentionally NOT
|
|
23
|
+
* layers here: the browser already gives them their own top-layer Escape
|
|
24
|
+
* handling. The panel guards against those separately via its modal-open flags.
|
|
25
|
+
*
|
|
26
|
+
* Topmost selection
|
|
27
|
+
* -----------------
|
|
28
|
+
* "Topmost" is resolved by DOM depth, not registration order: the layer whose
|
|
29
|
+
* element is the deepest descendant wins (a nested popover's container is a DOM
|
|
30
|
+
* descendant of its host popover's container). This is robust regardless of the
|
|
31
|
+
* order in which effects register the layers (child effects run before parent
|
|
32
|
+
* effects in Preact), which matters for the ColorPicker-inside-
|
|
33
|
+
* HighlightSettingsPopover case. When elements are unrelated or unavailable it
|
|
34
|
+
* falls back to the most-recently-registered layer.
|
|
35
|
+
*/
|
|
36
|
+
export interface DismissLayerOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Invoked when this layer is the topmost and Escape is pressed. Should close
|
|
39
|
+
* the layer (and may restore focus to its trigger).
|
|
40
|
+
*/
|
|
41
|
+
onEscape: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the layer's root element, used to resolve DOM depth when several
|
|
44
|
+
* layers are open at once. May return null before the element mounts.
|
|
45
|
+
*/
|
|
46
|
+
getElement: () => HTMLElement | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Register a dismiss layer. Returns an unregister function to call on unmount.
|
|
50
|
+
*/
|
|
51
|
+
export declare function pushDismissLayer(options: DismissLayerOptions): () => void;
|
|
52
|
+
/** Number of currently-registered layers (test/introspection helper). */
|
|
53
|
+
export declare function dismissLayerCount(): number;
|
|
54
|
+
/** Clear all registered layers. Test-only reset between cases. */
|
|
55
|
+
export declare function __resetDismissLayersForTests(): void;
|
|
@@ -34,4 +34,3 @@ export interface PillSliderRowProps {
|
|
|
34
34
|
declare function PillSliderRow({ token, value, onChange }: PillSliderRowProps): import("preact").JSX.Element;
|
|
35
35
|
declare const _default: typeof PillSliderRow;
|
|
36
36
|
export default _default;
|
|
37
|
-
//# sourceMappingURL=pill-slider-row.d.ts.map
|
|
@@ -15,4 +15,3 @@ export interface RoleButtonProps {
|
|
|
15
15
|
'aria-label'?: string;
|
|
16
16
|
}
|
|
17
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
|
|
@@ -36,4 +36,3 @@ export interface TierRefSelectorProps {
|
|
|
36
36
|
declare function TierRefSelector({ tab, tierId, itemId, value, onChange, previewValueFor }: TierRefSelectorProps): import("preact").JSX.Element;
|
|
37
37
|
declare const _default: typeof TierRefSelector;
|
|
38
38
|
export default _default;
|
|
39
|
-
//# sourceMappingURL=tier-ref-selector.d.ts.map
|
|
@@ -14,4 +14,3 @@ export interface TokenLabelProps {
|
|
|
14
14
|
declare function TokenLabelInner({ cssVar, label, className }: TokenLabelProps): import("preact").JSX.Element;
|
|
15
15
|
export declare const TokenLabel: typeof TokenLabelInner;
|
|
16
16
|
export default TokenLabel;
|
|
17
|
-
//# sourceMappingURL=token-label.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDialogBackdropClose — gesture-aware backdrop dismissal for native
|
|
3
|
+
* `<dialog>` modals (#446, finding F14).
|
|
4
|
+
*
|
|
5
|
+
* The naive backdrop check tests only the *click* coordinates against the
|
|
6
|
+
* dialog rect: `if (clientX < rect.left || ...) dialog.close()`. That misfires
|
|
7
|
+
* on a text-selection drag — when the user presses inside a selectable region
|
|
8
|
+
* (the export JSON block, the import textarea, the apply preview) and releases
|
|
9
|
+
* on the backdrop, Chrome synthesizes the `click` on the common ancestor (the
|
|
10
|
+
* `<dialog>` itself) using the mouseup coordinates, which land outside the rect.
|
|
11
|
+
* The modal then closes and the user's unsaved input (e.g. pasted JSON) is lost.
|
|
12
|
+
*
|
|
13
|
+
* The fix tracks where the gesture STARTED. A backdrop dismissal fires only when
|
|
14
|
+
* BOTH the mousedown and the click landed outside the dialog's content rect, so
|
|
15
|
+
* a drag that began inside the dialog never dismisses it.
|
|
16
|
+
*
|
|
17
|
+
* This is a hook so the mousedown-origin ref is per-modal-instance; the returned
|
|
18
|
+
* handlers are spread onto the `<dialog>` element.
|
|
19
|
+
*/
|
|
20
|
+
import type { JSX } from 'preact';
|
|
21
|
+
export interface DialogBackdropHandlers {
|
|
22
|
+
onMouseDown: (e: JSX.TargetedMouseEvent<HTMLDialogElement>) => void;
|
|
23
|
+
onClick: (e: JSX.TargetedMouseEvent<HTMLDialogElement>) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @param dialogRef ref to the `<dialog>` element.
|
|
27
|
+
* @param onBackdrop invoked for a genuine backdrop dismissal (a press+release
|
|
28
|
+
* that both land outside the dialog's content rect).
|
|
29
|
+
*/
|
|
30
|
+
export declare function useDialogBackdropClose(dialogRef: {
|
|
31
|
+
current: HTMLDialogElement | null;
|
|
32
|
+
}, onBackdrop: () => void): DialogBackdropHandlers;
|
|
@@ -83,4 +83,3 @@ export declare function buildElementPath(el: Element): ElementPathResult;
|
|
|
83
83
|
export declare function formatElementPath(result: ElementPathResult): string;
|
|
84
84
|
/** Convenience: build + format in one call. */
|
|
85
85
|
export declare function buildElementPathString(el: Element): string;
|
|
86
|
-
//# sourceMappingURL=build-element-path.d.ts.map
|
|
@@ -18,4 +18,3 @@ import type { PanelConfig } from '../config/panel-config';
|
|
|
18
18
|
export declare function loadElementPathEnabled(cfg?: PanelConfig): boolean;
|
|
19
19
|
/** Persist the enabled flag to localStorage. Degrades silently when storage is unavailable. */
|
|
20
20
|
export declare function saveElementPathEnabled(enabled: boolean, cfg?: PanelConfig): void;
|
|
21
|
-
//# sourceMappingURL=element-path-state.d.ts.map
|
|
@@ -12,4 +12,3 @@ export type { ElementPathContextValue } from './element-path-context';
|
|
|
12
12
|
export { buildElementPath, buildElementPathString, formatElementPath, buildUniqueSelector, buildBreadcrumb, } from './build-element-path';
|
|
13
13
|
export type { ElementPathResult } from './build-element-path';
|
|
14
14
|
export { loadElementPathEnabled, saveElementPathEnabled } from './element-path-state';
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/export-modal.d.ts
CHANGED