@takazudo/zdtp 0.6.1 → 0.7.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.
@@ -6,13 +6,27 @@
6
6
  }
7
7
 
8
8
  .zdtp-dashboard {
9
+ --zdtp-dashboard-bg: light-dark(#f8fafc, #151b24);
10
+ --zdtp-dashboard-fg: light-dark(#182131, #edf2f7);
11
+ --zdtp-dashboard-muted: light-dark(#536174, #acb9cb);
12
+ --zdtp-dashboard-border: light-dark(#dce1e8, #465367);
13
+ --zdtp-dashboard-card-bg: light-dark(#fff, #202936);
14
+ --zdtp-dashboard-diag-bg: light-dark(#fff5e6, #3b2c18);
15
+ --zdtp-dashboard-diag-fg: light-dark(#704612, #ffdaa3);
16
+ --zdtp-dashboard-diag-accent: light-dark(#9d641a, #e4ad5c);
17
+ --zdtp-dashboard-focus: light-dark(#245caa, #6488b8);
18
+ --zdtp-dashboard-ruler-major: light-dark(#8290a3, #a3b2c7);
19
+ --zdtp-dashboard-ruler-minor: light-dark(#c4ccd7, #63748c);
20
+ --zdtp-dashboard-bar: light-dark(#526c92, #9dbbe6);
21
+ --zdtp-dashboard-sample-bg: light-dark(#fff, #39475b);
22
+ --zdtp-dashboard-sample-border: light-dark(#8290a3, #a3b2c7);
23
+ --zdtp-dashboard-transparent: light-dark(transparent, transparent);
9
24
  min-inline-size: 0;
10
25
  max-inline-size: 100%;
11
- border: 1px solid #dce1e8;
26
+ border: 1px solid var(--zdtp-dashboard-border);
12
27
  border-radius: 10px;
13
- background: #f8fafc;
14
- color: #182131;
15
- color-scheme: light;
28
+ background: var(--zdtp-dashboard-bg);
29
+ color: var(--zdtp-dashboard-fg);
16
30
  font: 400 14px/1.5 system-ui, sans-serif;
17
31
  letter-spacing: normal;
18
32
  text-align: start;
@@ -21,6 +35,10 @@
21
35
  overflow-wrap: anywhere;
22
36
  }
23
37
 
38
+ .zdtp-dashboard[data-chrome='light'] { color-scheme: light; }
39
+ .zdtp-dashboard[data-chrome='dark'] { color-scheme: dark; }
40
+ .zdtp-dashboard[data-chrome='host'] { color-scheme: inherit; }
41
+
24
42
  .zdtp-dashboard :where(div, span) {
25
43
  min-inline-size: 0;
26
44
  margin: 0;
@@ -37,7 +55,7 @@
37
55
  display: grid;
38
56
  gap: 8px;
39
57
  padding: 20px;
40
- border-block-end: 1px solid #dce1e8;
58
+ border-block-end: 1px solid var(--zdtp-dashboard-border);
41
59
  }
42
60
 
43
61
  .zdtp-dashboard__title {
@@ -51,12 +69,12 @@
51
69
  flex-wrap: wrap;
52
70
  align-items: baseline;
53
71
  gap: 4px 16px;
54
- color: #536174;
72
+ color: var(--zdtp-dashboard-muted);
55
73
  font-size: 12px;
56
74
  }
57
75
 
58
76
  .zdtp-dashboard__count {
59
- color: #182131;
77
+ color: var(--zdtp-dashboard-fg);
60
78
  font-weight: 600;
61
79
  }
62
80
 
@@ -77,7 +95,7 @@
77
95
  align-items: baseline;
78
96
  gap: 4px 12px;
79
97
  padding-block-end: 8px;
80
- border-block-end: 1px solid #dce1e8;
98
+ border-block-end: 1px solid var(--zdtp-dashboard-border);
81
99
  }
82
100
 
83
101
  .zdtp-dashboard__tab-title {
@@ -86,7 +104,7 @@
86
104
  }
87
105
 
88
106
  .zdtp-dashboard__tab-count {
89
- color: #536174;
107
+ color: var(--zdtp-dashboard-muted);
90
108
  font-size: 12px;
91
109
  }
92
110
 
@@ -108,10 +126,10 @@
108
126
  .zdtp-dashboard__token {
109
127
  display: flex;
110
128
  flex-direction: column;
111
- border: 1px solid #dce1e8;
129
+ border: 1px solid var(--zdtp-dashboard-border);
112
130
  border-radius: 6px;
113
- background: #fff;
114
- color: #182131;
131
+ background: var(--zdtp-dashboard-card-bg);
132
+ color: var(--zdtp-dashboard-fg);
115
133
  }
116
134
 
117
135
  .zdtp-dashboard__token-content {
@@ -135,37 +153,46 @@
135
153
 
136
154
  .zdtp-dashboard__variable,
137
155
  .zdtp-dashboard__reference {
138
- color: #536174;
156
+ color: var(--zdtp-dashboard-muted);
139
157
  }
140
158
 
141
159
  .zdtp-dashboard__value {
142
160
  padding-block-start: 5px;
143
- color: #182131;
161
+ color: var(--zdtp-dashboard-fg);
144
162
  }
145
163
 
146
164
  .zdtp-dashboard__diagnostic {
147
165
  margin-block-start: 3px;
148
166
  padding: 8px;
149
- border-inline-start: 2px solid #9d641a;
150
- background: #fff5e6;
151
- color: #704612;
167
+ border-inline-start: 2px solid var(--zdtp-dashboard-diag-accent);
168
+ background: var(--zdtp-dashboard-diag-bg);
169
+ color: var(--zdtp-dashboard-diag-fg);
152
170
  font-size: 12px;
153
171
  }
154
172
 
155
173
  .zdtp-dashboard__preview {
156
174
  display: flex;
157
- align-items: center;
158
- padding: 16px;
159
175
  block-size: 88px;
160
- border-block-end: 1px solid #dce1e8;
176
+ border-block-end: 1px solid var(--zdtp-dashboard-border);
161
177
  border-start-start-radius: 5px;
162
178
  border-start-end-radius: 5px;
179
+ overflow: hidden;
180
+ }
181
+
182
+ /* The inner well owns specimen paint and mode; borders and scrolling stay outside. */
183
+ .zdtp-dashboard__preview > .zdtp-dashboard__specimen {
184
+ display: flex;
185
+ align-items: center;
186
+ flex: 1;
187
+ padding: 16px;
188
+ }
189
+
190
+ :where(.zdtp-dashboard[data-mode='light']) .zdtp-dashboard__preview > .zdtp-dashboard__specimen {
163
191
  background: #eef1f5;
164
192
  color: #182131;
165
- overflow: hidden;
166
193
  }
167
194
 
168
- .zdtp-dashboard[data-mode='dark'] .zdtp-dashboard__preview {
195
+ .zdtp-dashboard[data-mode='dark'] .zdtp-dashboard__preview > .zdtp-dashboard__specimen {
169
196
  background: #222936;
170
197
  color: #f1f5f9;
171
198
  }
@@ -176,12 +203,15 @@
176
203
  max-inline-size: 100%;
177
204
  }
178
205
 
179
- .zdtp-dashboard__preview--color {
206
+ .zdtp-dashboard__preview--color > .zdtp-dashboard__specimen {
180
207
  padding: 0;
208
+ }
209
+
210
+ :where(.zdtp-dashboard[data-mode='light']) .zdtp-dashboard__preview--color > .zdtp-dashboard__specimen {
181
211
  background: repeating-conic-gradient(#e2e6eb 0% 25%, #fff 0% 50%) 0 / 16px 16px;
182
212
  }
183
213
 
184
- .zdtp-dashboard[data-mode='dark'] .zdtp-dashboard__preview--color {
214
+ .zdtp-dashboard[data-mode='dark'] .zdtp-dashboard__preview--color > .zdtp-dashboard__specimen {
185
215
  background: repeating-conic-gradient(#3e4652 0% 25%, #252c37 0% 50%) 0 / 16px 16px;
186
216
  }
187
217
 
@@ -192,15 +222,14 @@
192
222
 
193
223
  .zdtp-dashboard__sample--bar {
194
224
  block-size: 16px;
195
- background: currentColor;
196
225
  }
197
226
 
198
227
  .zdtp-dashboard__sample--radius,
199
228
  .zdtp-dashboard__sample--shadow {
200
229
  inline-size: 64px;
201
230
  block-size: 48px;
202
- background: #fff;
203
- border: 1px solid #8290a3;
231
+ background: var(--zdtp-dashboard-sample-bg);
232
+ border: 1px solid var(--zdtp-dashboard-sample-border);
204
233
  }
205
234
 
206
235
  .zdtp-dashboard__sample--family,
@@ -214,7 +243,7 @@
214
243
  }
215
244
 
216
245
  .zdtp-dashboard__empty {
217
- color: #536174;
246
+ color: var(--zdtp-dashboard-muted);
218
247
  }
219
248
 
220
249
  /* Wide rows use their embedding width, including narrow documentation columns. */
@@ -232,13 +261,14 @@
232
261
  overscroll-behavior-inline: contain;
233
262
  }
234
263
  .zdtp-dashboard__scroll:focus-visible {
235
- outline: 2px solid #245caa;
236
- outline-offset: -2px;
264
+ outline: 2px solid var(--zdtp-dashboard-focus);
265
+ /* Paint outside the mode-scoped well, against surrounding chrome. */
266
+ outline-offset: 0;
237
267
  }
238
268
  .zdtp-dashboard__ruler-wrap { padding: 12px; }
239
269
  .zdtp-dashboard__ruler-caption,
240
270
  .zdtp-dashboard__preview-unavailable {
241
- color: #536174;
271
+ color: var(--zdtp-dashboard-muted);
242
272
  font-size: 12px;
243
273
  padding: 12px;
244
274
  }
@@ -248,8 +278,8 @@
248
278
  block-size: 64px;
249
279
  padding-block-start: 36px;
250
280
  background:
251
- repeating-linear-gradient(to right, #8290a3 0 1px, transparent 1px 64px) left 24px / 100% 12px no-repeat,
252
- repeating-linear-gradient(to right, #c4ccd7 0 1px, transparent 1px 8px) left 30px / 100% 6px no-repeat;
281
+ repeating-linear-gradient(to right, var(--zdtp-dashboard-ruler-major) 0 1px, var(--zdtp-dashboard-transparent) 1px 64px) left 24px / 100% 12px no-repeat,
282
+ repeating-linear-gradient(to right, var(--zdtp-dashboard-ruler-minor) 0 1px, var(--zdtp-dashboard-transparent) 1px 8px) left 30px / 100% 6px no-repeat;
253
283
  }
254
284
  .zdtp-dashboard__ruler-origin { position: absolute; inset-block-start: 0; inset-inline-start: 0; font-size: 12px; }
255
285
  .zdtp-dashboard__sample--bar {
@@ -257,7 +287,7 @@
257
287
  min-inline-size: 0;
258
288
  border: 0;
259
289
  padding: 0;
260
- background: #526c92;
290
+ background: var(--zdtp-dashboard-bar);
261
291
  }
262
292
  .zdtp-dashboard__palette {
263
293
  display: flex;
@@ -278,11 +308,15 @@
278
308
  .zdtp-dashboard__preview--typography {
279
309
  display: block;
280
310
  block-size: auto;
281
- padding: 20px;
282
311
  border: 0;
283
312
  border-radius: 0;
284
313
  }
285
- .zdtp-dashboard__preview--typography > .zdtp-dashboard__sample {
314
+ .zdtp-dashboard__preview--typography > .zdtp-dashboard__specimen {
315
+ display: block;
316
+ padding: 20px;
317
+ min-block-size: 100%;
318
+ }
319
+ .zdtp-dashboard__preview--typography > .zdtp-dashboard__specimen > .zdtp-dashboard__sample {
286
320
  font: 400 18px/1.6 system-ui, sans-serif;
287
321
  letter-spacing: normal;
288
322
  white-space: pre-wrap;
@@ -1,12 +1,16 @@
1
1
  import type { JSX } from 'preact';
2
2
  import type { TabConfig, TierConfig } from "../tokens/tier-model.js";
3
- import type { DashboardMode } from "./types.js";
3
+ import type { DashboardChrome, DashboardMode } from "./types.js";
4
4
  /** Visual samples are independent from the panel's editor kind. */
5
5
  export type DashboardPreviewKind = NonNullable<TierConfig['preview']> | 'color' | 'shadow' | 'text';
6
6
  export interface TokenDashboardProps {
7
7
  tabs: readonly TabConfig[];
8
8
  /** Selects declared per-mode defaults. Does not read the host or panel mode. */
9
9
  mode?: DashboardMode;
10
+ /** Selects chrome appearance (shell, cards, labels, borders, diagnostics and
11
+ * focus/scroll affordances), independently of mode's declared defaults.
12
+ * 'host' inherits the host's effective color-scheme. Defaults to 'light'. */
13
+ chrome?: DashboardChrome;
10
14
  title?: string;
11
15
  /** Static multiline typography specimen. Empty strings are preserved. */
12
16
  previewText?: string;
@@ -20,4 +24,4 @@ export interface TokenDashboardProps {
20
24
  * server renderer without hydration, browser globals, or panel configuration.
21
25
  * Include @takazudo/zdtp/dashboard/styles.css through the host's CSS pipeline.
22
26
  */
23
- export declare function TokenDashboard({ tabs, mode, title, id, previewOverrides, previewText, }: TokenDashboardProps): JSX.Element;
27
+ export declare function TokenDashboard({ tabs, mode, chrome, title, id, previewOverrides, previewText, }: TokenDashboardProps): JSX.Element;
@@ -1,6 +1,8 @@
1
1
  import type { TierConfig, TierValueKind } from "../tokens/tier-model.js";
2
2
  /** Internal, render-independent description of declared token defaults. */
3
3
  export type DashboardMode = 'light' | 'dark';
4
+ /** Appearance of the dashboard chrome, independent of declared token mode. */
5
+ export type DashboardChrome = 'light' | 'dark' | 'host';
4
6
  export interface DashboardDiagnostic {
5
7
  code: string;
6
8
  severity: 'warning' | 'error';
@@ -1,6 +1,6 @@
1
1
  import { jsx as y, jsxs as K, Fragment as kt } from "preact/jsx-runtime";
2
2
  import { useEffect as P, useState as Y, useRef as O, useMemo as J, useCallback as X } from "preact/hooks";
3
- import { b as ft, p as wt, u as ht, a as Ne, A as bt, Z as gt } from "./index-DWs1XPfy.js";
3
+ import { b as ft, p as wt, u as ht, a as Ne, A as bt, Z as gt } from "./index-CUWkR-Gb.js";
4
4
  import { g as vt, m as j } from "./panel-config-Crn5QJGy.js";
5
5
  const xt = (e, o) => {
6
6
  const t = new Array(e.length + o.length);