@charisol/plexo-sdk 2.0.4 → 2.0.6

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 CHANGED
@@ -247,10 +247,10 @@ The editor fills its container (give the parent a height), and it is client-only
247
247
  | | Where it lives | Examples |
248
248
  |---|---|---|
249
249
  | **SDK default** — works with no configuration | inside the editor | the whole editing UI, undo (one step per gesture), snapping, desktop/tablet/mobile frames, keyboard shortcuts (scoped to the editor, never the host page), the colour picker, Fit-to-screen, the nine elements, image upload that embeds small images, a blank starting page |
250
- | **Host prop** — needs the host's server, accounts or secrets | `<V2Editor … />` props | saving (`onSave`, `onPublish`, `autoSave`), files (`onUpload`, `media`, `stockImages`), AI (`onAskSol`), brand colours (`colors`), ready-made sections (`sections`), link targets (`linkTargets`), where forms send (`formAction`, `apiKey`, `templateId`), permissions (`readOnly`, `commentMode`), header slots, turning panels off (`features`) |
250
+ | **Host prop** — needs the host's server, accounts or secrets | `<V2Editor … />` props | saving (`onSave`, `onPublish`, `autoSave`), files (`onUpload`, `onUploadFont`, `media`, `stockImages`), AI (`onAskSol`), brand colours (`colors`), ready-made sections (`sections`), link targets (`linkTargets`), where forms send (`formAction`, `apiKey`, `templateId`), permissions (`readOnly`, `commentMode`), header slots, turning panels off (`features`) |
251
251
  | **Separate entry** — no React, runs on a server | `@charisol/plexo-sdk/v2/compile` | `compilePageToHtml`, `compilePageToReact`, `parsePages`, `convertLegacyDesign`, frame sizes, `computePlacements` |
252
252
 
253
- Nothing is faked when a prop is missing: with no `onAskSol` the SOL button is hidden, with no `onSave` there is no Save button, with no `onUpload` images are embedded in the design (up to 1.5 MB) with a clear message beyond that. No provider key ever lives in the browser — AI and stock-image search go through the host, as in V1.
253
+ Nothing is faked when a prop is missing: with no `onAskSol` the SOL button is hidden, with no `onSave` there is no Save button, with no `onUpload` images are embedded in the design (up to 1.5 MB) with a clear message beyond that; with no `onUploadFont` the font picker offers Google Fonts only (no "Add a font" button). Uploaded fonts are stored in the design system (`designSystem.fonts`) and compiled to `@font-face` rules; if the host stores font files on another origin, pass it to `sanitizeV2Html(html, { fontOrigins: [...] })`. `compilePageToHtml` also returns `head` (font `<link>` tags) and `fontLinks` for hosts that place `html` + `css` in their own page. No provider key ever lives in the browser — AI and stock-image search go through the host, as in V1.
254
254
 
255
255
  ### Where a form sends messages
256
256
 
@@ -1,4 +1,4 @@
1
- import { n as e } from "./lint-D-2x-Yeb.js";
1
+ import { n as e } from "./lint-CTTecyu_.js";
2
2
  //#region src/v2/strata/merge.ts
