kss-modern 1.7.0-beta.3 → 1.7.0-beta.4

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.
@@ -1810,7 +1810,7 @@ async function generateFullPageFile(data) {
1810
1810
  <meta name="theme-color" media="(prefers-color-scheme: dark)" content="${data.brandColor.dark}">
1811
1811
  ` : `<meta name="theme-color" content="${data.brandColor}">`}
1812
1812
  <script type="module" src="styleguide-assets/fullpage-aWqc0gjm.js"><\/script>
1813
- ${data.playgroundConfig ? '<script type="module" src="styleguide-assets/playground-BhseyspT.js"><\/script>' : ""}
1813
+ ${data.playgroundConfig ? '<script type="module" src="styleguide-assets/playground-BBMnDZ8b.js"><\/script>' : ""}
1814
1814
  ${computedStyleTags}
1815
1815
  ${computedThemeStyleTags}
1816
1816
  </head>
@@ -2921,7 +2921,7 @@ document.addEventListener("DOMContentLoaded", () => {
2921
2921
  //#endregion
2922
2922
  ;
2923
2923
  <\/script>
2924
- <script type="module" src="styleguide-assets/preview-By_Bbr0k.js"><\/script>
2924
+ <script type="module" src="styleguide-assets/preview-BkKvdDnK.js"><\/script>
2925
2925
  <link rel="preload" href="styleguide-assets/fonts/geist-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
2926
2926
  <link rel="preload" href="styleguide-assets/fonts/geist-mono-latin-600-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
2927
2927
  <link rel="preload" href="styleguide-assets/fonts/geist-mono-latin-300-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
@@ -21,8 +21,8 @@
21
21
  "file": "code-highlight-Fm7cxf-E.js",
22
22
  "name": "code-highlight"
23
23
  },
24
- "_controller-Bw_HCban.js": {
25
- "file": "controller-Bw_HCban.js",
24
+ "_controller-drB07Xo_.js": {
25
+ "file": "controller-drB07Xo_.js",
26
26
  "name": "controller",
27
27
  "imports": [
28
28
  "_utils-DtB-AzJa.js",
@@ -147,14 +147,14 @@
147
147
  ]
148
148
  },
149
149
  "client/lib/playground/explorer.ts": {
150
- "file": "explorer-CawEz1UK.js",
150
+ "file": "explorer-BivD2FYm.js",
151
151
  "name": "explorer",
152
152
  "src": "client/lib/playground/explorer.ts",
153
153
  "isDynamicEntry": true,
154
154
  "imports": [
155
155
  "_code-highlight-Fm7cxf-E.js",
156
156
  "_utils-DtB-AzJa.js",
157
- "_controller-Bw_HCban.js",
157
+ "_controller-drB07Xo_.js",
158
158
  "_alerts-DIQ8TeZB.js"
159
159
  ]
160
160
  },
@@ -169,13 +169,13 @@
169
169
  ]
170
170
  },
171
171
  "client/playground.ts": {
172
- "file": "playground-BhseyspT.js",
172
+ "file": "playground-BBMnDZ8b.js",
173
173
  "name": "playground",
174
174
  "src": "client/playground.ts",
175
175
  "isEntry": true,
176
176
  "imports": [
177
177
  "_shared-hGcWlnRM.js",
178
- "_controller-Bw_HCban.js"
178
+ "_controller-drB07Xo_.js"
179
179
  ]
180
180
  },
181
181
  "client/preview-inline.ts": {
@@ -185,7 +185,7 @@
185
185
  "isEntry": true
186
186
  },
187
187
  "client/preview.ts": {
188
- "file": "preview-By_Bbr0k.js",
188
+ "file": "preview-BkKvdDnK.js",
189
189
  "name": "preview",
190
190
  "src": "client/preview.ts",
191
191
  "isEntry": true,
@@ -552,68 +552,70 @@ var F = /^(?:javascript|vbscript|data):/i;
552
552
  function I(e) {
553
553
  return F.test([...e].filter((e) => e.charCodeAt(0) > 32).join(""));
554
554
  }
555
- function L(e) {
555
+ var L = /^on|[^\w:.-]/i;
556
+ function R(e) {
556
557
  if (typeof e == "string") return e.includes("<") || I(e) ? e : void 0;
557
- if (typeof e == "object" && e) for (let t of Object.values(e)) {
558
- let e = L(t);
559
- if (e !== void 0) return e;
558
+ if (typeof e == "object" && e) for (let [t, n] of Object.entries(e)) {
559
+ if (!Array.isArray(e) && L.test(t)) return t;
560
+ let r = R(n);
561
+ if (r !== void 0) return r;
560
562
  }
561
563
  }
562
- function R(e) {
563
- let t = P(new URLSearchParams(e.hash.slice(1)).get(N) ?? e.searchParams.get(N)), n = t.props ? L(t.props) : void 0;
564
- return n === void 0 ? t : { error: `The props from the link were not applied: they contain markup or a script URL (${JSON.stringify(n.slice(0, 40))}). Enter such values in the controls instead.` };
564
+ function z(e) {
565
+ let t = P(new URLSearchParams(e.hash.slice(1)).get(N) ?? e.searchParams.get(N)), n = t.props ? R(Object.values(t.props)) : void 0;
566
+ return n === void 0 ? t : { error: `The props from the link were not applied: they contain markup, a script URL or an attribute name like onclick (${JSON.stringify(n.slice(0, 40))}). Enter such values in the controls instead.` };
565
567
  }
566
- function z(e, t) {
568
+ function B(e, t) {
567
569
  let n = new URL(e), r = new URLSearchParams(n.hash.slice(1));
568
570
  return r.set(N, JSON.stringify(t)), n.hash = r.toString(), n;
569
571
  }
570
- function B(e, t) {
572
+ function V(e, t) {
571
573
  let n = new URL(e);
572
574
  return n.searchParams.set(N, JSON.stringify(t)), n.hash = "", n;
573
575
  }
574
- var V = /^[A-Z_$][\w$]*$/i;
575
- function H(e) {
576
+ var H = /^[A-Z_$][\w$]*$/i;
577
+ function U(e) {
576
578
  if (typeof e == "string") return `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'").replaceAll("\n", "\\n")}'`;
577
- if (Array.isArray(e)) return `[${e.map(H).join(", ")}]`;
579
+ if (Array.isArray(e)) return `[${e.map(U).join(", ")}]`;
578
580
  if (typeof e == "object" && e) {
579
581
  let t = Object.entries(e);
580
- return t.length === 0 ? "{}" : `{ ${t.map(([e, t]) => `${V.test(e) ? e : H(e)}: ${H(t)}`).join(", ")} }`;
582
+ return t.length === 0 ? "{}" : `{ ${t.map(([e, t]) => `${H.test(e) ? e : U(e)}: ${U(t)}`).join(", ")} }`;
581
583
  }
582
584
  return JSON.stringify(e) ?? "undefined";
583
585
  }
584
- function U(e, t) {
586
+ function W(e, t) {
585
587
  let n = new Map(t.filter((e) => e.hasDefault).map((e) => [e.key, JSON.stringify(e.default)]));
586
588
  return Object.fromEntries(Object.entries(e).filter(([e, t]) => n.get(e) !== JSON.stringify(t)));
587
589
  }
588
- function W(e, t, n = []) {
589
- let r = U(t, n);
590
+ function G(e, t, n = []) {
591
+ let r = W(t, n);
590
592
  for (let e of n) {
591
593
  let { items: t } = e;
592
- t?.kind === "object" && Array.isArray(r[e.key]) && (r[e.key] = r[e.key].map((e) => typeof e == "object" && e ? U(e, t.fields) : e));
594
+ t?.kind === "object" && Array.isArray(r[e.key]) && (r[e.key] = r[e.key].map((e) => typeof e == "object" && e ? W(e, t.fields) : e));
593
595
  }
594
- return `+${e}(${H(r)})`;
596
+ return `+${e}(${U(r)})`;
595
597
  }
596
598
  //#endregion
597
599
  //#region client/lib/playground/validate.ts
598
- var G = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
599
- function K(e) {
600
+ var K = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
601
+ function q(e) {
600
602
  return typeof e == "string" ? `"${e}"` : String(e);
601
603
  }
602
- function q(e) {
604
+ function J(e) {
603
605
  try {
604
606
  return !!new URL(e);
605
607
  } catch {
606
608
  return !1;
607
609
  }
608
610
  }
609
- function J(e, t) {
611
+ function Y(e, t) {
610
612
  return `${e} ${t}${e === 1 ? "" : "s"}`;
611
613
  }
612
- function Y(e, t) {
614
+ function X(e, t) {
613
615
  switch (e.kind) {
614
- case "enum": return e.options?.includes(t) ? void 0 : `Must be one of ${(e.options ?? []).map(K).join(", ")}`;
616
+ case "enum": return e.options?.includes(t) ? void 0 : `Must be one of ${(e.options ?? []).map(q).join(", ")}`;
615
617
  case "boolean": return typeof t == "boolean" ? void 0 : "Must be true or false";
616
- case "string": return typeof t == "string" ? e.minLength !== void 0 && t.length < e.minLength ? e.minLength === 1 ? "Must not be empty" : `Must be at least ${J(e.minLength, "character")}` : e.maxLength !== void 0 && t.length > e.maxLength ? `Must be at most ${J(e.maxLength, "character")}` : e.format === "email" && !G.test(t) ? "Must be an email address" : e.format === "uri" && !q(t) ? "Must be a URL" : e.pattern !== void 0 && e.format !== "email" && !new RegExp(e.pattern).test(t) ? `Must match ${e.pattern}` : void 0 : "Must be text";
618
+ case "string": return typeof t == "string" ? e.minLength !== void 0 && t.length < e.minLength ? e.minLength === 1 ? "Must not be empty" : `Must be at least ${Y(e.minLength, "character")}` : e.maxLength !== void 0 && t.length > e.maxLength ? `Must be at most ${Y(e.maxLength, "character")}` : e.format === "email" && !K.test(t) ? "Must be an email address" : e.format === "uri" && !J(t) ? "Must be a URL" : e.pattern !== void 0 && e.format !== "email" && !new RegExp(e.pattern).test(t) ? `Must match ${e.pattern}` : void 0 : "Must be text";
617
619
  case "number":
618
620
  case "integer":
619
621
  if (typeof t != "number" || Number.isNaN(t)) return "Must be a number";
@@ -629,57 +631,57 @@ function Y(e, t) {
629
631
  return;
630
632
  }
631
633
  }
632
- function X(e, t) {
633
- return typeof t != "object" || !t || Array.isArray(t) ? ["Must be an object"] : e.fields.flatMap((e) => Q(e, t[e.key]).map((t) => `${e.key}: ${t}`));
634
- }
635
634
  function Z(e, t) {
635
+ return typeof t != "object" || !t || Array.isArray(t) ? ["Must be an object"] : e.fields.flatMap((e) => $(e, t[e.key]).map((t) => `${e.key}: ${t}`));
636
+ }
637
+ function Q(e, t) {
636
638
  if (typeof t != "object" || !t || Array.isArray(t)) return ["Must be an object"];
637
639
  let n = [];
638
640
  for (let [r, i] of Object.entries(t)) {
639
- e.keyPattern !== void 0 && !new RegExp(e.keyPattern).test(r) ? n.push(`Key "${r}": Must match ${e.keyPattern}`) : e.keyMinLength !== void 0 && r.length < e.keyMinLength ? n.push(`Key "${r}": Must be at least ${J(e.keyMinLength, "character")}`) : e.keyMaxLength !== void 0 && r.length > e.keyMaxLength && n.push(`Key "${r}": Must be at most ${J(e.keyMaxLength, "character")}`);
640
- let t = e.values.map((e) => Y(e, i));
641
+ e.keyPattern !== void 0 && !new RegExp(e.keyPattern).test(r) ? n.push(`Key "${r}": Must match ${e.keyPattern}`) : e.keyMinLength !== void 0 && r.length < e.keyMinLength ? n.push(`Key "${r}": Must be at least ${Y(e.keyMinLength, "character")}`) : e.keyMaxLength !== void 0 && r.length > e.keyMaxLength && n.push(`Key "${r}": Must be at most ${Y(e.keyMaxLength, "character")}`);
642
+ let t = e.values.map((e) => X(e, i));
641
643
  t.every((e) => e !== void 0) && n.push(`"${r}": ${e.values.length === 1 ? t[0] : `Must be ${e.values.map((e) => e.kind).join(" or ")}`}`);
642
644
  }
643
645
  return n;
644
646
  }
645
- function Q(e, t) {
647
+ function $(e, t) {
646
648
  if (t === void 0) return e.isOptional ? [] : ["Required"];
647
- if (e.kind === "record") return e.record ? Z(e.record, t) : [];
649
+ if (e.kind === "record") return e.record ? Q(e.record, t) : [];
648
650
  if (e.kind !== "array") {
649
- let n = Y(e, t);
651
+ let n = X(e, t);
650
652
  return n ? [n] : [];
651
653
  }
652
654
  if (!Array.isArray(t)) return ["Must be a list"];
653
655
  let n = [];
654
- e.minItems !== void 0 && t.length < e.minItems && n.push(`Needs at least ${J(e.minItems, "entry").replace("entrys", "entries")}`), e.maxItems !== void 0 && t.length > e.maxItems && n.push(`Allows at most ${J(e.maxItems, "entry").replace("entrys", "entries")}`);
656
+ e.minItems !== void 0 && t.length < e.minItems && n.push(`Needs at least ${Y(e.minItems, "entry").replace("entrys", "entries")}`), e.maxItems !== void 0 && t.length > e.maxItems && n.push(`Allows at most ${Y(e.maxItems, "entry").replace("entrys", "entries")}`);
655
657
  let { items: r } = e;
656
658
  return t.forEach((e, t) => {
657
659
  if (!r) return;
658
- let i = r.kind === "object" ? X(r, e) : [Y(r, e)].filter((e) => e !== void 0);
660
+ let i = r.kind === "object" ? Z(r, e) : [X(r, e)].filter((e) => e !== void 0);
659
661
  n.push(...i.map((e) => `Entry ${t + 1}: ${e}`));
660
662
  }), n;
661
663
  }
662
- function $(e, t) {
664
+ function ee(e, t) {
663
665
  let n = /* @__PURE__ */ new Map();
664
666
  for (let r of e) {
665
- let e = Q(r, t[r.key]);
667
+ let e = $(r, t[r.key]);
666
668
  e.length > 0 && n.set(r.key, e);
667
669
  }
668
670
  return n;
669
671
  }
670
672
  //#endregion
671
673
  //#region client/lib/playground/controller.ts
672
- var ee = 1e3;
673
- async function te(e, n, r = {}) {
674
+ var te = 1e3;
675
+ async function ne(e, n, r = {}) {
674
676
  let i = (await O(e.manifestUrl, e.isDevelopment)).mixins.find((t) => t.id === e.id);
675
677
  if (!i || !i.hasSchema) throw Error(`Mixin "${e.name}" has no playground in ${e.manifestUrl}`);
676
- let a = d(i.jsonSchema), o = h(a, r.props), s = i.module ? await A(i) : void 0, c, l = () => g(a, o), u = () => W(i.name, l(), a), f = () => {
678
+ let a = d(i.jsonSchema), o = h(a, r.props), s = i.module ? await A(i) : void 0, c, l = () => g(a, o), u = () => G(i.name, l(), a), f = () => {
677
679
  let e = l();
678
680
  if (c?.setPugCall(u()), !s) {
679
681
  c?.setMessage(i.error?.message ?? "The mixin has not compiled yet.");
680
682
  return;
681
683
  }
682
- let t = $(a, o);
684
+ let t = ee(a, o);
683
685
  if (t.size > 0) {
684
686
  let r = [...t].flatMap(([e, t]) => t.map((t) => ({
685
687
  key: e,
@@ -746,7 +748,7 @@ async function te(e, n, r = {}) {
746
748
  r = !1;
747
749
  }
748
750
  }
749
- }, ee), document.visibilityState === "visible" && p.start(), document.addEventListener("visibilitychange", () => {
751
+ }, te), document.visibilityState === "visible" && p.start(), document.addEventListener("visibilitychange", () => {
750
752
  document.visibilityState === "visible" ? p.resume() : p.pause();
751
753
  }, { signal: m.signal });
752
754
  }
@@ -766,4 +768,4 @@ async function te(e, n, r = {}) {
766
768
  };
767
769
  }
768
770
  //#endregion
769
- export { O as a, o as c, B as i, i as l, R as n, v as o, z as r, a as s, te as t, r as u };
771
+ export { O as a, o as c, V as i, i as l, z as n, v as o, B as r, a as s, ne as t, r as u };
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./code-highlight-Fm7cxf-E.js";
2
2
  import { n as t } from "./utils-DtB-AzJa.js";
3
- import { a as n, i as r, n as i, r as a, s as o, t as s, u as c } from "./controller-Bw_HCban.js";
3
+ import { a as n, i as r, n as i, r as a, s as o, t as s, u as c } from "./controller-drB07Xo_.js";
4
4
  import { t as l } from "./alerts-DIQ8TeZB.js";
5
5
  //#region client/lib/playground/format-html.ts
6
6
  var u = /* @__PURE__ */ new Set([
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./shared-hGcWlnRM.js";
2
- import { c as t, i as n, l as r, n as i, o as a, r as o, t as s } from "./controller-Bw_HCban.js";
2
+ import { c as t, i as n, l as r, n as i, o as a, r as o, t as s } from "./controller-drB07Xo_.js";
3
3
  //#region client/playground.ts
4
4
  var c = "kss-modern:playground-panel", l = {
5
5
  dock: "right",
@@ -1139,7 +1139,7 @@ ot && import("./global-theme-select-CdFgPJ0T.js").then(({ default: e }) => e(ot)
1139
1139
  var st = document.querySelectorAll("[data-section-theme-select]");
1140
1140
  st.length > 0 && import("./section-theme-select-CO65kL5N.js").then(({ default: e }) => e(st)).catch(console.error);
1141
1141
  var ct = document.querySelector("[data-mixin-explorer]");
1142
- ct && import("./explorer-CawEz1UK.js").then(({ default: e }) => e(ct)).catch(console.error);
1142
+ ct && import("./explorer-BivD2FYm.js").then(({ default: e }) => e(ct)).catch(console.error);
1143
1143
  var lt = document.querySelector(".editor-select");
1144
1144
  lt && import("./editor-select-DIZFtqe7.js").then(({ default: e }) => e(lt)).catch(console.error);
1145
1145
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kss-modern",
3
3
  "type": "module",
4
- "version": "1.7.0-beta.3",
4
+ "version": "1.7.0-beta.4",
5
5
  "description": "Modern KSS compatible styleguide generator",
6
6
  "keywords": [
7
7
  "kss",