@stacksjs/stx 0.2.268 → 0.2.270
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/builtins/image-delivery.d.ts +16 -0
- package/dist/builtins/image-delivery.js +73 -0
- package/dist/builtins/stx-image.js +27 -11
- package/dist/{chunk-2x9s5z8x.js → chunk-0an022xa.js} +1 -1
- package/dist/{chunk-6746wmsf.js → chunk-0gpkptex.js} +1 -1
- package/dist/{chunk-278yw67q.js → chunk-0ye9aj3r.js} +1 -1
- package/dist/chunk-11x9r23q.js +2 -0
- package/dist/{chunk-0athjw48.js → chunk-1bwwtctk.js} +2 -2
- package/dist/{chunk-shtemwbq.js → chunk-1fgbwc7a.js} +1 -1
- package/dist/chunk-1mr82303.js +2 -0
- package/dist/{chunk-bby4emay.js → chunk-1spzqjve.js} +1 -1
- package/dist/chunk-2a689vdq.js +2 -0
- package/dist/{chunk-krgth3gf.js → chunk-2c2z8n54.js} +1 -1
- package/dist/chunk-2qddseth.js +2 -0
- package/dist/chunk-2y22cbx8.js +2 -0
- package/dist/{chunk-q4n8a7sf.js → chunk-3445kmwm.js} +1 -1
- package/dist/{chunk-wrg838f0.js → chunk-3w45v2rv.js} +1 -1
- package/dist/chunk-3zd2f5qr.js +2 -0
- package/dist/chunk-4r06061f.js +2 -0
- package/dist/{chunk-987kjtg8.js → chunk-4we8yzyx.js} +1 -1
- package/dist/{chunk-5k1bec90.js → chunk-578te43w.js} +12 -12
- package/dist/chunk-5a07gxnz.js +2 -0
- package/dist/chunk-5arv7j0q.js +2 -0
- package/dist/{chunk-zr2rkgag.js → chunk-5n2g2z63.js} +2 -2
- package/dist/{chunk-9rdg7x9h.js → chunk-5xj9t4wa.js} +1 -1
- package/dist/chunk-6nar1v2y.js +2 -0
- package/dist/{chunk-8n89zhmq.js → chunk-6sha41vn.js} +2 -2
- package/dist/{chunk-f8wjdg40.js → chunk-71gwef4q.js} +1 -1
- package/dist/{chunk-chte720d.js → chunk-7fs8qzdd.js} +1 -1
- package/dist/{chunk-wnt3yvxv.js → chunk-7x4xbgp7.js} +1 -1
- package/dist/{chunk-9y175wxc.js → chunk-89wwrrpk.js} +2 -2
- package/dist/{chunk-rzdar1x9.js → chunk-8ee6xtdz.js} +3 -3
- package/dist/{chunk-95bfzrx2.js → chunk-8hpqcwwc.js} +2 -2
- package/dist/chunk-8v09eehd.js +2 -0
- package/dist/chunk-9ej520sb.js +2 -0
- package/dist/{chunk-1hhxj2r5.js → chunk-a53v7hcy.js} +1 -1
- package/dist/{chunk-f3m0q482.js → chunk-a6a9djpq.js} +1 -1
- package/dist/{chunk-khfszwjy.js → chunk-ae5tb4zm.js} +1 -1
- package/dist/{chunk-rwb4nztb.js → chunk-b63wkbvt.js} +1 -1
- package/dist/chunk-b70jwwhd.js +2 -0
- package/dist/{chunk-sfha6xsd.js → chunk-bab9k1e8.js} +1 -1
- package/dist/{chunk-hzwvszyg.js → chunk-bkavpp75.js} +2 -2
- package/dist/{chunk-8jvmjzmr.js → chunk-brahft3h.js} +1 -1
- package/dist/{chunk-m87wfz2b.js → chunk-bxv3k5w8.js} +2 -2
- package/dist/{chunk-f5v2qf95.js → chunk-bz820epz.js} +1 -1
- package/dist/chunk-cvkjsa0m.js +2 -0
- package/dist/{chunk-tv6ds16a.js → chunk-d204cw1f.js} +1 -1
- package/dist/chunk-d8np0m39.js +2 -0
- package/dist/{chunk-yax48zgv.js → chunk-dtnfedg1.js} +1 -1
- package/dist/chunk-dyqh15py.js +11 -0
- package/dist/chunk-e4ty7vfv.js +2 -0
- package/dist/{chunk-rc4zrsw3.js → chunk-e5z100yg.js} +1 -1
- package/dist/{chunk-1j77d7fw.js → chunk-e7svf8zh.js} +1 -1
- package/dist/chunk-eb17vwke.js +2 -0
- package/dist/chunk-ertf9176.js +2 -0
- package/dist/{chunk-yhtq662h.js → chunk-f0m82977.js} +1 -1
- package/dist/chunk-f0z8dy89.js +2 -0
- package/dist/{chunk-h6xxqg0h.js → chunk-f9decgn9.js} +1 -1
- package/dist/{chunk-wacr03x4.js → chunk-fk5y786g.js} +1 -1
- package/dist/chunk-g7gr6pvb.js +2 -0
- package/dist/{chunk-455pgdzh.js → chunk-g8xanqdg.js} +1 -1
- package/dist/{chunk-a3drgebc.js → chunk-ggem4nm2.js} +2 -2
- package/dist/{chunk-5k0j7bjy.js → chunk-gyrpe6m3.js} +1 -1
- package/dist/{chunk-n2r83qwt.js → chunk-ht4r7d1p.js} +1 -1
- package/dist/{chunk-w7gpyx2k.js → chunk-jqm0hfx2.js} +1 -1
- package/dist/{chunk-fvh9ca47.js → chunk-jr3jp3ev.js} +1 -1
- package/dist/{chunk-vnrhn6b0.js → chunk-k2nej4y6.js} +1 -1
- package/dist/{chunk-73yr54sg.js → chunk-kdg7g76f.js} +1 -1
- package/dist/{chunk-50gk2vsn.js → chunk-kerjvqz9.js} +2 -2
- package/dist/{chunk-477zvh3f.js → chunk-kkrg94ay.js} +2 -2
- package/dist/{chunk-f8g0zbm3.js → chunk-kms7q66w.js} +1 -1
- package/dist/{chunk-mync09v4.js → chunk-kzj42dav.js} +1 -1
- package/dist/chunk-man5awsh.js +2 -0
- package/dist/chunk-mjmm6wts.js +2 -0
- package/dist/{chunk-15x3b9tp.js → chunk-mw1szffx.js} +2 -2
- package/dist/{chunk-5d4csjhx.js → chunk-n3ggrhb3.js} +1 -1
- package/dist/{chunk-z8btarwy.js → chunk-nsf6d5dq.js} +1 -1
- package/dist/{chunk-dhe8sp1a.js → chunk-nsn7gfew.js} +1 -1
- package/dist/{chunk-fpkgcpey.js → chunk-ntfmdx5n.js} +416 -416
- package/dist/{chunk-jcped0kt.js → chunk-nx5qkm8k.js} +1 -1
- package/dist/{chunk-gej3rmfy.js → chunk-ph0q97r5.js} +1 -1
- package/dist/{chunk-135mme4g.js → chunk-q9zsjgpf.js} +1 -1
- package/dist/chunk-qhd9ctad.js +2 -0
- package/dist/{chunk-qmpsyysd.js → chunk-qkhw6tdx.js} +1 -1
- package/dist/{chunk-vrskjx64.js → chunk-qyfh6mf4.js} +1 -1
- package/dist/{chunk-5wkwhjjn.js → chunk-rhbq1var.js} +2 -2
- package/dist/{chunk-k7n88ess.js → chunk-s5r7hwsw.js} +1 -1
- package/dist/{chunk-6kcz7bg6.js → chunk-s9z3d94k.js} +2 -2
- package/dist/{chunk-4cr21p7m.js → chunk-sbppctqw.js} +1 -1
- package/dist/{chunk-p557qcrk.js → chunk-sqcpcnyf.js} +1 -1
- package/dist/{chunk-qkbrbys7.js → chunk-t1xzgpdm.js} +1 -1
- package/dist/{chunk-52wr95ps.js → chunk-t7b39wwk.js} +1 -1
- package/dist/{chunk-4ay1ymgp.js → chunk-tvtnf09q.js} +2 -2
- package/dist/{chunk-f1jd5qjb.js → chunk-txys90mf.js} +1 -1
- package/dist/{chunk-t35x61f5.js → chunk-v2rx1rey.js} +2 -2
- package/dist/chunk-v413wmmr.js +2 -0
- package/dist/chunk-v5vqxa3e.js +2 -0
- package/dist/{chunk-9gzmcxzg.js → chunk-vesr13aj.js} +1 -1
- package/dist/{chunk-1m4sa11y.js → chunk-vf4tde50.js} +1 -1
- package/dist/{chunk-e6tvnnnz.js → chunk-vqxmxgaj.js} +1 -1
- package/dist/{chunk-j24k071e.js → chunk-w18t3nmy.js} +1 -1
- package/dist/{chunk-868ep3pm.js → chunk-wyhp2hnm.js} +2 -2
- package/dist/chunk-x9s335jt.js +3 -0
- package/dist/chunk-xn65rbw3.js +2 -0
- package/dist/chunk-xtw5sm29.js +2 -0
- package/dist/{chunk-sde45gh3.js → chunk-yvpagchj.js} +1 -1
- package/dist/{chunk-erjf0z2d.js → chunk-yw1yt8b1.js} +1 -1
- package/dist/{chunk-hhyf0s7s.js → chunk-yy6m9kgm.js} +1 -1
- package/dist/chunk-zvygp42b.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +17 -17
- package/dist/store-loader.js +2 -0
- package/dist/visual-testing.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-0a2dq7g9.js +0 -2
- package/dist/chunk-1c0yy9rs.js +0 -2
- package/dist/chunk-2b4g32yv.js +0 -2
- package/dist/chunk-4mvpapjz.js +0 -2
- package/dist/chunk-5htqgzbb.js +0 -2
- package/dist/chunk-7jpq01y1.js +0 -2
- package/dist/chunk-7kkc13rc.js +0 -2
- package/dist/chunk-9asehtpb.js +0 -2
- package/dist/chunk-9th0hyk5.js +0 -2
- package/dist/chunk-bn1e010c.js +0 -2
- package/dist/chunk-bwf0xaqc.js +0 -2
- package/dist/chunk-c17r76es.js +0 -2
- package/dist/chunk-cg8dd896.js +0 -2
- package/dist/chunk-d867gwtk.js +0 -2
- package/dist/chunk-e1a1c5b9.js +0 -2
- package/dist/chunk-ea5ab7zt.js +0 -2
- package/dist/chunk-eszybcp6.js +0 -2
- package/dist/chunk-fwgqz5vv.js +0 -2
- package/dist/chunk-gaqvk74x.js +0 -11
- package/dist/chunk-j135b7xt.js +0 -2
- package/dist/chunk-jhfmkke9.js +0 -2
- package/dist/chunk-jnbhyzkv.js +0 -3
- package/dist/chunk-kcwa9cxw.js +0 -2
- package/dist/chunk-ng1wyd2v.js +0 -2
- package/dist/chunk-qh6223a0.js +0 -2
- package/dist/chunk-r4nkpr60.js +0 -2
- package/dist/chunk-ref9c9hn.js +0 -2
- package/dist/chunk-rgh4njyv.js +0 -2
- package/dist/chunk-tc01rmwh.js +0 -2
- package/dist/chunk-v5qv7q0y.js +0 -2
- package/dist/chunk-v9xkrwxt.js +0 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ImageDeliveryManifest } from 'ts-images/delivery';
|
|
2
|
+
/** Return build-time delivery metadata for one public image URL. */
|
|
3
|
+
export declare function getImageDelivery(src: string): ImageDeliveryManifest | undefined;
|
|
4
|
+
/** Clear process-global delivery state between builds and tests. */
|
|
5
|
+
export declare function clearImageDeliveryCatalog(): void;
|
|
6
|
+
/**
|
|
7
|
+
* Optimize every raster in the public directory before templates render.
|
|
8
|
+
*
|
|
9
|
+
* The builtin render pass is synchronous, so it consumes this in-memory
|
|
10
|
+
* catalog. Its content fingerprint is folded into the SSG cache key to ensure
|
|
11
|
+
* changing image bytes can never reuse HTML pointing at an older asset hash.
|
|
12
|
+
*/
|
|
13
|
+
export declare function prepareImageDelivery(publicDir: string, outputDir: string): Promise<{
|
|
14
|
+
count: number;
|
|
15
|
+
fingerprint: string;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { createImageDeliveryCatalog } from "ts-images/delivery";
|
|
5
|
+
const RASTER_EXTENSIONS = new Set([".avif", ".jpeg", ".jpg", ".png", ".webp"]), DEFAULT_WIDTHS = [320, 640, 960, 1280, 1920], DELIVERY_URL = "/_stx/images";
|
|
6
|
+
let deliveryCatalog = new Map;
|
|
7
|
+
function publicUrl(relativePath) {
|
|
8
|
+
return `/${relativePath.split(path.sep).map(encodeURIComponent).join("/")}`;
|
|
9
|
+
}
|
|
10
|
+
function catalogName(relativePath) {
|
|
11
|
+
const extension = path.extname(relativePath), readable = relativePath.slice(0, -extension.length).replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, ""), pathHash = createHash("sha256").update(relativePath).digest("hex").slice(0, 8);
|
|
12
|
+
return `${readable || "image"}-${pathHash}`;
|
|
13
|
+
}
|
|
14
|
+
async function collectRasterImages(root, directory = root) {
|
|
15
|
+
const entries = await fs.promises.readdir(directory, { withFileTypes: !0 });
|
|
16
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
17
|
+
const files = [];
|
|
18
|
+
for (const entry of entries) {
|
|
19
|
+
const absolutePath = path.join(directory, entry.name);
|
|
20
|
+
if (entry.isDirectory()) {
|
|
21
|
+
files.push(...await collectRasterImages(root, absolutePath));
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!entry.isFile() || !RASTER_EXTENSIONS.has(path.extname(entry.name).toLowerCase()))
|
|
25
|
+
continue;
|
|
26
|
+
files.push({ absolutePath, relativePath: path.relative(root, absolutePath) });
|
|
27
|
+
}
|
|
28
|
+
return files;
|
|
29
|
+
}
|
|
30
|
+
function normalizeLookupSource(src) {
|
|
31
|
+
if (!src || src.startsWith("data:") || src.startsWith("blob:") || /^https?:\/\//i.test(src) || src.startsWith("//"))
|
|
32
|
+
return;
|
|
33
|
+
const sourcePath = src.split(/[?#]/, 1)[0];
|
|
34
|
+
if (!sourcePath)
|
|
35
|
+
return;
|
|
36
|
+
try {
|
|
37
|
+
return `/${sourcePath.replace(/^\/+/, "").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`;
|
|
38
|
+
} catch {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function getImageDelivery(src) {
|
|
43
|
+
const key = normalizeLookupSource(src);
|
|
44
|
+
return key ? deliveryCatalog.get(key) : void 0;
|
|
45
|
+
}
|
|
46
|
+
export function clearImageDeliveryCatalog() {
|
|
47
|
+
deliveryCatalog = new Map;
|
|
48
|
+
}
|
|
49
|
+
export async function prepareImageDelivery(publicDir, outputDir) {
|
|
50
|
+
clearImageDeliveryCatalog();
|
|
51
|
+
if (!publicDir || !fs.existsSync(publicDir))
|
|
52
|
+
return { count: 0, fingerprint: "" };
|
|
53
|
+
const files = await collectRasterImages(publicDir);
|
|
54
|
+
if (files.length === 0)
|
|
55
|
+
return { count: 0, fingerprint: "" };
|
|
56
|
+
const catalog = await createImageDeliveryCatalog({
|
|
57
|
+
entries: files.map((file) => ({
|
|
58
|
+
key: publicUrl(file.relativePath),
|
|
59
|
+
input: file.absolutePath,
|
|
60
|
+
name: catalogName(file.relativePath)
|
|
61
|
+
})),
|
|
62
|
+
outDir: path.join(outputDir, "_stx", "images"),
|
|
63
|
+
baseUrl: DELIVERY_URL,
|
|
64
|
+
widths: DEFAULT_WIDTHS,
|
|
65
|
+
formats: ["avif", "webp"],
|
|
66
|
+
quality: { avif: 70, webp: 78, jpeg: 82, png: 100 },
|
|
67
|
+
placeholder: !0,
|
|
68
|
+
batchConcurrency: 4,
|
|
69
|
+
concurrency: 4
|
|
70
|
+
});
|
|
71
|
+
deliveryCatalog = new Map(Object.entries(catalog.entries));
|
|
72
|
+
return { count: files.length, fingerprint: catalog.fingerprint };
|
|
73
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { forwardResolvedAttrs, forwardStaticAttrs } from "./attrs.js";
|
|
2
|
+
import { getImageDelivery } from "./image-delivery.js";
|
|
2
3
|
import { getImagePlaceholder } from "./image-placeholder.js";
|
|
3
4
|
const DEFAULT_BREAKPOINTS = {
|
|
4
5
|
sm: 640,
|
|
@@ -100,11 +101,14 @@ function generateBlurPlaceholder(width, height, color = "#e5e7eb") {
|
|
|
100
101
|
}
|
|
101
102
|
export const StxImageBuiltin = {
|
|
102
103
|
name: "StxImage",
|
|
103
|
-
aliases: ["stx-image", "stx-img"],
|
|
104
|
+
aliases: ["Image", "stx-image", "stx-img"],
|
|
104
105
|
render(props, _slotContent, _ctx) {
|
|
105
|
-
const src = resolveProp(props, "src") || "", alt = resolveProp(props, "alt") || "", width = resolveProp(props, "width"), height = resolveProp(props, "height"), sizes = resolveProp(props, "sizes"), srcset = resolveProp(props, "srcset"), densities = resolveProp(props, "densities"), format = resolveProp(props, "format"), placeholder = resolveProp(props, "placeholder"), placeholderColor = resolveProp(props, "placeholderColor") || "#e5e7eb", provider = resolveProp(props, "provider"), className = resolveProp(props, "class") || resolveProp(props, "className") || "", style = resolveProp(props, "style") || "", quality = resolveProp(props, "quality"), lazy = resolveBoolProp(props, "lazy", !0), preload = resolveBoolProp(props, "preload", !1), usePicture = resolveBoolProp(props, "picture", !1) || !!format, numWidth = width ? Number.parseInt(width) : void 0, numHeight = height ? Number.parseInt(height) : void 0;
|
|
106
|
+
const src = resolveProp(props, "src") || "", delivery = getImageDelivery(src), alt = resolveProp(props, "alt") || "", width = resolveProp(props, "width") || (delivery ? String(delivery.source.width) : void 0), height = resolveProp(props, "height") || (delivery ? String(delivery.source.height) : void 0), sizes = resolveProp(props, "sizes"), srcset = resolveProp(props, "srcset"), densities = resolveProp(props, "densities"), format = resolveProp(props, "format"), placeholder = resolveProp(props, "placeholder") || (delivery ? "thumbhash" : void 0), placeholderColor = resolveProp(props, "placeholderColor") || "#e5e7eb", provider = resolveProp(props, "provider"), className = resolveProp(props, "class") || resolveProp(props, "className") || "", style = resolveProp(props, "style") || "", quality = resolveProp(props, "quality"), lazy = resolveBoolProp(props, "lazy", !0), preload = resolveBoolProp(props, "preload", !1), priority = resolveBoolProp(props, "priority", !1), explicitLoading = resolveProp(props, "loading"), decoding = resolveProp(props, "decoding") || "async", usePicture = !!delivery || resolveBoolProp(props, "picture", !1) || !!format, numWidth = width ? Number.parseInt(width) : void 0, numHeight = height ? Number.parseInt(height) : void 0;
|
|
106
107
|
let finalSrcset = srcset || "", finalSizes = "";
|
|
107
|
-
if (
|
|
108
|
+
if (delivery) {
|
|
109
|
+
finalSrcset = delivery.sources[delivery.fallback.format] || "";
|
|
110
|
+
finalSizes = sizes ? parseSizes(sizes) : "100vw";
|
|
111
|
+
} else if (!finalSrcset && sizes && provider && provider !== "local" && provider !== "static") {
|
|
108
112
|
finalSrcset = generateSrcset(src, DEFAULT_SRCSET_WIDTHS, provider, format);
|
|
109
113
|
finalSizes = parseSizes(sizes);
|
|
110
114
|
} else if (!finalSrcset && densities) {
|
|
@@ -118,7 +122,7 @@ export const StxImageBuiltin = {
|
|
|
118
122
|
if (numWidth && numHeight)
|
|
119
123
|
styles.push(`aspect-ratio:${numWidth}/${numHeight}`);
|
|
120
124
|
if (placeholder === "blur" || placeholder === "color" || placeholder === "thumbhash") {
|
|
121
|
-
const derived = getImagePlaceholder(src);
|
|
125
|
+
const derived = delivery?.placeholder ? { dataUrl: delivery.placeholder.dataUrl, color: placeholderColor } : getImagePlaceholder(src);
|
|
122
126
|
if (derived && placeholder === "color")
|
|
123
127
|
styles.push(`background-color:${derived.color}`);
|
|
124
128
|
else if (derived) {
|
|
@@ -137,16 +141,19 @@ export const StxImageBuiltin = {
|
|
|
137
141
|
styles.push("background-size:cover");
|
|
138
142
|
styles.push("background-repeat:no-repeat");
|
|
139
143
|
}
|
|
140
|
-
const finalSrc = transformSrc(src, numWidth, numHeight, provider, format), imgAttrs = [];
|
|
144
|
+
const finalSrc = delivery?.fallback.url || transformSrc(src, numWidth, numHeight, provider, format), imgAttrs = [];
|
|
141
145
|
imgAttrs.push(`src="${escapeAttr(finalSrc)}"`);
|
|
142
146
|
imgAttrs.push(`alt="${escapeAttr(alt)}"`);
|
|
143
147
|
if (width)
|
|
144
148
|
imgAttrs.push(`width="${escapeAttr(width)}"`);
|
|
145
149
|
if (height)
|
|
146
150
|
imgAttrs.push(`height="${escapeAttr(height)}"`);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
const loading = explicitLoading || (priority || preload ? "eager" : lazy ? "lazy" : "");
|
|
152
|
+
if (loading)
|
|
153
|
+
imgAttrs.push(`loading="${escapeAttr(loading)}"`);
|
|
154
|
+
if (priority)
|
|
155
|
+
imgAttrs.push('fetchpriority="high"');
|
|
156
|
+
imgAttrs.push(`decoding="${escapeAttr(decoding)}"`);
|
|
150
157
|
if (className)
|
|
151
158
|
imgAttrs.push(`class="${escapeAttr(className)}"`);
|
|
152
159
|
if (styles.length > 0)
|
|
@@ -173,7 +180,10 @@ export const StxImageBuiltin = {
|
|
|
173
180
|
"quality",
|
|
174
181
|
"densities",
|
|
175
182
|
"preload",
|
|
176
|
-
"
|
|
183
|
+
"priority",
|
|
184
|
+
"picture",
|
|
185
|
+
"loading",
|
|
186
|
+
"decoding"
|
|
177
187
|
]);
|
|
178
188
|
imgAttrs.push(...forwardStaticAttrs(props, consumedStatic));
|
|
179
189
|
imgAttrs.push(...forwardResolvedAttrs(props, consumedStatic));
|
|
@@ -186,11 +196,17 @@ export const StxImageBuiltin = {
|
|
|
186
196
|
}
|
|
187
197
|
if (usePicture) {
|
|
188
198
|
const sources = [];
|
|
189
|
-
if (
|
|
199
|
+
if (delivery)
|
|
200
|
+
for (const candidate of ["avif", "webp"]) {
|
|
201
|
+
const candidateSrcset = delivery.sources[candidate];
|
|
202
|
+
if (candidateSrcset)
|
|
203
|
+
sources.push(`<source type="image/${candidate}" srcset="${escapeAttr(candidateSrcset)}"${finalSizes ? ` sizes="${escapeAttr(finalSizes)}"` : ""} />`);
|
|
204
|
+
}
|
|
205
|
+
if (!delivery && (format === "avif" || format === "auto")) {
|
|
190
206
|
const avifSrc = transformSrc(src, numWidth, numHeight, provider, "avif"), avifSrcset = finalSrcset ? generateSrcset(src, DEFAULT_SRCSET_WIDTHS, provider, "avif") : `${avifSrc}`;
|
|
191
207
|
sources.push(`<source type="image/avif" srcset="${escapeAttr(avifSrcset)}"${finalSizes ? ` sizes="${escapeAttr(finalSizes)}"` : ""} />`);
|
|
192
208
|
}
|
|
193
|
-
if (format === "webp" || format === "auto") {
|
|
209
|
+
if (!delivery && (format === "webp" || format === "auto")) {
|
|
194
210
|
const webpSrc = transformSrc(src, numWidth, numHeight, provider, "webp"), webpSrcset = finalSrcset ? generateSrcset(src, DEFAULT_SRCSET_WIDTHS, provider, "webp") : `${webpSrc}`;
|
|
195
211
|
sources.push(`<source type="image/webp" srcset="${escapeAttr(webpSrcset)}"${finalSizes ? ` sizes="${escapeAttr(finalSizes)}"` : ""} />`);
|
|
196
212
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{eg as a,fg as b,gg as c,hg as d,ig as e,jg as f,kg as g,lg as h,mg as i,ng as j,og as k}from"./chunk-89wwrrpk.js";import"./chunk-74cv4ta1.js";import"./chunk-71gwef4q.js";export{c as setCachedVideoResult,k as processVideo,b as getCachedVideoResult,f as generateThumbnails,g as generateSpriteSheet,e as generatePoster,h as generateHLSManifest,i as generateDASHManifest,d as clearVideoCache,j as analyzeVideo,a as VideoProcessorCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ni as a,oi as b,pi as c,qi as d,ri as e}from"./chunk-9y0g8kzt.js";import"./chunk-
|
|
2
|
+
import{ni as a,oi as b,pi as c,qi as d,ri as e}from"./chunk-9y0g8kzt.js";import"./chunk-71gwef4q.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{At as
|
|
2
|
+
import{At as f,Bt as g,Ct as h,Dt as i,Et as j,Ft as k,Gt as l,Ht as m,It as n,Jt as o,Kt as p,vt as a,wt as b,xt as c,yt as d,zt as e}from"./chunk-t7b39wwk.js";import"./chunk-71gwef4q.js";export{i as useTitle,f as useSeoMeta,i as usePageTitle,d as useHead,g as seoMetaToHeadConfig,c as resetHead,k as renderHtmlAttrs,j as renderHead,l as renderBodyAttrs,o as processTitleDirective,p as processMetaDirective,n as processHeadDirective,e as mergeHeadConfigs,b as getPageMeta,a as getHead,h as definePageMeta,m as applyHead};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Gp as a,Hp as b,Ip as c,Jp as d,Kp as e,Lp as f}from"./chunk-ntfmdx5n.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-8ee6xtdz.js";import"./chunk-1spzqjve.js";import"./chunk-x9s335jt.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ns as B}from"./chunk-a6a9djpq.js";import I from"path";function M(z){if(!z)return!1;return z.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||z.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function L(z,X){let J=new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(z);if(!J)return null;return J[2]??J[3]??J[4]??null}function h(z,X,J,K){let j=z;j=j.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,G,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[G]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let _=/@screenReader\(([^@]*)\)@endScreenReader/g;return j=j.replace(_,(Q,G)=>{return`<span class="sr-only">${G.trim()}</span>`}),j=j.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,G,q)=>{return`<span id="${`desc-${G}`}" class="sr-only">${q}</span>`}),j}function s(){return`
|
|
3
3
|
.sr-only {
|
|
4
4
|
position: absolute;
|
|
5
5
|
width: 1px;
|
|
@@ -12,4 +12,4 @@ import{Is as B}from"./chunk-f3m0q482.js";import I from"path";function M(z){if(!z
|
|
|
12
12
|
border-width: 0;
|
|
13
13
|
}
|
|
14
14
|
`.trim()}function k(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function A(z){let X=new Map,J=z.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(j,_,Q)=>{let G=X.get(Q);if(!G)G=`stx-a11y-component-${X.size}`,X.set(Q,G);return`<${_}${G}`}),K=new Map([...X.entries()].map(([j,_])=>[_,j]));return{protectedSource:J,restore:(j)=>j.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(_,Q,G)=>{let q=K.get(G);return q?`<${Q}${q}`:_})}}function N(z,X){let J=[],K=/<img\s+([^>]*)>/gi,j;j=K.exec(z);while(j!==null){let Y=j[1];if(!/\balt\s*=/i.test(Y))J.push({type:"missing-alt",element:j[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});j=K.exec(z)}let _=/<button([^>]*)>\s*<\/button>/gi;j=_.exec(z);while(j!==null){let Y=j[1];if(!/\baria-label\s*=/i.test(Y)&&!/\btitle\s*=/i.test(Y))J.push({type:"missing-accessible-name",element:j[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});j=_.exec(z)}let Q=/<a\s+([^>]*)>\s*<\/a>/gi;j=Q.exec(z);while(j!==null){let Y=j[1];if(!/\baria-label\s*=/i.test(Y)&&!/\btitle\s*=/i.test(Y))J.push({type:"link-missing-text",element:j[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});j=Q.exec(z)}let G=/<(input|select|textarea)\s+([^>]*)>/gi;j=G.exec(z);while(j!==null){let Y=j[2];if(/\btype\s*=\s*["']hidden["']/i.test(Y)){j=G.exec(z);continue}let W=/\baria-label\s*=/i.test(Y)||/\baria-labelledby\s*=/i.test(Y),E=Y.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!W){let T=E&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${E[1]}["']`,"i").test(z),w=j.index,F=z.substring(0,w),f=z.substring(w),S=(F.match(/<label\b/gi)||[]).length,C=(F.match(/<\/label>/gi)||[]).length,P=S>C;if(!T&&!P)J.push({type:"input-missing-label",element:j[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}j=G.exec(z)}let q=/<h([1-6])[^>]*>/gi,H=[];j=q.exec(z);while(j!==null)H.push(Number.parseInt(j[1],10)),j=q.exec(z);let U=0;for(let Y of H){if(U>0&&Y>U+1)J.push({type:"heading-skip",element:`<h${Y}>`,message:`Heading level skipped from h${U} to h${Y}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});U=Y}if(/<html\b/i.test(z)&&!/<html[^>]*\slang\s*=/i.test(z))J.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let Z=/<table([^>]*)>([\s\S]*?)<\/table>/gi;j=Z.exec(z);while(j!==null){let Y=j[2];if(!M(L(j[1],"role"))&&!/<th\b/i.test(Y))J.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});j=Z.exec(z)}let O=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;j=O.exec(z);while(j!==null){if(!/\bmuted\b/i.test(j[0]))J.push({type:"autoplay-audio",element:`<${j[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});j=O.exec(z)}let $=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;j=$.exec(z);while(j!==null)J.push({type:"positive-tabindex",element:`tabindex="${j[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),j=$.exec(z);let V=/<iframe\s+([^>]*)>/gi;j=V.exec(z);while(j!==null){let Y=j[1];if(!/\btitle\s*=/i.test(Y)&&!/\baria-label\s*=/i.test(Y))J.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});j=V.exec(z)}let D=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;j=D.exec(z);while(j!==null){let Y=j[1].toLowerCase(),W=j[2];if(Y!=="button"&&!/\btabindex\s*=/i.test(W))J.push({type:"button-not-focusable",element:j[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});j=D.exec(z)}return J}async function y(z,X){let{protectedSource:J}=A(z);if(!k())return N(J,X);let K=[];try{let j=globalThis.document.createElement("div");j.innerHTML=J,j.querySelectorAll("img").forEach((q)=>{if(!q.hasAttribute("alt"))K.push({type:"missing-alt",element:`<${q.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),j.querySelectorAll('button, a, [role="button"]').forEach((q)=>{if(!(q.hasAttribute("aria-label")||q.hasAttribute("aria-labelledby")||q.textContent&&q.textContent.trim().length>0))K.push({type:"missing-accessible-name",element:`<${q.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),j.querySelectorAll("input, select, textarea").forEach((q)=>{let H=q.getAttribute("id"),U=H&&j.querySelector(`label[for="${H}"]`),Z=q.hasAttribute("aria-label")||q.hasAttribute("aria-labelledby"),O=q.closest("label")!==null;if(!U&&!Z&&!O)K.push({type:"input-missing-label",element:`<${q.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let _=Array.from(j.querySelectorAll("h1, h2, h3, h4, h5, h6")),Q=0;for(let q of _){let H=Number.parseInt(q.tagName.charAt(1));if(Q>0&&H>Q+1)K.push({type:"heading-skip",element:`<${q.outerHTML}>`,message:`Heading level skipped from h${Q} to h${H}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});Q=H}let G=j.querySelector("html");if(J.includes("<html")&&G&&!G.hasAttribute("lang"))K.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(j.querySelectorAll("a").forEach((q)=>{let H=q.textContent&&q.textContent.trim().length>0,U=q.hasAttribute("aria-label")||q.hasAttribute("aria-labelledby"),Z=q.hasAttribute("title"),O=q.querySelector("img[alt]");if(!H&&!U&&!Z&&!O)K.push({type:"link-missing-text",element:`<${q.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),J.includes("<nav")||J.includes("<header")){if(!j.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&j.querySelectorAll("a").length>5)K.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(j.querySelectorAll("table").forEach((q)=>{if(M(q.getAttribute("role")))return;let H=q.querySelector("caption");if(!q.querySelector("th"))K.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!H&&!q.hasAttribute("aria-label")&&!q.hasAttribute("aria-labelledby"))K.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),j.querySelectorAll('[style*="color"]').forEach((q)=>{let H=q.getAttribute("style")||"";if(H.includes("color:")&&!H.includes("background"))K.push({type:"potential-contrast-issue",element:`<${q.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),j.querySelectorAll("video[autoplay], audio[autoplay]").forEach((q)=>{if(!q.hasAttribute("muted"))K.push({type:"autoplay-audio",element:`<${q.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),j.querySelectorAll("[tabindex]").forEach((q)=>{if(Number.parseInt(q.getAttribute("tabindex")||"0")>0)K.push({type:"positive-tabindex",element:`<${q.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),j.querySelectorAll('[role="button"]').forEach((q)=>{if(!q.hasAttribute("tabindex"))K.push({type:"button-not-focusable",element:`<${q.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),J.includes("<body")&&!j.querySelector('main, [role="main"]'))K.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});j.querySelectorAll("iframe").forEach((q)=>{if(!q.hasAttribute("title")&&!q.hasAttribute("aria-label"))K.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(j){console.error(`Error checking accessibility in ${X}:`,j)}return K}async function R(z,X={}){let J={},{recursive:K=!0,ignorePaths:j=[]}=X,_=Array.isArray(z)?z:[z],Q=await B(_,{recursive:K,ignorePaths:j}),G=[];for(let q of Q)try{let H=await Bun.file(q).text();if(q.endsWith("good-a11y.stx"))continue;let U=await y(H,q);if(G.push(q),U.length>0)J[q]=U}catch(H){console.error(`Error scanning ${q}:`,H)}return{results:J,scannedFiles:G}}async function c(z,X={}){return(await R(z,X)).results}var b={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function v(z,X={}){let J={...b,...X},K=[],{protectedSource:j,restore:_}=A(z),Q=j;if(J.fixMissingAlt)Q=Q.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(G,q,H)=>{if(/\balt\s*=/i.test(q))return G;let U=G,Z=`<img${q} alt=""${H}`;return K.push({type:"missing-alt",description:"Added empty alt attribute to image",before:U,after:Z}),Z});if(J.fixMissingLabels)Q=Q.replace(/<button([^>]*)>\s*<\/button>/gi,(G,q)=>{if(/\baria-label\s*=/i.test(q)||/\btitle\s*=/i.test(q))return G;let H=G,U=`<button${q} aria-label="Button"></button>`;return K.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:H,after:U}),U}),Q=Q.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(G,q,H)=>{if(/\baria-label\s*=/i.test(q)||/\btitle\s*=/i.test(q))return G;if(!H&&G.replace(/<a[^>]*>|<\/a>/gi,"").trim())return G;let U=G,Z=`<a${q} aria-label="Link">${H||""}</a>`;return K.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:U,after:Z}),Z});if(J.fixMissingFormLabels)Q=Q.replace(/<(input|select|textarea)([^>]*)>/gi,(G,q,H)=>{if(/\baria-label\s*=/i.test(H)||/\baria-labelledby\s*=/i.test(H))return G;if(/\btype\s*=\s*["']hidden["']/i.test(H))return G;let U=H.match(/\bname\s*=\s*["']([^"']+)["']/i),Z=H.match(/\bid\s*=\s*["']([^"']+)["']/i),O=U?.[1]||Z?.[1]||q,$=G,V=`<${q}${H} aria-label="${O}">`;return K.push({type:"input-missing-label",description:`Added aria-label to ${q} element`,before:$,after:V}),V});if(J.fixMissingLang)Q=Q.replace(/<html([^>]*)>/gi,(G,q)=>{if(/\blang\s*=/i.test(q))return G;let H=G,U=`<html${q} lang="${J.defaultLang}">`;return K.push({type:"missing-lang",description:`Added lang="${J.defaultLang}" to html element`,before:H,after:U}),U});if(J.fixPositiveTabindex)Q=Q.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(G,q)=>{let H=G,U='tabindex="0"';return K.push({type:"positive-tabindex",description:`Changed tabindex="${q}" to tabindex="0"`,before:H,after:'tabindex="0"'}),'tabindex="0"'});if(J.fixButtonFocusable)Q=Q.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(G,q,H)=>{if(/\btabindex\s*=/i.test(H))return G;if(q.toLowerCase()==="button")return G;let U=G,Z=`<${q}${H} tabindex="0">`;return K.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:U,after:Z}),Z});if(J.fixTableHeaders)Q=Q.replace(/<th([^>]*)>/gi,(G,q)=>{if(/\bscope\s*=/i.test(q))return G;let H=G,U=`<th${q} scope="col">`;return K.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:H,after:U}),U});return{original:z,fixed:_(Q),fixCount:K.length,fixes:K}}async function x(z,X={},J=!1){let K=await Bun.file(z).text(),j=v(K,X);if(J&&j.fixCount>0)await Bun.write(z,j.fixed);return j}async function m(z,X={},J={}){let K={},{recursive:j=!0,ignorePaths:_=[],writeBack:Q=!1,extensions:G=[".stx",".html",".htm"]}=J,q=G.length===1?`*${G[0]}`:`*{${G.join(",")}}`,H=I.join(z,j?`**/${q}`:q),U=new Bun.Glob(H);for await(let Z of U.scan()){if(_.some(($)=>Z.includes(I.normalize($))))continue;try{let $=await x(Z,X,Q);if($.fixCount>0)K[Z]=$}catch($){console.error(`Error fixing ${Z}:`,$)}}return K}var u={name:"a11y",handler:(z,X,J,K)=>{if(!X.length)return z;let j=X[0].replace(/['"]/g,""),_=X.length>1?X[1].replace(/['"]/g,""):"",G={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[j]||"Make this element accessible";return`<!-- a11y-hint: ${_||G} -->${z}`},hasEndTag:!1},d={name:"screenReader",handler:(z)=>{return`<span class="sr-only">${z}</span>`},hasEndTag:!0};function r(){return[u,d]}
|
|
15
|
-
export{M as
|
|
15
|
+
export{M as os,L as ps,h as qs,s as rs,k as ss,N as ts,y as us,R as vs,c as ws,v as xs,x as ys,m as zs,u as As,d as Bs,r as Cs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ii as a,ji as b,ki as c,li as d,mi as e}from"./chunk-y7m2dpd3.js";import"./chunk-
|
|
2
|
+
import{ii as a,ji as b,ki as c,li as d,mi as e}from"./chunk-y7m2dpd3.js";import"./chunk-71gwef4q.js";export{c as renderSSRSuspense,a as processSuspenseDirectives,e as generateSuspenseRuntime,d as generateSuspenseCSS,b as createSSRSuspense};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Xi as a,Yi as b,Zi as c}from"./chunk-7x4xbgp7.js";import"./chunk-9n0gvfrg.js";import"./chunk-ntfmdx5n.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-8ee6xtdz.js";import"./chunk-1spzqjve.js";import"./chunk-x9s335jt.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import C from"path";var G=".stx",K="STX_DIR",J=null;function O(j){J=j?.trim()||null}function H(){return process.env[K]?.trim()||J||G}function Q(j=process.cwd(),...q){let B=H();return C.isAbsolute(B)?C.join(B,...q):C.join(j,B,...q)}function W(j){if(!j||C.isAbsolute(j))return j;let q=j.replace(/\\/g,"/");if(q!==G&&!q.startsWith(`${G}/`))return j;let B=q.slice(G.length+1);return B?C.join(H(),B):H()}
|
|
3
|
-
export{G as
|
|
3
|
+
export{G as mt,K as nt,O as ot,H as pt,Q as qt,W as rt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hf as c,if as d,jf as e,kf as f,lf as g,mf as h}from"./chunk-ggem4nm2.js";import{Ug as a,Xg as b}from"./chunk-kerjvqz9.js";import"./chunk-7x4xbgp7.js";import"./chunk-9n0gvfrg.js";import"./chunk-ntfmdx5n.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-8ee6xtdz.js";import"./chunk-1spzqjve.js";import"./chunk-x9s335jt.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
|
|
@@ -299,4 +299,4 @@ catch (error) {
|
|
|
299
299
|
}
|
|
300
300
|
})();
|
|
301
301
|
</script>`}var N={name:"pwa.installButton",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return H(j,q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Q={name:"pwa.updatePrompt",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return J(j,q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},T={name:"pwa.offlineIndicator",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return L(j,q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},V={name:"pwa.pushSubscribe",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return M(j,q)},hasEndTag:!0,description:"Renders a push notification subscription button"},X=[N,Q,T,V];function Z(j){return[...j,...X]}
|
|
302
|
-
export{N as
|
|
302
|
+
export{N as Qu,Q as Ru,T as Su,V as Tu,X as Uu,Z as Vu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Tg as a}from"./chunk-wyhp2hnm.js";import"./chunk-kerjvqz9.js";import"./chunk-v2rx1rey.js";import"./chunk-ph0q97r5.js";import"./chunk-w95sp0k9.js";import"./chunk-58f0mthg.js";import"./chunk-ntfmdx5n.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-8ee6xtdz.js";import"./chunk-1spzqjve.js";import"./chunk-x9s335jt.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{a as buildForProduction};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{us as Q}from"./chunk-1bwwtctk.js";import"./chunk-a6a9djpq.js";import{qt as R}from"./chunk-1spzqjve.js";import"./chunk-71gwef4q.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(" STX Story Visual Regression Tests"),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),b.join(`
|
|
3
3
|
`)}async function S(j,b={}){let q=performance.now(),z=[],K=0,B=0;for(let G of j.storyFiles)try{let L=await Bun.file(G.path).text(),M=await Q(L,G.path);if(M.length>0){for(let N of M)z.push({storyId:G.id,variantId:"default",component:G.component,message:`A11y: ${N.message}`,expected:"No accessibility violations",actual:`${N.type}: ${N.message} (impact: ${N.impact})`});B++}else K++}catch(L){z.push({storyId:G.id,variantId:"default",component:G.component,message:`Failed to check a11y: ${L instanceof Error?L.message:String(L)}`,expected:"File readable for a11y check",actual:"File read error"}),B++}let J=performance.now()-q;return{total:j.storyFiles.length,passed:K,failed:B,new:0,failures:z,duration:J}}export{A as updateSnapshots,W as runVisualTests,S as runA11yTests,I as formatTestResults};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$e as x,Xe as t,Ye as u,Ze as v,_e as w,af as y,bf as z,cf as A,df as B,ef as C,ff as D,gf as E}from"./chunk-s9z3d94k.js";import{Cf as r,Df as s}from"./chunk-5n2g2z63.js";import{Ag as e,Bg as f,Cg as g,Dg as h,Fg as i,Gg as j,Hg as k,Ig as l,Jg as m,Kg as n,Lg as o,Mg as p,Ng as q,xg as b,yg as c,zg as d}from"./chunk-tvtnf09q.js";import{Dh as a}from"./chunk-w3ycm4na.js";import"./chunk-q9zsjgpf.js";import"./chunk-71gwef4q.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fs as a,gs as b,hs as c,is as d,js as e,ks as f}from"./chunk-ntfmdx5n.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-8ee6xtdz.js";import"./chunk-1spzqjve.js";import"./chunk-x9s335jt.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Zu as v}from"./chunk-71gwef4q.js";function _4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function zZ(){return typeof window<"u"&&typeof document<"u"}async function N4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var y=new Map;function E4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function A4(Z){switch(Z){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function k4(Z="top-right"){if(!zZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function H4(Z){let{options:Y}=Z,$=A4(Y.type),J=Y.type||"info",G=Y.duration!==0;return`
|
|
3
3
|
<div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
|
|
4
4
|
<div class="stx-toast-icon">${$}</div>
|
|
5
5
|
<div class="stx-toast-content">
|