kss-modern 0.0.22 → 0.0.23

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.
@@ -145,7 +145,7 @@ async function logicalWriteFile(filepath, content) {
145
145
  }
146
146
  function fixAccessibilityIssues(html) {
147
147
  let parsedMarkup = html;
148
- const omitValue = ["required", "disabled", "checked", "selected", "multiple", "readonly"];
148
+ const omitValue = ["required", "disabled", "checked", "selected", "multiple", "readonly", "open"];
149
149
  omitValue.forEach((value) => {
150
150
  parsedMarkup = parsedMarkup.replaceAll(`${value}="${value}"`, value).replaceAll(`${value}=""`, value);
151
151
  });
@@ -1697,7 +1697,7 @@ document.addEventListener("DOMContentLoaded", () => {
1697
1697
  });
1698
1698
  ;
1699
1699
  <\/script>
1700
- <script type="module" src="/styleguide-assets/preview-BqaqMVtQ.js"><\/script>
1700
+ <script type="module" src="/styleguide-assets/preview-CzDBmeSK.js"><\/script>
1701
1701
  <link rel="preload" href="/styleguide-assets/fonts/geist-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
1702
1702
  <link rel="preload" href="/styleguide-assets/fonts/geist-mono-latin-600-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
1703
1703
  <link rel="preload" href="/styleguide-assets/fonts/geist-mono-latin-300-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
@@ -11,8 +11,8 @@
11
11
  "__commonjsHelpers-C6fGbg64.js"
12
12
  ]
13
13
  },
