@nonoun/native-ui 0.2.10 → 0.4.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.
Files changed (79) hide show
  1. package/dist/components-lean.css +20 -941
  2. package/dist/components.css +20 -948
  3. package/dist/components.js +66 -498
  4. package/dist/core.js +121 -38
  5. package/dist/custom-elements.json +3971 -6744
  6. package/dist/foundation.css +5 -6
  7. package/dist/index.d.ts +0 -8
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/kernel.js +208 -208
  10. package/dist/native-ui-lean.css +25 -947
  11. package/dist/native-ui.css +25 -954
  12. package/dist/native-ui.js +4 -4
  13. package/dist/register-all.js +4 -4
  14. package/dist/traits/drag-controller.d.ts.map +1 -1
  15. package/dist/traits.js +3 -3
  16. package/dist/ui-icon.js +1 -1
  17. package/package.json +6 -9
  18. package/dist/components/ui-nav/index.d.ts +0 -6
  19. package/dist/components/ui-nav/index.d.ts.map +0 -1
  20. package/dist/components/ui-nav/ui-nav-element.d.ts +0 -20
  21. package/dist/components/ui-nav/ui-nav-element.d.ts.map +0 -1
  22. package/dist/components/ui-nav/ui-nav-group-element.d.ts +0 -24
  23. package/dist/components/ui-nav/ui-nav-group-element.d.ts.map +0 -1
  24. package/dist/components/ui-nav/ui-nav-group-header-element.d.ts +0 -7
  25. package/dist/components/ui-nav/ui-nav-group-header-element.d.ts.map +0 -1
  26. package/dist/components/ui-nav/ui-nav-item-element.d.ts +0 -23
  27. package/dist/components/ui-nav/ui-nav-item-element.d.ts.map +0 -1
  28. package/dist/components/ui-nav/ui-nav.d.ts +0 -2
  29. package/dist/components/ui-nav/ui-nav.d.ts.map +0 -1
  30. package/dist/containers/ui-layout-chat/index.d.ts +0 -3
  31. package/dist/containers/ui-layout-chat/index.d.ts.map +0 -1
  32. package/dist/containers/ui-layout-chat/ui-layout-chat-element.d.ts +0 -14
  33. package/dist/containers/ui-layout-chat/ui-layout-chat-element.d.ts.map +0 -1
  34. package/dist/containers/ui-layout-chat/ui-layout-chat.d.ts +0 -3
  35. package/dist/containers/ui-layout-chat/ui-layout-chat.d.ts.map +0 -1
  36. package/dist/containers/ui-layout-inspector/index.d.ts +0 -3
  37. package/dist/containers/ui-layout-inspector/index.d.ts.map +0 -1
  38. package/dist/containers/ui-layout-inspector/ui-layout-inspector-element.d.ts +0 -14
  39. package/dist/containers/ui-layout-inspector/ui-layout-inspector-element.d.ts.map +0 -1
  40. package/dist/containers/ui-layout-inspector/ui-layout-inspector.d.ts +0 -3
  41. package/dist/containers/ui-layout-inspector/ui-layout-inspector.d.ts.map +0 -1
  42. package/dist/containers/ui-layout-sidebar/index.d.ts +0 -4
  43. package/dist/containers/ui-layout-sidebar/index.d.ts.map +0 -1
  44. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-element.d.ts +0 -11
  45. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-element.d.ts.map +0 -1
  46. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-item-element.d.ts +0 -10
  47. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-item-element.d.ts.map +0 -1
  48. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-item.d.ts +0 -3
  49. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-item.d.ts.map +0 -1
  50. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar.d.ts +0 -4
  51. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar.d.ts.map +0 -1
  52. package/dist/inspector/build-inspector.d.ts +0 -8
  53. package/dist/inspector/build-inspector.d.ts.map +0 -1
  54. package/dist/inspector/index.d.ts +0 -10
  55. package/dist/inspector/index.d.ts.map +0 -1
  56. package/dist/inspector/native-tokens-color-swatch-element.d.ts +0 -15
  57. package/dist/inspector/native-tokens-color-swatch-element.d.ts.map +0 -1
  58. package/dist/inspector/native-tokens-color-swatch.d.ts +0 -3
  59. package/dist/inspector/native-tokens-color-swatch.d.ts.map +0 -1
  60. package/dist/inspector/native-tokens-colors-element.d.ts +0 -14
  61. package/dist/inspector/native-tokens-colors-element.d.ts.map +0 -1
  62. package/dist/inspector/native-tokens-colors.d.ts +0 -4
  63. package/dist/inspector/native-tokens-colors.d.ts.map +0 -1
  64. package/dist/inspector/native-tokens-inspector-element.d.ts +0 -15
  65. package/dist/inspector/native-tokens-inspector-element.d.ts.map +0 -1
  66. package/dist/inspector/native-tokens-inspector.d.ts +0 -3
  67. package/dist/inspector/native-tokens-inspector.d.ts.map +0 -1
  68. package/dist/inspector/native-tokens-themes-element.d.ts +0 -13
  69. package/dist/inspector/native-tokens-themes-element.d.ts.map +0 -1
  70. package/dist/inspector/native-tokens-themes.d.ts +0 -4
  71. package/dist/inspector/native-tokens-themes.d.ts.map +0 -1
  72. package/dist/inspector/native-tokens-variable-element.d.ts +0 -19
  73. package/dist/inspector/native-tokens-variable-element.d.ts.map +0 -1
  74. package/dist/inspector/native-tokens-variable.d.ts +0 -4
  75. package/dist/inspector/native-tokens-variable.d.ts.map +0 -1
  76. package/dist/inspector.css +0 -231
  77. package/dist/inspector.d.ts +0 -12
  78. package/dist/inspector.d.ts.map +0 -1
  79. package/dist/inspector.js +0 -609