3
3
  function t(e) {
4
4
  return Array.isArray(e) ? `[${e.map(t).join(",")}]` : e && typeof e == "object" ? `{${Object.keys(e).sort().map((n) => `${JSON.stringify(n)}:${t(e[n])}`).join(",")}}` : JSON.stringify(e);
@@ -0,0 +1,429 @@
1
+ import { i as e } from "./colorUtils-ohNG3v1i.js";
2
+ //#region src/v2/design/googleFontsData.ts
3
+ var t = /* @__PURE__ */ "Roboto|s|123456789.Open Sans|s|345678.Inter|s|123456789.Montserrat|s|123456789.Poppins|s|123456789.Lato|s|13479.Arimo|s|4567.Roboto Condensed|s|123456789.Oswald|s|234567.Noto Sans|s|123456789.Roboto Mono|m|1234567.DM Sans|s|123456789.Raleway|s|123456789.Playfair Display|f|456789.Roboto Slab|f|123456789.Manrope|s|2345678.Rubik|s|3456789.Outfit|s|123456789.Nunito|s|23456789.Ubuntu|s|3457.Merriweather|f|3456789.Nunito Sans|s|23456789.Plus Jakarta Sans|s|2345678.Kanit|s|123456789.Bebas Neue|s|4.Work Sans|s|123456789.Lora|f|4567.Figtree|s|3456789.JetBrains Mono|m|12345678.Quicksand|s|34567.Barlow|s|123456789.PT Sans|s|47.Archivo|s|123456789.Mulish|s|23456789.Source Sans 3|s|23456789.Archivo Black|s|4.Prompt|s|123456789.Saira|s|123456789.Space Grotesk|s|34567.Bricolage Grotesque|s|2345678.Black Ops One|d|4.Fira Sans|s|123456789.Libre Baskerville|f|4567.Heebo|s|123456789.Jost|s|123456789.Cormorant Garamond|f|34567.Share Tech|s|4.Noto Serif|f|123456789.IBM Plex Sans|s|1234567.Barlow Condensed|s|123456789.Titillium Web|s|234679.Anton|s|4.Karla|s|2345678.Josefin Sans|s|1234567.Inter Tight|s|123456789.PT Serif|f|47.IBM Plex Mono|m|1234567.Libre Franklin|s|123456789.Smooch Sans|s|123456789.Inconsolata|m|23456789.Cairo|s|23456789.Mukta|s|2345678.EB Garamond|f|45678.Instrument Serif|f|4.Source Code Pro|m|23456789.Fraunces|f|123456789.Fjalla One|s|4.Lobster Two|d|47.Sora|s|12345678.Public Sans|s|123456789.Changa One|d|4.Assistant|s|2345678.Cabin|s|4567.Rajdhani|s|34567.Geist|s|123456789.Merriweather Sans|s|345678.Dancing Script|h|4567.Nanum Gothic|s|478.Lexend|s|123456789.Fredoka|s|34567.Ramabhadra|s|4.Instrument Sans|s|4567.Dosis|s|2345678.DM Serif Display|f|4.Anek Telugu|s|12345678.Newsreader|f|2345678.Red Hat Display|s|3456789.Source Serif 4|f|23456789.Cinzel|f|456789.Schibsted Grotesk|s|456789.Hind Siliguri|s|34567.Tajawal|s|2345789.Urbanist|s|123456789.Bitter|f|123456789.Oxygen|s|347.Caveat|h|4567.Hind|s|34567.Alfa Slab One|d|4.Google Sans Flex|s|123456789.Slabo 27px|f|4.Pacifico|h|4.Bungee|d|4.Crimson Text|f|467.Overpass|s|123456789.Geist Mono|m|123456789.Barlow Semi Condensed|s|123456789.Bodoni Moda|f|456789.Roboto Flex|s|123456789.Teko|s|34567.Chakra Petch|s|34567.M PLUS Rounded 1c|s|1345789.PT Sans Narrow|s|47.Orbitron|s|456789.Epilogue|s|123456789.DM Mono|m|345.Comfortaa|d|34567.Abel|s|4.Space Mono|m|47.M PLUS 1p|s|1345789.Zen Kaku Gothic New|s|34579.Almarai|s|3478.Shadows Into Light|h|4.Maven Pro|s|456789.Asap|s|123456789.Exo 2|s|123456789.Abril Fatface|d|4.Marcellus|f|4.Archivo Narrow|s|4567.Saira Condensed|s|123456789.Be Vietnam Pro|s|123456789.Questrial|s|4.Play|s|47.Unbounded|s|23456789.Great Vibes|h|4.Gravitas One|d|4.Hanken Grotesk|s|123456789.IBM Plex Sans Arabic|s|1234567.Spectral|f|2345678.Arvo|f|47.Sofia Sans|s|123456789.Lobster|d|4.Cormorant|f|34567.Albert Sans|s|123456789.Baloo 2|d|45678.Lexend Deca|s|123456789.League Spartan|s|123456789.Exo|s|123456789.Varela Round|s|4.Permanent Marker|h|4.IBM Plex Serif|f|1234567.Nanum Myeongjo|f|478.Red Hat Text|s|34567.Syne|s|45678.Geologica|s|123456789.Lilita One|d|4.Frank Ruhl Libre|f|3456789.Indie Flower|h|4.Amiri|f|47.Satisfy|h|4.Slabo 13px|f|4.Doppio One|s|4.Courier Prime|m|47.Atkinson Hyperlegible|s|47.Domine|f|4567.Yellowtail|h|4.Rethink Sans|s|45678.Noto Kufi Arabic|s|123456789.Alegreya Sans|s|1345789.Zilla Slab|f|34567.Fira Sans Condensed|s|123456789.ABeeZee|s|4.Yanone Kaffeesatz|s|234567.Luckiest Guy|d|4.Onest|s|123456789.Vollkorn|f|456789.Faustina|f|345678.Hammersmith One|s|4.LINE Seed JP|s|1478.Crimson Pro|f|23456789.Shippori Mincho|f|45678.Literata|f|23456789.Playfair|f|3456789.Roboto Serif|f|123456789.Montserrat Alternates|s|123456789.Quantico|s|47.Baskervville|f|4567.Noto Nastaliq Urdu|f|4567.Noto Naskh Arabic|f|4567.Press Start 2P|d|4.Asap Condensed|s|23456789.Catamaran|s|123456789.Rowdies|d|347.Bangers|d|4.Russo One|s|4.Bree Serif|f|4.Viga|s|4.Special Elite|d|4.Zen Maru Gothic|s|34579.Lexend Giga|s|123456789.News Cycle|s|47.Prata|f|4.Tinos|f|47.Alegreya|f|456789.Changa|s|2345678.Patua One|d|4.Tenor Sans|s|4.Khand|s|34567.Audiowide|d|4.Zeyada|h|4.Oxanium|d|2345678.Kalam|h|347.Golos Text|s|456789.Alata|s|4.Noticia Text|f|47.Amatic SC|h|47.Comic Neue|h|347.Hind Madurai|s|34567.Cantarell|s|47.Sarabun|s|12345678.IBM Plex Sans Condensed|s|1234567.Encode Sans|s|123456789.Righteous|d|4.Nanum Gothic Coding|h|47.Gothic A1|s|123456789.Fira Code|m|34567.Aleo|f|123456789.Libre Caslon Text|f|47.Chivo|s|123456789.Sawarabi Mincho|f|4.Sanchez|f|4.Courgette|h|4.Antic Slab|f|4.Kumbh Sans|s|123456789.Quattrocento|f|47.Old Standard TT|f|47.Cardo|f|47.Crete Round|f|4.Sawarabi Gothic|s|4.Antonio|s|1234567.League Gothic|s|4.DM Serif Text|f|4.STIX Two Text|f|4567.Philosopher|s|47.Signika|s|34567.Rubik Mono One|s|4.Passion One|d|479.Neuton|f|23478.Share Tech Mono|m|4.Gruppo|s|4.Kaushan Script|h|4.Sacramento|h|4.Francois One|s|4.VT323|m|4.Signika Negative|s|34567.Vazirmatn|s|123456789.Josefin Slab|f|1234567.Creepster|d|4.BIZ UDPGothic|s|47.Readex Pro|s|234567.Acme|s|4.Sen|s|45678.Titan One|d|4.Forum|d|4.Martel|f|2346789.Bevan|f|4.Unna|f|47.Biryani|s|2346789.Amaranth|s|47.Radio Canada|s|34567.Gilda Display|f|4.Pinyon Script|h|4.Didact Gothic|s|4.Encode Sans Condensed|s|123456789.Dela Gothic One|d|4.Saira Extra Condensed|s|123456789.Playfair Display SC|f|479.Playball|d|4.Delius|h|4.Ubuntu Condensed|s|4.Bai Jamjuree|s|234567.Oleo Script|d|47.Alex Brush|h|4.Merienda|h|3456789.Rammetto One|d|4.Alexandria|s|123456789.Michroma|s|4.Staatliches|d|4.Libre Barcode 39|d|4.Rokkitt|f|123456789.Sofia Sans Condensed|s|123456789.Gabarito|d|456789.Fugaz One|d|4.Kameron|f|4567.Krub|s|234567.IBM Plex Sans Thai|s|1234567.Concert One|d|4.Zen Old Mincho|f|45679.Poiret One|d|4.Quattrocento Sans|s|47.Cinzel Decorative|d|479.Andada Pro|f|45678.Libre Bodoni|f|4567.Racing Sans One|d|4.PT Mono|m|4.Lalezar|s|4.Architects Daughter|h|4.Bowlby One SC|d|4.Allura|h|4.Abhaya Libre|f|45678.Cookie|h|4.Italianno|h|4.Homemade Apple|h|4.Patrick Hand|h|4.Google Sans Code|m|345678.Yeseva One|d|4.Yantramanav|s|134579.Cormorant Infant|f|34567.Comic Relief|d|47.Chelsea Market|d|4.Unica One|d|4.Jua|s|4.GFS Didot|f|4.Goldman|d|47.Lustria|f|4.Paytone One|s|4.Gelasio|f|4567.Actor|s|4.Radio Canada Big|s|4567.Pathway Gothic One|s|4.Tektur|d|456789.Arsenal|s|47.Damion|h|4.Nanum Pen Script|h|4.Volkhov|f|47.Parisienne|h|4.Ubuntu Mono|m|47.Commissioner|s|123456789.Sofia Sans Extra Condensed|s|123456789.Host Grotesk|s|345678.Sorts Mill Goudy|f|4.Reenie Beanie|h|4.Hind Guntur|s|34567.PT Sans Caption|s|47.Lusitana|f|47.Petrona|f|123456789.Belleza|s|4.Cutive Mono|m|4.Sarala|s|47.DotGothic16|s|4.Fira Mono|m|457.Berkshire Swash|h|4.Caveat Brush|h|4.Advent Pro|s|123456789.Shippori Mincho B1|f|45678.Atkinson Hyperlegible Next|s|2345678.Istok Web|s|47.Jersey 25|d|4.Pirata One|d|4.Afacad|s|4567.Kosugi Maru|s|4.Saira Semi Condensed|s|123456789.Lemonada|d|34567.Sriracha|h|4.Rock Salt|h|4.Besley|f|456789.Gloria Hallelujah|h|4.M PLUS 1|s|123456789.Reddit Sans|s|23456789.Mrs Saint Delafield|h|4.Rozha One|f|4.Arapey|f|4.Amita|h|47.Alumni Sans|s|123456789.El Messiri|s|4567.Rye|d|4.Averia Serif Libre|d|347.Familjen Grotesk|s|4567.Pixelify Sans|d|4567.Julius Sans One|s|4.M PLUS 2|s|123456789.Tangerine|h|47.Alice|f|4.Blinker|s|12346789.Varela|s|4.Anonymous Pro|m|47.Reem Kufi|s|4567.BIZ UDGothic|s|47.Nothing You Could Do|h|4.Mona Sans|s|23456789.Monda|s|4567.Carlito|s|47.Jura|s|34567.Mukta Malar|s|2345678.Fira Sans Extra Condensed|s|123456789.Zen Kaku Gothic Antique|s|34579.Kaisei Decol|f|457.Eczar|f|45678.Ultra|f|4.Pangolin|h|4.Mitr|s|234567.Taviraj|f|123456789.Squada One|d|4.Italiana|s|4.Baloo Bhai 2|d|45678.Secular One|s|4.Red Hat Mono|m|34567.Monoton|d|4.Handlee|h|4.Mate|f|4.Marck Script|h|4.IBM Plex Sans JP|s|1234567.Vidaloka|f|4.Limelight|d|4.Six Caps|s|4.K2D|s|12345678.Mandali|s|4.Cousine|m|47.Germania One|d|4.Economica|s|47.Boogaloo|d|4".split("."), n = "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif", r = "ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif", i = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace", a = "cursive", o = (e) => /\s/.test(e) ? `'${e}'` : e, s = {
4
+ sans: n,
5
+ display: n,
6
+ serif: r,
7
+ mono: i,
8
+ handwriting: a
9
+ }, c = {
10
+ s: "sans",
11
+ f: "serif",
12
+ d: "display",
13
+ m: "mono",
14
+ h: "handwriting"
15
+ }, l = [
16
+ "Inter",
17
+ "Roboto",
18
+ "Open Sans",
19
+ "Montserrat",
20
+ "Poppins",
21
+ "Lato",
22
+ "DM Sans",
23
+ "Plus Jakarta Sans",
24
+ "Manrope",
25
+ "Work Sans",
26
+ "Nunito",
27
+ "Raleway",
28
+ "Playfair Display",
29
+ "Lora",
30
+ "Merriweather",
31
+ "DM Serif Display",
32
+ "Space Grotesk",
33
+ "Outfit",
34
+ "Oswald",
35
+ "Fraunces"
36
+ ], u = new Set(l), d = t.map((e) => {
37
+ let [t, n, r] = e.split("|"), i = c[n] ?? "sans";
38
+ return {
39
+ name: t,
40
+ kind: i,
41
+ stack: `${o(t)}, ${s[i]}`,
42
+ weights: [...r].map((e) => Number(e) * 100),
43
+ popular: u.has(t)
44
+ };
45
+ }), f = new Map(d.map((e) => [e.name.toLowerCase(), e])), p = (e) => f.get(e.trim().toLowerCase()), ee = /* @__PURE__ */ new Set(/* @__PURE__ */ "serif.sans-serif.monospace.cursive.fantasy.system-ui.ui-sans-serif.ui-serif.ui-monospace.ui-rounded.arial.helvetica.helvetica neue.georgia.times new roman.times.courier new.courier.verdana.tahoma.trebuchet ms.segoe ui.inherit.initial.unset.menlo.monaco.consolas.cambria.impact.comic sans ms".split(".")), m = (e) => ee.has(e.trim().toLowerCase());
46
+ function h(e) {
47
+ return e.split(",")[0].trim().replace(/^['"]|['"]$/g, "");
48
+ }
49
+ var g = (e) => /^[A-Za-z0-9][A-Za-z0-9 ]{0,63}$/.test(e) && !m(e), _ = (e) => p(e)?.stack ?? `${o(e)}, ${n}`, v = [
50
+ 400,
51
+ 500,
52
+ 600,
53
+ 700
54
+ ];
55
+ function y(e, t = []) {
56
+ let n = p(e)?.weights;
57
+ if (!n) return [];
58
+ let r = new Set([...v, ...t].filter((e) => n.includes(e)));
59
+ return r.size || r.add(n.includes(400) ? 400 : n[0]), [...r].sort((e, t) => e - t);
60
+ }
61
+ var b = (e) => encodeURIComponent(e).replace(/%20/g, "+");
62
+ function x(e) {
63
+ let t = e.map((e) => typeof e == "string" ? { family: e } : e).filter((e) => g(e.family)), n = [], r = [], i = /* @__PURE__ */ new Set();
64
+ for (let e of t) {
65
+ let t = e.family.toLowerCase();
66
+ if (i.has(t)) continue;
67
+ i.add(t);
68
+ let a = p(e.family);
69
+ a ? n.push(`family=${b(a.name)}:wght@${y(a.name, e.weights).join(";")}`) : r.push(`https://fonts.googleapis.com/css?family=${b(e.family)}:400,700&display=swap`);
70
+ }
71
+ return [...n.length ? [`https://fonts.googleapis.com/css2?${n.join("&")}&display=swap`] : [], ...r];
72
+ }
73
+ function S(e) {
74
+ let t = p(e);
75
+ if (!t) return null;
76
+ let n = encodeURIComponent(`${t.name} AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789$%&!?.,'-`);
77
+ return `https://fonts.googleapis.com/css2?family=${b(t.name)}&text=${n}&display=swap`;
78
+ }
79
+ //#endregion
80
+ //#region src/v2/design/customFonts.ts
81
+ var C = 12, w = 12, te = 3e6, ne = ".woff2,.woff,.ttf,.otf,font/woff2,font/woff,font/ttf,font/otf", re = /^[A-Za-z0-9][A-Za-z0-9 ]{0,47}$/, ie = [
82
+ "woff2",
83
+ "woff",
84
+ "truetype",
85
+ "opentype"
86
+ ], ae = /^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
+ function T(e) {
88
+ return typeof e != "string" || /[\s"'\\()<>]/.test(e) ? !1 : e.startsWith("data:") ? e.length <= 56e4 && ae.test(e) : e.length > 2e3 ? !1 : /^https:\/\/[^/?#]+(?:[/?#]|$)/i.test(e) || /^\/(?!\/)/.test(e);
89
+ }
90
+ var oe = (e) => {
91
+ let t = typeof e == "string" ? Number(e) : e;
92
+ return typeof t == "number" && Number.isInteger(t) && t >= 100 && t <= 900 && t % 100 == 0 ? t : null;
93
+ };
94
+ function E(e) {
95
+ if (!Array.isArray(e)) return [];
96
+ let t = [];
97
+ for (let n of e) {
98
+ if (t.length >= 12) break;
99
+ if (!n || typeof n != "object") continue;
100
+ let e = typeof n.family == "string" ? n.family.trim().replace(/\s+/g, " ") : "";
101
+ if (!re.test(e) || m(e)) continue;
102
+ let r = Array.isArray(n.variants) ? n.variants : [], i = [];
103
+ for (let e of r) {
104
+ if (i.length >= 12 || !e || typeof e != "object") continue;
105
+ let t = oe(e.weight), n = e.style === "italic" ? "italic" : "normal";
106
+ if (t === null || !T(e.url) || !ie.includes(e.format)) continue;
107
+ let r = i.findIndex((e) => e.weight === t && e.style === n), a = {
108
+ weight: t,
109
+ style: n,
110
+ url: e.url,
111
+ format: e.format
112
+ };
113
+ r >= 0 ? i[r] = a : i.push(a);
114
+ }
115
+ if (!i.length) continue;
116
+ let a = t.findIndex((t) => t.family.toLowerCase() === e.toLowerCase());
117
+ a >= 0 ? t[a] = {
118
+ family: t[a].family,
119
+ variants: D(t[a].variants, i)
120
+ } : t.push({
121
+ family: e,
122
+ variants: i.sort((e, t) => e.weight - t.weight || e.style.localeCompare(t.style))
123
+ });
124
+ }
125
+ return t;
126
+ }
127
+ function D(e, t) {
128
+ let n = [...e];
129
+ for (let e of t) {
130
+ let t = n.findIndex((t) => t.weight === e.weight && t.style === e.style);
131
+ t >= 0 ? n[t] = e : n.push(e);
132
+ }
133
+ return n.slice(0, 12).sort((e, t) => e.weight - t.weight || e.style.localeCompare(t.style));
134
+ }
135
+ var O = (e) => e?.fonts ?? [], k = (e, t) => e?.find((e) => e.family.toLowerCase() === t.trim().toLowerCase());
136
+ function A(e, t, n) {
137
+ let r = E([...e.fonts ?? [], {
138
+ family: t,
139
+ variants: [n]
140
+ }]);
141
+ return {
142
+ ...e,
143
+ fonts: r
144
+ };
145
+ }
146
+ function j(e, t) {
147
+ let n = (e.fonts ?? []).filter((e) => e.family.toLowerCase() !== t.toLowerCase());
148
+ if (n.length === (e.fonts ?? []).length) return e;
149
+ let { fonts: r, ...i } = e;
150
+ return n.length ? {
151
+ ...e,
152
+ fonts: n
153
+ } : i;
154
+ }
155
+ function M(e, t) {
156
+ let n = [];
157
+ for (let r of E(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
+ return n.join("\n");
159
+ }
160
+ var N = [
161
+ [/extra[\s_-]?light|ultra[\s_-]?light|\bxlight\b/i, 200],
162
+ [/\bthin\b|hairline/i, 100],
163
+ [/semi[\s_-]?bold|demi[\s_-]?bold/i, 600],
164
+ [/extra[\s_-]?bold|ultra[\s_-]?bold|\bxbold\b/i, 800],
165
+ [/\bblack\b|\bheavy\b/i, 900],
166
+ [/\bbold\b/i, 700],
167
+ [/\bmedium\b/i, 500],
168
+ [/\blight\b/i, 300],
169
+ [/\bregular\b|\bnormal\b|\bbook\b/i, 400]
170
+ ];
171
+ function P(e, t = "") {
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 N) if (e.test(a)) {
174
+ s = t;
175
+ break;
176
+ }
177
+ let c = i.replace(/italic|oblique/gi, " ");
178
+ for (let [e] of N) c = c.replace(new RegExp(e.source, "gi"), " ");
179
+ return c = c.replace(/[^A-Za-z0-9 ]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 48), {
180
+ family: c,
181
+ weight: s,
182
+ style: o,
183
+ format: r
184
+ };
185
+ }
186
+ var F = {
187
+ 100: "Thin",
188
+ 200: "Extra light",
189
+ 300: "Light",
190
+ 400: "Regular",
191
+ 500: "Medium",
192
+ 600: "Semibold",
193
+ 700: "Bold",
194
+ 800: "Extra bold",
195
+ 900: "Black"
196
+ };
197
+ //#endregion
198
+ //#region src/v2/design/tokens.ts
199
+ function I(e) {
200
+ let t = String(e.value), n = e.unit && e.unit !== "null" ? e.unit : "";
201
+ return !n || t.endsWith(n) || t.includes("var(") || t.includes("calc(") ? t : `${t}${n}`;
202
+ }
203
+ var L = (e) => `var(${e})`;
204
+ function R(e) {
205
+ let t = /^\s*var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,.*)?\)\s*$/.exec(e);
206
+ return t ? t[1] : null;
207
+ }
208
+ function z(e) {
209
+ return new Map(e.tokens.map((e) => [e.key, e]));
210
+ }
211
+ function B(e, t) {
212
+ return e.tokens.find((e) => e.key === t);
213
+ }
214
+ function V(e, t) {
215
+ return B(e, t)?.value;
216
+ }
217
+ var H = (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", U = (e) => e.replace(/^--/, "").split("-").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join(" ");
218
+ function W(e, t, n, r = {}) {
219
+ let i = B(e, t);
220
+ if (i) return i.value === n && (r.unit === void 0 || r.unit === i.unit) ? e : {
221
+ ...e,
222
+ tokens: e.tokens.map((e) => e.key === t ? {
223
+ ...e,
224
+ value: n,
225
+ ...r.unit === void 0 ? {} : { unit: r.unit }
226
+ } : e)
227
+ };
228
+ let a = r.layer ?? "brand", o = {
229
+ key: t,
230
+ name: r.name ?? U(t),
231
+ value: n,
232
+ type: r.type ?? H(n),
233
+ unit: r.unit ?? null,
234
+ layer: a,
235
+ comment: r.comment ?? null
236
+ };
237
+ return {
238
+ ...e,
239
+ tokens: [...e.tokens, o]
240
+ };
241
+ }
242
+ function G(e, t) {
243
+ let n = e;
244
+ for (let [e, r] of Object.entries(t)) n = W(n, e, r);
245
+ return n;
246
+ }
247
+ function K(e, t) {
248
+ return e.tokens.some((e) => e.key === t) ? {
249
+ ...e,
250
+ tokens: e.tokens.filter((e) => e.key !== t)
251
+ } : e;
252
+ }
253
+ function q(e, t, n = 0) {
254
+ let r = e instanceof Map ? e : z(e), i = R(t);
255
+ if (!i || n > 12) return t;
256
+ let a = r.get(i);
257
+ if (!a) {
258
+ let e = /^\s*var\(\s*--[A-Za-z0-9_-]+\s*,\s*(.*)\)\s*$/.exec(t)?.[1];
259
+ return e ? q(r, e.trim(), n + 1) : t;
260
+ }
261
+ return q(r, I(a), n + 1);
262
+ }
263
+ function se(e, t) {
264
+ let n = B(e, t);
265
+ return n ? q(e, I(n)) : void 0;
266
+ }
267
+ //#endregion
268
+ //#region src/v2/design/lint.ts
269
+ var J = { "--color-border-muted": "--color-border-subtle" }, ce = /var\(\s*(--[A-Za-z0-9_-]+)/g, Y = (e) => [...e.matchAll(ce)].map((e) => e[1]);
270
+ function* X(e) {
271
+ for (let t of e ?? []) {
272
+ for (let e of Object.values(t.properties ?? {})) yield String(e.value);
273
+ for (let e of Object.values(t.variants ?? {})) for (let t of Object.values(e.properties ?? {})) yield String(t.value);
274
+ yield* X(t.children);
275
+ }
276
+ }
277
+ function le(t) {
278
+ let n = [], r = /* @__PURE__ */ new Map();
279
+ for (let e of t.tokens) r.set(e.key, (r.get(e.key) ?? 0) + 1);
280
+ for (let i of t.tokens) {
281
+ /^--[A-Za-z0-9_-]+$/.test(i.key) || n.push({
282
+ kind: "bad-key",
283
+ key: i.key,
284
+ message: `"${i.key}" isn't a valid CSS variable name (it should look like --color-brand-primary).`,
285
+ fixable: !1
286
+ }), (r.get(i.key) ?? 0) > 1 && t.tokens.findIndex((e) => e.key === i.key) === t.tokens.indexOf(i) && n.push({
287
+ kind: "duplicate-key",
288
+ key: i.key,
289
+ message: `${i.key} is defined more than once; only one value can win.`,
290
+ fixable: !0
291
+ });
292
+ let a = String(i.value), o = Y(a);
293
+ o.length && i.unit && i.unit !== "null" && n.push({
294
+ kind: "unit-on-reference",
295
+ key: i.key,
296
+ message: `${i.key} points at another token but also has the unit "${i.unit}", which produces invalid CSS ("${a}${i.unit}").`,
297
+ fixable: !0
298
+ }), i.layer === "brand" && o.length && n.push({
299
+ kind: "brand-references-token",
300
+ key: i.key,
301
+ message: `${i.key} is a brand token, so it should hold a real value, not point at ${o[0]}.`,
302
+ fixable: !0
303
+ });
304
+ for (let e of o) !r.has(e) && !e.startsWith("--plx-") && n.push({
305
+ kind: "dangling-reference",
306
+ key: i.key,
307
+ message: `${i.key} points at ${e}, which doesn't exist, so it has no value.`,
308
+ fixable: !0
309
+ });
310
+ i.type === "color" && !o.length && !e(a) && !/^(currentcolor|inherit|transparent|none)$/i.test(a) && n.push({
311
+ kind: "invalid-color",
312
+ key: i.key,
313
+ message: `${i.key} is marked as a colour but "${a}" isn't one.`,
314
+ fixable: !1
315
+ });
316
+ }
317
+ let i = new Map(t.tokens.map((e) => [e.key, e])), a = /* @__PURE__ */ new Set();
318
+ for (let e of t.tokens) {
319
+ let t = /* @__PURE__ */ new Set(), r = e.key;
320
+ for (; r && !t.has(r);) {
321
+ t.add(r);
322
+ let e = R(String(i.get(r)?.value ?? ""));
323
+ r = e && i.has(e) ? e : void 0;
324
+ }
325
+ r && !a.has(r) && (a.add(r), n.push({
326
+ kind: "circular-reference",
327
+ key: r,
328
+ message: `${r} ends up pointing back at itself, so it can never resolve.`,
329
+ fixable: !1
330
+ }));
331
+ }
332
+ let o = /* @__PURE__ */ new Set();
333
+ for (let e of t.components) for (let t of X(e.nodes)) for (let i of Y(t)) !r.has(i) && !o.has(`${e.name}:${i}`) && (o.add(`${e.name}:${i}`), n.push({
334
+ kind: "dangling-reference",
335
+ key: e.name,
336
+ message: `The ${e.name} component uses ${i}, which doesn't exist.`,
337
+ fixable: i in J
338
+ }));
339
+ return n;
340
+ }
341
+ function Z(e, t, n = 0) {
342
+ return n > 12 ? e : e.replace(/var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,[^)]*)?\)/g, (e, r) => {
343
+ let i = t.get(r);
344
+ if (!i) return e;
345
+ let a = i.unit && i.unit !== "null" ? i.unit : "", o = String(i.value);
346
+ return Z(!a || o.endsWith(a) || o.includes("var(") || o.includes("calc(") ? o : `${o}${a}`, t, n + 1);
347
+ });
348
+ }
349
+ var Q = (e) => e.replace(/var\(\s*(--[A-Za-z0-9_-]+)/g, (e, t) => J[t] ? e.replace(t, J[t]) : e);
350
+ function $(e) {
351
+ let t = !1, n = (e) => {
352
+ if (!e) return e;
353
+ let n = {};
354
+ for (let [r, i] of Object.entries(e)) {
355
+ let e = Q(String(i.value));
356
+ e !== i.value && (t = !0), n[r] = e === i.value ? i : {
357
+ ...i,
358
+ value: e
359
+ };
360
+ }
361
+ return n;
362
+ }, r = (e) => {
363
+ if (!e) return e;
364
+ let n = {};
365
+ for (let [r, i] of Object.entries(e)) {
366
+ let e = Q(String(i));
367
+ e !== i && (t = !0), n[r] = e;
368
+ }
369
+ return n;
370
+ }, i = (e) => {
371
+ let t = { ...e };
372
+ return e.properties && (t.properties = n(e.properties)), e.styles && (t.styles = r(e.styles)), e.variants && (t.variants = Object.fromEntries(Object.entries(e.variants).map(([e, t]) => [e, t.properties ? {
373
+ ...t,
374
+ properties: n(t.properties)
375
+ } : t]))), e.children && (t.children = e.children.map(i)), t;
376
+ }, a = e?.map(i);
377
+ return {
378
+ nodes: t ? a : e,
379
+ changed: t
380
+ };
381
+ }
382
+ function ue(e) {
383
+ 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) => Y(String(e.value)).length && e.unit && e.unit !== "null" ? (t = !0, {
384
+ ...e,
385
+ unit: null
386
+ }) : e), i = new Map(r.map((e) => [e.key, e]));
387
+ r = r.map((e) => {
388
+ if (e.layer === "brand" && Y(String(e.value)).length) {
389
+ let n = Z(String(e.value), i);
390
+ if (n !== e.value && !Y(n).length) return t = !0, {
391
+ ...e,
392
+ value: n
393
+ };
394
+ }
395
+ return e;
396
+ });
397
+ let a = new Set(r.map((e) => e.key)), o = r.find((e) => e.key === "--font-family-sans");
398
+ for (let e of [...r]) for (let n of Y(String(e.value))) a.has(n) || (n === "--font-family-heading" || n === "--font-family-body") && o && (a.add(n), t = !0, r = [...r, {
399
+ key: n,
400
+ name: n === "--font-family-heading" ? "Font Family Heading" : "Font Family Body",
401
+ value: o.value,
402
+ type: "font family",
403
+ unit: null,
404
+ layer: "brand",
405
+ comment: n === "--font-family-heading" ? "Heading font" : "Body font"
406
+ }]);
407
+ let s = e.components, c = e.components.map((e) => {
408
+ let t = $(e.nodes);
409
+ return t.changed ? {
410
+ ...e,
411
+ nodes: t.nodes ?? e.nodes
412
+ } : e;
413
+ });
414
+ c.some((t, n) => t !== e.components[n]) && (s = c, t = !0);
415
+ let l = e.fonts;
416
+ if (l !== void 0) {
417
+ let e = E(l);
418
+ JSON.stringify(e) !== JSON.stringify(l) && (l = e, t = !0);
419
+ }
420
+ if (!t) return e;
421
+ let u = {
422
+ ...e,
423
+ tokens: r,
424
+ components: s
425
+ };
426
+ return l?.length ? u.fonts = l : delete u.fonts, u;
427
+ }
428
+ //#endregion
429
+ export { p as A, k as C, E as D, j as E, h as F, _ as I, y as L, x as M, g as N, d as O, m as P, O as S, T, te as _, U as a, A as b, K as c, W as d, G as f, C as g, ne as h, V as i, S as j, l as k, se as l, z as m, ue as n, L as o, I as p, B as r, R as s, le as t, q as u, w as v, P as w, M as x, F as y };