14
- "_preview-DxsvGJsw.js": {
15
- "file": "preview-DxsvGJsw.js",
14
+ "_preview-Cknxd_cP.js": {
15
+ "file": "preview-Cknxd_cP.js",
16
16
  "name": "preview",
17
17
  "dynamicImports": [
18
18
  "client/lib/html-validator.ts",
@@ -32,12 +32,12 @@
32
32
  ]
33
33
  },
34
34
  "client/lib/clipboard.ts": {
35
- "file": "clipboard-CQ7U7_P0.js",
35
+ "file": "clipboard-DULMn8xf.js",
36
36
  "name": "clipboard",
37
37
  "src": "client/lib/clipboard.ts",
38
38
  "isDynamicEntry": true,
39
39
  "imports": [
40
- "_preview-DxsvGJsw.js"
40
+ "_preview-Cknxd_cP.js"
41
41
  ]
42
42
  },
43
43
  "client/lib/editor-select.ts": {
@@ -47,21 +47,21 @@
47
47
  "isDynamicEntry": true
48
48
  },
49
49
  "client/lib/html-validator.ts": {
50
- "file": "html-validator-M0X8x6ag.js",
50
+ "file": "html-validator-DLEAmrmB.js",
51
51
  "name": "html-validator",
52
52
  "src": "client/lib/html-validator.ts",
53
53
  "isDynamicEntry": true,
54
54
  "imports": [
55
- "_preview-DxsvGJsw.js"
55
+ "_preview-Cknxd_cP.js"
56
56
  ]
57
57
  },
58
58
  "client/lib/icons.ts": {
59
- "file": "icons-IQYIngUi.js",
59
+ "file": "icons-s_oHNZd6.js",
60
60
  "name": "icons",
61
61
  "src": "client/lib/icons.ts",
62
62
  "isDynamicEntry": true,
63
63
  "imports": [
64
- "_preview-DxsvGJsw.js"
64
+ "_preview-Cknxd_cP.js"
65
65
  ]
66
66
  },
67
67
  "client/preview-inline.ts": {
@@ -71,12 +71,12 @@
71
71
  "isEntry": true
72
72
  },
73
73
  "client/preview.ts": {
74
- "file": "preview-BqaqMVtQ.js",
74
+ "file": "preview-CzDBmeSK.js",
75
75
  "name": "preview",
76
76
  "src": "client/preview.ts",
77
77
  "isEntry": true,
78
78
  "imports": [
79
- "_preview-DxsvGJsw.js"
79
+ "_preview-Cknxd_cP.js"
80
80
  ]
81
81
  },
82
82
  "node_modules/html-validate/dist/esm/browser.js": {
@@ -1,4 +1,4 @@
1
- import { b as $, a as p } from "./preview-DxsvGJsw.js";
1
+ import { b as $, a as p } from "./preview-Cknxd_cP.js";
2
2
  function C(n, i, e) {
3
3
  var t = e || {}, a = t.noTrailing, s = a === void 0 ? !1 : a, r = t.noLeading, u = r === void 0 ? !1 : r, c = t.debounceMode, m = c === void 0 ? void 0 : c, d, b = !1, w = 0;
4
4
  function E() {
@@ -1,4 +1,4 @@
1
- import { h as L } from "./preview-DxsvGJsw.js";
1
+ import { h as L } from "./preview-Cknxd_cP.js";
2
2
  const f = (l, a) => l ? a() : "";
3
3
  function $(l, a) {
4
4
  return l.map((m, h) => a(m, h)).join("");
@@ -27,7 +27,7 @@ const A = T(), E = {
27
27
  "font-style: italic"
28
28
  ].join(";")
29
29
  };
30
- function H(l, a) {
30
+ function V(l, a) {
31
31
  console.group("%cValidation Error", E.header), console.info(
32
32
  "%c%o",
33
33
  E.elementStyle,
@@ -42,13 +42,13 @@ async function R(l, a, m) {
42
42
  const h = l.getAttribute("data-code-audit-iframe");
43
43
  if (!h)
44
44
  throw new Error("No code audit template selector provided");
45
- const c = document.querySelector(`#${h}`);
46
- if (!c)
45
+ const d = document.querySelector(`#${h}`);
46
+ if (!d)
47
47
  throw new Error("Code audit template not found");
48
- if (!c.contentWindow)
48
+ if (!d.contentWindow)
49
49
  throw new Error("Code audit iframe has no content window");
50
- const g = a.querySelector(".audit-results");
51
- if (!g)
50
+ const w = a.querySelector(".audit-results");
51
+ if (!w)
52
52
  throw new Error("No audit results list found");
53
53
  window.validator = {
54
54
  referenceMap: /* @__PURE__ */ new Map(),
@@ -60,22 +60,22 @@ async function R(l, a, m) {
60
60
  }
61
61
  };
62
62
  const u = await new Promise((e, o) => {
63
- const s = setTimeout(() => {
63
+ const i = setTimeout(() => {
64
64
  o(new Error("Accessibility audit timed out"));
65
65
  }, 3e4), n = (v) => {
66
66
  const y = v;
67
- clearTimeout(s), c.removeEventListener("accessibility-result", n), e(y.detail);
67
+ clearTimeout(i), d.removeEventListener("accessibility-result", n), e(y.detail);
68
68
  };
69
- c.addEventListener("accessibility-result", n);
70
- const r = c.contentWindow;
71
- r.runAccessibilityTest ? r.runAccessibilityTest() : (clearTimeout(s), c.removeEventListener("accessibility-result", n), o(new Error("runAxe function not found in iframe")));
72
- }), d = {
69
+ d.addEventListener("accessibility-result", n);
70
+ const r = d.contentWindow;
71
+ r.runAccessibilityTest ? r.runAccessibilityTest() : (clearTimeout(i), d.removeEventListener("accessibility-result", n), o(new Error("runAxe function not found in iframe")));
72
+ }), c = {
73
73
  violations: [],
74
74
  incomplete: [],
75
75
  passes: [],
76
76
  inapplicable: []
77
- }, w = (e, o) => {
78
- const s = o.map((n) => ({
77
+ }, g = (e, o) => {
78
+ const i = o.map((n) => ({
79
79
  id: n.id,
80
80
  description: n.description,
81
81
  helpUrl: n.helpUrl,
@@ -86,9 +86,9 @@ async function R(l, a, m) {
86
86
  target: r.target
87
87
  }))
88
88
  }));
89
- d[e].push(...s);
89
+ c[e].push(...i);
90
90
  };
91
- w("violations", u.axe.result.violations), w("incomplete", u.axe.result.incomplete), w("passes", u.axe.result.passes), w("inapplicable", u.axe.result.inapplicable);
91
+ g("violations", u.axe.result.violations), g("incomplete", u.axe.result.incomplete), g("passes", u.axe.result.passes), g("inapplicable", u.axe.result.inapplicable);
92
92
  function S(e, o) {
93
93
  switch (o) {
94
94
  case "off":
@@ -105,7 +105,15 @@ async function R(l, a, m) {
105
105
  }
106
106
  }
107
107
  u.htmlValidate.forEach((e) => {
108
- d.violations.push({
108
+ const o = c.violations.find((i) => i.id === e.ruleId);
109
+ if (o) {
110
+ o.nodes.push({
111
+ type: "htmlvalidate",
112
+ selector: e.selector
113
+ });
114
+ return;
115
+ }
116
+ c.violations.push({
109
117
  id: e.ruleId,
110
118
  description: e.ruleDescription || e.message,
111
119
  helpUrl: e.ruleUrl || "",
@@ -116,16 +124,16 @@ async function R(l, a, m) {
116
124
  }]
117
125
  });
118
126
  });
119
- const I = u.axe.targetMap, x = (e, o, s) => {
120
- const n = e.charAt(0).toUpperCase() + e.slice(1), r = ["critical", "serious", "moderate", "minor"], v = s.toSorted((t, i) => {
121
- const p = r.indexOf(t.impact || "minor"), b = r.indexOf(i.impact || "minor");
127
+ const I = u.axe.targetMap, x = (e, o, i) => {
128
+ const n = e.charAt(0).toUpperCase() + e.slice(1), r = ["critical", "serious", "moderate", "minor"], v = i.toSorted((t, s) => {
129
+ const p = r.indexOf(t.impact || "minor"), b = r.indexOf(s.impact || "minor");
122
130
  return p - b;
123
131
  }), y = (t) => {
124
- const i = t.target.map((p) => I.get(p)).filter(Boolean);
125
- if (i.length === 0)
132
+ const s = t.target.map((p) => I.get(p)).filter(Boolean);
133
+ if (s.length === 0)
126
134
  throw new Error(`No elements found for axe-core target: ${t.target}`);
127
135
  return `
128
- ${$(i, (p) => {
136
+ ${$(s, (p) => {
129
137
  const b = A.next().value;
130
138
  return window.validator.referenceMap.set(b, p), `
131
139
  <button
@@ -138,11 +146,11 @@ async function R(l, a, m) {
138
146
  })}
139
147
  `;
140
148
  }, M = (t) => {
141
- const i = c.contentWindow?.document.querySelector(t.selector);
142
- if (!i)
149
+ const s = d.contentWindow?.document.querySelector(t.selector);
150
+ if (!s)
143
151
  throw new Error(`Element not found for selector: ${t.selector}`);
144
152
  const p = A.next().value;
145
- return window.validator.referenceMap.set(p, i), `
153
+ return window.validator.referenceMap.set(p, s), `
146
154
  <button
147
155
  class="block font-mono py-1.5 text-[13px] text-blue-600 text-sm cursor-pointer text-left"
148
156
  onclick="console.log(window.validator.referenceMap.get('${p}')); window.validator.logReferenceAlert(this)"
@@ -159,7 +167,7 @@ async function R(l, a, m) {
159
167
  <h3 class="px-6 py-4 text-sm font-semibold leading-[1]">
160
168
  <span class="mr-2" aria-hidden="true">${o}</span>
161
169
  <span class="text-styleguide-highlight">${n}:</span>
162
- <span class="ml-2">(${s.length})</span>
170
+ <span class="ml-2">(${i.length})</span>
163
171
  </h3>
164
172
  </summary>
165
173
 
@@ -181,7 +189,7 @@ async function R(l, a, m) {
181
189
 
182
190
  <div class="pt-2 pb-6 text-sm code-audit-container">
183
191
  <p class="mb-3">
184
- ${t.description.replace(/`([^`]*)`/g, "<code>$1</code>")}
192
+ ${t.description}
185
193
  </p>
186
194
 
187
195
  <p class="mb-3 pb-3 border-b border-styleguide-border">
@@ -202,10 +210,10 @@ async function R(l, a, m) {
202
210
  <h3 class="font-semibold mb-2">Affected nodes (${t.nodes.length}):</h3>
203
211
 
204
212
  <ol class="!pl-0 !list-none">
205
- ${$(t.nodes, (i) => `
213
+ ${$(t.nodes, (s) => `
206
214
  <li>
207
- ${f(i.type === "axe", () => `${y(i)}`)}
208
- ${f(i.type === "htmlvalidate", () => `${M(i)}`)}
215
+ ${f(s.type === "axe", () => `${y(s)}`)}
216
+ ${f(s.type === "htmlvalidate", () => `${M(s)}`)}
209
217
  </li>
210
218
  `)}
211
219
  </ol>
@@ -220,26 +228,26 @@ async function R(l, a, m) {
220
228
  </li>
221
229
  `)}
222
230
  `;
223
- }, k = d.violations.length > 0 ? "🔴" : "🟢", C = d.incomplete.length > 0 ? "🟠" : "🟢";
224
- g.innerHTML = `
225
- ${x("violations", k, d.violations)}
226
- ${x("incomplete", C, d.incomplete)}
227
- ${x("passes", "🟢", d.passes)}
228
- ${x("inapplicable", "⚪", d.inapplicable)}
229
- `, g.querySelectorAll("[data-source-code]").forEach((e) => L(e)), g.querySelectorAll("[data-iframe-selector]").forEach((e) => {
231
+ }, k = c.violations.length > 0 ? "🔴" : "🟢", C = c.incomplete.length > 0 ? "🟠" : "🟢";
232
+ w.innerHTML = `
233
+ ${x("violations", k, c.violations)}
234
+ ${x("incomplete", C, c.incomplete)}
235
+ ${x("passes", "🟢", c.passes)}
236
+ ${x("inapplicable", "⚪", c.inapplicable)}
237
+ `, w.querySelectorAll("[data-source-code]").forEach((e) => L(e)), w.querySelectorAll("[data-iframe-selector]").forEach((e) => {
230
238
  const o = e.getAttribute("data-iframe-selector");
231
239
  if (!o)
232
240
  throw new Error("No message found");
233
241
  e.addEventListener("click", async () => {
234
242
  await m();
235
- const s = e.textContent;
236
- if (!s)
243
+ const i = e.textContent;
244
+ if (!i)
237
245
  throw new Error("No selector found");
238
- const n = c.contentDocument?.querySelectorAll(s);
246
+ const n = d.contentDocument?.querySelectorAll(i);
239
247
  if (!n)
240
248
  throw new Error("No elements found");
241
249
  n.forEach((r) => {
242
- H(o, r), r.style.outline = "2px solid red", r.scrollIntoView({ behavior: "smooth", block: "center" }), setTimeout(() => r.style.outline = "", 5e3);
250
+ V(o, r), r.style.outline = "2px solid red", r.scrollIntoView({ behavior: "smooth", block: "center" }), setTimeout(() => r.style.outline = "", 5e3);
243
251
  });
244
252
  });
245
253
  });
@@ -1,4 +1,4 @@
1
- import { a as i, s as l } from "./preview-DxsvGJsw.js";
1
+ import { a as i, s as l } from "./preview-Cknxd_cP.js";
2
2
  const p = (o, s, a) => {
3
3
  o.addEventListener("input", () => {
4
4
  const t = o.value.toLowerCase();
@@ -3310,7 +3310,7 @@ rn.length > 0 && rn.forEach((e) => {
3310
3310
  });
3311
3311
  const Se = document.querySelectorAll("[data-code-audit-iframe]"), Re = document.querySelector("#code-audit-dialog"), on = document.querySelector(".dialog-backdrop");
3312
3312
  Se.length > 0 && Re && on && (async () => {
3313
- const { auditCode: e } = await import("./html-validator-M0X8x6ag.js"), { show: t, close: n } = ys(Re, on);
3313
+ const { auditCode: e } = await import("./html-validator-DLEAmrmB.js"), { show: t, close: n } = ys(Re, on);
3314
3314
  Se.forEach((s) => s.addEventListener("click", async () => {
3315
3315
  Se.forEach((r) => r.setAttribute("aria-expanded", "false")), s.setAttribute("disabled", ""), await e(s, Re, n), s.removeAttribute("disabled"), s.setAttribute("aria-expanded", "true"), await t(
3316
3316
  void 0,
@@ -3323,9 +3323,9 @@ Se.length > 0 && Re && on && (async () => {
3323
3323
  }));
3324
3324
  })();
3325
3325
  const an = document.querySelector("#icon-search-input"), ln = document.querySelector("#icon-search-input-reset"), un = document.querySelector("#icon-search-list");
3326
- an && un && ln && import("./icons-IQYIngUi.js").then(({ default: e }) => e(an, un, ln)).catch(console.error);
3326
+ an && un && ln && import("./icons-s_oHNZd6.js").then(({ default: e }) => e(an, un, ln)).catch(console.error);
3327
3327
  const Vs = "data-clipboard-value", cn = document.querySelectorAll(`button[${Vs}]`);
3328
- cn.length > 0 && import("./clipboard-CQ7U7_P0.js").then(({ default: e }) => e(cn, Vs)).catch(console.error);
3328
+ cn.length > 0 && import("./clipboard-DULMn8xf.js").then(({ default: e }) => e(cn, Vs)).catch(console.error);
3329
3329
  const fn = document.querySelectorAll(".markdown-container-folded");
3330
3330
  fn.length > 0 && fn.forEach((e) => {
3331
3331
  const t = e.querySelector(".markdown-container");
@@ -0,0 +1 @@
1
+ import "./preview-Cknxd_cP.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kss-modern",
3
3
  "type": "module",
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
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",
@@ -1 +0,0 @@
1
- import "./preview-DxsvGJsw.js";