@takazudo/zdtp 0.3.3 → 0.4.1
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 +24 -0
- package/dist/apply/build-apply-overrides.d.ts.map +1 -1
- package/dist/components/palette-chart/index.d.ts +3 -0
- package/dist/components/palette-chart/index.d.ts.map +1 -0
- package/dist/components/palette-chart/palette-chart.d.ts +75 -0
- package/dist/components/palette-chart/palette-chart.d.ts.map +1 -0
- package/dist/index.js +3169 -2264
- package/dist/panel.d.ts.map +1 -1
- package/dist/tabs/palette/palette-check-view.d.ts +22 -0
- package/dist/tabs/palette/palette-check-view.d.ts.map +1 -0
- package/dist/tabs/palette/palette-edit-view.d.ts +56 -0
- package/dist/tabs/palette/palette-edit-view.d.ts.map +1 -0
- package/dist/tabs/palette/palette-readout.d.ts +23 -0
- package/dist/tabs/palette/palette-readout.d.ts.map +1 -0
- package/dist/tabs/palette/palette-tab.d.ts +37 -0
- package/dist/tabs/palette/palette-tab.d.ts.map +1 -0
- package/dist/utils/palette-curve.d.ts +62 -0
- package/dist/utils/palette-curve.d.ts.map +1 -0
- package/dist/utils/wcag-contrast.d.ts +32 -0
- package/dist/utils/wcag-contrast.d.ts.map +1 -0
- package/dist/zdtp.css +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Palette tab no longer renders unstyled for self-injection consumers.** The 0.4.0 palette-tab CSS (`palette-chart` / `palette-edit` / `palette-readout`) reached `dist/zdtp.css` but was missing from the stylesheet the panel self-injects at runtime, so consumers using `import('@takazudo/zdtp')` + `configurePanel(...)` without importing `@takazudo/zdtp/styles` saw collapsed swatch bars and a missing curve-editor canvas. The two palette stylesheets are now `@import`ed into the single `panel.css` aggregate (matching `color-picker.css`) so both CSS delivery paths stay in sync, guarded by a new static `Invariant G` test. ([#413](https://github.com/Takazudo/zudo-design-token-panel/issues/413))
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- **Palette tab — an OKLCH palette generator & checker built into the panel.** A new reserved `palette` tab (joining `color` / `font` / `spacing` / `size`) lets a host define grouped color scales as `{ kind: "color", format: "oklch" }` tier items (`--palette-{group}-{n}`) and edit/verify them in-panel with no lossy hex round-trip. Two modes:
|
|
14
|
+
- **Edit mode** — a grouped step grid plus a `PrismChart` OKLCH L/C/H curve editor; dragging a curve re-derives every step in the group and commits the whole group in one batched write on pointer-up. ([#390](https://github.com/Takazudo/zudo-design-token-panel/issues/390), [#393](https://github.com/Takazudo/zudo-design-token-panel/issues/393), [#395](https://github.com/Takazudo/zudo-design-token-panel/issues/395))
|
|
15
|
+
- **Check mode** — a WCAG contrast-checker view over the live palette. ([#394](https://github.com/Takazudo/zudo-design-token-panel/issues/394))
|
|
16
|
+
- Backed by new OKLCH curve math + WCAG contrast helpers, and wired through the generic-tab apply path (`buildApplyOverrides` emits `state.tabs[*]`) so palette overrides apply, persist, and round-trip through Export/Load. ([#391](https://github.com/Takazudo/zudo-design-token-panel/issues/391), [#392](https://github.com/Takazudo/zudo-design-token-panel/issues/392))
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Palette flat-mode tier ids, persist-safe hue handling, and serialize arity (post-codex-review hardening). (f9c38f9)
|
|
21
|
+
|
|
22
|
+
### Other Changes
|
|
23
|
+
|
|
24
|
+
- Integration + serde + browser-confirm test coverage for the palette tab. ([#396](https://github.com/Takazudo/zudo-design-token-panel/issues/396))
|
|
25
|
+
- Add a grouped palette tab recipe + reference docs (EN + JA). ([#397](https://github.com/Takazudo/zudo-design-token-panel/issues/397))
|
|
26
|
+
|
|
3
27
|
## 0.3.3
|
|
4
28
|
|
|
5
29
|
### Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-apply-overrides.d.ts","sourceRoot":"","sources":["../../src/apply/build-apply-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,aAAa,EAAE,eAAe,GAAG,SAAS,EAC1C,OAAO,GAAE,kBAA8C,EACvD,IAAI,GAAE,SAAS,SAAS,EAA0B,GACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"build-apply-overrides.d.ts","sourceRoot":"","sources":["../../src/apply/build-apply-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,aAAa,EAAE,eAAe,GAAG,SAAS,EAC1C,OAAO,GAAE,kBAA8C,EACvD,IAAI,GAAE,SAAS,SAAS,EAA0B,GACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8ExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/palette-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,OAAO,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import { type Channel } from '../../utils/palette-curve';
|
|
3
|
+
import { type Oklcha } from '../../utils/color-oklch';
|
|
4
|
+
/**
|
|
5
|
+
* PaletteChart — controlled, presentational OKLCH L/C/H curve editor.
|
|
6
|
+
*
|
|
7
|
+
* Ported from pgen's PrismChart (OKHsl H/S/L) to zdtp's OKLCH L/C/H space.
|
|
8
|
+
* Composition:
|
|
9
|
+
* • Background = N vertical color bands, one per palette color. Band `i` is
|
|
10
|
+
* painted `oklchaToHex(colors[i])` and spans the FULL chart height. The
|
|
11
|
+
* selected band renders at full opacity; the rest are dimmed.
|
|
12
|
+
* • One overlaid draggable curve per VISIBLE channel — L, C, H — EACH IN ITS
|
|
13
|
+
* OWN SVG with its OWN Y-domain (L 0–100, C 0–MAX_OKLCH_CHROMA, H 0–360)
|
|
14
|
+
* mapped to the SAME pixel height. The vertical bands (x = step) are the
|
|
15
|
+
* only shared reference; the three channels deliberately do NOT share one
|
|
16
|
+
* numeric Y axis (Prism's key trick).
|
|
17
|
+
* • N nodes per curve at x = stepIndex (centered over band `i`), y = inverted
|
|
18
|
+
* channel value. Dragging a node vertically reports the new value.
|
|
19
|
+
*
|
|
20
|
+
* Ownership boundary: this chart is FULLY CONTROLLED. It owns no color state;
|
|
21
|
+
* `colors` is the single source of truth supplied by the parent (#395). It only
|
|
22
|
+
* CONSUMES `visibleChannels` (to draw/hide each curve) and reports intents via
|
|
23
|
+
* `onChange` / `onSelectIndex` / `onToggleChannel`. Commit boundaries for
|
|
24
|
+
* batched persistence are signalled by `onChangeStart` / `onChangeEnd`.
|
|
25
|
+
*
|
|
26
|
+
* Drag modes (Prism parity):
|
|
27
|
+
* • Per-node drag — grab a single node and move it vertically.
|
|
28
|
+
* • Whole-curve drag — grab the connecting LINE and translate EVERY node of
|
|
29
|
+
* that channel by one clamped delta, preserving the curve's relative shape
|
|
30
|
+
* and stopping when any node hits 0 or CHANNEL_MAX.
|
|
31
|
+
* Nodes WIN over line drag: the node hit circles render AFTER the hit-polyline
|
|
32
|
+
* within the same SVG, so a pointer-down on a node hits the circle (DOM order
|
|
33
|
+
* within an SVG determines paint/hit precedence).
|
|
34
|
+
*/
|
|
35
|
+
export type { Oklcha } from '../../utils/color-oklch';
|
|
36
|
+
export type { Channel } from '../../utils/palette-curve';
|
|
37
|
+
export interface PaletteChartProps {
|
|
38
|
+
/** Palette colors in OKLCH space. Band `i` = oklchaToHex(colors[i]). */
|
|
39
|
+
colors: Oklcha[];
|
|
40
|
+
/** Index of the currently selected color/step (highlighted band + node column). */
|
|
41
|
+
selectedIndex: number;
|
|
42
|
+
/** Which curves are drawn. Owned by the parent; chart only consumes. */
|
|
43
|
+
visibleChannels: {
|
|
44
|
+
l: boolean;
|
|
45
|
+
c: boolean;
|
|
46
|
+
h: boolean;
|
|
47
|
+
};
|
|
48
|
+
/** Fired when a node is dragged/keyed — value is clamped+quantized to the channel range. */
|
|
49
|
+
onChange: (index: number, channel: Channel, value: number) => void;
|
|
50
|
+
/** Fired when a node/band is picked. */
|
|
51
|
+
onSelectIndex: (i: number) => void;
|
|
52
|
+
/** Fired to request a channel visibility toggle. Chart does NOT own the state. */
|
|
53
|
+
onToggleChannel: (c: Channel) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Commit-boundary start. Fires ONCE at the beginning of an edit gesture:
|
|
56
|
+
* pointer-down on a node or curve line, or the first key of a keyboard edit.
|
|
57
|
+
* The parent (#395) opens a transient/preview write here.
|
|
58
|
+
*/
|
|
59
|
+
onChangeStart?: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Commit-boundary end. Fires ONCE when the edit gesture completes: pointer-up
|
|
62
|
+
* / pointer-cancel, or immediately after a keyboard edit. The parent batches
|
|
63
|
+
* the whole gesture into a single persist on this signal.
|
|
64
|
+
*/
|
|
65
|
+
onChangeEnd?: () => void;
|
|
66
|
+
}
|
|
67
|
+
declare function PaletteChartImpl({ colors, selectedIndex, visibleChannels, onChange, onSelectIndex, onChangeStart, onChangeEnd, }: PaletteChartProps): JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* Memoized so parent re-renders that don't change props don't re-walk every
|
|
70
|
+
* band/curve/node. The drag state lives in refs, so a controlled-value update
|
|
71
|
+
* from the parent flows back through props as the single source of truth.
|
|
72
|
+
*/
|
|
73
|
+
export declare const PaletteChart: typeof PaletteChartImpl;
|
|
74
|
+
export default PaletteChart;
|
|
75
|
+
//# sourceMappingURL=palette-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette-chart.d.ts","sourceRoot":"","sources":["../../../src/components/palette-chart/palette-chart.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAKL,KAAK,OAAO,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,YAAY,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAsDzD,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,mFAAmF;IACnF,aAAa,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,eAAe,EAAE;QAAE,CAAC,EAAE,OAAO,CAAC;QAAC,CAAC,EAAE,OAAO,CAAC;QAAC,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACxD,4FAA4F;IAC5F,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,wCAAwC;IACxC,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,kFAAkF;IAClF,eAAe,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAsCD,iBAAS,gBAAgB,CAAC,EACxB,MAAM,EACN,aAAa,EACb,eAAe,EACf,QAAQ,EACR,aAAa,EAIb,aAAa,EACb,WAAW,GACZ,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAgYjC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD,eAAe,YAAY,CAAC"}
|