package/dist/inspector.js DELETED
@@ -1,609 +0,0 @@
1
- import { A as e, E as t, It as n, Lt as r, ft as i, ht as a, pt as o, t as s } from "./components.js";
2
- import { G as c } from "./core.js";
3
- import { t as l } from "./ui-icon.js";
4
- var u = class extends r {
5
- static observedAttributes = ["data"];
6
- #e = null;
7
- #t = null;
8
- #n = null;
9
- attributeChangedCallback(e, t, n) {
10
- if (t !== n && e === "data" && n) {
11
- try {
12
- this.#e = JSON.parse(n);
13
- } catch {}
14
- this.#t && this.#a();
15
- }
16
- }
17
- setup() {
18
- super.setup();
19
- let e = this.getAttribute("data");
20
- if (e) try {
21
- this.#e = JSON.parse(e);
22
- } catch {}
23
- this.#a(), this.addEventListener("native-tokens-theme-change", this.#r);
24
- }
25
- teardown() {
26
- this.removeEventListener("native-tokens-theme-change", this.#r), this.innerHTML = "", this.#t = null, this.#n = null, super.teardown();
27
- }
28
- #r = () => {
29
- requestAnimationFrame(() => this.#i());
30
- };
31
- sync() {
32
- this.#i();
33
- }
34
- #i() {
35
- if (!this.#e || !this.#t || !this.#n) return;
36
- let e = getComputedStyle(document.documentElement).getPropertyValue(this.#e.token).trim();
37
- if (e) {
38
- this.#t.value = parseFloat(e);
39
- let t = this.#e.step ?? .01;
40
- this.#n.textContent = parseFloat(e).toFixed(t < .01 ? 3 : 2);
41
- }
42
- }
43
- #a() {
44
- if (!this.#e) return;
45
- let e = this.#e;
46
- this.innerHTML = "";
47
- let t = document.createElement("div");
48
- t.className = "native-tokens-variable-row";
49
- let n = document.createElement("label");
50
- n.className = "native-tokens-variable-label", n.textContent = e.name;
51
- let r = document.createElement("ui-range");
52
- r.setAttribute("min", String(e.min ?? 0)), r.setAttribute("max", String(e.max ?? 1)), r.setAttribute("step", String(e.step ?? .01)), r.setAttribute("size", "xs");
53
- let i = getComputedStyle(document.documentElement).getPropertyValue(e.token).trim(), a = i ? parseFloat(i) : e.value;
54
- r.setAttribute("value", String(a));
55
- let o = e.step ?? .01, s = document.createElement("span");
56
- s.className = "native-tokens-variable-value", s.textContent = a.toFixed(o < .01 ? 3 : 2), r.addEventListener("ui-input", ((t) => {
57
- let n = t.detail.value;
58
- document.documentElement.style.setProperty(e.token, String(n)), s.textContent = n.toFixed(o < .01 ? 3 : 2), this.dispatchEvent(new CustomEvent("native-tokens-change", {
59
- bubbles: !0,
60
- detail: {
61
- token: e.token,
62
- value: n
63
- }
64
- }));
65
- })), this.#t = r, this.#n = s, t.append(n, r, s), this.appendChild(t);
66
- }
67
- }, d = class extends r {
68
- static observedAttributes = ["data"];
69
- #e = [];
70
- attributeChangedCallback(e, t, n) {
71
- if (t !== n && e === "data" && n) {
72
- try {
73
- this.#e = JSON.parse(n);
74
- } catch {}
75
- this.isConnected && this.#n();
76
- }
77
- }
78
- setup() {
79
- super.setup();
80
- let e = this.getAttribute("data");
81
- if (e) try {
82
- this.#e = JSON.parse(e);
83
- } catch {}
84
- this.#n(), this.addEventListener("native-tokens-change", this.#t), this.addEventListener("native-tokens-theme-change", this.#t);
85
- }
86
- teardown() {
87
- this.removeEventListener("native-tokens-change", this.#t), this.removeEventListener("native-tokens-theme-change", this.#t), this.innerHTML = "", super.teardown();
88
- }
89
- #t = () => {
90
- requestAnimationFrame(() => this.#r());
91
- };
92
- refresh() {
93
- this.#r();
94
- }
95
- #n() {
96
- this.innerHTML = "";
97
- let e = document.createElement("div");
98
- e.className = "native-tokens-colors-strip";
99
- for (let t of this.#e) {
100
- let n = document.createElement("native-tokens-color-swatch");
101
- n.setAttribute("token", t.token), n.setAttribute("name", t.name), e.appendChild(n);
102
- }
103
- this.appendChild(e);
104
- }
105
- #r() {
106
- this.querySelectorAll("native-tokens-color-swatch").forEach((e) => e.refresh());
107
- }
108
- };
109
- /** Parse a computed `rgb(...)` / `rgba(...)` string into [r, g, b, a] (0–255, 0–1). */
110
- function f(e) {
111
- let t = e.match(/[\d.]+/g);
112
- return !t || t.length < 3 ? [
113
- 0,
114
- 0,
115
- 0,
116
- 1
117
- ] : [
118
- Number(t[0]),
119
- Number(t[1]),
120
- Number(t[2]),
121
- t[3] === void 0 ? 1 : Number(t[3])
122
- ];
123
- }
124
- /** Relative luminance (ITU-R BT.709). Returns true if light. */
125
- function p(e, t, n) {
126
- let r = [
127
- e,
128
- t,
129
- n
130
- ].map((e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4));
131
- return .2126 * r[0] + .7152 * r[1] + .0722 * r[2] > .4;
132
- }
133
- /** Convert 0–255 component to 2-digit hex. */
134
- function m(e) {
135
- return Math.round(e).toString(16).padStart(2, "0");
136
- }
137
- /** sRGB → linear. */
138
- function h(e) {
139
- return e /= 255, e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
140
- }
141
- /** sRGB (0–255) → OKLCH via OKLab. Returns [L (0–1), C, H (degrees)]. */
142
- function g(e, t, n) {
143
- let r = h(e), i = h(t), a = h(n), o = .4122214708 * r + .5363325363 * i + .0514459929 * a, s = .2119034982 * r + .6806995451 * i + .1073969566 * a, c = .0883024619 * r + .2817188376 * i + .6299787005 * a, l = Math.cbrt(o), u = Math.cbrt(s), d = Math.cbrt(c), f = .2104542553 * l + .793617785 * u - .0040720468 * d, p = 1.9779984951 * l - 2.428592205 * u + .4505937099 * d, m = .0259040371 * l + .7827717662 * u - .808675766 * d, g = Math.sqrt(p * p + m * m), _ = Math.atan2(m, p) * (180 / Math.PI);
144
- return _ < 0 && (_ += 360), [
145
- f,
146
- g,
147
- _
148
- ];
149
- }
150
- /** sRGB (0–255) → HSL. Returns [H (0–360), S (0–100), L (0–100)]. */
151
- function _(e, t, n) {
152
- e /= 255, t /= 255, n /= 255;
153
- let r = Math.max(e, t, n), i = Math.min(e, t, n), a = r - i, o = (r + i) / 2;
154
- if (a === 0) return [
155
- 0,
156
- 0,
157
- o * 100
158
- ];
159
- let s = a / (1 - Math.abs(2 * o - 1)), c = 0;
160
- return c = r === e ? ((t - n) / a + 6) % 6 : r === t ? (n - e) / a + 2 : (e - t) / a + 4, [
161
- c * 60,
162
- s * 100,
163
- o * 100
164
- ];
165
- }
166
- /** sRGB (0–255) → HSB/HSV. Returns [H (0–360), S (0–100), B (0–100)]. */
167
- function v(e, t, n) {
168
- e /= 255, t /= 255, n /= 255;
169
- let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = r * 100;
170
- if (r === 0) return [
171
- 0,
172
- 0,
173
- a
174
- ];
175
- let o = i / r * 100, s = 0;
176
- return i !== 0 && (s = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, s *= 60), [
177
- s,
178
- o,
179
- a
180
- ];
181
- }
182
- function y(e, t, n, r) {
183
- let [i, a, o] = g(e, t, n), s = `oklch(${(i * 100).toFixed(1)}% ${a.toFixed(4)} ${o.toFixed(1)})`;
184
- return r < 1 ? `oklch(${(i * 100).toFixed(1)}% ${a.toFixed(4)} ${o.toFixed(1)} / ${r.toFixed(2)})` : s;
185
- }
186
- function b(e, t, n, r) {
187
- let i = `#${m(e)}${m(t)}${m(n)}`;
188
- return r < 1 ? `${i}${m(Math.round(r * 255))}` : i;
189
- }
190
- function x(e, t, n, r) {
191
- return r < 1 ? `rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${r.toFixed(2)})` : `rgb(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)})`;
192
- }
193
- function S(e, t, n, r) {
194
- let [i, a, o] = _(e, t, n);
195
- return r < 1 ? `hsla(${i.toFixed(0)}, ${a.toFixed(1)}%, ${o.toFixed(1)}%, ${r.toFixed(2)})` : `hsl(${i.toFixed(0)}, ${a.toFixed(1)}%, ${o.toFixed(1)}%)`;
196
- }
197
- function C(e, t, n, r) {
198
- let [i, a, o] = v(e, t, n);
199
- return `hsb(${i.toFixed(0)}, ${a.toFixed(1)}%, ${o.toFixed(1)}%)`;
200
- }
201
- var w = [
202
- {
203
- label: "OKLCH",
204
- fn: y
205
- },
206
- {
207
- label: "HEX",
208
- fn: b
209
- },
210
- {
211
- label: "RGB",
212
- fn: x
213
- },
214
- {
215
- label: "HSL",
216
- fn: S
217
- },
218
- {
219
- label: "HSB",
220
- fn: C
221
- }
222
- ], T = class extends r {
223
- static observedAttributes = ["token", "name"];
224
- #e = null;
225
- #t = null;
226
- #n = "";
227
- get token() {
228
- return this.getAttribute("token") ?? "";
229
- }
230
- set token(e) {
231
- this.setAttribute("token", e);
232
- }
233
- get name() {
234
- return this.getAttribute("name") ?? "";
235
- }
236
- set name(e) {
237
- this.setAttribute("name", e);
238
- }
239
- attributeChangedCallback(e, t, n) {
240
- t !== n && (e === "token" && this.isConnected && (this.style.background = n ? `var(${n})` : "", this.title = `${this.name}\n${n}`, requestAnimationFrame(() => this.#a())), e === "name" && this.#t && (this.#t.textContent = n ?? "", this.title = `${n}\n${this.token}`));
241
- }
242
- setup() {
243
- super.setup(), this.token && (this.style.background = `var(${this.token})`, this.title = `${this.name}\n${this.token}`);
244
- let e = document.createElement("span");
245
- e.className = "native-tokens-swatch-label", e.textContent = this.name, this.#t = e, this.appendChild(e), this.#n = n("swatch"), this.style.setProperty("anchor-name", `--${this.#n}`);
246
- let t = document.createElement("div");
247
- t.className = "native-tokens-swatch-popover", t.setAttribute("popover", "auto"), t.style.setProperty("position-anchor", `--${this.#n}`), this.#e = t, this.appendChild(t), this.addEventListener("click", this.#i), this.addEventListener("native-tokens-change", this.#r), this.addEventListener("native-tokens-theme-change", this.#r), requestAnimationFrame(() => this.#a());
248
- }
249
- teardown() {
250
- this.removeEventListener("click", this.#i), this.removeEventListener("native-tokens-change", this.#r), this.removeEventListener("native-tokens-theme-change", this.#r), this.#e = null, this.#t = null, this.innerHTML = "", super.teardown();
251
- }
252
- /** Refresh background and contrast from current token value. */
253
- refresh() {
254
- this.token && (this.style.background = `var(${this.token})`), this.#a();
255
- }
256
- #r = () => {
257
- requestAnimationFrame(() => this.refresh());
258
- };
259
- #i = (e) => {
260
- if (!(this.#e && e.target.closest(".native-tokens-swatch-popover")) && this.#e) {
261
- this.#o();
262
- try {
263
- this.#e.showPopover();
264
- } catch {}
265
- }
266
- };
267
- #a() {
268
- let e = getComputedStyle(this).backgroundColor, [t, n, r] = f(e);
269
- this.#t && (this.#t.style.color = p(t, n, r) ? "rgba(0,0,0,0.55)" : "rgba(255,255,255,0.7)");
270
- }
271
- #o() {
272
- if (!this.#e) return;
273
- this.#e.innerHTML = "";
274
- let e = getComputedStyle(this).backgroundColor, [t, n, r, i] = f(e), a = document.createElement("div");
275
- a.className = "native-tokens-swatch-popover-header", a.textContent = this.token, this.#e.appendChild(a);
276
- for (let e of w) {
277
- let a = e.fn(t, n, r, i), o = document.createElement("button");
278
- o.className = "native-tokens-swatch-popover-row", o.type = "button";
279
- let s = document.createElement("span");
280
- s.className = "native-tokens-swatch-popover-label", s.textContent = e.label;
281
- let c = document.createElement("span");
282
- c.className = "native-tokens-swatch-popover-value", c.textContent = a, o.append(s, c), o.addEventListener("click", (e) => {
283
- e.stopPropagation(), navigator.clipboard.writeText(a).then(() => {
284
- c.textContent = "Copied!", setTimeout(() => {
285
- c.textContent = a;
286
- }, 1200);
287
- });
288
- }), this.#e.appendChild(o);
289
- }
290
- }
291
- }, E = /* @__PURE__ */ "color-env-lightness-min.color-env-lightness-max.color-env-lightness-delta.color-env-chroma.color-env-chroma-k-muted.color-env-chroma-k-vivid.color-env-chroma-k-edge.color-env-alpha.color-env-alpha-delta.color-env-hue-neutral.color-env-chroma-neutral.color-env-lightness-neutral.color-env-hue-accent.color-env-chroma-accent.color-env-lightness-accent.color-env-hue-info.color-env-chroma-info.color-env-lightness-info.color-env-hue-success.color-env-chroma-success.color-env-lightness-success.color-env-hue-warning.color-env-chroma-warning.color-env-lightness-warning.color-env-hue-danger.color-env-chroma-danger.color-env-lightness-danger".split("."), D = class extends r {
292
- static observedAttributes = ["data"];
293
- #e = [];
294
- attributeChangedCallback(e, t, n) {
295
- if (t !== n && e === "data" && n) {
296
- try {
297
- this.#e = JSON.parse(n);
298
- } catch {}
299
- this.isConnected && this.#t();
300
- }
301
- }
302
- setup() {
303
- super.setup();
304
- let e = this.getAttribute("data");
305
- if (e) try {
306
- this.#e = JSON.parse(e);
307
- } catch {}
308
- this.#t();
309
- }
310
- teardown() {
311
- this.innerHTML = "", super.teardown();
312
- }
313
- #t() {
314
- this.innerHTML = "";
315
- let e = document.documentElement.getAttribute("theme") ?? "", t = document.createElement("ui-select");
316
- t.setAttribute("size", "xs"), t.setAttribute("placeholder", "Theme..."), t.setAttribute("options", JSON.stringify(this.#e.map((e) => ({
317
- value: e.value,
318
- label: e.name
319
- })))), t.setAttribute("value", e), t.addEventListener("ui-change", ((e) => {
320
- this.#n(e.detail.value);
321
- })), this.appendChild(t);
322
- }
323
- #n(e) {
324
- let t = document.documentElement;
325
- for (let e of E) t.style.removeProperty("--" + e);
326
- e ? t.setAttribute("theme", e) : t.removeAttribute("theme"), this.dispatchEvent(new CustomEvent("native-tokens-theme-change", {
327
- bubbles: !0,
328
- detail: { theme: e }
329
- }));
330
- }
331
- }, O = [
332
- {
333
- name: "Default",
334
- value: ""
335
- },
336
- {
337
- name: "Forest",
338
- value: "forest"
339
- },
340
- {
341
- name: "Rose",
342
- value: "rose"
343
- },
344
- {
345
- name: "Zinc",
346
- value: "zinc"
347
- }
348
- ], k = [
349
- {
350
- name: "L min",
351
- token: "--color-env-lightness-min",
352
- value: .15,
353
- step: .01,
354
- min: 0,
355
- max: 1,
356
- group: "Lightness"
357
- },
358
- {
359
- name: "L max",
360
- token: "--color-env-lightness-max",
361
- value: 1,
362
- step: .01,
363
- min: 0,
364
- max: 1,
365
- group: "Lightness"
366
- },
367
- {
368
- name: "L delta",
369
- token: "--color-env-lightness-delta",
370
- value: .015,
371
- step: .005,
372
- min: 0,
373
- max: .15,
374
- group: "Lightness"
375
- },
376
- {
377
- name: "Chroma",
378
- token: "--color-env-chroma",
379
- value: .2,
380
- step: .005,
381
- min: 0,
382
- max: .5,
383
- group: "Chroma"
384
- },
385
- {
386
- name: "C muted",
387
- token: "--color-env-chroma-k-muted",
388
- value: .125,
389
- step: .01,
390
- min: 0,
391
- max: 1,
392
- group: "Chroma"
393
- },
394
- {
395
- name: "C vivid",
396
- token: "--color-env-chroma-k-vivid",
397
- value: 1,
398
- step: .01,
399
- min: 0,
400
- max: 1,
401
- group: "Chroma"
402
- },
403
- {
404
- name: "C edge",
405
- token: "--color-env-chroma-k-edge",
406
- value: .05,
407
- step: .01,
408
- min: 0,
409
- max: 1,
410
- group: "Chroma"
411
- },
412
- {
413
- name: "Alpha",
414
- token: "--color-env-alpha",
415
- value: .85,
416
- step: .01,
417
- min: 0,
418
- max: 1,
419
- group: "Alpha"
420
- },
421
- {
422
- name: "A delta",
423
- token: "--color-env-alpha-delta",
424
- value: .02,
425
- step: .005,
426
- min: 0,
427
- max: .15,
428
- group: "Alpha"
429
- }
430
- ], A = [
431
- "neutral",
432
- "accent",
433
- "info",
434
- "success",
435
- "warning",
436
- "danger"
437
- ], j = [
438
- "lowest",
439
- "lower",
440
- "low",
441
- "base",
442
- "high",
443
- "higher",
444
- "highest"
445
- ], M = [
446
- "brightest",
447
- "brighter",
448
- "bright",
449
- "base",
450
- "dim",
451
- "dimmer",
452
- "dimmest"
453
- ], N = [
454
- "1",
455
- "2",
456
- "3",
457
- "4",
458
- "5",
459
- "6",
460
- "7",
461
- "8",
462
- "9",
463
- "10",
464
- "11"
465
- ], P = [
466
- "050",
467
- "100",
468
- "200",
469
- "300",
470
- "400",
471
- "500",
472
- "600",
473
- "700",
474
- "800",
475
- "900",
476
- "950"
477
- ], F = [
478
- "strongest",
479
- "stronger",
480
- "strong",
481
- "base",
482
- "weak",
483
- "weaker",
484
- "weakest"
485
- ];
486
- function I(e, t) {
487
- let n = document.createElement("div");
488
- n.className = "native-tokens-inspector-section", t && (n.dataset.family = t);
489
- let r = document.createElement("h3");
490
- return r.className = "native-tokens-inspector-heading", r.textContent = e, n.appendChild(r), n;
491
- }
492
- function L(e) {
493
- let t = document.createElement("h4");
494
- return t.className = "native-tokens-inspector-subheading", t.textContent = e, t;
495
- }
496
- function R(e) {
497
- let t = document.createElement("native-tokens-colors");
498
- return t.setAttribute("data", JSON.stringify(e)), t;
499
- }
500
- function z(e) {
501
- let t = document.createElement("native-tokens-variable");
502
- return t.setAttribute("data", JSON.stringify({
503
- name: e.name,
504
- type: "number",
505
- token: e.token,
506
- value: e.value,
507
- step: e.step,
508
- min: e.min,
509
- max: e.max
510
- })), t;
511
- }
512
- function B(e) {
513
- let t = document.createElement("div");
514
- t.className = "native-tokens-inspector-toolbar";
515
- let n = document.createElement("native-tokens-themes");
516
- n.setAttribute("data", JSON.stringify(O)), t.appendChild(n);
517
- let r = [{
518
- value: "all",
519
- label: "All Families"
520
- }, ...A.map((e) => ({
521
- value: e,
522
- label: e.charAt(0).toUpperCase() + e.slice(1)
523
- }))], i = document.createElement("ui-select");
524
- i.setAttribute("size", "xs"), i.setAttribute("placeholder", "Family..."), i.setAttribute("options", JSON.stringify(r)), i.setAttribute("value", "all"), t.appendChild(i), e.appendChild(t);
525
- let a = "", o = null;
526
- for (let t of k) t.group !== a && (a = t.group, o = I(t.group, "env"), e.appendChild(o)), o.appendChild(z(t));
527
- for (let t of A) {
528
- let n = I(t.charAt(0).toUpperCase() + t.slice(1), t);
529
- n.appendChild(z({
530
- name: "Hue",
531
- token: `--color-env-hue-${t}`,
532
- value: 230,
533
- step: 1,
534
- min: 0,
535
- max: 360
536
- })), n.appendChild(z({
537
- name: "Chroma",
538
- token: `--color-env-chroma-${t}`,
539
- value: .5,
540
- step: .01,
541
- min: 0,
542
- max: 1
543
- })), n.appendChild(z({
544
- name: "Lightness",
545
- token: `--color-env-lightness-${t}`,
546
- value: .5,
547
- step: .01,
548
- min: 0,
549
- max: 1
550
- })), n.appendChild(L("Elevation")), n.appendChild(R(j.map((e) => ({
551
- name: e,
552
- token: `--${t}-${e}`
553
- })))), n.appendChild(L("Brightness")), n.appendChild(R(M.map((e) => ({
554
- name: e,
555
- token: `--${t}-${e}`
556
- })))), n.appendChild(L("Solid")), n.appendChild(R(N.map((e) => ({
557
- name: e,
558
- token: `--${t}-${e}`
559
- })))), n.appendChild(L("Scrim")), n.appendChild(R(N.map((e) => ({
560
- name: e,
561
- token: `--${t}-${e}-scrim`
562
- })))), n.appendChild(L("Semantic")), n.appendChild(R(P.map((e) => ({
563
- name: e,
564
- token: `--${t}-${e}`
565
- })))), n.appendChild(L("Semantic Scrim")), n.appendChild(R(P.map((e) => ({
566
- name: e,
567
- token: `--${t}-${e}-scrim`
568
- })))), n.appendChild(L("Tint")), n.appendChild(R(F.map((e) => ({
569
- name: e,
570
- token: `--${t}-scrim-tint-${e}`
571
- })))), n.appendChild(L("Shade")), n.appendChild(R(F.map((e) => ({
572
- name: e,
573
- token: `--${t}-scrim-shade-${e}`
574
- })))), e.appendChild(n);
575
- }
576
- i.addEventListener("ui-change", ((t) => {
577
- let n = t.detail.value, r = e.querySelectorAll(".native-tokens-inspector-section[data-family]");
578
- for (let e of r) {
579
- let t = e.dataset.family;
580
- n === "all" || t === "env" ? e.hidden = !1 : e.hidden = t !== n;
581
- }
582
- requestAnimationFrame(() => {
583
- e.querySelectorAll("native-tokens-colors").forEach((e) => e.refresh());
584
- });
585
- })), e.addEventListener("native-tokens-theme-change", () => {
586
- requestAnimationFrame(() => {
587
- e.querySelectorAll("native-tokens-variable").forEach((e) => e.sync());
588
- });
589
- });
590
- }
591
- /**
592
- * Self-contained design system inspector.
593
- *
594
- * Stamps the full color/variable inspector UI on connection.
595
- * Consumer usage: `<native-tokens-inspector></native-tokens-inspector>`.
596
- *
597
- * All `native-tokens-*` sub-elements are registered by the `@nonoun/native-ui/inspector`
598
- * entry point as a side effect of import.
599
- */
600
- var V = class extends r {
601
- setup() {
602
- super.setup(), B(this);
603
- }
604
- teardown() {
605
- this.innerHTML = "", super.teardown();
606
- }
607
- };
608
- c("native-tokens-variable", u), c("native-tokens-colors", d), c("native-tokens-color-swatch", T), c("native-tokens-themes", D), c("native-tokens-inspector", V), c("ui-range", t), c("ui-select", e), c("ui-button", a), c("ui-icon", l), c("ui-listbox", o), c("ui-option", i), c("ui-layout-inspector", s);
609
- export { T as NativeTokensColorSwatch, d as NativeTokensColors, V as NativeTokensInspector, D as NativeTokensThemes, u as NativeTokensVariable, s as UILayoutInspector, B as buildInspector };