@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Renamed — npm package is now `@takazudo/zdtp`
|
|
6
|
+
|
|
7
|
+
- **Package name** changed from `@takazudo/zudo-design-token-panel` to
|
|
8
|
+
`@takazudo/zdtp`. Update imports accordingly
|
|
9
|
+
(`import { configurePanel } from '@takazudo/zdtp'`,
|
|
10
|
+
`import '@takazudo/zdtp/styles'`, `@takazudo/zdtp/astro`, etc.).
|
|
11
|
+
- **CLI bin** renamed from `design-token-panel-server` to `zdtp-server`.
|
|
12
|
+
- First public prerelease is published to npm under the `next` dist-tag; install
|
|
13
|
+
with `pnpm add @takazudo/zdtp@next preact`.
|
|
14
|
+
|
|
15
|
+
### Fixed (panel renders unstyled without a consumer CSS import — [#219](https://github.com/Takazudo/zudo-design-token-panel/issues/219))
|
|
16
|
+
|
|
17
|
+
- **Self-injected stylesheet** — the panel now injects its own bundled CSS as a
|
|
18
|
+
`<style>` element on first mount (`ensurePanelStyles()` in `src/index.tsx`).
|
|
19
|
+
Previously the panel painted unstyled unless the consumer manually added
|
|
20
|
+
`import '@takazudo/zdtp/styles'` to its static module
|
|
21
|
+
graph — Vite library mode strips the package-internal CSS side-effect import
|
|
22
|
+
from `dist/index.js`, so the emitted JS never loaded its own CSS. The CSS is
|
|
23
|
+
now also imported via `?inline` (a string constant that survives library-mode
|
|
24
|
+
bundling) and injected at runtime. Because injection happens in
|
|
25
|
+
`ensureMounted()`, the CSS loads exactly when the panel first opens — no eager
|
|
26
|
+
cost on pages where the panel is never used. The `./styles` / `./styles.css`
|
|
27
|
+
exports still resolve (the standalone `dist/zdtp.css` is
|
|
28
|
+
still emitted) and remain valid but optional; the install doc's "Don't skip
|
|
29
|
+
the styles import" warning is downgraded accordingly. Public API unchanged.
|
|
30
|
+
|
|
31
|
+
### Fixed (panel-singleton & first-toggle bugfixes — [#108](https://github.com/Takazudo/zudo-design-token-panel/issues/108), root PR [#113](https://github.com/Takazudo/zudo-design-token-panel/pull/113))
|
|
32
|
+
|
|
33
|
+
- **Cross-instance singleton sharing** — configuration singletons (`configuredConfig`,
|
|
34
|
+
post-configure hooks) are now stored on `globalThis[Symbol.for('@takazudo/zudo-design-token-panel:singleton')]`
|
|
35
|
+
instead of module-scope variables. When a bundler produces two separate module instances of
|
|
36
|
+
`panel-config.ts` (e.g. Vite chunk-dedup in Astro consumers), both instances now share the same
|
|
37
|
+
slot, so `configurePanel()` writes and `getPanelConfig()` reads from the same object regardless
|
|
38
|
+
of which module instance each call landed in. Public API is bit-identical.
|
|
39
|
+
([#109](https://github.com/Takazudo/zudo-design-token-panel/issues/109))
|
|
40
|
+
|
|
41
|
+
- **Deferred reapply via post-configure hooks** — `reapplyPersistedOverrides()` and
|
|
42
|
+
`reapplyFromStorage()` are no longer called at module-init time. They are now registered as a
|
|
43
|
+
post-configure hook (via the new `registerPostConfigureHook` API) and fire only after
|
|
44
|
+
`configurePanel()` supplies the host's storage prefix. This prevents a default-prefix Preact
|
|
45
|
+
panel from mounting before the host's prefix is known, which was the root cause of the first
|
|
46
|
+
`toggleDesignPanel()` call being a no-op when legacy default-prefix keys existed in localStorage.
|
|
47
|
+
Late-registration semantics: if `configurePanel()` has already been called when a hook is
|
|
48
|
+
registered, the hook fires immediately. View-transition re-run safety is preserved via a stable
|
|
49
|
+
module-level hook constant. ([#111](https://github.com/Takazudo/zudo-design-token-panel/issues/111))
|
|
50
|
+
|
|
51
|
+
### Added (abstract-token-tiers epic — [#69](https://github.com/Takazudo/zudo-design-token-panel/issues/69), root PR [#91](https://github.com/Takazudo/zudo-design-token-panel/pull/91))
|
|
52
|
+
|
|
53
|
+
> **Note:** the package version is still `0.0.0` (pre-1.0, in active
|
|
54
|
+
> development). The changes below are unreleased additions tracked under the
|
|
55
|
+
> abstract-token-tiers epic.
|
|
56
|
+
|
|
57
|
+
- **Tier model types** (`TierValueKind`, `TierItem`, `TierConfig`, `TabConfig`,
|
|
58
|
+
`ColorClusterExtras`) in `src/tokens/tier-model.ts` — the data model that
|
|
59
|
+
backs the new tab-driven panel. Narrowing helpers (`isLengthKind`,
|
|
60
|
+
`isNumberKind`, `isSelectKind`, `isTextKind`, `isColorKind`) are exported.
|
|
61
|
+
- **`TierRefSelector` control** — when a `TierConfig` carries `referencesTier`,
|
|
62
|
+
each item's persisted value is the id of an item in the base tier, and the
|
|
63
|
+
apply pipeline emits `var(--target-cssvar)`.
|
|
64
|
+
- **`GenericTab` component** — data-driven tab renderer that handles any
|
|
65
|
+
host-coined tab id using kind-appropriate editors for `length`, `number`,
|
|
66
|
+
`select`, `text`, and `color` kinds.
|
|
67
|
+
- **`PanelConfig.tabs` (required)** — replaces the previous `tokens` and
|
|
68
|
+
`colorCluster` fields. Every visible tab, including the color tab, is
|
|
69
|
+
expressed as a `TabConfig` entry. The color tab (id `'color'`) carries
|
|
70
|
+
palette and semantic data as `TierItem` arrays inside its `tiers`, with
|
|
71
|
+
structural metadata in `colorExtras`.
|
|
72
|
+
- **Persist envelope v3** (`${storagePrefix}-state-v3`) — adds a `tabs` map
|
|
73
|
+
alongside the existing per-category slices so host-coined tabs can persist
|
|
74
|
+
their overrides without schema changes.
|
|
75
|
+
- **JSON serde v2** (`$schema: 'zudo-design-tokens/v2'`) — `tabs`-keyed
|
|
76
|
+
wrapper with cssVar-keyed leaves. `serialize()` always emits v2.
|
|
77
|
+
`deserialize()` accepts both v1 and v2 and normalises to `TweakState`.
|
|
78
|
+
Tier-2 ref values are stored as literal `var(--tier1-cssvar)` CSS strings.
|
|
79
|
+
- **Host-tabs validation** in `assertValidPanelConfig` — enforces tier-id
|
|
80
|
+
uniqueness, item-id uniqueness across tiers, cssVar format, kind consistency
|
|
81
|
+
within a tier, and `referencesTier` integrity (existence + kind
|
|
82
|
+
compatibility).
|
|
83
|
+
- **v2 → v3 storage migration** in `loadPersistedState` — lifts existing
|
|
84
|
+
per-category overrides into the v3 envelope on first load, then deletes the
|
|
85
|
+
v2 key.
|
|
86
|
+
- Export `TweakState` (type) and `emptyOverrides` from main entry (#49) — external SerDe layers (e.g. zudo-doc's `design-token-serde.ts`) can now construct a fully-populated `TweakState` without reaching into the test-only `./testing` sub-export.
|
|
87
|
+
- Framework-agnostic `setLifecycleAdapter(adapter)` API for non-Astro hosts (zfb, vite, etc.) (#50). The astro `astro:before-swap` / `astro:page-load` fallback is preserved when no adapter is registered, and is actively unbound when a host installs an adapter so the internal handlers do not double-fire. A partial adapter (one that registers only `onBeforeSwap` or only `onPageLoad`) keeps the astro fallback for the unregistered channel and emits a `console.warn` so authors notice the silent gap.
|
|
88
|
+
|
|
89
|
+
### Changed (abstract-token-tiers epic — [#69](https://github.com/Takazudo/zudo-design-token-panel/issues/69))
|
|
90
|
+
|
|
91
|
+
- **`PanelConfig.tokens` dropped** — replaced by `PanelConfig.tabs`. This is a
|
|
92
|
+
breaking change for any host that relied on the `tokens: TokenManifest` field.
|
|
93
|
+
Wire per-tab token arrays as `TierItem[]` inside a `TierConfig` inside a
|
|
94
|
+
`TabConfig` on `PanelConfig.tabs`.
|
|
95
|
+
- **`PanelConfig.colorCluster` / `secondaryColorCluster` dropped** — replaced
|
|
96
|
+
by a `TabConfig` with `id: 'color'` (or `'color-secondary'`) and a
|
|
97
|
+
`colorExtras` field. Palette and semantic tokens move into the tab's `tiers`
|
|
98
|
+
as `TierItem` entries; `colorExtras` carries the structural metadata
|
|
99
|
+
(`baseRoles`, `colorSchemes`, `panelSettings`, etc.).
|
|
100
|
+
- **`TokenManifest` / `TokenDef` types removed from the public surface** —
|
|
101
|
+
superseded by the `TabConfig` / `TierConfig` / `TierItem` model.
|
|
102
|
+
- **`ColorClusterConfig`** — previously accepted as a top-level `PanelConfig`
|
|
103
|
+
field. Now the equivalent data lives on `TabConfig.colorExtras`. The public
|
|
104
|
+
alias `ColorClusterConfig` continues to re-export `ColorClusterDataConfig`
|
|
105
|
+
for backward-compatible type imports.
|
|
106
|
+
- Make typography-id rename map configurable via `PanelConfig.legacyIdRenameMap` (#51). The default is an empty map (no renaming) so hosts whose manifest ids are stable (e.g. zudo-doc) are not corrupted. The historical zdtp-internal map is exported as `ZDTP_LEGACY_TYPOGRAPHY_RENAME_MAP` for opt-in callers; the bundled astro host adapter wires it in automatically so existing zdtp deployments keep their behaviour. Map shape is `Record<string, string | null>` — a `null` value preserves the historical "drop this id" semantic for callers whose original behaviour dropped certain ids without replacement.
|
|
107
|
+
- After the typography migration runs (rename or null-drop), `loadPersistedState` rewrites the normalized envelope back to `localStorage` so legacy ids and dropped entries do not survive on disk indefinitely as dead data, and a host that later removes the opt-in rename map does not regress every user back to non-applying overrides.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Takeshi Takatsudo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|