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