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.
package/dist/node/lib/index.mjs
CHANGED
|
@@ -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-
|
|
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}"` : ""}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
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(" "),
|
|
17
|
-
return
|
|
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
|
|
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 }),
|
|
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(
|
|
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,
|
|
55
|
-
t !==
|
|
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") &&
|
|
60
|
-
const
|
|
61
|
-
const { default: r } = await import("./axe-Ciyt_55N.js").then((a) => a.a),
|
|
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 (!
|
|
70
|
+
if (!o)
|
|
71
71
|
throw new Error("No results from html-validate");
|
|
72
|
-
const
|
|
72
|
+
const l = /* @__PURE__ */ new Map(), s = (a) => {
|
|
73
73
|
a.forEach((p) => {
|
|
74
74
|
p.nodes.forEach((u) => {
|
|
75
|
-
u.target.forEach((
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
throw new Error(`Could not find element for selector: ${
|
|
79
|
-
|
|
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
|
|
85
|
-
result:
|
|
86
|
-
targetMap:
|
|
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:
|
|
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
|
|
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
|
-
}),
|
|
98
|
-
return await Promise.all(
|
|
99
|
-
const w = (await
|
|
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
|
-
...
|
|
101
|
+
...c,
|
|
102
102
|
ruleDescription: w
|
|
103
103
|
};
|
|
104
104
|
}));
|
|
105
105
|
}, [n, t] = await Promise.all([
|
|
106
|
-
|
|
106
|
+
d(),
|
|
107
107
|
e()
|
|
108
|
-
]),
|
|
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(
|
|
115
|
-
}) : new URLSearchParams(window.location.search).get("modifier") &&
|
|
116
|
-
window.querySelectorAnywhere = (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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.
|
|
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.
|
|
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",
|