@takazudo/zdtp 0.2.2 → 0.3.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 +27 -0
- package/README.md +91 -9
- package/dist/apply-modal.d.ts +10 -0
- package/dist/apply-modal.d.ts.map +1 -1
- package/dist/astro/host-adapter.js +36 -38
- package/dist/astro/index.js +1 -1
- package/dist/config/color-schemes.d.ts +6 -1
- package/dist/config/color-schemes.d.ts.map +1 -1
- package/dist/config/panel-config.d.ts +247 -27
- package/dist/config/panel-config.d.ts.map +1 -1
- package/dist/export-modal.d.ts +9 -1
- package/dist/export-modal.d.ts.map +1 -1
- package/dist/import-modal.d.ts +9 -1
- package/dist/import-modal.d.ts.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2351 -2243
- package/dist/{panel-config-DP2_P7dD.js → panel-config-BOyB8Egg.js} +197 -118
- package/dist/panel.d.ts +17 -1
- package/dist/panel.d.ts.map +1 -1
- package/dist/state/persist.d.ts +12 -1
- package/dist/state/persist.d.ts.map +1 -1
- package/dist/state/tweak-state.d.ts +115 -33
- package/dist/state/tweak-state.d.ts.map +1 -1
- package/dist/testing.js +2 -2
- package/dist/tweak-state-DMwBHPow.js +730 -0
- package/dist/utils/design-token-serde.d.ts +26 -7
- package/dist/utils/design-token-serde.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/tweak-state-DSJa5csL.js +0 -624
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A(e, n) {
|
|
2
2
|
return e.paletteCssVarTemplate.replace("{n}", String(n));
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function m(e) {
|
|
5
5
|
const n = e.colorExtras;
|
|
6
6
|
if (!n) return;
|
|
7
7
|
const t = e.tiers.find(
|
|
8
|
-
(
|
|
8
|
+
(f) => !f.referencesTier && f.items.length > 0 && f.items[0].type.kind === "color"
|
|
9
9
|
);
|
|
10
10
|
if (!t)
|
|
11
11
|
return {
|
|
@@ -21,40 +21,40 @@ function y(e) {
|
|
|
21
21
|
colorSchemes: n.colorSchemes,
|
|
22
22
|
panelSettings: n.panelSettings
|
|
23
23
|
};
|
|
24
|
-
const r = t.items,
|
|
25
|
-
for (let
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
(
|
|
29
|
-
), s = {},
|
|
30
|
-
if (
|
|
31
|
-
for (const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
s[
|
|
24
|
+
const r = t.items, u = r.length, o = (r[0]?.cssVar ?? "--palette-{n}").replace(/\d+$/, "{n}"), i = /* @__PURE__ */ new Map();
|
|
25
|
+
for (let f = 0; f < r.length; f++)
|
|
26
|
+
i.set(r[f].id, f);
|
|
27
|
+
const a = e.tiers.find(
|
|
28
|
+
(f) => f.referencesTier === t.id
|
|
29
|
+
), s = {}, g = {};
|
|
30
|
+
if (a)
|
|
31
|
+
for (const f of a.items) {
|
|
32
|
+
g[f.id] = f.cssVar;
|
|
33
|
+
const w = i.get(f.default);
|
|
34
|
+
s[f.id] = w ?? 0;
|
|
35
35
|
}
|
|
36
36
|
return {
|
|
37
37
|
id: n.id,
|
|
38
38
|
label: n.label,
|
|
39
|
-
paletteSize:
|
|
39
|
+
paletteSize: u,
|
|
40
40
|
baseRoles: n.baseRoles,
|
|
41
41
|
paletteCssVarTemplate: o,
|
|
42
42
|
semanticDefaults: s,
|
|
43
|
-
semanticCssNames:
|
|
43
|
+
semanticCssNames: g,
|
|
44
44
|
baseDefaults: n.baseDefaults,
|
|
45
45
|
defaultShikiTheme: n.defaultShikiTheme,
|
|
46
46
|
colorSchemes: n.colorSchemes,
|
|
47
47
|
panelSettings: n.panelSettings
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function T(e) {
|
|
51
51
|
const n = e.find((t) => t.id === "color");
|
|
52
52
|
if (n)
|
|
53
|
-
return
|
|
53
|
+
return m(n);
|
|
54
54
|
}
|
|
55
55
|
function C(e) {
|
|
56
56
|
const n = e.find((t) => t.id === "color-secondary");
|
|
57
|
-
return n ?
|
|
57
|
+
return n ? m(n) ?? null : null;
|
|
58
58
|
}
|
|
59
59
|
function d(e, n) {
|
|
60
60
|
if (Object.is(e, n)) return !0;
|
|
@@ -68,13 +68,13 @@ function d(e, n) {
|
|
|
68
68
|
if (Array.isArray(n)) return !1;
|
|
69
69
|
const t = Object.keys(e), r = Object.keys(n);
|
|
70
70
|
if (t.length !== r.length) return !1;
|
|
71
|
-
const
|
|
71
|
+
const u = new Set(r);
|
|
72
72
|
for (const l of t)
|
|
73
|
-
if (!
|
|
73
|
+
if (!u.has(l) || !d(e[l], n[l]))
|
|
74
74
|
return !1;
|
|
75
75
|
return !0;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const h = {
|
|
78
78
|
storagePrefix: "zudo-design-token-panel",
|
|
79
79
|
consoleNamespace: "zudo",
|
|
80
80
|
modalClassPrefix: "zudo-design-token-panel-modal",
|
|
@@ -86,72 +86,142 @@ const w = {
|
|
|
86
86
|
// No bundled apply endpoint / routing — hosts wire their own.
|
|
87
87
|
applyEndpoint: void 0,
|
|
88
88
|
applyRouting: void 0
|
|
89
|
-
},
|
|
90
|
-
function
|
|
89
|
+
}, y = /* @__PURE__ */ Symbol.for("@takazudo/zdtp:singleton");
|
|
90
|
+
function c() {
|
|
91
91
|
const e = globalThis;
|
|
92
|
-
let n = e[
|
|
93
|
-
return n || (n = {
|
|
92
|
+
let n = e[y];
|
|
93
|
+
return n || (n = {
|
|
94
|
+
instances: /* @__PURE__ */ new Map(),
|
|
95
|
+
defaultPrefix: null,
|
|
96
|
+
pendingColorPresets: null,
|
|
97
|
+
pendingPostConfigureHooks: [],
|
|
98
|
+
lifecycleHooks: {}
|
|
99
|
+
}, e[y] = n), n;
|
|
100
|
+
}
|
|
101
|
+
function b(e) {
|
|
102
|
+
return {
|
|
103
|
+
instanceId: e,
|
|
104
|
+
open() {
|
|
105
|
+
c().lifecycleHooks.open?.(e);
|
|
106
|
+
},
|
|
107
|
+
close() {
|
|
108
|
+
c().lifecycleHooks.close?.(e);
|
|
109
|
+
},
|
|
110
|
+
toggle() {
|
|
111
|
+
c().lifecycleHooks.toggle?.(e);
|
|
112
|
+
},
|
|
113
|
+
destroy() {
|
|
114
|
+
c().lifecycleHooks.destroy?.(e);
|
|
115
|
+
const n = c();
|
|
116
|
+
if (n.instances.delete(e), n.defaultPrefix === e) {
|
|
117
|
+
const t = [...n.instances.keys()];
|
|
118
|
+
n.defaultPrefix = t.length > 0 ? t[t.length - 1] : null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
94
122
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
123
|
+
function S(e) {
|
|
124
|
+
c().lifecycleHooks = {
|
|
125
|
+
configured: e.configured,
|
|
126
|
+
open: e.open,
|
|
127
|
+
close: e.close,
|
|
128
|
+
toggle: e.toggle,
|
|
129
|
+
destroy: e.destroy
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function R(e) {
|
|
133
|
+
const n = c(), t = e.storagePrefix, r = n.instances.get(t);
|
|
134
|
+
if (r) {
|
|
135
|
+
if (d(r.config, e))
|
|
136
|
+
return n.defaultPrefix = t, r.handle;
|
|
99
137
|
throw new Error(
|
|
100
|
-
|
|
138
|
+
`[design-token-panel] configurePanel() was already called with different values for storagePrefix "${t}". Configuration is one-shot per prefix per page lifecycle. To re-configure this prefix, call handle.destroy() first, then configurePanel() again. (Use a distinct storagePrefix for a second panel instance.)`
|
|
101
139
|
);
|
|
102
140
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
141
|
+
const u = n.pendingColorPresets, l = u ? { ...e, colorPresets: u } : { ...e };
|
|
142
|
+
n.pendingColorPresets = null;
|
|
143
|
+
const o = n.instances.size === 0, i = o ? [...n.pendingPostConfigureHooks] : [];
|
|
144
|
+
o && (n.pendingPostConfigureHooks.length = 0);
|
|
145
|
+
const a = {
|
|
146
|
+
config: l,
|
|
147
|
+
pendingColorPresets: null,
|
|
148
|
+
postConfigureHooks: i,
|
|
149
|
+
handle: b(t)
|
|
150
|
+
};
|
|
151
|
+
n.instances.set(t, a), n.defaultPrefix = t;
|
|
152
|
+
for (const s of a.postConfigureHooks)
|
|
153
|
+
s();
|
|
154
|
+
return n.lifecycleHooks.configured?.(t), a.handle;
|
|
155
|
+
}
|
|
156
|
+
function p() {
|
|
157
|
+
const e = c();
|
|
158
|
+
return e.defaultPrefix === null ? null : e.instances.get(e.defaultPrefix) ?? null;
|
|
159
|
+
}
|
|
160
|
+
function _(e) {
|
|
161
|
+
const n = p();
|
|
162
|
+
if (n === null) {
|
|
163
|
+
const t = c();
|
|
164
|
+
if (t.pendingPostConfigureHooks.includes(e)) return;
|
|
165
|
+
t.pendingPostConfigureHooks.push(e);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
n.postConfigureHooks.includes(e) || (n.postConfigureHooks.push(e), e());
|
|
106
169
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
n.postConfigureHooks.includes(e) || (n.postConfigureHooks.push(e), n.configuredConfig !== null && e());
|
|
170
|
+
function P() {
|
|
171
|
+
return p()?.config ?? h;
|
|
110
172
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
173
|
+
function j(e) {
|
|
174
|
+
return c().instances.get(e)?.config ?? null;
|
|
113
175
|
}
|
|
114
|
-
function
|
|
115
|
-
const e =
|
|
116
|
-
e.
|
|
176
|
+
function H() {
|
|
177
|
+
const e = c();
|
|
178
|
+
e.instances.clear(), e.defaultPrefix = null, e.pendingColorPresets = null, e.pendingPostConfigureHooks.length = 0;
|
|
117
179
|
}
|
|
118
|
-
function
|
|
180
|
+
function V(e = P()) {
|
|
119
181
|
return C(e.tabs);
|
|
120
182
|
}
|
|
121
|
-
function
|
|
183
|
+
function O(e) {
|
|
122
184
|
return `${e.storagePrefix}-state-v2`;
|
|
123
185
|
}
|
|
124
|
-
function
|
|
186
|
+
function z(e) {
|
|
125
187
|
return `${e.storagePrefix}-state-v3`;
|
|
126
188
|
}
|
|
127
|
-
function
|
|
189
|
+
function K(e) {
|
|
128
190
|
return `${e.storagePrefix}-state`;
|
|
129
191
|
}
|
|
130
|
-
function
|
|
192
|
+
function N(e) {
|
|
131
193
|
return `${e.storagePrefix}-open`;
|
|
132
194
|
}
|
|
133
|
-
function
|
|
195
|
+
function I(e) {
|
|
134
196
|
return `${e.storagePrefix}-position`;
|
|
135
197
|
}
|
|
136
|
-
function
|
|
198
|
+
function F(e) {
|
|
137
199
|
return `${e.storagePrefix}-size`;
|
|
138
200
|
}
|
|
139
|
-
function
|
|
201
|
+
function D(e) {
|
|
140
202
|
return `${e.storagePrefix}-density`;
|
|
141
203
|
}
|
|
142
|
-
function
|
|
204
|
+
function M(e) {
|
|
143
205
|
return `${e.storagePrefix}:visible`;
|
|
144
206
|
}
|
|
145
|
-
function
|
|
207
|
+
function L(e) {
|
|
146
208
|
return `${e.storagePrefix}-root`;
|
|
147
209
|
}
|
|
148
|
-
|
|
210
|
+
const k = h.storagePrefix, $ = "toggle-design-token-panel";
|
|
211
|
+
function B(e) {
|
|
212
|
+
return e.storagePrefix === k ? $ : e.toggleEvent ?? `toggle-${e.storagePrefix}`;
|
|
213
|
+
}
|
|
214
|
+
const E = "__zdtp:open-state-changed";
|
|
215
|
+
function G(e) {
|
|
216
|
+
return `${E}:${e.storagePrefix}`;
|
|
217
|
+
}
|
|
218
|
+
function U(e, n) {
|
|
149
219
|
return `${e.modalClassPrefix}${n}`;
|
|
150
220
|
}
|
|
151
|
-
function
|
|
221
|
+
function q(e) {
|
|
152
222
|
return `${e.exportFilenameBase}.json`;
|
|
153
223
|
}
|
|
154
|
-
function
|
|
224
|
+
function J(e) {
|
|
155
225
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
156
226
|
throw new Error("[design-token-panel] PanelConfig must be a non-null object");
|
|
157
227
|
const n = e;
|
|
@@ -166,7 +236,11 @@ function F(e) {
|
|
|
166
236
|
throw new Error(
|
|
167
237
|
`[design-token-panel] PanelConfig.${t} must be a non-empty string (got ${typeof n[t]})`
|
|
168
238
|
);
|
|
169
|
-
if (
|
|
239
|
+
if (x(n.tabs), n.toggleEvent !== void 0 && (typeof n.toggleEvent != "string" || n.toggleEvent.length === 0))
|
|
240
|
+
throw new Error(
|
|
241
|
+
`[design-token-panel] PanelConfig.toggleEvent must be a non-empty string when set (got ${typeof n.toggleEvent})`
|
|
242
|
+
);
|
|
243
|
+
if (n.applyEndpoint !== void 0 && typeof n.applyEndpoint != "string")
|
|
170
244
|
throw new Error(
|
|
171
245
|
`[design-token-panel] PanelConfig.applyEndpoint must be a string when set (got ${typeof n.applyEndpoint})`
|
|
172
246
|
);
|
|
@@ -189,7 +263,7 @@ function F(e) {
|
|
|
189
263
|
);
|
|
190
264
|
}
|
|
191
265
|
}
|
|
192
|
-
function
|
|
266
|
+
function x(e) {
|
|
193
267
|
if (!Array.isArray(e))
|
|
194
268
|
throw new Error("[design-token-panel] PanelConfig.tabs must be an array");
|
|
195
269
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -203,10 +277,10 @@ function b(e) {
|
|
|
203
277
|
throw new Error(
|
|
204
278
|
`[design-token-panel] PanelConfig.tabs: duplicate tab id "${r.id}"`
|
|
205
279
|
);
|
|
206
|
-
n.add(r.id),
|
|
280
|
+
n.add(r.id), v(r.id, r);
|
|
207
281
|
}
|
|
208
282
|
}
|
|
209
|
-
function
|
|
283
|
+
function v(e, n) {
|
|
210
284
|
if (!Array.isArray(n.tiers))
|
|
211
285
|
throw new Error(
|
|
212
286
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers must be an array`
|
|
@@ -230,103 +304,108 @@ function P(e, n) {
|
|
|
230
304
|
throw new Error(
|
|
231
305
|
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${o.id}"].items must be an array`
|
|
232
306
|
);
|
|
233
|
-
let
|
|
234
|
-
for (const
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
239
|
-
if (typeof
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
else if (
|
|
307
|
+
let i;
|
|
308
|
+
for (const a of o.items) {
|
|
309
|
+
if (a === null || typeof a != "object" || Array.isArray(a)) continue;
|
|
310
|
+
const g = a.type;
|
|
311
|
+
if (g === null || typeof g != "object" || Array.isArray(g)) continue;
|
|
312
|
+
const f = g.kind;
|
|
313
|
+
if (typeof f == "string") {
|
|
314
|
+
if (i === void 0)
|
|
315
|
+
i = f;
|
|
316
|
+
else if (i !== f)
|
|
243
317
|
throw new Error(
|
|
244
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${o.id}"]: mixed item kinds — found "${
|
|
318
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${o.id}"]: mixed item kinds — found "${i}" and "${f}" in the same tier (all items must share the same kind)`
|
|
245
319
|
);
|
|
246
320
|
}
|
|
247
321
|
}
|
|
248
|
-
|
|
322
|
+
i !== void 0 && r.set(o.id, i);
|
|
249
323
|
}
|
|
250
|
-
const
|
|
324
|
+
const u = /* @__PURE__ */ new Set();
|
|
251
325
|
for (const l of n.tiers) {
|
|
252
|
-
const o = l,
|
|
253
|
-
for (const
|
|
254
|
-
if (
|
|
326
|
+
const o = l, i = o.id;
|
|
327
|
+
for (const a of o.items) {
|
|
328
|
+
if (a === null || typeof a != "object" || Array.isArray(a))
|
|
255
329
|
throw new Error(
|
|
256
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
330
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].items: each item must be a non-null object`
|
|
257
331
|
);
|
|
258
|
-
const s =
|
|
332
|
+
const s = a;
|
|
259
333
|
if (typeof s.id != "string" || s.id.length === 0)
|
|
260
334
|
throw new Error(
|
|
261
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
335
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].items: each item must have a non-empty string id`
|
|
262
336
|
);
|
|
263
|
-
if (
|
|
337
|
+
if (u.has(s.id))
|
|
264
338
|
throw new Error(
|
|
265
339
|
`[design-token-panel] PanelConfig.tabs["${e}"]: duplicate item id "${s.id}" (item ids must be unique across all tiers within a tab)`
|
|
266
340
|
);
|
|
267
|
-
if (
|
|
341
|
+
if (u.add(s.id), typeof s.cssVar != "string" || !s.cssVar.startsWith("--"))
|
|
268
342
|
throw new Error(
|
|
269
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
343
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].items["${s.id}"].cssVar must start with "--" (got ${JSON.stringify(s.cssVar)})`
|
|
270
344
|
);
|
|
271
345
|
if (s.cssVar.length <= 2)
|
|
272
346
|
throw new Error(
|
|
273
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
347
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].items["${s.id}"].cssVar must be non-empty after "--"`
|
|
274
348
|
);
|
|
275
349
|
}
|
|
276
350
|
}
|
|
277
351
|
for (const l of n.tiers) {
|
|
278
|
-
const o = l,
|
|
352
|
+
const o = l, i = o.id;
|
|
279
353
|
if (o.referencesTier !== void 0) {
|
|
280
354
|
if (typeof o.referencesTier != "string")
|
|
281
355
|
throw new Error(
|
|
282
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
356
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].referencesTier must be a string`
|
|
283
357
|
);
|
|
284
|
-
const
|
|
285
|
-
if (!t.has(
|
|
358
|
+
const a = o.referencesTier;
|
|
359
|
+
if (!t.has(a))
|
|
286
360
|
throw new Error(
|
|
287
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
361
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].referencesTier: tier "${a}" does not exist in this tab`
|
|
288
362
|
);
|
|
289
|
-
const s = r.get(
|
|
290
|
-
if (s !== void 0 &&
|
|
363
|
+
const s = r.get(i), g = r.get(a);
|
|
364
|
+
if (s !== void 0 && g !== void 0 && s !== "text" && s !== g)
|
|
291
365
|
throw new Error(
|
|
292
|
-
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${
|
|
366
|
+
`[design-token-panel] PanelConfig.tabs["${e}"].tiers["${i}"].referencesTier: referencing tier has kind "${s}" but referenced tier "${a}" has kind "${g}" (cross-kind reference is only allowed when the referencing tier has kind "text")`
|
|
293
367
|
);
|
|
294
368
|
}
|
|
295
369
|
}
|
|
296
370
|
}
|
|
297
|
-
function
|
|
371
|
+
function Y(e = P()) {
|
|
298
372
|
return e.applyRouting ?? {};
|
|
299
373
|
}
|
|
300
|
-
function
|
|
301
|
-
const n =
|
|
302
|
-
if (n
|
|
303
|
-
|
|
374
|
+
function W(e) {
|
|
375
|
+
const n = p();
|
|
376
|
+
if (n === null) {
|
|
377
|
+
c().pendingColorPresets = e;
|
|
304
378
|
return;
|
|
305
379
|
}
|
|
306
|
-
n.
|
|
380
|
+
n.config = { ...n.config, colorPresets: e };
|
|
307
381
|
}
|
|
308
382
|
export {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
383
|
+
$ as D,
|
|
384
|
+
H as _,
|
|
385
|
+
M as a,
|
|
386
|
+
O as b,
|
|
387
|
+
R as c,
|
|
388
|
+
z as d,
|
|
389
|
+
J as e,
|
|
390
|
+
N as f,
|
|
391
|
+
P as g,
|
|
392
|
+
I as h,
|
|
393
|
+
K as i,
|
|
394
|
+
T as j,
|
|
395
|
+
A as k,
|
|
396
|
+
F as l,
|
|
397
|
+
D as m,
|
|
398
|
+
q as n,
|
|
399
|
+
U as o,
|
|
325
400
|
d as p,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
401
|
+
Y as q,
|
|
402
|
+
V as r,
|
|
403
|
+
W as s,
|
|
404
|
+
m as t,
|
|
405
|
+
G as u,
|
|
406
|
+
S as v,
|
|
407
|
+
_ as w,
|
|
408
|
+
B as x,
|
|
409
|
+
L as y,
|
|
410
|
+
j as z
|
|
332
411
|
};
|
package/dist/panel.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { type PanelConfig } from './config/panel-config';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the panel shell.
|
|
4
|
+
*
|
|
5
|
+
* `instanceConfig` is the FULL registered config of the instance this mounted
|
|
6
|
+
* tree belongs to (issue #354). The adapter (`index.tsx`) passes it at
|
|
7
|
+
* `render(...)` time. The panel reads its OWN open key, visible key,
|
|
8
|
+
* per-instance open-state sync-event name, AND its OWN tabs from this config —
|
|
9
|
+
* so two panels on one page read/write distinct storage keys, listen on
|
|
10
|
+
* distinct sync events, and render distinct manifests, never cross-talking.
|
|
11
|
+
* Omitted (e.g. a direct test render) → the active/default instance, preserving
|
|
12
|
+
* the historical single-panel behaviour.
|
|
13
|
+
*/
|
|
14
|
+
interface DesignTokenTweakPanelProps {
|
|
15
|
+
instanceConfig?: PanelConfig;
|
|
16
|
+
}
|
|
17
|
+
export default function DesignTokenTweakPanel({ instanceConfig: instanceConfigProp, }?: DesignTokenTweakPanelProps): import("preact").JSX.Element;
|
|
2
18
|
export type { TweakState } from './state/tweak-state';
|
|
3
19
|
//# sourceMappingURL=panel.d.ts.map
|
package/dist/panel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../src/panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../src/panel.tsx"],"names":[],"mappings":"AAeA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAkG/B;;;;;;;;;;;GAWG;AACH,UAAU,0BAA0B;IAClC,cAAc,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,cAAc,EAAE,kBAAkB,GACnC,GAAE,0BAA+B,gCAguBjC;AAED,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/state/persist.d.ts
CHANGED
|
@@ -13,8 +13,19 @@
|
|
|
13
13
|
* In practice the panel passes Preact's `setState` from `useState`.
|
|
14
14
|
*/
|
|
15
15
|
import { type ColorTweakState, type TabOverrides, type TokenOverrides, type TweakState } from './tweak-state';
|
|
16
|
+
import type { PanelConfig } from '../config/panel-config';
|
|
16
17
|
type SetState<T> = (updater: (prev: T | null) => T | null) => void;
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* `usePersist` hook.
|
|
20
|
+
*
|
|
21
|
+
* Accepts an optional `cfg` — the panel instance config. When supplied its
|
|
22
|
+
* `applySink` (if any) routes every CSS-var write through the sink instead
|
|
23
|
+
* of `document.documentElement`, AND its `storagePrefix` scopes the persisted
|
|
24
|
+
* envelope to THIS instance's storage key (multi-instance, #357). Omitting
|
|
25
|
+
* `cfg` resolves the default instance via `getPanelConfig()` inside both
|
|
26
|
+
* `applyFullState` and `savePersistedState`, preserving the single-panel path.
|
|
27
|
+
*/
|
|
28
|
+
export declare function usePersist(setState: SetState<TweakState>, cfg?: PanelConfig): {
|
|
18
29
|
persist: (updater: (prev: TweakState) => TweakState) => void;
|
|
19
30
|
persistTab: (tabId: string, updater: (prev: TabOverrides) => TabOverrides) => void;
|
|
20
31
|
persistColor: (updater: (prev: ColorTweakState) => ColorTweakState) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../src/state/persist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../src/state/persist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;AAEnE;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,EAAE,WAAW;uBAE9D,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU;wBAuBlC,MAAM,WAAW,CAAC,IAAI,EAAE,YAAY,KAAK,YAAY;4BAiBnD,CAAC,IAAI,EAAE,eAAe,KAAK,eAAe;8BAO1C,CAAC,IAAI,EAAE,cAAc,KAAK,cAAc;iCAOxC,CAAC,IAAI,EAAE,cAAc,KAAK,cAAc;2BAAxC,CAAC,IAAI,EAAE,cAAc,KAAK,cAAc;2BAOxC,CAAC,IAAI,EAAE,cAAc,KAAK,cAAc;oCAOxC,CAAC,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,KAAK,UAAU,CAAC,eAAe,CAAC;gCAYlE,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS,KAAK,eAAe,GAAG,SAAS;EA6B/E;AAED,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAC7E,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,mBAAmB,CAAC,CAAC;AACnF,uEAAuE;AACvE,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,sBAAsB,CAAC,CAAC;AACzF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,kBAAkB,CAAC,CAAC"}
|