@nonoun/native-ui 0.2.9 → 0.2.10
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/dist/{ui-layout-inspector-element.js → components.js} +2279 -386
- package/dist/{register-all2.js → core.js} +78 -35
- package/dist/custom-elements.json +2502 -2502
- package/dist/inspector/build-inspector.d.ts +4 -4
- package/dist/inspector/build-inspector.d.ts.map +1 -1
- package/dist/inspector/index.d.ts +8 -8
- package/dist/inspector/index.d.ts.map +1 -1
- package/dist/inspector/{ds-color-swatch-element.d.ts → native-tokens-color-swatch-element.d.ts} +2 -2
- package/dist/inspector/native-tokens-color-swatch-element.d.ts.map +1 -0
- package/dist/inspector/native-tokens-color-swatch.d.ts +3 -0
- package/dist/inspector/native-tokens-color-swatch.d.ts.map +1 -0
- package/dist/inspector/{ds-colors-element.d.ts → native-tokens-colors-element.d.ts} +3 -3
- package/dist/inspector/native-tokens-colors-element.d.ts.map +1 -0
- package/dist/inspector/native-tokens-colors.d.ts +4 -0
- package/dist/inspector/native-tokens-colors.d.ts.map +1 -0
- package/dist/inspector/native-tokens-inspector-element.d.ts +15 -0
- package/dist/inspector/native-tokens-inspector-element.d.ts.map +1 -0
- package/dist/inspector/native-tokens-inspector.d.ts +3 -0
- package/dist/inspector/native-tokens-inspector.d.ts.map +1 -0
- package/dist/inspector/{ds-themes-element.d.ts → native-tokens-themes-element.d.ts} +3 -3
- package/dist/inspector/native-tokens-themes-element.d.ts.map +1 -0
- package/dist/inspector/native-tokens-themes.d.ts +4 -0
- package/dist/inspector/native-tokens-themes.d.ts.map +1 -0
- package/dist/inspector/{ds-variable-element.d.ts → native-tokens-variable-element.d.ts} +3 -3
- package/dist/inspector/native-tokens-variable-element.d.ts.map +1 -0
- package/dist/inspector/native-tokens-variable.d.ts +4 -0
- package/dist/inspector/native-tokens-variable.d.ts.map +1 -0
- package/dist/inspector.css +30 -30
- package/dist/inspector.d.ts +10 -9
- package/dist/inspector.d.ts.map +1 -1
- package/dist/inspector.js +102 -103
- package/dist/kernel.js +175 -174
- package/dist/native-ui.js +4 -49
- package/dist/register-all.js +4 -4
- package/dist/traits.js +3 -5
- package/dist/ui-icon.js +56 -0
- package/package.json +1 -1
- package/dist/dialog-controller.js +0 -391
- package/dist/inspector/ds-color-swatch-element.d.ts.map +0 -1
- package/dist/inspector/ds-color-swatch.d.ts +0 -3
- package/dist/inspector/ds-color-swatch.d.ts.map +0 -1
- package/dist/inspector/ds-colors-element.d.ts.map +0 -1
- package/dist/inspector/ds-colors.d.ts +0 -4
- package/dist/inspector/ds-colors.d.ts.map +0 -1
- package/dist/inspector/ds-inspector-element.d.ts +0 -15
- package/dist/inspector/ds-inspector-element.d.ts.map +0 -1
- package/dist/inspector/ds-inspector.d.ts +0 -3
- package/dist/inspector/ds-inspector.d.ts.map +0 -1
- package/dist/inspector/ds-themes-element.d.ts.map +0 -1
- package/dist/inspector/ds-themes.d.ts +0 -4
- package/dist/inspector/ds-themes.d.ts.map +0 -1
- package/dist/inspector/ds-variable-element.d.ts.map +0 -1
- package/dist/inspector/ds-variable.d.ts +0 -4
- package/dist/inspector/ds-variable.d.ts.map +0 -1
- package/dist/list-navigate-controller.js +0 -457
- package/dist/ui-icon-element.js +0 -986
- package/dist/uid.js +0 -147
package/dist/inspector.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
var
|
|
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
5
|
static observedAttributes = ["data"];
|
|
6
6
|
#e = null;
|
|
7
7
|
#t = null;
|
|
@@ -20,10 +20,10 @@ var l = class extends n {
|
|
|
20
20
|
if (e) try {
|
|
21
21
|
this.#e = JSON.parse(e);
|
|
22
22
|
} catch {}
|
|
23
|
-
this.#a(), this.addEventListener("
|
|
23
|
+
this.#a(), this.addEventListener("native-tokens-theme-change", this.#r);
|
|
24
24
|
}
|
|
25
25
|
teardown() {
|
|
26
|
-
this.removeEventListener("
|
|
26
|
+
this.removeEventListener("native-tokens-theme-change", this.#r), this.innerHTML = "", this.#t = null, this.#n = null, super.teardown();
|
|
27
27
|
}
|
|
28
28
|
#r = () => {
|
|
29
29
|
requestAnimationFrame(() => this.#i());
|
|
@@ -45,17 +45,17 @@ var l = class extends n {
|
|
|
45
45
|
let e = this.#e;
|
|
46
46
|
this.innerHTML = "";
|
|
47
47
|
let t = document.createElement("div");
|
|
48
|
-
t.className = "
|
|
48
|
+
t.className = "native-tokens-variable-row";
|
|
49
49
|
let n = document.createElement("label");
|
|
50
|
-
n.className = "
|
|
50
|
+
n.className = "native-tokens-variable-label", n.textContent = e.name;
|
|
51
51
|
let r = document.createElement("ui-range");
|
|
52
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
53
|
let i = getComputedStyle(document.documentElement).getPropertyValue(e.token).trim(), a = i ? parseFloat(i) : e.value;
|
|
54
54
|
r.setAttribute("value", String(a));
|
|
55
55
|
let o = e.step ?? .01, s = document.createElement("span");
|
|
56
|
-
s.className = "
|
|
56
|
+
s.className = "native-tokens-variable-value", s.textContent = a.toFixed(o < .01 ? 3 : 2), r.addEventListener("ui-input", ((t) => {
|
|
57
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("
|
|
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
59
|
bubbles: !0,
|
|
60
60
|
detail: {
|
|
61
61
|
token: e.token,
|
|
@@ -64,7 +64,7 @@ var l = class extends n {
|
|
|
64
64
|
}));
|
|
65
65
|
})), this.#t = r, this.#n = s, t.append(n, r, s), this.appendChild(t);
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, d = class extends r {
|
|
68
68
|
static observedAttributes = ["data"];
|
|
69
69
|
#e = [];
|
|
70
70
|
attributeChangedCallback(e, t, n) {
|
|
@@ -81,10 +81,10 @@ var l = class extends n {
|
|
|
81
81
|
if (e) try {
|
|
82
82
|
this.#e = JSON.parse(e);
|
|
83
83
|
} catch {}
|
|
84
|
-
this.#n(), this.addEventListener("
|
|
84
|
+
this.#n(), this.addEventListener("native-tokens-change", this.#t), this.addEventListener("native-tokens-theme-change", this.#t);
|
|
85
85
|
}
|
|
86
86
|
teardown() {
|
|
87
|
-
this.removeEventListener("
|
|
87
|
+
this.removeEventListener("native-tokens-change", this.#t), this.removeEventListener("native-tokens-theme-change", this.#t), this.innerHTML = "", super.teardown();
|
|
88
88
|
}
|
|
89
89
|
#t = () => {
|
|
90
90
|
requestAnimationFrame(() => this.#r());
|
|
@@ -95,19 +95,19 @@ var l = class extends n {
|
|
|
95
95
|
#n() {
|
|
96
96
|
this.innerHTML = "";
|
|
97
97
|
let e = document.createElement("div");
|
|
98
|
-
e.className = "
|
|
98
|
+
e.className = "native-tokens-colors-strip";
|
|
99
99
|
for (let t of this.#e) {
|
|
100
|
-
let n = document.createElement("
|
|
100
|
+
let n = document.createElement("native-tokens-color-swatch");
|
|
101
101
|
n.setAttribute("token", t.token), n.setAttribute("name", t.name), e.appendChild(n);
|
|
102
102
|
}
|
|
103
103
|
this.appendChild(e);
|
|
104
104
|
}
|
|
105
105
|
#r() {
|
|
106
|
-
this.querySelectorAll("
|
|
106
|
+
this.querySelectorAll("native-tokens-color-swatch").forEach((e) => e.refresh());
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
/** Parse a computed `rgb(...)` / `rgba(...)` string into [r, g, b, a] (0–255, 0–1). */
|
|
110
|
-
function
|
|
110
|
+
function f(e) {
|
|
111
111
|
let t = e.match(/[\d.]+/g);
|
|
112
112
|
return !t || t.length < 3 ? [
|
|
113
113
|
0,
|
|
@@ -122,7 +122,7 @@ function d(e) {
|
|
|
122
122
|
];
|
|
123
123
|
}
|
|
124
124
|
/** Relative luminance (ITU-R BT.709). Returns true if light. */
|
|
125
|
-
function
|
|
125
|
+
function p(e, t, n) {
|
|
126
126
|
let r = [
|
|
127
127
|
e,
|
|
128
128
|
t,
|
|
@@ -131,17 +131,16 @@ function f(e, t, n) {
|
|
|
131
131
|
return .2126 * r[0] + .7152 * r[1] + .0722 * r[2] > .4;
|
|
132
132
|
}
|
|
133
133
|
/** Convert 0–255 component to 2-digit hex. */
|
|
134
|
-
function
|
|
134
|
+
function m(e) {
|
|
135
135
|
return Math.round(e).toString(16).padStart(2, "0");
|
|
136
136
|
}
|
|
137
137
|
/** sRGB → linear. */
|
|
138
|
-
function
|
|
138
|
+
function h(e) {
|
|
139
139
|
return e /= 255, e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
140
140
|
}
|
|
141
|
-
/** linear → sRGB (0–1 range). */
|
|
142
141
|
/** sRGB (0–255) → OKLCH via OKLab. Returns [L (0–1), C, H (degrees)]. */
|
|
143
|
-
function
|
|
144
|
-
let r =
|
|
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);
|
|
145
144
|
return _ < 0 && (_ += 360), [
|
|
146
145
|
f,
|
|
147
146
|
g,
|
|
@@ -149,7 +148,7 @@ function h(e, t, n) {
|
|
|
149
148
|
];
|
|
150
149
|
}
|
|
151
150
|
/** sRGB (0–255) → HSL. Returns [H (0–360), S (0–100), L (0–100)]. */
|
|
152
|
-
function
|
|
151
|
+
function _(e, t, n) {
|
|
153
152
|
e /= 255, t /= 255, n /= 255;
|
|
154
153
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = r - i, o = (r + i) / 2;
|
|
155
154
|
if (a === 0) return [
|
|
@@ -165,7 +164,7 @@ function g(e, t, n) {
|
|
|
165
164
|
];
|
|
166
165
|
}
|
|
167
166
|
/** sRGB (0–255) → HSB/HSV. Returns [H (0–360), S (0–100), B (0–100)]. */
|
|
168
|
-
function
|
|
167
|
+
function v(e, t, n) {
|
|
169
168
|
e /= 255, t /= 255, n /= 255;
|
|
170
169
|
let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = r * 100;
|
|
171
170
|
if (r === 0) return [
|
|
@@ -180,47 +179,47 @@ function _(e, t, n) {
|
|
|
180
179
|
a
|
|
181
180
|
];
|
|
182
181
|
}
|
|
183
|
-
function v(e, t, n, r) {
|
|
184
|
-
let [i, a, o] = h(e, t, n), s = `oklch(${(i * 100).toFixed(1)}% ${a.toFixed(4)} ${o.toFixed(1)})`;
|
|
185
|
-
return r < 1 ? `oklch(${(i * 100).toFixed(1)}% ${a.toFixed(4)} ${o.toFixed(1)} / ${r.toFixed(2)})` : s;
|
|
186
|
-
}
|
|
187
182
|
function y(e, t, n, r) {
|
|
188
|
-
let i =
|
|
189
|
-
return r < 1 ?
|
|
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;
|
|
190
185
|
}
|
|
191
186
|
function b(e, t, n, r) {
|
|
192
|
-
|
|
187
|
+
let i = `#${m(e)}${m(t)}${m(n)}`;
|
|
188
|
+
return r < 1 ? `${i}${m(Math.round(r * 255))}` : i;
|
|
193
189
|
}
|
|
194
190
|
function x(e, t, n, r) {
|
|
195
|
-
|
|
196
|
-
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)}%)`;
|
|
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)})`;
|
|
197
192
|
}
|
|
198
193
|
function S(e, t, n, r) {
|
|
199
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);
|
|
200
199
|
return `hsb(${i.toFixed(0)}, ${a.toFixed(1)}%, ${o.toFixed(1)}%)`;
|
|
201
200
|
}
|
|
202
|
-
var
|
|
201
|
+
var w = [
|
|
203
202
|
{
|
|
204
203
|
label: "OKLCH",
|
|
205
|
-
fn:
|
|
204
|
+
fn: y
|
|
206
205
|
},
|
|
207
206
|
{
|
|
208
207
|
label: "HEX",
|
|
209
|
-
fn:
|
|
208
|
+
fn: b
|
|
210
209
|
},
|
|
211
210
|
{
|
|
212
211
|
label: "RGB",
|
|
213
|
-
fn:
|
|
212
|
+
fn: x
|
|
214
213
|
},
|
|
215
214
|
{
|
|
216
215
|
label: "HSL",
|
|
217
|
-
fn:
|
|
216
|
+
fn: S
|
|
218
217
|
},
|
|
219
218
|
{
|
|
220
219
|
label: "HSB",
|
|
221
|
-
fn:
|
|
220
|
+
fn: C
|
|
222
221
|
}
|
|
223
|
-
],
|
|
222
|
+
], T = class extends r {
|
|
224
223
|
static observedAttributes = ["token", "name"];
|
|
225
224
|
#e = null;
|
|
226
225
|
#t = null;
|
|
@@ -243,12 +242,12 @@ var C = [
|
|
|
243
242
|
setup() {
|
|
244
243
|
super.setup(), this.token && (this.style.background = `var(${this.token})`, this.title = `${this.name}\n${this.token}`);
|
|
245
244
|
let e = document.createElement("span");
|
|
246
|
-
e.className = "
|
|
247
|
-
let
|
|
248
|
-
|
|
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());
|
|
249
248
|
}
|
|
250
249
|
teardown() {
|
|
251
|
-
this.removeEventListener("click", this.#i), this.removeEventListener("
|
|
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();
|
|
252
251
|
}
|
|
253
252
|
/** Refresh background and contrast from current token value. */
|
|
254
253
|
refresh() {
|
|
@@ -258,7 +257,7 @@ var C = [
|
|
|
258
257
|
requestAnimationFrame(() => this.refresh());
|
|
259
258
|
};
|
|
260
259
|
#i = (e) => {
|
|
261
|
-
if (!(this.#e && e.target.closest(".
|
|
260
|
+
if (!(this.#e && e.target.closest(".native-tokens-swatch-popover")) && this.#e) {
|
|
262
261
|
this.#o();
|
|
263
262
|
try {
|
|
264
263
|
this.#e.showPopover();
|
|
@@ -266,21 +265,21 @@ var C = [
|
|
|
266
265
|
}
|
|
267
266
|
};
|
|
268
267
|
#a() {
|
|
269
|
-
let e = getComputedStyle(this).backgroundColor, [t, n, r] =
|
|
270
|
-
this.#t && (this.#t.style.color =
|
|
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)");
|
|
271
270
|
}
|
|
272
271
|
#o() {
|
|
273
272
|
if (!this.#e) return;
|
|
274
273
|
this.#e.innerHTML = "";
|
|
275
|
-
let e = getComputedStyle(this).backgroundColor, [t, n, r, i] =
|
|
276
|
-
a.className = "
|
|
277
|
-
for (let e of
|
|
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) {
|
|
278
277
|
let a = e.fn(t, n, r, i), o = document.createElement("button");
|
|
279
|
-
o.className = "
|
|
278
|
+
o.className = "native-tokens-swatch-popover-row", o.type = "button";
|
|
280
279
|
let s = document.createElement("span");
|
|
281
|
-
s.className = "
|
|
280
|
+
s.className = "native-tokens-swatch-popover-label", s.textContent = e.label;
|
|
282
281
|
let c = document.createElement("span");
|
|
283
|
-
c.className = "
|
|
282
|
+
c.className = "native-tokens-swatch-popover-value", c.textContent = a, o.append(s, c), o.addEventListener("click", (e) => {
|
|
284
283
|
e.stopPropagation(), navigator.clipboard.writeText(a).then(() => {
|
|
285
284
|
c.textContent = "Copied!", setTimeout(() => {
|
|
286
285
|
c.textContent = a;
|
|
@@ -289,7 +288,7 @@ var C = [
|
|
|
289
288
|
}), this.#e.appendChild(o);
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
|
-
},
|
|
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 {
|
|
293
292
|
static observedAttributes = ["data"];
|
|
294
293
|
#e = [];
|
|
295
294
|
attributeChangedCallback(e, t, n) {
|
|
@@ -323,13 +322,13 @@ var C = [
|
|
|
323
322
|
}
|
|
324
323
|
#n(e) {
|
|
325
324
|
let t = document.documentElement;
|
|
326
|
-
for (let e of
|
|
327
|
-
e ? t.setAttribute("theme", e) : t.removeAttribute("theme"), this.dispatchEvent(new CustomEvent("
|
|
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", {
|
|
328
327
|
bubbles: !0,
|
|
329
328
|
detail: { theme: e }
|
|
330
329
|
}));
|
|
331
330
|
}
|
|
332
|
-
},
|
|
331
|
+
}, O = [
|
|
333
332
|
{
|
|
334
333
|
name: "Default",
|
|
335
334
|
value: ""
|
|
@@ -346,7 +345,7 @@ var C = [
|
|
|
346
345
|
name: "Zinc",
|
|
347
346
|
value: "zinc"
|
|
348
347
|
}
|
|
349
|
-
],
|
|
348
|
+
], k = [
|
|
350
349
|
{
|
|
351
350
|
name: "L min",
|
|
352
351
|
token: "--color-env-lightness-min",
|
|
@@ -428,14 +427,14 @@ var C = [
|
|
|
428
427
|
max: .15,
|
|
429
428
|
group: "Alpha"
|
|
430
429
|
}
|
|
431
|
-
],
|
|
430
|
+
], A = [
|
|
432
431
|
"neutral",
|
|
433
432
|
"accent",
|
|
434
433
|
"info",
|
|
435
434
|
"success",
|
|
436
435
|
"warning",
|
|
437
436
|
"danger"
|
|
438
|
-
],
|
|
437
|
+
], j = [
|
|
439
438
|
"lowest",
|
|
440
439
|
"lower",
|
|
441
440
|
"low",
|
|
@@ -443,7 +442,7 @@ var C = [
|
|
|
443
442
|
"high",
|
|
444
443
|
"higher",
|
|
445
444
|
"highest"
|
|
446
|
-
],
|
|
445
|
+
], M = [
|
|
447
446
|
"brightest",
|
|
448
447
|
"brighter",
|
|
449
448
|
"bright",
|
|
@@ -451,7 +450,7 @@ var C = [
|
|
|
451
450
|
"dim",
|
|
452
451
|
"dimmer",
|
|
453
452
|
"dimmest"
|
|
454
|
-
],
|
|
453
|
+
], N = [
|
|
455
454
|
"1",
|
|
456
455
|
"2",
|
|
457
456
|
"3",
|
|
@@ -463,7 +462,7 @@ var C = [
|
|
|
463
462
|
"9",
|
|
464
463
|
"10",
|
|
465
464
|
"11"
|
|
466
|
-
],
|
|
465
|
+
], P = [
|
|
467
466
|
"050",
|
|
468
467
|
"100",
|
|
469
468
|
"200",
|
|
@@ -475,7 +474,7 @@ var C = [
|
|
|
475
474
|
"800",
|
|
476
475
|
"900",
|
|
477
476
|
"950"
|
|
478
|
-
],
|
|
477
|
+
], F = [
|
|
479
478
|
"strongest",
|
|
480
479
|
"stronger",
|
|
481
480
|
"strong",
|
|
@@ -484,22 +483,22 @@ var C = [
|
|
|
484
483
|
"weaker",
|
|
485
484
|
"weakest"
|
|
486
485
|
];
|
|
487
|
-
function
|
|
486
|
+
function I(e, t) {
|
|
488
487
|
let n = document.createElement("div");
|
|
489
|
-
n.className = "
|
|
488
|
+
n.className = "native-tokens-inspector-section", t && (n.dataset.family = t);
|
|
490
489
|
let r = document.createElement("h3");
|
|
491
|
-
return r.className = "
|
|
490
|
+
return r.className = "native-tokens-inspector-heading", r.textContent = e, n.appendChild(r), n;
|
|
492
491
|
}
|
|
493
|
-
function
|
|
492
|
+
function L(e) {
|
|
494
493
|
let t = document.createElement("h4");
|
|
495
|
-
return t.className = "
|
|
494
|
+
return t.className = "native-tokens-inspector-subheading", t.textContent = e, t;
|
|
496
495
|
}
|
|
497
|
-
function
|
|
498
|
-
let t = document.createElement("
|
|
496
|
+
function R(e) {
|
|
497
|
+
let t = document.createElement("native-tokens-colors");
|
|
499
498
|
return t.setAttribute("data", JSON.stringify(e)), t;
|
|
500
499
|
}
|
|
501
|
-
function
|
|
502
|
-
let t = document.createElement("
|
|
500
|
+
function z(e) {
|
|
501
|
+
let t = document.createElement("native-tokens-variable");
|
|
503
502
|
return t.setAttribute("data", JSON.stringify({
|
|
504
503
|
name: e.name,
|
|
505
504
|
type: "number",
|
|
@@ -510,82 +509,82 @@ function R(e) {
|
|
|
510
509
|
max: e.max
|
|
511
510
|
})), t;
|
|
512
511
|
}
|
|
513
|
-
function
|
|
512
|
+
function B(e) {
|
|
514
513
|
let t = document.createElement("div");
|
|
515
|
-
t.className = "
|
|
516
|
-
let n = document.createElement("
|
|
517
|
-
n.setAttribute("data", JSON.stringify(
|
|
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);
|
|
518
517
|
let r = [{
|
|
519
518
|
value: "all",
|
|
520
519
|
label: "All Families"
|
|
521
|
-
}, ...
|
|
520
|
+
}, ...A.map((e) => ({
|
|
522
521
|
value: e,
|
|
523
522
|
label: e.charAt(0).toUpperCase() + e.slice(1)
|
|
524
523
|
}))], i = document.createElement("ui-select");
|
|
525
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);
|
|
526
525
|
let a = "", o = null;
|
|
527
|
-
for (let t of
|
|
528
|
-
for (let t of
|
|
529
|
-
let n =
|
|
530
|
-
n.appendChild(
|
|
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({
|
|
531
530
|
name: "Hue",
|
|
532
531
|
token: `--color-env-hue-${t}`,
|
|
533
532
|
value: 230,
|
|
534
533
|
step: 1,
|
|
535
534
|
min: 0,
|
|
536
535
|
max: 360
|
|
537
|
-
})), n.appendChild(
|
|
536
|
+
})), n.appendChild(z({
|
|
538
537
|
name: "Chroma",
|
|
539
538
|
token: `--color-env-chroma-${t}`,
|
|
540
539
|
value: .5,
|
|
541
540
|
step: .01,
|
|
542
541
|
min: 0,
|
|
543
542
|
max: 1
|
|
544
|
-
})), n.appendChild(
|
|
543
|
+
})), n.appendChild(z({
|
|
545
544
|
name: "Lightness",
|
|
546
545
|
token: `--color-env-lightness-${t}`,
|
|
547
546
|
value: .5,
|
|
548
547
|
step: .01,
|
|
549
548
|
min: 0,
|
|
550
549
|
max: 1
|
|
551
|
-
})), n.appendChild(
|
|
550
|
+
})), n.appendChild(L("Elevation")), n.appendChild(R(j.map((e) => ({
|
|
552
551
|
name: e,
|
|
553
552
|
token: `--${t}-${e}`
|
|
554
|
-
})))), n.appendChild(
|
|
553
|
+
})))), n.appendChild(L("Brightness")), n.appendChild(R(M.map((e) => ({
|
|
555
554
|
name: e,
|
|
556
555
|
token: `--${t}-${e}`
|
|
557
|
-
})))), n.appendChild(
|
|
556
|
+
})))), n.appendChild(L("Solid")), n.appendChild(R(N.map((e) => ({
|
|
558
557
|
name: e,
|
|
559
558
|
token: `--${t}-${e}`
|
|
560
|
-
})))), n.appendChild(
|
|
559
|
+
})))), n.appendChild(L("Scrim")), n.appendChild(R(N.map((e) => ({
|
|
561
560
|
name: e,
|
|
562
561
|
token: `--${t}-${e}-scrim`
|
|
563
|
-
})))), n.appendChild(
|
|
562
|
+
})))), n.appendChild(L("Semantic")), n.appendChild(R(P.map((e) => ({
|
|
564
563
|
name: e,
|
|
565
564
|
token: `--${t}-${e}`
|
|
566
|
-
})))), n.appendChild(
|
|
565
|
+
})))), n.appendChild(L("Semantic Scrim")), n.appendChild(R(P.map((e) => ({
|
|
567
566
|
name: e,
|
|
568
567
|
token: `--${t}-${e}-scrim`
|
|
569
|
-
})))), n.appendChild(
|
|
568
|
+
})))), n.appendChild(L("Tint")), n.appendChild(R(F.map((e) => ({
|
|
570
569
|
name: e,
|
|
571
570
|
token: `--${t}-scrim-tint-${e}`
|
|
572
|
-
})))), n.appendChild(
|
|
571
|
+
})))), n.appendChild(L("Shade")), n.appendChild(R(F.map((e) => ({
|
|
573
572
|
name: e,
|
|
574
573
|
token: `--${t}-scrim-shade-${e}`
|
|
575
574
|
})))), e.appendChild(n);
|
|
576
575
|
}
|
|
577
576
|
i.addEventListener("ui-change", ((t) => {
|
|
578
|
-
let n = t.detail.value, r = e.querySelectorAll(".
|
|
577
|
+
let n = t.detail.value, r = e.querySelectorAll(".native-tokens-inspector-section[data-family]");
|
|
579
578
|
for (let e of r) {
|
|
580
579
|
let t = e.dataset.family;
|
|
581
580
|
n === "all" || t === "env" ? e.hidden = !1 : e.hidden = t !== n;
|
|
582
581
|
}
|
|
583
582
|
requestAnimationFrame(() => {
|
|
584
|
-
e.querySelectorAll("
|
|
583
|
+
e.querySelectorAll("native-tokens-colors").forEach((e) => e.refresh());
|
|
585
584
|
});
|
|
586
|
-
})), e.addEventListener("
|
|
585
|
+
})), e.addEventListener("native-tokens-theme-change", () => {
|
|
587
586
|
requestAnimationFrame(() => {
|
|
588
|
-
e.querySelectorAll("
|
|
587
|
+
e.querySelectorAll("native-tokens-variable").forEach((e) => e.sync());
|
|
589
588
|
});
|
|
590
589
|
});
|
|
591
590
|
}
|
|
@@ -593,18 +592,18 @@ function z(e) {
|
|
|
593
592
|
* Self-contained design system inspector.
|
|
594
593
|
*
|
|
595
594
|
* Stamps the full color/variable inspector UI on connection.
|
|
596
|
-
* Consumer usage: `<
|
|
595
|
+
* Consumer usage: `<native-tokens-inspector></native-tokens-inspector>`.
|
|
597
596
|
*
|
|
598
|
-
* All `
|
|
597
|
+
* All `native-tokens-*` sub-elements are registered by the `@nonoun/native-ui/inspector`
|
|
599
598
|
* entry point as a side effect of import.
|
|
600
599
|
*/
|
|
601
|
-
var
|
|
600
|
+
var V = class extends r {
|
|
602
601
|
setup() {
|
|
603
|
-
super.setup(),
|
|
602
|
+
super.setup(), B(this);
|
|
604
603
|
}
|
|
605
604
|
teardown() {
|
|
606
605
|
this.innerHTML = "", super.teardown();
|
|
607
606
|
}
|
|
608
607
|
};
|
|
609
|
-
|
|
610
|
-
export {
|
|
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 };
|