kss-modern 0.0.31 → 0.0.32

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.
@@ -896,7 +896,7 @@ async function generateFullPageFile(data) {
896
896
  <link rel="icon" type="image/svg+xml" href="/styleguide-assets/favicon/fullpage-light.svg">
897
897
  `}
898
898
  ${data.ogImageUrl ? `<meta property="og:image" content="${data.ogImageUrl}">` : ""}
899
- <script type="module" src="/styleguide-assets/fullpage-DrO6Pf-j.js"><\/script>
899
+ <script type="module" src="/styleguide-assets/fullpage-C3Xx0NH3.js"><\/script>
900
900
  ${computedStyleTags}
901
901
  </head>
902
902
  <body${data.page.bodyclass ? ` class="${data.page.bodyclass}"` : ""}>
@@ -22,7 +22,7 @@
22
22
  ]
23
23
  },
24
24
  "client/fullpage.ts": {
25
- "file": "fullpage-DrO6Pf-j.js",
25
+ "file": "fullpage-C3Xx0NH3.js",
26
26
  "name": "fullpage",
27
27
  "src": "client/fullpage.ts",
28
28
  "isEntry": true,
@@ -1,4 +1,4 @@
1
- class m {
1
+ class f {
2
2
  modifier;
3
3
  placeholder;
4
4
  constructor(e) {
@@ -13,19 +13,19 @@ class m {
13
13
  const n = window.frameElement.getAttribute("data-modifier");
14
14
  if (!n)
15
15
  return null;
16
- const t = n.split(".").filter((r) => r.length > 0).join(" "), o = new m({ modifier: t });
17
- return o.initialize(e), o;
16
+ const t = n.split(".").filter((r) => r.length > 0).join(" "), i = new f({ modifier: t });
17
+ return i.initialize(e), i;
18
18
  }
19
19
  static fromUrl(e = document) {
20
20
  const t = new URLSearchParams(window.location.search).get("modifier");
21
21
  if (!t)
22
22
  return null;
23
- const o = t.split(".").filter((i) => i.length > 0).join(" "), r = new m({ modifier: o });
23
+ const i = t.split(".").filter((o) => o.length > 0).join(" "), r = new f({ modifier: i });
24
24
  return r.initialize(e), r;
25
25
  }
26
26
  replaceAll(e) {
27
- const n = encodeURIComponent(JSON.stringify(this.placeholder)), t = JSON.stringify({ modifierClass: this.placeholder }), o = encodeURIComponent(t);
28
- return e.replace(new RegExp(this.escapeRegExp(this.placeholder), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(n), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(o), "g"), this.modifier);
27
+ const n = encodeURIComponent(JSON.stringify(this.placeholder)), t = JSON.stringify({ modifierClass: this.placeholder }), i = encodeURIComponent(t);
28
+ return e.replace(new RegExp(this.escapeRegExp(this.placeholder), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(n), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(i), "g"), this.modifier);
29
29
  }
30
30
  escapeRegExp(e) {
31
31
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -51,14 +51,14 @@ class m {
51
51
  }
52
52
  replaceInElementAttributes(e) {
53
53
  Array.from(e.attributes).forEach((n) => {
54
- const t = n.value, o = this.replaceAll(t);
55
- t !== o && (n.value = o);
54
+ const t = n.value, i = this.replaceAll(t);
55
+ t !== i && (n.value = i);
56
56
  });
57
57
  }
58
58
  }
59
- window.frameElement ? (window.frameElement.getAttribute("data-preview") === "true" && document.documentElement.classList.add("styleguide-preview"), window.frameElement.hasAttribute("data-modifier") && m.fromIframe(), window.runAccessibilityTest = async () => {
60
- const c = async () => {
61
- const { default: r } = await import("./axe-Ciyt_55N.js").then((a) => a.a), i = await r.run("body", {
59
+ window.frameElement ? (window.frameElement.getAttribute("data-preview") === "true" && document.documentElement.classList.add("styleguide-preview"), window.frameElement.hasAttribute("data-modifier") && f.fromIframe(), window.runAccessibilityTest = async () => {
60
+ const d = async () => {
61
+ const { default: r } = await import("./axe-Ciyt_55N.js").then((a) => a.a), o = await r.run("body", {
62
62
  rules: {
63
63
  // color contrast can't be calculated correctly yet in axe-core
64
64
  // when using dark-mode. See: https://github.com/dequelabs/axe-core/issues/3605
@@ -67,61 +67,66 @@ window.frameElement ? (window.frameElement.getAttribute("data-preview") === "tru
67
67
  "landmark-one-main": { enabled: !1 }
68
68
  }
69
69
  }).catch(console.error);
70
- if (!i)
70
+ if (!o)
71
71
  throw new Error("No results from html-validate");
72
- const f = /* @__PURE__ */ new Map(), l = (a) => {
72
+ const l = /* @__PURE__ */ new Map(), s = (a) => {
73
73
  a.forEach((p) => {
74
74
  p.nodes.forEach((u) => {
75
- u.target.forEach((d) => {
76
- const s = r.utils.shadowSelect(d);
77
- if (!s)
78
- throw new Error(`Could not find element for selector: ${d}`);
79
- f.set(d, s);
75
+ u.target.forEach((m) => {
76
+ const c = r.utils.shadowSelect(m);
77
+ if (!c)
78
+ throw new Error(`Could not find element for selector: ${m}`);
79
+ l.set(m, c);
80
80
  });
81
81
  });
82
82
  });
83
83
  };
84
- return l(i.violations), l(i.inapplicable), l(i.passes), l(i.incomplete), {
85
- result: i,
86
- targetMap: f
84
+ return s(o.violations), s(o.inapplicable), s(o.passes), s(o.incomplete), {
85
+ result: o,
86
+ targetMap: l
87
87
  };
88
88
  }, e = async () => {
89
- const { HtmlValidate: r, StaticConfigLoader: i } = await import("./browser-foEci-k2.js"), f = new i(), l = new r(f), a = await fetch(window.location.href);
89
+ const { HtmlValidate: r, StaticConfigLoader: o } = await import("./browser-foEci-k2.js"), l = new o(), s = new r(l), a = await fetch(window.location.href);
90
90
  if (!a.ok)
91
91
  throw new Error(`Failed to fetch document for html-validate: ${a.status} ${a.statusText}`);
92
- const p = await a.text(), { results: u } = await l.validateString(p, {
92
+ const p = await a.text(), { results: u } = await s.validateString(p, {
93
93
  rules: {
94
94
  "no-trailing-whitespace": "off",
95
95
  "no-inline-style": "off"
96
96
  }
97
- }), d = u.map((s) => s.messages).flat();
98
- return await Promise.all(d.map(async (s) => {
99
- const w = (await l.getContextualDocumentation(s))?.description;
97
+ }), m = u.map((c) => c.messages).flat();
98
+ return await Promise.all(m.map(async (c) => {
99
+ const w = (await s.getContextualDocumentation(c))?.description;
100
100
  return {
101
- ...s,
101
+ ...c,
102
102
  ruleDescription: w
103
103
  };
104
104
  }));
105
105
  }, [n, t] = await Promise.all([
106
- c(),
106
+ d(),
107
107
  e()
108
- ]), o = new CustomEvent("accessibility-result", {
108
+ ]), i = new CustomEvent("accessibility-result", {
109
109
  detail: {
110
110
  axe: n,
111
111
  htmlValidate: t
112
112
  }
113
113
  });
114
- window.frameElement?.dispatchEvent(o);
115
- }) : new URLSearchParams(window.location.search).get("modifier") && m.fromUrl();
116
- window.querySelectorAnywhere = (c) => {
117
- const e = document.querySelector(c);
118
- if (e)
119
- return e;
120
- const n = c.replace(/.*template[^>]*>\s*/i, ""), t = Array.from(document.querySelectorAll("template"));
121
- for (const o of t) {
122
- const r = o.content.querySelector(n);
123
- if (r)
124
- return r;
114
+ window.frameElement?.dispatchEvent(i);
115
+ }) : new URLSearchParams(window.location.search).get("modifier") && f.fromUrl();
116
+ window.querySelectorAnywhere = (d) => {
117
+ if (!d.includes("template")) {
118
+ const o = document.querySelector(d);
119
+ if (o)
120
+ return o;
121
+ }
122
+ const e = d.split(/\s+/), n = e.findIndex((o) => o.startsWith("template"));
123
+ if (n < 0)
124
+ return null;
125
+ const t = e.slice(0, n + 1).join(" "), i = e.slice(n + 1).join(" "), r = Array.from(document.querySelectorAll(t));
126
+ for (const o of r) {
127
+ const l = o.content.querySelector(i || "*");
128
+ if (l)
129
+ return l;
125
130
  }
126
131
  return null;
127
132
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kss-modern",
3
3
  "type": "module",
4
- "version": "0.0.31",
4
+ "version": "0.0.32",
5
5
  "description": "Modern KSS compatible styleguide generator",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@antfu/utils": "^9.3.0",
27
27
  "@biomejs/js-api": "^4.0.0",
28
- "@biomejs/wasm-nodejs": "^2.3.14",
28
+ "@biomejs/wasm-nodejs": "^2.3.15",
29
29
  "@shikijs/markdown-it": "^3.22.0",
30
30
  "chokidar": "^5.0.0",
31
31
  "fs-extra": "^11.3.3",