kss-modern 0.0.23 → 0.0.25

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.
@@ -833,7 +833,7 @@ async function generateFullPageFile(data) {
833
833
  <link rel="icon" type="image/svg+xml" href="/styleguide-assets/favicon/fullpage-light.svg">
834
834
  `}
835
835
  ${data.ogImageUrl ? `<meta property="og:image" content="${data.ogImageUrl}">` : ""}
836
- <script type="module" src="/styleguide-assets/fullpage-BEOBUDsG.js"><\/script>
836
+ <script type="module" src="/styleguide-assets/fullpage-DOmxO-jm.js"><\/script>
837
837
  ${computedStyleTags}
838
838
  </head>
839
839
  <body${data.page.bodyclass ? ` class="${data.page.bodyclass}"` : ""}>
@@ -22,7 +22,7 @@
22
22
  ]
23
23
  },
24
24
  "client/fullpage.ts": {
25
- "file": "fullpage-BEOBUDsG.js",
25
+ "file": "fullpage-DOmxO-jm.js",
26
26
  "name": "fullpage",
27
27
  "src": "client/fullpage.ts",
28
28
  "isEntry": true,
@@ -1,4 +1,4 @@
1
- class c {
1
+ class d {
2
2
  modifier;
3
3
  placeholder;
4
4
  constructor(e) {
@@ -13,19 +13,19 @@ class c {
13
13
  const i = window.frameElement.getAttribute("data-modifier");
14
14
  if (!i)
15
15
  return null;
16
- const t = i.split(".").filter((r) => r.length > 0).join(" "), n = new c({ modifier: t });
17
- return n.initialize(e), n;
16
+ const t = i.split(".").filter((r) => r.length > 0).join(" "), o = new d({ modifier: t });
17
+ return o.initialize(e), o;
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 n = t.split(".").filter((o) => o.length > 0).join(" "), r = new c({ modifier: n });
23
+ const o = t.split(".").filter((n) => n.length > 0).join(" "), r = new d({ modifier: o });
24
24
  return r.initialize(e), r;
25
25
  }
26
26
  replaceAll(e) {
27
- const i = encodeURIComponent(JSON.stringify(this.placeholder)), t = JSON.stringify({ modifierClass: this.placeholder }), n = encodeURIComponent(t);
28
- return e.replace(new RegExp(this.escapeRegExp(this.placeholder), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(i), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(n), "g"), this.modifier);
27
+ const i = 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(i), "g"), this.modifier).replace(new RegExp(this.escapeRegExp(o), "g"), this.modifier);
29
29
  }
30
30
  escapeRegExp(e) {
31
31
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -51,59 +51,65 @@ class c {
51
51
  }
52
52
  replaceInElementAttributes(e) {
53
53
  Array.from(e.attributes).forEach((i) => {
54
- const t = i.value, n = this.replaceAll(t);
55
- t !== n && (i.value = n);
54
+ const t = i.value, o = this.replaceAll(t);
55
+ t !== o && (i.value = o);
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") && c.fromIframe(), window.runAccessibilityTest = async () => {
59
+ window.frameElement ? (window.frameElement.getAttribute("data-preview") === "true" && document.documentElement.classList.add("styleguide-preview"), window.frameElement.hasAttribute("data-modifier") && d.fromIframe(), window.runAccessibilityTest = async () => {
60
60
  const u = async () => {
61
- const { default: r } = await import("./axe-A2Ows1Aj.js").then((s) => s.a), o = await r.run("body", {
61
+ const { default: r } = await import("./axe-A2Ows1Aj.js").then((a) => a.a), n = await r.run("body", {
62
62
  rules: {
63
+ // color contrast can't be calculated correctly yet in axe-core
64
+ // when using dark-mode. See: https://github.com/dequelabs/axe-core/issues/3605
65
+ "color-contrast": { enabled: !1 },
63
66
  region: { enabled: !1 },
64
67
  "landmark-one-main": { enabled: !1 }
65
68
  }
66
69
  }).catch(console.error);
67
- if (!o)
70
+ if (!n)
68
71
  throw new Error("No results from html-validate");
69
- const d = /* @__PURE__ */ new Map(), l = (s) => {
70
- s.forEach((m) => {
71
- m.nodes.forEach((f) => {
72
- f.target.forEach((a) => {
73
- const p = r.utils.shadowSelect(a);
74
- if (!p)
75
- throw new Error(`Could not find element for selector: ${a}`);
76
- d.set(a, p);
72
+ const m = /* @__PURE__ */ new Map(), l = (a) => {
73
+ a.forEach((f) => {
74
+ f.nodes.forEach((p) => {
75
+ p.target.forEach((c) => {
76
+ const s = r.utils.shadowSelect(c);
77
+ if (!s)
78
+ throw new Error(`Could not find element for selector: ${c}`);
79
+ m.set(c, s);
77
80
  });
78
81
  });
79
82
  });
80
83
  };
81
- return l(o.violations), l(o.inapplicable), l(o.passes), l(o.incomplete), {
82
- result: o,
83
- targetMap: d
84
+ return l(n.violations), l(n.inapplicable), l(n.passes), l(n.incomplete), {
85
+ result: n,
86
+ targetMap: m
84
87
  };
85
88
  }, e = async () => {
86
- const { HtmlValidate: r, StaticConfigLoader: o } = await import("./browser-Bjhprfz3.js"), d = new o(), l = new r(d), s = document.documentElement.outerHTML, { results: m } = await l.validateString(s, {
89
+ const { HtmlValidate: r, StaticConfigLoader: n } = await import("./browser-Bjhprfz3.js"), m = new n(), l = new r(m), a = await fetch(window.location.href);
90
+ if (!a.ok)
91
+ throw new Error(`Failed to fetch document for html-validate: ${a.status} ${a.statusText}`);
92
+ const f = await a.text(), { results: p } = await l.validateString(f, {
87
93
  rules: {
88
94
  "no-trailing-whitespace": "off",
89
95
  "no-inline-style": "off"
90
96
  }
91
- }), f = m.map((a) => a.messages).flat();
92
- return await Promise.all(f.map(async (a) => {
93
- const w = (await l.getContextualDocumentation(a))?.description;
97
+ }), c = p.map((s) => s.messages).flat();
98
+ return await Promise.all(c.map(async (s) => {
99
+ const w = (await l.getContextualDocumentation(s))?.description;
94
100
  return {
95
- ...a,
101
+ ...s,
96
102
  ruleDescription: w
97
103
  };
98
104
  }));
99
105
  }, [i, t] = await Promise.all([
100
106
  u(),
101
107
  e()
102
- ]), n = new CustomEvent("accessibility-result", {
108
+ ]), o = new CustomEvent("accessibility-result", {
103
109
  detail: {
104
110
  axe: i,
105
111
  htmlValidate: t
106
112
  }
107
113
  });
108
- window.frameElement?.dispatchEvent(n);
109
- }) : new URLSearchParams(window.location.search).get("modifier") && c.fromUrl();
114
+ window.frameElement?.dispatchEvent(o);
115
+ }) : new URLSearchParams(window.location.search).get("modifier") && d.fromUrl();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kss-modern",
3
3
  "type": "module",
4
- "version": "0.0.23",
4
+ "version": "0.0.25",
5
5
  "description": "Modern KSS compatible styleguide generator",
6
6
  "main": "./dist/node/lib/index.mjs",
7
7
  "types": "./dist/node/lib/index.d.ts",