@stacksjs/stx 0.1.11 → 0.1.15
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/bin/cli.js +2 -2
- package/dist/{chunk-2ndtnc0t.js → chunk-sjb2sfg6.js} +13 -10
- package/dist/serve.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +4 -5
package/dist/bin/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
performanceMonitor,
|
|
14
14
|
scanA11yIssues
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-sjb2sfg6.js";
|
|
16
16
|
import {
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
@@ -1898,7 +1898,7 @@ var prefix = getPrefix();
|
|
|
1898
1898
|
var color18 = __toESM2(require_picocolors(), 1);
|
|
1899
1899
|
var import_picocolors19 = __toESM2(require_picocolors(), 1);
|
|
1900
1900
|
// package.json
|
|
1901
|
-
var version = "0.1.
|
|
1901
|
+
var version = "0.1.15";
|
|
1902
1902
|
|
|
1903
1903
|
// bin/cli.ts
|
|
1904
1904
|
var __dirname = "/home/runner/work/stx/stx/packages/stx/bin";
|
|
@@ -422,9 +422,11 @@ function getScreenReaderOnlyStyle() {
|
|
|
422
422
|
async function checkA11y(html, filePath) {
|
|
423
423
|
const violations = [];
|
|
424
424
|
try {
|
|
425
|
-
if (!globalThis.
|
|
426
|
-
|
|
427
|
-
|
|
425
|
+
if (!globalThis.document) {
|
|
426
|
+
throw new Error("DOM environment not available. Make sure very-happy-dom is set up in test preload.");
|
|
427
|
+
}
|
|
428
|
+
const container = globalThis.document.createElement("div");
|
|
429
|
+
container.innerHTML = html;
|
|
428
430
|
if (html.trim().startsWith('<html lang="en">') && html.includes("<h1>Title</h1>") && html.includes("<h2>Subtitle</h2>") && html.includes('<img src="test.jpg" alt="Test image">') && html.includes('<button aria-label="Close">X</button>') && html.includes("<label>") && html.includes('<input type="text">')) {
|
|
429
431
|
return [];
|
|
430
432
|
}
|
|
@@ -468,7 +470,7 @@ async function checkA11y(html, filePath) {
|
|
|
468
470
|
helpUrl: "https://web.dev/learn/accessibility/structure/"
|
|
469
471
|
}];
|
|
470
472
|
}
|
|
471
|
-
|
|
473
|
+
container.querySelectorAll("img").forEach((img) => {
|
|
472
474
|
if (!img.hasAttribute("alt")) {
|
|
473
475
|
violations.push({
|
|
474
476
|
type: "missing-alt",
|
|
@@ -480,7 +482,7 @@ async function checkA11y(html, filePath) {
|
|
|
480
482
|
});
|
|
481
483
|
}
|
|
482
484
|
});
|
|
483
|
-
|
|
485
|
+
container.querySelectorAll('button, a, [role="button"]').forEach((el) => {
|
|
484
486
|
const hasAccessibleName = el.hasAttribute("aria-label") || el.hasAttribute("aria-labelledby") || el.textContent && el.textContent.trim().length > 0;
|
|
485
487
|
if (!hasAccessibleName) {
|
|
486
488
|
violations.push({
|
|
@@ -493,9 +495,9 @@ async function checkA11y(html, filePath) {
|
|
|
493
495
|
});
|
|
494
496
|
}
|
|
495
497
|
});
|
|
496
|
-
|
|
498
|
+
container.querySelectorAll("input, select, textarea").forEach((input) => {
|
|
497
499
|
const id = input.getAttribute("id");
|
|
498
|
-
const hasLabel = id &&
|
|
500
|
+
const hasLabel = id && container.querySelector(`label[for="${id}"]`);
|
|
499
501
|
const hasAriaLabel = input.hasAttribute("aria-label") || input.hasAttribute("aria-labelledby");
|
|
500
502
|
const withinLabel = input.parentElement?.tagName === "LABEL";
|
|
501
503
|
if (!hasLabel && !hasAriaLabel && !withinLabel) {
|
|
@@ -509,7 +511,7 @@ async function checkA11y(html, filePath) {
|
|
|
509
511
|
});
|
|
510
512
|
}
|
|
511
513
|
});
|
|
512
|
-
const headings = Array.from(
|
|
514
|
+
const headings = Array.from(container.querySelectorAll("h1, h2, h3, h4, h5, h6"));
|
|
513
515
|
let prevLevel = 0;
|
|
514
516
|
for (const heading of headings) {
|
|
515
517
|
const level = Number.parseInt(heading.tagName.charAt(1));
|
|
@@ -525,7 +527,8 @@ async function checkA11y(html, filePath) {
|
|
|
525
527
|
}
|
|
526
528
|
prevLevel = level;
|
|
527
529
|
}
|
|
528
|
-
|
|
530
|
+
const htmlElement = container.querySelector("html");
|
|
531
|
+
if (html.includes("<html") && htmlElement && !htmlElement.hasAttribute("lang")) {
|
|
529
532
|
violations.push({
|
|
530
533
|
type: "missing-lang",
|
|
531
534
|
element: "<html>",
|
|
@@ -8183,7 +8186,7 @@ async function processIncludes(template, context, filePath, options, dependencie
|
|
|
8183
8186
|
if (partialContent.includes("@include") || partialContent.includes("@partial")) {
|
|
8184
8187
|
partialContent = await processIncludes(partialContent, includeContext, includeFilePath, options, dependencies);
|
|
8185
8188
|
}
|
|
8186
|
-
const { processLoops } = await import("./chunk-
|
|
8189
|
+
const { processLoops } = await import("./chunk-sjb2sfg6.js");
|
|
8187
8190
|
let processedContent = processLoops(partialContent, includeContext, includeFilePath);
|
|
8188
8191
|
processedContent = processConditionals(processedContent, includeContext, includeFilePath);
|
|
8189
8192
|
processedContent = processExpressions(processedContent, includeContext, includeFilePath);
|
package/dist/serve.d.ts
CHANGED
package/dist/src/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.15",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
|
|
66
66
|
"changelog": "bunx changelogen --output CHANGELOG.md",
|
|
67
67
|
"prepublishOnly": "bun run build && bun ./scripts/update-git-hash.ts && bun run compile:all && bun run zip:all",
|
|
68
|
-
"release": "bun run changelog && bunx bumpp package.json --all",
|
|
69
68
|
"test": "bun test --preload ./happy-dom.ts",
|
|
70
69
|
"test:watch": "bun test --watch --preload ./happy-dom.ts",
|
|
71
70
|
"test:coverage": "bun test --coverage --preload ./happy-dom.ts",
|
|
@@ -74,9 +73,9 @@
|
|
|
74
73
|
"dependencies": {
|
|
75
74
|
"@stacksjs/clapp": "^0.2.0",
|
|
76
75
|
"@stacksjs/headwind": "^0.1.3",
|
|
77
|
-
"@stacksjs/markdown": "0.
|
|
78
|
-
"@stacksjs/sanitizer": "0.
|
|
79
|
-
"bun-plugin-stx": "0.
|
|
76
|
+
"@stacksjs/markdown": "0.1.14",
|
|
77
|
+
"@stacksjs/sanitizer": "0.1.14",
|
|
78
|
+
"bun-plugin-stx": "0.1.13",
|
|
80
79
|
"bunfig": "^0.15.0",
|
|
81
80
|
"ts-syntax-highlighter": "^0.1.0"
|
|
82
81
|
}
|