@charisol/plexo-sdk 2.0.27 → 2.0.29
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/README.md +301 -0
- package/dist/{InlineColorPicker-BYcOgLVc.js → InlineColorPicker-XesBzRsU.js} +362 -114
- package/dist/{v1-Dm9rxrfa.js → blank-BEl6CY5C.js} +4657 -10897
- package/dist/brandGuide-Dd4fqVjS.js +33 -0
- package/dist/{client-DUSU8g5z.js → client-CWui0-3q.js} +1 -1
- package/dist/codeEditor-Cux0ud2j.js +205 -0
- package/dist/files-Df6FY0HK.js +2182 -0
- package/dist/id-CR6Y8qD6.js +8 -0
- package/dist/index.js +12786 -13034
- package/dist/{brandGuide-DgoZ7spo.js → lint-CV3DmM0X.js} +78 -109
- package/dist/pdfImport-BOev0Pc1.js +262 -0
- package/dist/plexo-sdk.css +1 -1
- package/dist/v1-Cn7SGvZk.js +6253 -0
- package/dist/v2/CanvasEditor.d.ts +25 -0
- package/dist/v2/V2Editor.d.ts +15 -20
- package/dist/v2/compile/build.d.ts +5 -0
- package/dist/v2/components/properties/PropertiesPanel.d.ts +1 -0
- package/dist/v2/files/aiPicture.d.ts +85 -0
- package/dist/v2/files/build.d.ts +49 -0
- package/dist/v2/files/capture.d.ts +52 -0
- package/dist/v2/files/convert.d.ts +24 -0
- package/dist/v2/files/docx.d.ts +1 -0
- package/dist/v2/files/engine.d.ts +2 -0
- package/dist/v2/files/export.d.ts +97 -0
- package/dist/v2/files/import.d.ts +34 -0
- package/dist/v2/files/index.d.ts +16 -0
- package/dist/v2/files/pdf.d.ts +15 -0
- package/dist/v2/files/pdfImport.d.ts +28 -0
- package/dist/v2/files/sheet.d.ts +16 -0
- package/dist/v2/files/text.d.ts +8 -0
- package/dist/v2/files/types.d.ts +96 -0
- package/dist/v2/files/ui/ExportDock.d.ts +11 -0
- package/dist/v2/files/ui/ExportMenu.d.ts +5 -0
- package/dist/v2/files/ui/ExportPanel.d.ts +17 -0
- package/dist/v2/files/ui/FileEditor.d.ts +14 -0
- package/dist/v2/files/ui/HtmlWorkbench.d.ts +15 -0
- package/dist/v2/files/ui/codeEditor.d.ts +12 -0
- package/dist/v2/files/ui/editors.d.ts +28 -0
- package/dist/v2/files/vector.d.ts +19 -0
- package/dist/v2/files/zip.d.ts +10 -0
- package/dist/v2/host/HostContext.d.ts +6 -3
- package/dist/v2/index.d.ts +5 -1
- package/dist/v2-compile.js +17 -16
- package/dist/v2-files.js +3 -0
- package/dist/v2-strata.js +2 -2
- package/dist/v2.js +5805 -4038
- package/package.json +18 -3
|
@@ -46,64 +46,64 @@ var t = /* @__PURE__ */ "Roboto|s|123456789.Open Sans|s|345678.Inter|s|123456789
|
|
|
46
46
|
function h(e) {
|
|
47
47
|
return e.split(",")[0].trim().replace(/^['"]|['"]$/g, "");
|
|
48
48
|
}
|
|
49
|
-
var g = (e) => /^[A-Za-z0-9][A-Za-z0-9 ]{0,63}$/.test(e) && !m(e),
|
|
49
|
+
var g = (e) => /^[A-Za-z0-9][A-Za-z0-9 ]{0,63}$/.test(e) && !m(e), te = (e) => p(e)?.stack ?? `${o(e)}, ${n}`, _ = [
|
|
50
50
|
400,
|
|
51
51
|
500,
|
|
52
52
|
600,
|
|
53
53
|
700
|
|
54
54
|
];
|
|
55
|
-
function
|
|
55
|
+
function v(e, t = []) {
|
|
56
56
|
let n = p(e)?.weights;
|
|
57
57
|
if (!n) return [];
|
|
58
|
-
let r = new Set([...
|
|
58
|
+
let r = new Set([..._, ...t].filter((e) => n.includes(e)));
|
|
59
59
|
return r.size || r.add(n.includes(400) ? 400 : n[0]), [...r].sort((e, t) => e - t);
|
|
60
60
|
}
|
|
61
|
-
var
|
|
62
|
-
function
|
|
61
|
+
var y = (e) => encodeURIComponent(e).replace(/%20/g, "+");
|
|
62
|
+
function b(e) {
|
|
63
63
|
let t = e.map((e) => typeof e == "string" ? { family: e } : e).filter((e) => g(e.family)), n = [], r = [], i = /* @__PURE__ */ new Set();
|
|
64
64
|
for (let e of t) {
|
|
65
65
|
let t = e.family.toLowerCase();
|
|
66
66
|
if (i.has(t)) continue;
|
|
67
67
|
i.add(t);
|
|
68
68
|
let a = p(e.family);
|
|
69
|
-
a ? n.push(`family=${
|
|
69
|
+
a ? n.push(`family=${y(a.name)}:wght@${v(a.name, e.weights).join(";")}`) : r.push(`https://fonts.googleapis.com/css?family=${y(e.family)}:400,700&display=swap`);
|
|
70
70
|
}
|
|
71
71
|
return [...n.length ? [`https://fonts.googleapis.com/css2?${n.join("&")}&display=swap`] : [], ...r];
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function x(e) {
|
|
74
74
|
let t = p(e);
|
|
75
75
|
if (!t) return null;
|
|
76
76
|
let n = encodeURIComponent(`${t.name} AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789$%&!?.,'-`);
|
|
77
|
-
return `https://fonts.googleapis.com/css2?family=${
|
|
77
|
+
return `https://fonts.googleapis.com/css2?family=${y(t.name)}&text=${n}&display=swap`;
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/v2/design/customFonts.ts
|
|
81
|
-
var
|
|
81
|
+
var ne = 12, S = 12, C = 3e6, re = ".woff2,.woff,.ttf,.otf,font/woff2,font/woff,font/ttf,font/otf", ie = /^[A-Za-z0-9][A-Za-z0-9 ]{0,47}$/, ae = [
|
|
82
82
|
"woff2",
|
|
83
83
|
"woff",
|
|
84
84
|
"truetype",
|
|
85
85
|
"opentype"
|
|
86
|
-
],
|
|
86
|
+
], oe = /^data:(?:font\/(?:woff2?|ttf|otf|sfnt)|application\/(?:font-woff2?|x-font-(?:woff2?|ttf|otf|truetype|opentype)|vnd\.ms-fontobject|octet-stream));base64,[A-Za-z0-9+/=]+$/i;
|
|
87
87
|
function w(e) {
|
|
88
|
-
return typeof e != "string" || /[\s"'\\()<>]/.test(e) ? !1 : e.startsWith("data:") ? e.length <= 56e4 &&
|
|
88
|
+
return typeof e != "string" || /[\s"'\\()<>]/.test(e) ? !1 : e.startsWith("data:") ? e.length <= 56e4 && oe.test(e) : e.length > 2e3 ? !1 : /^https:\/\/[^/?#]+(?:[/?#]|$)/i.test(e) || /^\/(?!\/)/.test(e);
|
|
89
89
|
}
|
|
90
|
-
var
|
|
90
|
+
var se = (e) => {
|
|
91
91
|
let t = typeof e == "string" ? Number(e) : e;
|
|
92
92
|
return typeof t == "number" && Number.isInteger(t) && t >= 100 && t <= 900 && t % 100 == 0 ? t : null;
|
|
93
93
|
};
|
|
94
|
-
function
|
|
94
|
+
function T(e) {
|
|
95
95
|
if (!Array.isArray(e)) return [];
|
|
96
96
|
let t = [];
|
|
97
97
|
for (let n of e) {
|
|
98
98
|
if (t.length >= 12) break;
|
|
99
99
|
if (!n || typeof n != "object") continue;
|
|
100
100
|
let e = typeof n.family == "string" ? n.family.trim().replace(/\s+/g, " ") : "";
|
|
101
|
-
if (!
|
|
101
|
+
if (!ie.test(e) || m(e)) continue;
|
|
102
102
|
let r = Array.isArray(n.variants) ? n.variants : [], i = [];
|
|
103
103
|
for (let e of r) {
|
|
104
104
|
if (i.length >= 12 || !e || typeof e != "object") continue;
|
|
105
|
-
let t =
|
|
106
|
-
if (t === null || !w(e.url) || !
|
|
105
|
+
let t = se(e.weight), n = e.style === "italic" ? "italic" : "normal";
|
|
106
|
+
if (t === null || !w(e.url) || !ae.includes(e.format)) continue;
|
|
107
107
|
let r = i.findIndex((e) => e.weight === t && e.style === n), a = {
|
|
108
108
|
weight: t,
|
|
109
109
|
style: n,
|
|
@@ -116,7 +116,7 @@ function E(e) {
|
|
|
116
116
|
let a = t.findIndex((t) => t.family.toLowerCase() === e.toLowerCase());
|
|
117
117
|
a >= 0 ? t[a] = {
|
|
118
118
|
family: t[a].family,
|
|
119
|
-
variants:
|
|
119
|
+
variants: E(t[a].variants, i)
|
|
120
120
|
} : t.push({
|
|
121
121
|
family: e,
|
|
122
122
|
variants: i.sort((e, t) => e.weight - t.weight || e.style.localeCompare(t.style))
|
|
@@ -124,7 +124,7 @@ function E(e) {
|
|
|
124
124
|
}
|
|
125
125
|
return t;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function E(e, t) {
|
|
128
128
|
let n = [...e];
|
|
129
129
|
for (let e of t) {
|
|
130
130
|
let t = n.findIndex((t) => t.weight === e.weight && t.style === e.style);
|
|
@@ -132,9 +132,9 @@ function se(e, t) {
|
|
|
132
132
|
}
|
|
133
133
|
return n.slice(0, 12).sort((e, t) => e.weight - t.weight || e.style.localeCompare(t.style));
|
|
134
134
|
}
|
|
135
|
-
var
|
|
136
|
-
function
|
|
137
|
-
let r =
|
|
135
|
+
var D = (e) => e?.fonts ?? [], O = (e, t) => e?.find((e) => e.family.toLowerCase() === t.trim().toLowerCase());
|
|
136
|
+
function k(e, t, n) {
|
|
137
|
+
let r = T([...e.fonts ?? [], {
|
|
138
138
|
family: t,
|
|
139
139
|
variants: [n]
|
|
140
140
|
}]);
|
|
@@ -143,7 +143,7 @@ function ue(e, t, n) {
|
|
|
143
143
|
fonts: r
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function A(e, t) {
|
|
147
147
|
let n = (e.fonts ?? []).filter((e) => e.family.toLowerCase() !== t.toLowerCase());
|
|
148
148
|
if (n.length === (e.fonts ?? []).length) return e;
|
|
149
149
|
let { fonts: r, ...i } = e;
|
|
@@ -152,12 +152,12 @@ function D(e, t) {
|
|
|
152
152
|
fonts: n
|
|
153
153
|
} : i;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function j(e, t) {
|
|
156
156
|
let n = [];
|
|
157
|
-
for (let r of
|
|
157
|
+
for (let r of T(e)) if (!(t && !t.has(r.family.toLowerCase()))) for (let e of r.variants) n.push(`@font-face{font-family:"${r.family}";font-style:${e.style};font-weight:${e.weight};font-display:swap;src:url("${e.url}") format("${e.format}")}`);
|
|
158
158
|
return n.join("\n");
|
|
159
159
|
}
|
|
160
|
-
var
|
|
160
|
+
var M = [
|
|
161
161
|
[/extra[\s_-]?light|ultra[\s_-]?light|\bxlight\b/i, 200],
|
|
162
162
|
[/\bthin\b|hairline/i, 100],
|
|
163
163
|
[/semi[\s_-]?bold|demi[\s_-]?bold/i, 600],
|
|
@@ -168,14 +168,14 @@ var k = [
|
|
|
168
168
|
[/\blight\b/i, 300],
|
|
169
169
|
[/\bregular\b|\bnormal\b|\bbook\b/i, 400]
|
|
170
170
|
];
|
|
171
|
-
function
|
|
171
|
+
function N(e, t = "") {
|
|
172
172
|
let n = /\.([A-Za-z0-9]+)$/.exec(e)?.[1]?.toLowerCase() ?? "", r = n === "woff2" || /woff2/.test(t) ? "woff2" : n === "woff" || /woff/.test(t) ? "woff" : n === "ttf" || /ttf|truetype/.test(t) ? "truetype" : n === "otf" || /otf|opentype/.test(t) ? "opentype" : null, i = e.replace(/\.[A-Za-z0-9]+$/, "").replace(/[_]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/-/g, " "), a = ` ${i} `, o = /italic|oblique/i.test(a) ? "italic" : "normal", s = 400;
|
|
173
|
-
for (let [e, t] of
|
|
173
|
+
for (let [e, t] of M) if (e.test(a)) {
|
|
174
174
|
s = t;
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
let c = i.replace(/italic|oblique/gi, " ");
|
|
178
|
-
for (let [e] of
|
|
178
|
+
for (let [e] of M) c = c.replace(new RegExp(e.source, "gi"), " ");
|
|
179
179
|
return c = c.replace(/[^A-Za-z0-9 ]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 48), {
|
|
180
180
|
family: c,
|
|
181
181
|
weight: s,
|
|
@@ -183,7 +183,7 @@ function A(e, t = "") {
|
|
|
183
183
|
format: r
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
var
|
|
186
|
+
var P = {
|
|
187
187
|
100: "Thin",
|
|
188
188
|
200: "Extra light",
|
|
189
189
|
300: "Light",
|
|
@@ -196,27 +196,27 @@ var j = {
|
|
|
196
196
|
};
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region src/v2/design/tokens.ts
|
|
199
|
-
function
|
|
199
|
+
function F(e) {
|
|
200
200
|
let t = String(e.value), n = e.unit && e.unit !== "null" ? e.unit : "";
|
|
201
201
|
return !n || t.endsWith(n) || t.includes("var(") || t.includes("calc(") ? t : `${t}${n}`;
|
|
202
202
|
}
|
|
203
|
-
var
|
|
204
|
-
function
|
|
203
|
+
var I = (e) => `var(${e})`;
|
|
204
|
+
function L(e) {
|
|
205
205
|
let t = /^\s*var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,.*)?\)\s*$/.exec(e);
|
|
206
206
|
return t ? t[1] : null;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function R(e) {
|
|
209
209
|
return new Map(e.tokens.map((e) => [e.key, e]));
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function z(e, t) {
|
|
212
212
|
return e.tokens.find((e) => e.key === t);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
214
|
+
function B(e, t) {
|
|
215
|
+
return z(e, t)?.value;
|
|
216
216
|
}
|
|
217
|
-
var
|
|
218
|
-
function
|
|
219
|
-
let i =
|
|
217
|
+
var V = (e) => /^#[0-9a-f]{3,8}$/i.test(e) || /^(rgb|hsl)a?\(/i.test(e) ? "color" : /^-?\d*\.?\d+(px|rem|em|%)$/.test(e) ? "dimension" : /^-?\d*\.?\d+$/.test(e) ? "number" : "string", H = (e) => e.replace(/^--/, "").split("-").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join(" ");
|
|
218
|
+
function U(e, t, n, r = {}) {
|
|
219
|
+
let i = z(e, t);
|
|
220
220
|
if (i) return i.value === n && (r.unit === void 0 || r.unit === i.unit) ? e : {
|
|
221
221
|
...e,
|
|
222
222
|
tokens: e.tokens.map((e) => e.key === t ? {
|
|
@@ -227,9 +227,9 @@ function B(e, t, n, r = {}) {
|
|
|
227
227
|
};
|
|
228
228
|
let a = r.layer ?? "brand", o = {
|
|
229
229
|
key: t,
|
|
230
|
-
name: r.name ??
|
|
230
|
+
name: r.name ?? H(t),
|
|
231
231
|
value: n,
|
|
232
|
-
type: r.type ??
|
|
232
|
+
type: r.type ?? V(n),
|
|
233
233
|
unit: r.unit ?? null,
|
|
234
234
|
layer: a,
|
|
235
235
|
comment: r.comment ?? null
|
|
@@ -239,42 +239,42 @@ function B(e, t, n, r = {}) {
|
|
|
239
239
|
tokens: [...e.tokens, o]
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function W(e, t) {
|
|
243
243
|
let n = e;
|
|
244
|
-
for (let [e, r] of Object.entries(t)) n =
|
|
244
|
+
for (let [e, r] of Object.entries(t)) n = U(n, e, r);
|
|
245
245
|
return n;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function G(e, t) {
|
|
248
248
|
return e.tokens.some((e) => e.key === t) ? {
|
|
249
249
|
...e,
|
|
250
250
|
tokens: e.tokens.filter((e) => e.key !== t)
|
|
251
251
|
} : e;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
let r = e instanceof Map ? e :
|
|
253
|
+
function K(e, t, n = 0) {
|
|
254
|
+
let r = e instanceof Map ? e : R(e), i = L(t);
|
|
255
255
|
if (!i || n > 12) return t;
|
|
256
256
|
let a = r.get(i);
|
|
257
257
|
if (!a) {
|
|
258
258
|
let e = /^\s*var\(\s*--[A-Za-z0-9_-]+\s*,\s*(.*)\)\s*$/.exec(t)?.[1];
|
|
259
|
-
return e ?
|
|
259
|
+
return e ? K(r, e.trim(), n + 1) : t;
|
|
260
260
|
}
|
|
261
|
-
return
|
|
261
|
+
return K(r, F(a), n + 1);
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
let n =
|
|
265
|
-
return n ?
|
|
263
|
+
function ce(e, t) {
|
|
264
|
+
let n = z(e, t);
|
|
265
|
+
return n ? K(e, F(n)) : void 0;
|
|
266
266
|
}
|
|
267
267
|
//#endregion
|
|
268
268
|
//#region src/v2/design/lint.ts
|
|
269
|
-
var
|
|
270
|
-
function*
|
|
269
|
+
var q = { "--color-border-muted": "--color-border-subtle" }, le = /var\(\s*(--[A-Za-z0-9_-]+)/g, J = (e) => [...e.matchAll(le)].map((e) => e[1]);
|
|
270
|
+
function* Y(e) {
|
|
271
271
|
for (let t of e ?? []) {
|
|
272
272
|
for (let e of Object.values(t.properties ?? {})) yield String(e.value);
|
|
273
273
|
for (let e of Object.values(t.variants ?? {})) for (let t of Object.values(e.properties ?? {})) yield String(t.value);
|
|
274
|
-
yield*
|
|
274
|
+
yield* Y(t.children);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function ue(t) {
|
|
278
278
|
let n = [], r = /* @__PURE__ */ new Map();
|
|
279
279
|
for (let e of t.tokens) r.set(e.key, (r.get(e.key) ?? 0) + 1);
|
|
280
280
|
for (let i of t.tokens) {
|
|
@@ -289,7 +289,7 @@ function pe(t) {
|
|
|
289
289
|
message: `${i.key} is defined more than once; only one value can win.`,
|
|
290
290
|
fixable: !0
|
|
291
291
|
});
|
|
292
|
-
let a = String(i.value), o =
|
|
292
|
+
let a = String(i.value), o = J(a);
|
|
293
293
|
o.length && i.unit && i.unit !== "null" && n.push({
|
|
294
294
|
kind: "unit-on-reference",
|
|
295
295
|
key: i.key,
|
|
@@ -319,7 +319,7 @@ function pe(t) {
|
|
|
319
319
|
let t = /* @__PURE__ */ new Set(), r = e.key;
|
|
320
320
|
for (; r && !t.has(r);) {
|
|
321
321
|
t.add(r);
|
|
322
|
-
let e =
|
|
322
|
+
let e = L(String(i.get(r)?.value ?? ""));
|
|
323
323
|
r = e && i.has(e) ? e : void 0;
|
|
324
324
|
}
|
|
325
325
|
r && !a.has(r) && (a.add(r), n.push({
|
|
@@ -330,29 +330,29 @@ function pe(t) {
|
|
|
330
330
|
}));
|
|
331
331
|
}
|
|
332
332
|
let o = /* @__PURE__ */ new Set();
|
|
333
|
-
for (let e of t.components) for (let t of
|
|
333
|
+
for (let e of t.components) for (let t of Y(e.nodes)) for (let i of J(t)) !r.has(i) && !o.has(`${e.name}:${i}`) && (o.add(`${e.name}:${i}`), n.push({
|
|
334
334
|
kind: "dangling-reference",
|
|
335
335
|
key: e.name,
|
|
336
336
|
message: `The ${e.name} component uses ${i}, which doesn't exist.`,
|
|
337
|
-
fixable: i in
|
|
337
|
+
fixable: i in q
|
|
338
338
|
}));
|
|
339
339
|
return n;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function X(e, t, n = 0) {
|
|
342
342
|
return n > 12 ? e : e.replace(/var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,[^)]*)?\)/g, (e, r) => {
|
|
343
343
|
let i = t.get(r);
|
|
344
344
|
if (!i) return e;
|
|
345
345
|
let a = i.unit && i.unit !== "null" ? i.unit : "", o = String(i.value);
|
|
346
|
-
return
|
|
346
|
+
return X(!a || o.endsWith(a) || o.includes("var(") || o.includes("calc(") ? o : `${o}${a}`, t, n + 1);
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
var
|
|
350
|
-
function
|
|
349
|
+
var Z = (e) => e.replace(/var\(\s*(--[A-Za-z0-9_-]+)/g, (e, t) => q[t] ? e.replace(t, q[t]) : e);
|
|
350
|
+
function Q(e) {
|
|
351
351
|
let t = !1, n = (e) => {
|
|
352
352
|
if (!e) return e;
|
|
353
353
|
let n = {};
|
|
354
354
|
for (let [r, i] of Object.entries(e)) {
|
|
355
|
-
let e =
|
|
355
|
+
let e = Z(String(i.value));
|
|
356
356
|
e !== i.value && (t = !0), n[r] = e === i.value ? i : {
|
|
357
357
|
...i,
|
|
358
358
|
value: e
|
|
@@ -363,7 +363,7 @@ function me(e) {
|
|
|
363
363
|
if (!e) return e;
|
|
364
364
|
let n = {};
|
|
365
365
|
for (let [r, i] of Object.entries(e)) {
|
|
366
|
-
let e =
|
|
366
|
+
let e = Z(String(i));
|
|
367
367
|
e !== i && (t = !0), n[r] = e;
|
|
368
368
|
}
|
|
369
369
|
return n;
|
|
@@ -379,23 +379,23 @@ function me(e) {
|
|
|
379
379
|
changed: t
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
var
|
|
382
|
+
var de = /^-?\d*\.?\d+(px|rem|em|%|vh|vw)$|^#[0-9a-f]{3,8}$/i, $ = (e) => {
|
|
383
383
|
let t = String(e).trim().toLowerCase().replace(/\s+/g, ""), n = /^(-?\d*\.?\d+)rem$/.exec(t);
|
|
384
384
|
return n ? `${parseFloat(n[1]) * 16}px` : t;
|
|
385
385
|
};
|
|
386
|
-
function
|
|
386
|
+
function fe(e, t) {
|
|
387
387
|
if (!e) return e;
|
|
388
388
|
let n;
|
|
389
389
|
for (let [r, i] of Object.entries(e)) {
|
|
390
|
-
if (typeof i != "string" || !
|
|
390
|
+
if (typeof i != "string" || !de.test(i.trim())) continue;
|
|
391
391
|
n ??= { ...e };
|
|
392
|
-
let a = t.find((e) => e.layer === "semantic" &&
|
|
392
|
+
let a = t.find((e) => e.layer === "semantic" && $(`${e.value}${e.unit && e.unit !== "null" && !String(e.value).endsWith(e.unit) ? e.unit : ""}`) === $(i));
|
|
393
393
|
a ? n[r] = `var(${a.key})` : delete n[r];
|
|
394
394
|
}
|
|
395
395
|
return n ?? e;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
let t = !1, n = /* @__PURE__ */ new Set(), r = e.tokens.filter((e) => n.has(e.key) ? (t = !0, !1) : (n.add(e.key), !0)).map((e) =>
|
|
397
|
+
function pe(e) {
|
|
398
|
+
let t = !1, n = /* @__PURE__ */ new Set(), r = e.tokens.filter((e) => n.has(e.key) ? (t = !0, !1) : (n.add(e.key), !0)).map((e) => J(String(e.value)).length && e.unit && e.unit !== "null" ? (t = !0, {
|
|
399
399
|
...e,
|
|
400
400
|
unit: null
|
|
401
401
|
}) : e), i = r.find((e) => e.key === "--semantic-shadow-focus");
|
|
@@ -416,9 +416,9 @@ function _e(e) {
|
|
|
416
416
|
}
|
|
417
417
|
let a = new Map(r.map((e) => [e.key, e]));
|
|
418
418
|
r = r.map((e) => {
|
|
419
|
-
if (e.layer === "brand" &&
|
|
420
|
-
let n =
|
|
421
|
-
if (n !== e.value && !
|
|
419
|
+
if (e.layer === "brand" && J(String(e.value)).length) {
|
|
420
|
+
let n = X(String(e.value), a);
|
|
421
|
+
if (n !== e.value && !J(n).length) return t = !0, {
|
|
422
422
|
...e,
|
|
423
423
|
value: n
|
|
424
424
|
};
|
|
@@ -426,7 +426,7 @@ function _e(e) {
|
|
|
426
426
|
return e;
|
|
427
427
|
});
|
|
428
428
|
let o = new Set(r.map((e) => e.key)), s = r.find((e) => e.key === "--font-family-sans");
|
|
429
|
-
for (let e of [...r]) for (let n of
|
|
429
|
+
for (let e of [...r]) for (let n of J(String(e.value))) o.has(n) || (n === "--font-family-heading" || n === "--font-family-body") && s && (o.add(n), t = !0, r = [...r, {
|
|
430
430
|
key: n,
|
|
431
431
|
name: n === "--font-family-heading" ? "Font Family Heading" : "Font Family Body",
|
|
432
432
|
value: s.value,
|
|
@@ -436,7 +436,7 @@ function _e(e) {
|
|
|
436
436
|
comment: n === "--font-family-heading" ? "Heading font" : "Body font"
|
|
437
437
|
}]);
|
|
438
438
|
let c = e.components, l = e.components.map((e) => {
|
|
439
|
-
let t =
|
|
439
|
+
let t = Q(e.nodes), n = fe(e.props, r);
|
|
440
440
|
return !t.changed && n === e.props ? e : {
|
|
441
441
|
...e,
|
|
442
442
|
nodes: t.changed ? t.nodes ?? e.nodes : e.nodes,
|
|
@@ -446,7 +446,7 @@ function _e(e) {
|
|
|
446
446
|
l.some((t, n) => t !== e.components[n]) && (c = l, t = !0);
|
|
447
447
|
let u = e.fonts;
|
|
448
448
|
if (u !== void 0) {
|
|
449
|
-
let e =
|
|
449
|
+
let e = T(u);
|
|
450
450
|
JSON.stringify(e) !== JSON.stringify(u) && (u = e, t = !0);
|
|
451
451
|
}
|
|
452
452
|
if (!t) return e;
|
|
@@ -458,35 +458,4 @@ function _e(e) {
|
|
|
458
458
|
return u?.length ? d.fonts = u : delete d.fonts, d;
|
|
459
459
|
}
|
|
460
460
|
//#endregion
|
|
461
|
-
|
|
462
|
-
var X = (e) => e.replace(/^--/, ""), ve = (e) => [...e].sort((e, t) => e.key.localeCompare(t.key, void 0, { numeric: !0 }));
|
|
463
|
-
function ye(e) {
|
|
464
|
-
return `:root {\n${e.tokens.map((e) => ` ${e.key}: ${M(e)};`).join("\n")}\n}\n`;
|
|
465
|
-
}
|
|
466
|
-
function be(e) {
|
|
467
|
-
return `// ${e.name ?? "Brand"} — generated from the design system. Each variable reads its CSS custom property.\n${e.tokens.map((e) => `$${X(e.key)}: var(${e.key});`).join("\n")}\n`;
|
|
468
|
-
}
|
|
469
|
-
var xe = (e) => `- ${e.key}: ${M(e)}`, Z = (e, t) => ve(e.tokens.filter((e) => e.layer !== "component" && t(e))), Q = 30, $ = (e, t) => {
|
|
470
|
-
if (!t.length) return "";
|
|
471
|
-
let n = t.slice(0, Q).map(xe);
|
|
472
|
-
return t.length > Q && n.push(`- …and ${t.length - Q} more`), `## ${e}\n${n.join("\n")}\n\n`;
|
|
473
|
-
};
|
|
474
|
-
function Se(e) {
|
|
475
|
-
let t = (t) => Z(e, (e) => e.key.startsWith(t));
|
|
476
|
-
return [
|
|
477
|
-
`# ${e.name ?? "Brand"} guidelines${e.strata?.projectName ? ` (from Strata: ${e.strata.projectName})` : ""}\n\n`,
|
|
478
|
-
"Rules\n- Never write a colour, font, size, spacing or corner value by hand. Use the variable below, as var(--name).\n- Brand colours: use the action and text colours for buttons and copy, the background colours for sections, the state colours for success, warning and error.\n- If something you need isn't below, pick the nearest variable. Don't invent a hex colour.\n- Headings use var(--font-family-heading), body text var(--font-family-body).\n- Spacing comes from the --space-* scale and corners from --radius-*.\n\n",
|
|
479
|
-
$("Brand colours", t("--color-brand-")),
|
|
480
|
-
$("Meaning colours (use these in layouts)", Z(e, (e) => e.type === "color" && /^--color-(action|bg|text|border|state)-/.test(e.key))),
|
|
481
|
-
$("Neutral greys", t("--color-neutral-")),
|
|
482
|
-
$("Fonts", Z(e, (e) => e.type === "font family" && !e.key.startsWith("--semantic-"))),
|
|
483
|
-
$("Text sizes", t("--font-size-")),
|
|
484
|
-
$("Font weights", Z(e, (e) => e.type === "font weight" && !e.key.startsWith("--semantic-"))),
|
|
485
|
-
$("Spacing", t("--space-")),
|
|
486
|
-
$("Corners", t("--radius-")),
|
|
487
|
-
$("Shadows", Z(e, (e) => e.type === "shadow" && !e.key.startsWith("--semantic-"))),
|
|
488
|
-
e.components.length ? `## Components\n${[...new Set(e.components.map((e) => e.name))].join(", ")}. Their looks come from the variables above.\n` : ""
|
|
489
|
-
].join("").trim() + "\n";
|
|
490
|
-
}
|
|
491
|
-
//#endregion
|
|
492
|
-
export { E as A, y as B, ue as C, A as D, le as E, te as F, g as I, m as L, l as M, p as N, w as O, ne as P, h as R, j as S, ce as T, F as _, _e as a, ae as b, z as c, H as d, de as f, M as g, V as h, pe as i, d as j, D as k, N as l, B as m, Se as n, I as o, U as p, be as r, L as s, ye as t, P as u, oe as v, O as w, ie as x, re as y, _ as z };
|
|
461
|
+
export { p as A, O as C, T as D, A as E, h as F, te as I, v as L, b as M, g as N, d as O, m as P, D as S, w as T, C as _, H as a, k as b, G as c, U as d, W as f, ne as g, re as h, B as i, x as j, l as k, ce as l, R as m, pe as n, I as o, F as p, z as r, L as s, ue as t, K as u, S as v, N as w, j as x, P as y };
|