@vizejs/vite-plugin-musea 0.429.0 → 0.429.2
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/a11y/index.d.mts +1 -1
- package/dist/api-CNyDcynu.d.mts +92 -0
- package/dist/api-CNyDcynu.d.mts.map +1 -0
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.d.mts.map +1 -1
- package/dist/cli/index.mjs +77 -32
- package/dist/cli/index.mjs.map +1 -1
- package/dist/gallery/assets/{MonacoEditor-BIjYdDrA.js → MonacoEditor-CB2n7c2l.js} +2 -2
- package/dist/gallery/assets/{cssMode-C5PB9d_X.js → cssMode-BOXljs9I.js} +1 -1
- package/dist/gallery/assets/{editor.api-tyf2wJeZ.js → editor.api-z9id08VB.js} +1 -1
- package/dist/gallery/assets/{freemarker2-Df2SP4C4.js → freemarker2-vB6fnjn6.js} +1 -1
- package/dist/gallery/assets/{handlebars-CbFr-5KQ.js → handlebars-BnLDdGBy.js} +1 -1
- package/dist/gallery/assets/{html-C1ubjnt5.js → html-XIF_CBY2.js} +1 -1
- package/dist/gallery/assets/{htmlMode-9FYaGqmo.js → htmlMode-BbETkoCr.js} +1 -1
- package/dist/gallery/assets/{index-BjW1cVGf.js → index-DJdBoIcR.js} +3 -3
- package/dist/gallery/assets/{index-D81pMC9f.css → index-DecaxxaH.css} +1 -1
- package/dist/gallery/assets/{javascript-DjzYR9ls.js → javascript-BQ2IaRg8.js} +1 -1
- package/dist/gallery/assets/{jsonMode-BRxSdIjW.js → jsonMode-CfAhmV2N.js} +1 -1
- package/dist/gallery/assets/{liquid-DD0LqlcF.js → liquid-D276vDHW.js} +1 -1
- package/dist/gallery/assets/{lspLanguageFeatures-C0f4qlAU.js → lspLanguageFeatures-T0Yl8WyA.js} +1 -1
- package/dist/gallery/assets/{mdx-DtcWR2Lx.js → mdx-8tVpATwJ.js} +1 -1
- package/dist/gallery/assets/{python-C1OlrT9L.js → python-DATCDwcZ.js} +1 -1
- package/dist/gallery/assets/{razor-BN2Zj1B9.js → razor-ClabmU4L.js} +1 -1
- package/dist/gallery/assets/{register-CTEjv03I.js → register-5BfKof-F.js} +2 -2
- package/dist/gallery/assets/{toggleHighContrast-BELgo5Kd.js → toggleHighContrast-DioIT9Mn.js} +1 -1
- package/dist/gallery/assets/{tsMode-Bd8a8shj.js → tsMode-cVX35Sca.js} +1 -1
- package/dist/gallery/assets/{typescript-DLlFIuFu.js → typescript-Bb2NpBwY.js} +1 -1
- package/dist/gallery/assets/{vs-YCtNwrNl.js → vs-DUMbM4mx.js} +3 -3
- package/dist/gallery/assets/{workers-CBv4Qjp-.js → workers-DTy0Zfv5.js} +1 -1
- package/dist/gallery/assets/{xml-wUPbJH_s.js → xml-uDUv8sjd.js} +1 -1
- package/dist/gallery/assets/{yaml-B52zgDg-.js → yaml-BDdk5pSi.js} +1 -1
- package/dist/gallery/index.html +2 -2
- package/dist/{gallery-qE5deHL0.mjs → gallery-BVjLEh8U.mjs} +2 -2
- package/dist/{gallery-qE5deHL0.mjs.map → gallery-BVjLEh8U.mjs.map} +1 -1
- package/dist/{index-HVtO9FK5.d.mts → index-CVNSFoLa.d.mts} +3 -92
- package/dist/index-CVNSFoLa.d.mts.map +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +29 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{options-Cd7bzLGr.mjs → options-CRaAwhKq.mjs} +88 -28
- package/dist/options-CRaAwhKq.mjs.map +1 -0
- package/dist/{plugin-CIrKPW8K.d.mts → plugin-GXZ0wPOx.d.mts} +10 -1
- package/dist/plugin-GXZ0wPOx.d.mts.map +1 -0
- package/dist/{template-DNhEgY8-.mjs → template-BRTA___e.mjs} +2 -2
- package/dist/{template-DNhEgY8-.mjs.map → template-BRTA___e.mjs.map} +1 -1
- package/package.json +4 -4
- package/dist/index-HVtO9FK5.d.mts.map +0 -1
- package/dist/options-Cd7bzLGr.mjs.map +0 -1
- package/dist/plugin-CIrKPW8K.d.mts.map +0 -1
package/dist/a11y/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as generateA11yHtmlReport, i as computeA11ySummary, n as MuseaA11yRunner, o as generateA11yJsonReport, r as resolveAxeSource, t as A11ySummary } from "../index-
|
|
1
|
+
import { a as generateA11yHtmlReport, i as computeA11ySummary, n as MuseaA11yRunner, o as generateA11yJsonReport, r as resolveAxeSource, t as A11ySummary } from "../index-CVNSFoLa.mjs";
|
|
2
2
|
export { A11ySummary, MuseaA11yRunner, computeA11ySummary, generateA11yHtmlReport, generateA11yJsonReport, resolveAxeSource };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//#region src/types/api.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Palette API response.
|
|
4
|
+
*/
|
|
5
|
+
interface PaletteApiResponse {
|
|
6
|
+
title: string;
|
|
7
|
+
controls: PaletteControl[];
|
|
8
|
+
groups: string[];
|
|
9
|
+
json: string;
|
|
10
|
+
typescript: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Single prop control definition.
|
|
14
|
+
*/
|
|
15
|
+
interface PaletteControl {
|
|
16
|
+
name: string;
|
|
17
|
+
control: ControlKind;
|
|
18
|
+
default_value?: unknown;
|
|
19
|
+
description?: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
options: Array<{
|
|
22
|
+
label: string;
|
|
23
|
+
value: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
range?: {
|
|
26
|
+
min: number;
|
|
27
|
+
max: number;
|
|
28
|
+
step?: number;
|
|
29
|
+
};
|
|
30
|
+
group?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Supported control kinds for the props panel.
|
|
34
|
+
*/
|
|
35
|
+
type ControlKind = "text" | "number" | "boolean" | "range" | "select" | "radio" | "color" | "date" | "object" | "array" | "file" | "raw";
|
|
36
|
+
/**
|
|
37
|
+
* Analysis API response (Props/Emits info).
|
|
38
|
+
*/
|
|
39
|
+
interface AnalysisApiResponse {
|
|
40
|
+
props: Array<{
|
|
41
|
+
name: string;
|
|
42
|
+
type: string;
|
|
43
|
+
required: boolean;
|
|
44
|
+
default_value?: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
emits: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Accessibility testing options.
|
|
50
|
+
*/
|
|
51
|
+
interface A11yOptions {
|
|
52
|
+
/** Enable a11y auditing during VRT */
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
/** axe-core rules to include */
|
|
55
|
+
includeRules?: string[];
|
|
56
|
+
/** axe-core rules to exclude */
|
|
57
|
+
excludeRules?: string[];
|
|
58
|
+
/** WCAG level (A, AA, AAA) */
|
|
59
|
+
level?: "A" | "AA" | "AAA";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Accessibility audit result.
|
|
63
|
+
*/
|
|
64
|
+
interface A11yResult {
|
|
65
|
+
artPath: string;
|
|
66
|
+
variantName: string;
|
|
67
|
+
violations: A11yViolation[];
|
|
68
|
+
passes: number;
|
|
69
|
+
incomplete: number;
|
|
70
|
+
/**
|
|
71
|
+
* Why the audit could not run, when it could not run.
|
|
72
|
+
*
|
|
73
|
+
* A variant that failed to audit measured *nothing* about accessibility,
|
|
74
|
+
* so it reports no violations. Recording the failure here instead of as a
|
|
75
|
+
* synthetic `critical` violation keeps the counts honest: a broken run
|
|
76
|
+
* reads as broken rather than as a component with critical defects.
|
|
77
|
+
*/
|
|
78
|
+
error?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Single accessibility violation.
|
|
82
|
+
*/
|
|
83
|
+
interface A11yViolation {
|
|
84
|
+
id: string;
|
|
85
|
+
impact: "minor" | "moderate" | "serious" | "critical";
|
|
86
|
+
description: string;
|
|
87
|
+
helpUrl: string;
|
|
88
|
+
nodes: number;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { PaletteApiResponse as i, A11yResult as n, AnalysisApiResponse as r, A11yOptions as t };
|
|
92
|
+
//# sourceMappingURL=api-CNyDcynu.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-CNyDcynu.d.mts","names":[],"sources":["../src/types/api.ts"],"mappings":";;AAGA;;UAAiB,kBAAA;EACf,KAAA;EACA,QAAA,EAAU,cAAc;EACxB,MAAA;EACA,IAAA;EACA,UAAA;AAAA;;;AAAU;UAMK,cAAA;EACf,IAAA;EACA,OAAA,EAAS,WAAA;EACT,aAAA;EACA,WAAA;EACA,QAAA;EACA,OAAA,EAAS,KAAK;IAAG,KAAA;IAAe,KAAA;EAAA;EAChC,KAAA;IAAU,GAAA;IAAa,GAAA;IAAa,IAAA;EAAA;EACpC,KAAA;AAAA;;;;KAMU,WAAA;AAAZ;;;AAAA,UAiBiB,mBAAA;EACf,KAAA,EAAO,KAAK;IACV,IAAA;IACA,IAAA;IACA,QAAA;IACA,aAAA;EAAA;EAEF,KAAA;AAAA;;;;UAUe,WAAA;EAVV;EAYL,OAAA;EAFe;EAIf,YAAA;;EAEA,YAAA;EAJA;EAMA,KAAA;AAAA;;;AAAK;UAMU,UAAA;EACf,OAAA;EACA,WAAA;EACA,UAAA,EAAY,aAAa;EACzB,MAAA;EACA,UAAA;EAFA;;;;;;AAWK;AAMP;EANE,KAAA;AAAA;;;;UAMe,aAAA;EACf,EAAA;EACA,MAAA;EACA,WAAA;EACA,OAAA;EACA,KAAA;AAAA"}
|
package/dist/cli/index.d.mts
CHANGED
package/dist/cli/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/cli/index.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/cli/index.ts"],"mappings":";;;KAkCK,OAAA;AAAA,UAEY,UAAA;EACf,OAAA,EAAS,OAAA;EACT,MAAA;EACA,MAAA;EACA,MAAA;EACA,SAAA;EACA,iBAAA;EACA,OAAA;EACA,eAAA;EACA,IAAA;EACA,EAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA;EACA,OAAA;EACA,aAAA;EACA,GAAA,GAAM,eAAe;AAAA;AAAA,iBAGP,SAAA,CAAU,IAAA,aAAiB,UAAU"}
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as readMuseaOptions, r as processMuseaArtFile } from "../options-
|
|
2
|
+
import { g as scanArtFiles, n as readMuseaOptions, r as processMuseaArtFile } from "../options-CRaAwhKq.mjs";
|
|
3
3
|
import { a as normalizeVrtWorkerCount, i as MuseaVrtRunner, n as generateVrtJsonReport, r as generateVrtReport } from "../vrt-UxzWFygI.mjs";
|
|
4
4
|
import fs, { realpathSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { loadConfigFromFile } from "vite";
|
|
8
8
|
//#region src/cli/utils.ts
|
|
9
|
-
/**
|
|
10
|
-
* CLI utility functions for art file scanning and parsing.
|
|
11
|
-
*
|
|
12
|
-
* Extracted from cli.ts to keep file sizes manageable.
|
|
13
|
-
*/
|
|
14
|
-
/** Recursively scan a directory for .art.vue files. */
|
|
15
|
-
async function scanArtFiles(root) {
|
|
16
|
-
const files = [];
|
|
17
|
-
async function scan(dir) {
|
|
18
|
-
let entries;
|
|
19
|
-
try {
|
|
20
|
-
entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
21
|
-
} catch (error) {
|
|
22
|
-
if (error.code === "EACCES") return;
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
for (const entry of entries) {
|
|
26
|
-
const fullPath = path.join(dir, entry.name);
|
|
27
|
-
if (entry.name === "node_modules" || entry.name === "dist") continue;
|
|
28
|
-
if (entry.isDirectory()) await scan(fullPath);
|
|
29
|
-
else if (entry.isFile() && entry.name.endsWith(".art.vue")) files.push(fullPath);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
await scan(root);
|
|
33
|
-
return files;
|
|
34
|
-
}
|
|
35
9
|
/** Parse a single .art.vue file into an ArtFileInfo structure. */
|
|
36
10
|
async function parseArtFile(filePath) {
|
|
37
11
|
return processMuseaArtFile(filePath, {
|
|
@@ -54,16 +28,34 @@ function isArtFileInput(filePath) {
|
|
|
54
28
|
return filePath.endsWith(".art.vue");
|
|
55
29
|
}
|
|
56
30
|
function createVrtOptions(options) {
|
|
57
|
-
const configured = options.vrt
|
|
31
|
+
const configured = withoutA11y(options.vrt);
|
|
58
32
|
const vrtOptions = {
|
|
59
33
|
...configured,
|
|
60
|
-
snapshotDir:
|
|
34
|
+
snapshotDir: resolveVrtSnapshotDir(options, configured.snapshotDir),
|
|
61
35
|
threshold: options.thresholdProvided ? options.threshold : configured.threshold ?? options.threshold
|
|
62
36
|
};
|
|
63
37
|
const workers = options.workersProvided ? options.workers : configured.workers;
|
|
64
38
|
if (workers !== void 0) vrtOptions.workers = normalizeVrtWorkerCount(workers);
|
|
65
39
|
return vrtOptions;
|
|
66
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* `vrt.snapshotDir` is resolved against the config file's directory.
|
|
43
|
+
* When it is unset, baselines stay under `<--output>/snapshots`.
|
|
44
|
+
*/
|
|
45
|
+
function resolveVrtSnapshotDir(options, snapshotDir) {
|
|
46
|
+
if (!snapshotDir) return path.join(options.output, "snapshots");
|
|
47
|
+
return path.resolve(path.dirname(path.resolve(options.config)), snapshotDir);
|
|
48
|
+
}
|
|
49
|
+
function withoutA11y(vrt) {
|
|
50
|
+
if (!vrt) return {};
|
|
51
|
+
const configured = { ...vrt };
|
|
52
|
+
delete configured.a11y;
|
|
53
|
+
return configured;
|
|
54
|
+
}
|
|
55
|
+
/** Options object `musea-vrt --a11y` passes to `MuseaA11yRunner`. */
|
|
56
|
+
function createA11yRunner(options, Runner) {
|
|
57
|
+
return new Runner(options.vrt?.a11y);
|
|
58
|
+
}
|
|
67
59
|
async function runVrt(options, artFiles) {
|
|
68
60
|
const totalVariants = artFiles.reduce((sum, art) => sum + art.variants.filter((v) => !v.skipVrt).length, 0);
|
|
69
61
|
console.log(` Testing ${totalVariants} variant(s) across ${artFiles.length} art file(s)\n`);
|
|
@@ -93,7 +85,7 @@ async function runVrt(options, artFiles) {
|
|
|
93
85
|
console.log(" Running accessibility audits...\n");
|
|
94
86
|
try {
|
|
95
87
|
const { MuseaA11yRunner } = await import("../a11y/index.mjs");
|
|
96
|
-
const a11yRunner =
|
|
88
|
+
const a11yRunner = createA11yRunner(options, MuseaA11yRunner);
|
|
97
89
|
const a11yResults = await a11yRunner.runAudits(artFiles, options.baseUrl, runner);
|
|
98
90
|
const a11ySummary = a11yRunner.getSummary(a11yResults);
|
|
99
91
|
console.log(" A11y Results:");
|
|
@@ -215,7 +207,33 @@ async function runGenerate(options) {
|
|
|
215
207
|
}
|
|
216
208
|
//#endregion
|
|
217
209
|
//#region src/cli/config.ts
|
|
210
|
+
const DEFAULT_INCLUDE = ["**/*.art.vue"];
|
|
211
|
+
const DEFAULT_EXCLUDE = ["node_modules/**", "dist/**"];
|
|
212
|
+
const VIZE_CONFIG_NAMES = [
|
|
213
|
+
"vize.config.ts",
|
|
214
|
+
"vize.config.mts",
|
|
215
|
+
"vize.config.js",
|
|
216
|
+
"vize.config.mjs",
|
|
217
|
+
"vize.config.cjs"
|
|
218
|
+
];
|
|
218
219
|
async function loadMuseaVrtOptions(configPath, cwd = process.cwd()) {
|
|
220
|
+
const loaded = await loadViteConfig(configPath, cwd);
|
|
221
|
+
if (!loaded) return void 0;
|
|
222
|
+
return readPluginMuseaOptions(loaded.plugins)?.vrt;
|
|
223
|
+
}
|
|
224
|
+
async function loadMuseaFileSet(configPath, cwd = process.cwd()) {
|
|
225
|
+
const loaded = await loadViteConfig(configPath, cwd);
|
|
226
|
+
const pluginOptions = loaded ? readPluginMuseaOptions(loaded.plugins) : void 0;
|
|
227
|
+
const vizeOptions = pluginOptions?.include ? void 0 : await readVizeMuseaOptions(loaded?.configDir ?? cwd);
|
|
228
|
+
const include = pluginOptions?.include ?? vizeOptions?.include ?? DEFAULT_INCLUDE;
|
|
229
|
+
const exclude = pluginOptions?.exclude ?? vizeOptions?.exclude ?? DEFAULT_EXCLUDE;
|
|
230
|
+
return {
|
|
231
|
+
root: loaded?.root ?? cwd,
|
|
232
|
+
include,
|
|
233
|
+
exclude
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
async function loadViteConfig(configPath, cwd) {
|
|
219
237
|
const resolvedConfigPath = path.isAbsolute(configPath) ? configPath : path.resolve(cwd, configPath);
|
|
220
238
|
if (!await fileExists(resolvedConfigPath)) return void 0;
|
|
221
239
|
const loaded = await loadConfigFromFile({
|
|
@@ -227,9 +245,35 @@ async function loadMuseaVrtOptions(configPath, cwd = process.cwd()) {
|
|
|
227
245
|
if (!loaded) return void 0;
|
|
228
246
|
const plugins = [];
|
|
229
247
|
await collectPlugins(loaded.config.plugins, plugins);
|
|
248
|
+
const configDir = path.dirname(resolvedConfigPath);
|
|
249
|
+
const configuredRoot = loaded.config.root;
|
|
250
|
+
return {
|
|
251
|
+
root: configuredRoot ? path.resolve(configDir, configuredRoot) : configDir,
|
|
252
|
+
configDir,
|
|
253
|
+
plugins
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function readPluginMuseaOptions(plugins) {
|
|
230
257
|
for (const plugin of plugins) {
|
|
231
258
|
const options = readMuseaOptions(plugin);
|
|
232
|
-
if (options
|
|
259
|
+
if (options) return options;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async function readVizeMuseaOptions(dir) {
|
|
263
|
+
for (const name of VIZE_CONFIG_NAMES) {
|
|
264
|
+
const file = path.join(dir, name);
|
|
265
|
+
if (!await fileExists(file)) continue;
|
|
266
|
+
try {
|
|
267
|
+
const musea = ((await loadConfigFromFile({
|
|
268
|
+
command: "serve",
|
|
269
|
+
mode: "development",
|
|
270
|
+
isPreview: false,
|
|
271
|
+
isSsrBuild: false
|
|
272
|
+
}, file))?.config)?.musea;
|
|
273
|
+
if (musea?.include || musea?.exclude) return musea;
|
|
274
|
+
} catch {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
233
277
|
}
|
|
234
278
|
}
|
|
235
279
|
async function collectPlugins(input, plugins) {
|
|
@@ -442,8 +486,9 @@ async function main() {
|
|
|
442
486
|
return;
|
|
443
487
|
}
|
|
444
488
|
options.vrt = await loadMuseaVrtOptions(options.config, cwd);
|
|
489
|
+
const fileSet = await loadMuseaFileSet(options.config, cwd);
|
|
445
490
|
console.log(" Scanning for art files...");
|
|
446
|
-
const artFilePaths = await scanArtFiles(
|
|
491
|
+
const artFilePaths = await scanArtFiles(fileSet.root, fileSet.include, fileSet.exclude);
|
|
447
492
|
if (artFilePaths.length === 0) {
|
|
448
493
|
console.log(" No art files found.\n");
|
|
449
494
|
process.exit(0);
|
package/dist/cli/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/cli/utils.ts","../../src/cli/commands.ts","../../src/cli/config.ts","../../src/cli/index.ts"],"sourcesContent":["/**\n * CLI utility functions for art file scanning and parsing.\n *\n * Extracted from cli.ts to keep file sizes manageable.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { processMuseaArtFile } from \"../plugin/art-processing.js\";\nimport type { ArtFileInfo } from \"../types/index.js\";\n\n/** Recursively scan a directory for .art.vue files. */\nexport async function scanArtFiles(root: string): Promise<string[]> {\n const files: string[] = [];\n\n async function scan(dir: string): Promise<void> {\n let entries: fs.Dirent[];\n try {\n entries = await fs.promises.readdir(dir, { withFileTypes: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"EACCES\") {\n return;\n }\n throw error;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n // Skip node_modules and dist\n if (entry.name === \"node_modules\" || entry.name === \"dist\") {\n continue;\n }\n\n if (entry.isDirectory()) {\n await scan(fullPath);\n } else if (entry.isFile() && entry.name.endsWith(\".art.vue\")) {\n files.push(fullPath);\n }\n }\n }\n\n await scan(root);\n return files;\n}\n\n/** Parse a single .art.vue file into an ArtFileInfo structure. */\nexport async function parseArtFile(filePath: string): Promise<ArtFileInfo | null> {\n return processMuseaArtFile(filePath, {\n root: path.dirname(filePath),\n command: \"serve\",\n });\n}\n","/**\n * CLI command handlers for the Musea VRT tool.\n *\n * Extracted from cli.ts to keep file sizes manageable.\n * Contains the runVrt, runApprove, runClean, and runGenerate command implementations.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { MuseaVrtRunner, generateVrtReport, generateVrtJsonReport } from \"../vrt.js\";\nimport type { ExtendedVrtOptions, VrtSummary } from \"../vrt.js\";\nimport { normalizeVrtWorkerCount } from \"../vrt.js\";\nimport type { ArtFileInfo } from \"../types/index.js\";\n\nimport type { CliOptions } from \"./index.js\";\n\nexport function hasCiBlockingVrtResult(summary: VrtSummary): boolean {\n return summary.failed > 0 || (summary.errors ?? 0) > 0;\n}\n\nexport function isArtFileInput(filePath: string): boolean {\n return filePath.endsWith(\".art.vue\");\n}\n\nexport function createVrtOptions(options: CliOptions): ExtendedVrtOptions {\n const configured = options.vrt ?? {};\n const vrtOptions: ExtendedVrtOptions = {\n ...configured,\n snapshotDir: path.join(options.output, \"snapshots\"),\n threshold: options.thresholdProvided\n ? options.threshold\n : (configured.threshold ?? options.threshold),\n };\n const workers = options.workersProvided ? options.workers : configured.workers;\n if (workers !== undefined) {\n vrtOptions.workers = normalizeVrtWorkerCount(workers);\n }\n return vrtOptions;\n}\n\nexport async function runVrt(options: CliOptions, artFiles: ArtFileInfo[]): Promise<void> {\n const totalVariants = artFiles.reduce(\n (sum, art) => sum + art.variants.filter((v) => !v.skipVrt).length,\n 0,\n );\n\n console.log(` Testing ${totalVariants} variant(s) across ${artFiles.length} art file(s)\\n`);\n\n const runner = new MuseaVrtRunner({\n ...createVrtOptions(options),\n ci: options.ci ? { failOnDiff: true, jsonReport: options.json } : undefined,\n });\n\n try {\n console.log(\" Launching browser...\");\n await runner.init();\n\n console.log(\" Running visual regression tests...\\n\");\n\n // Run tests\n const results = await runner.runAllTests(artFiles, options.baseUrl);\n const summary = runner.getSummary(results);\n\n // Print results\n console.log(\" Results:\");\n console.log(\" ---------\");\n console.log(` Passed: ${summary.passed}`);\n console.log(` Failed: ${summary.failed}`);\n console.log(` New: ${summary.new}`);\n console.log(` Errors: ${summary.errors ?? 0}`);\n console.log(` Skipped: ${summary.skipped}`);\n console.log(` Total: ${summary.total}`);\n console.log(` Duration: ${(summary.duration / 1000).toFixed(2)}s\\n`);\n\n // Run a11y audits if requested\n if (options.a11y) {\n console.log(\" Running accessibility audits...\\n\");\n try {\n const { MuseaA11yRunner } = await import(\"../a11y/index.js\");\n const a11yRunner = new MuseaA11yRunner();\n const a11yResults = await a11yRunner.runAudits(artFiles, options.baseUrl, runner);\n const a11ySummary = a11yRunner.getSummary(a11yResults);\n\n console.log(\" A11y Results:\");\n console.log(\" -------------\");\n console.log(` Components: ${a11ySummary.totalComponents}`);\n console.log(` Variants: ${a11ySummary.totalVariants}`);\n console.log(` Violations: ${a11ySummary.totalViolations}`);\n console.log(` Critical: ${a11ySummary.criticalCount}`);\n console.log(` Serious: ${a11ySummary.seriousCount}`);\n console.log(` Not audited: ${a11ySummary.erroredVariants}\\n`);\n\n // Generate a11y report\n const reportDir = options.output;\n await fs.promises.mkdir(reportDir, { recursive: true });\n\n if (options.json) {\n const a11yJson = a11yRunner.generateJsonReport(a11yResults);\n const a11yPath = path.join(reportDir, \"a11y-report.json\");\n await fs.promises.writeFile(a11yPath, a11yJson);\n console.log(` A11y JSON report: ${a11yPath}\\n`);\n } else {\n const a11yHtml = a11yRunner.generateHtmlReport(a11yResults);\n const a11yPath = path.join(reportDir, \"a11y-report.html\");\n await fs.promises.writeFile(a11yPath, a11yHtml);\n console.log(` A11y HTML report: ${a11yPath}\\n`);\n }\n\n // CI mode - exit with error on critical/serious violations. A variant\n // whose audit never ran fails too, but under its own message: it is\n // not an accessibility finding, and reporting it as one sends people\n // looking for a component defect that does not exist.\n if (options.ci && a11ySummary.erroredVariants > 0) {\n console.log(\n ` CI mode: ${a11ySummary.erroredVariants} variant(s) could not be audited\\n`,\n );\n process.exit(1);\n }\n if (options.ci && (a11ySummary.criticalCount > 0 || a11ySummary.seriousCount > 0)) {\n console.log(\" CI mode: Accessibility violations found\\n\");\n process.exit(1);\n }\n } catch (e) {\n console.warn(\" A11y audits skipped:\", e instanceof Error ? e.message : String(e));\n console.warn(\" Make sure axe-core is installed: npm install axe-core\\n\");\n }\n }\n\n // Update baselines if requested\n if (options.update) {\n console.log(\" Updating baselines...\");\n const updated = await runner.updateBaselines(results);\n console.log(` Updated ${updated} baseline(s)\\n`);\n }\n\n // Generate VRT report\n const reportDir = options.output;\n await fs.promises.mkdir(reportDir, { recursive: true });\n\n if (options.json) {\n const jsonReport = generateVrtJsonReport(results, summary);\n const jsonPath = path.join(reportDir, \"vrt-report.json\");\n await fs.promises.writeFile(jsonPath, jsonReport);\n console.log(` JSON report: ${jsonPath}\\n`);\n } else {\n const htmlReport = generateVrtReport(results, summary);\n const htmlPath = path.join(reportDir, \"vrt-report.html\");\n await fs.promises.writeFile(htmlPath, htmlReport);\n console.log(` HTML report: ${htmlPath}\\n`);\n }\n\n // CI mode - exit with error if visual diffs or runner errors occurred.\n if (options.ci && hasCiBlockingVrtResult(summary)) {\n console.log(\" CI mode: Exiting with error due to failures or errors\\n\");\n process.exit(1);\n }\n } finally {\n await runner.close();\n }\n}\n\nexport async function runApprove(options: CliOptions, artFiles: ArtFileInfo[]): Promise<void> {\n const runner = new MuseaVrtRunner(createVrtOptions(options));\n\n try {\n console.log(\" Launching browser...\");\n await runner.init();\n\n console.log(\" Running tests to find diffs...\\n\");\n\n const results = await runner.runAllTests(artFiles, options.baseUrl);\n const failed = results.filter((r) => !r.passed && !r.error);\n\n if (failed.length === 0) {\n console.log(\" No failed tests to approve.\\n\");\n return;\n }\n\n const pattern = options.pattern;\n if (pattern) {\n console.log(` Approving snapshots matching: ${pattern}\\n`);\n } else {\n console.log(` Approving all ${failed.length} failed snapshot(s)...\\n`);\n }\n\n const approved = await runner.approveResults(results, pattern);\n console.log(` Approved ${approved} snapshot(s)\\n`);\n } finally {\n await runner.close();\n }\n}\n\nexport async function runClean(options: CliOptions, artFiles: ArtFileInfo[]): Promise<void> {\n const runner = new MuseaVrtRunner(createVrtOptions(options));\n\n console.log(\" Scanning for orphaned snapshots...\\n\");\n\n const cleaned = await runner.cleanOrphans(artFiles);\n\n if (cleaned === 0) {\n console.log(\" No orphaned snapshots found.\\n\");\n } else {\n console.log(`\\n Cleaned ${cleaned} orphaned snapshot(s)\\n`);\n }\n}\n\nexport async function runGenerate(options: CliOptions): Promise<void> {\n if (!options.componentPath) {\n console.error(\" Error: Missing component path.\");\n console.error(\" Usage: musea-vrt generate <component.vue>\\n\");\n process.exit(1);\n }\n\n const componentPath = path.resolve(options.componentPath);\n if (isArtFileInput(componentPath)) {\n console.error(\n \" Error: musea-vrt generate expects a source .vue component, not a .art.vue file.\",\n );\n console.error(\" Pass the component file that the art file should wrap.\\n\");\n process.exit(1);\n }\n\n // Check file exists\n try {\n await fs.promises.access(componentPath);\n } catch {\n console.error(` Error: File not found: ${componentPath}\\n`);\n process.exit(1);\n }\n\n console.log(` Generating art file for: ${path.relative(process.cwd(), componentPath)}\\n`);\n\n try {\n const { writeArtFile } = await import(\"../autogen/index.js\");\n const outputPath = await writeArtFile(componentPath);\n const relOutput = path.relative(process.cwd(), outputPath);\n\n console.log(` Generated: ${relOutput}\\n`);\n } catch (e) {\n console.error(\" Generation failed:\", e instanceof Error ? e.message : String(e));\n process.exit(1);\n }\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { loadConfigFromFile, type PluginOption } from \"vite\";\n\nimport type { MuseaVrtOptions } from \"../types/index.js\";\nimport { readMuseaOptions } from \"../plugin/options.js\";\n\nexport async function loadMuseaVrtOptions(\n configPath: string,\n cwd = process.cwd(),\n): Promise<MuseaVrtOptions | undefined> {\n const resolvedConfigPath = path.isAbsolute(configPath)\n ? configPath\n : path.resolve(cwd, configPath);\n if (!(await fileExists(resolvedConfigPath))) return undefined;\n\n const loaded = await loadConfigFromFile(\n {\n command: \"serve\",\n mode: \"development\",\n isPreview: false,\n isSsrBuild: false,\n },\n resolvedConfigPath,\n );\n if (!loaded) return undefined;\n\n const plugins: unknown[] = [];\n await collectPlugins(loaded.config.plugins, plugins);\n\n for (const plugin of plugins) {\n const options = readMuseaOptions(plugin);\n if (options?.vrt) return options.vrt;\n }\n return undefined;\n}\n\nasync function collectPlugins(\n input: PluginOption | Promise<PluginOption> | undefined,\n plugins: unknown[],\n) {\n const resolved = await input;\n if (!resolved) return;\n\n if (Array.isArray(resolved)) {\n for (const item of resolved) {\n await collectPlugins(item, plugins);\n }\n return;\n }\n\n plugins.push(resolved);\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.promises.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n","#!/usr/bin/env node\n/**\n * Musea CLI\n *\n * Usage:\n * musea-vrt [command] [options]\n *\n * Commands:\n * (default) Run VRT tests\n * approve [pat] Approve failed snapshots (optionally filtered by pattern)\n * clean Remove orphaned snapshots\n *\n * Options:\n * -u, --update Update baseline snapshots\n * -c, --config Path to vite config (default: vite.config.ts)\n * -o, --output Output directory for reports (default: .vize)\n * -t, --threshold Diff threshold percentage (default: 0.1)\n * -w, --workers Number of concurrent captures (default: 1)\n * --json Output JSON report instead of HTML\n * --ci CI mode - exit with non-zero code on failures\n * --a11y Run accessibility audits alongside VRT\n * -h, --help Show help\n */\n\nimport path from \"node:path\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport type { ArtFileInfo } from \"../types/index.js\";\nimport { scanArtFiles, parseArtFile } from \"./utils.js\";\nimport { runVrt, runApprove, runClean, runGenerate } from \"./commands.js\";\nimport { loadMuseaVrtOptions } from \"./config.js\";\nimport type { MuseaVrtOptions } from \"../types/index.js\";\n\ntype Command = \"run\" | \"approve\" | \"clean\" | \"generate\";\n\nexport interface CliOptions {\n command: Command;\n update: boolean;\n config: string;\n output: string;\n threshold: number;\n thresholdProvided: boolean;\n workers: number;\n workersProvided: boolean;\n json: boolean;\n ci: boolean;\n a11y: boolean;\n help: boolean;\n baseUrl: string;\n pattern?: string;\n componentPath?: string;\n vrt?: MuseaVrtOptions;\n}\n\nexport function parseArgs(args: string[]): CliOptions {\n const options: CliOptions = {\n command: \"run\",\n update: false,\n config: \"vite.config.ts\",\n output: \".vize\",\n threshold: 0.1,\n thresholdProvided: false,\n workers: 1,\n workersProvided: false,\n json: false,\n ci: false,\n a11y: false,\n help: false,\n baseUrl: \"http://localhost:5173\",\n };\n\n let i = 0;\n\n // Check for subcommand as first arg\n if (args.length > 0 && !args[0].startsWith(\"-\")) {\n const sub = args[0];\n if (sub === \"approve\") {\n options.command = \"approve\";\n i = 1;\n // Optional pattern argument after approve\n if (args.length > 1 && !args[1].startsWith(\"-\")) {\n options.pattern = args[1];\n i = 2;\n }\n } else if (sub === \"clean\") {\n options.command = \"clean\";\n i = 1;\n } else if (sub === \"generate\") {\n options.command = \"generate\";\n i = 1;\n // Required component path argument\n if (args.length > 1 && !args[1].startsWith(\"-\")) {\n options.componentPath = args[1];\n i = 2;\n }\n }\n }\n\n for (; i < args.length; i++) {\n const arg = args[i];\n switch (arg) {\n case \"-u\":\n case \"--update\":\n options.update = true;\n break;\n case \"-c\":\n case \"--config\":\n options.config = args[++i] || \"vite.config.ts\";\n break;\n case \"-o\":\n case \"--output\":\n options.output = args[++i] || \".vize\";\n break;\n case \"-t\":\n case \"--threshold\":\n options.threshold = parseThreshold(args[++i]);\n options.thresholdProvided = true;\n break;\n case \"-w\":\n case \"--workers\":\n options.workers = parseWorkers(args[++i]);\n options.workersProvided = true;\n break;\n case \"--json\":\n options.json = true;\n break;\n case \"--ci\":\n options.ci = true;\n break;\n case \"--a11y\":\n options.a11y = true;\n break;\n case \"-b\":\n case \"--base-url\":\n options.baseUrl = args[++i] || \"http://localhost:5173\";\n break;\n case \"-h\":\n case \"--help\":\n options.help = true;\n break;\n }\n }\n\n return options;\n}\n\nfunction parseThreshold(value: string | undefined): number {\n const threshold = Number.parseFloat(value ?? \"\");\n return Number.isFinite(threshold) ? threshold : 0.1;\n}\n\nfunction parseWorkers(value: string | undefined): number {\n const workers = Number.parseInt(value ?? \"\", 10);\n return Number.isFinite(workers) ? Math.max(1, workers) : 1;\n}\n\nfunction printHelp(): void {\n console.log(`\nMusea VRT - Visual Regression Testing for Component Gallery\n\nUsage:\n musea-vrt [command] [options]\n\nCommands:\n (default) Run VRT tests\n approve [pattern] Approve failed snapshots and update baselines\n Optional pattern filters which snapshots to approve\n clean Remove orphaned snapshots (no matching art/variant)\n generate <component> Auto-generate .art.vue from a Vue component\n\nOptions:\n -u, --update Update baseline snapshots with current screenshots\n -c, --config <path> Path to vite config file (default: vite.config.ts)\n -o, --output <dir> Output directory for reports (default: .vize)\n -t, --threshold <n> Diff threshold percentage (default: 0.1)\n -b, --base-url <url> Base URL for dev server (default: http://localhost:5173)\n -w, --workers <n> Number of concurrent captures (default: 1)\n --json Output JSON report instead of HTML\n --ci CI mode - exit with non-zero code on failures\n --a11y Run accessibility audits alongside VRT\n -h, --help Show this help message\n\nExamples:\n # Run VRT tests\n musea-vrt\n\n # Update baseline snapshots\n musea-vrt -u\n\n # Run with custom threshold\n musea-vrt -t 0.5\n\n # CI mode with JSON output\n musea-vrt --ci --json\n\n # Run with accessibility audits\n musea-vrt --a11y\n\n # Capture variants concurrently\n musea-vrt --workers 8\n\n # Approve all failed snapshots\n musea-vrt approve\n\n # Approve specific snapshots by pattern\n musea-vrt approve \"Button/*\"\n\n # Clean orphaned snapshots\n musea-vrt clean\n\n # Auto-generate .art.vue from component\n musea-vrt generate src/components/Button.vue\n\n # Custom base URL\n musea-vrt -b http://localhost:3000\n`);\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const options = parseArgs(args);\n\n if (options.help) {\n printHelp();\n process.exit(0);\n }\n\n const cwd = process.cwd();\n\n console.log(\"\\n Musea VRT\");\n console.log(\" =========\\n\");\n\n // Handle generate command early (doesn't need art file scanning)\n if (options.command === \"generate\") {\n try {\n await runGenerate(options);\n } catch (error) {\n console.error(\"\\n Error:\", error);\n process.exit(1);\n }\n return;\n }\n\n options.vrt = await loadMuseaVrtOptions(options.config, cwd);\n\n // Scan for art files\n console.log(\" Scanning for art files...\");\n const artFilePaths = await scanArtFiles(cwd);\n\n if (artFilePaths.length === 0) {\n console.log(\" No art files found.\\n\");\n process.exit(0);\n }\n\n console.log(` Found ${artFilePaths.length} art file(s)\\n`);\n\n // Parse art files\n const artFiles: ArtFileInfo[] = [];\n for (const filePath of artFilePaths) {\n const art = await parseArtFile(filePath);\n if (art) {\n artFiles.push(art);\n }\n }\n\n try {\n switch (options.command) {\n case \"run\":\n await runVrt(options, artFiles);\n break;\n case \"approve\":\n await runApprove(options, artFiles);\n break;\n case \"clean\":\n await runClean(options, artFiles);\n break;\n case \"generate\":\n // Handled above before art file scanning\n break;\n }\n } catch (error) {\n console.error(\"\\n Error:\", error);\n process.exit(1);\n }\n}\n\nif (isDirectRun()) {\n main().catch((error) => {\n console.error(\"Fatal error:\", error);\n process.exit(1);\n });\n}\n\nfunction isDirectRun(): boolean {\n const entrypoint = process.argv[1];\n if (!entrypoint) {\n return false;\n }\n\n try {\n return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(path.resolve(entrypoint));\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,eAAsB,aAAa,MAAiC;CAClE,MAAM,QAAkB,CAAC;CAEzB,eAAe,KAAK,KAA4B;EAC9C,IAAI;EACJ,IAAI;GACF,UAAU,MAAM,GAAG,SAAS,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;EAClE,SAAS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"sourcesContent":["/**\n * CLI utility functions for art file scanning and parsing.\n *\n * Extracted from cli.ts to keep file sizes manageable.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { processMuseaArtFile } from \"../plugin/art-processing.js\";\nimport type { ArtFileInfo } from \"../types/index.js\";\n\n/** Recursively scan a directory for .art.vue files. */\nexport async function scanArtFiles(root: string): Promise<string[]> {\n const files: string[] = [];\n\n async function scan(dir: string): Promise<void> {\n let entries: fs.Dirent[];\n try {\n entries = await fs.promises.readdir(dir, { withFileTypes: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"EACCES\") {\n return;\n }\n throw error;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n // Skip node_modules and dist\n if (entry.name === \"node_modules\" || entry.name === \"dist\") {\n continue;\n }\n\n if (entry.isDirectory()) {\n await scan(fullPath);\n } else if (entry.isFile() && entry.name.endsWith(\".art.vue\")) {\n files.push(fullPath);\n }\n }\n }\n\n await scan(root);\n return files;\n}\n\n/** Parse a single .art.vue file into an ArtFileInfo structure. */\nexport async function parseArtFile(filePath: string): Promise<ArtFileInfo | null> {\n return processMuseaArtFile(filePath, {\n root: path.dirname(filePath),\n command: \"serve\",\n });\n}\n","/**\n * CLI command handlers for the Musea VRT tool.\n *\n * Extracted from cli.ts to keep file sizes manageable.\n * Contains the runVrt, runApprove, runClean, and runGenerate command implementations.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { MuseaVrtRunner, generateVrtReport, generateVrtJsonReport } from \"../vrt.js\";\nimport type { ExtendedVrtOptions, VrtSummary } from \"../vrt.js\";\nimport { normalizeVrtWorkerCount } from \"../vrt.js\";\nimport type { A11yOptions, ArtFileInfo, MuseaVrtOptions } from \"../types/index.js\";\n\nimport type { CliOptions } from \"./index.js\";\n\nexport function hasCiBlockingVrtResult(summary: VrtSummary): boolean {\n return summary.failed > 0 || (summary.errors ?? 0) > 0;\n}\n\nexport function isArtFileInput(filePath: string): boolean {\n return filePath.endsWith(\".art.vue\");\n}\n\nexport function createVrtOptions(options: CliOptions): ExtendedVrtOptions {\n // `vrt.a11y` is MuseaA11yRunner config. ExtendedVrtOptions.a11y is a boolean.\n const configured = withoutA11y(options.vrt);\n const vrtOptions: ExtendedVrtOptions = {\n ...configured,\n // run, approve, and clean all read this directory.\n snapshotDir: resolveVrtSnapshotDir(options, configured.snapshotDir),\n threshold: options.thresholdProvided\n ? options.threshold\n : (configured.threshold ?? options.threshold),\n };\n const workers = options.workersProvided ? options.workers : configured.workers;\n if (workers !== undefined) {\n vrtOptions.workers = normalizeVrtWorkerCount(workers);\n }\n return vrtOptions;\n}\n\n/**\n * `vrt.snapshotDir` is resolved against the config file's directory.\n * When it is unset, baselines stay under `<--output>/snapshots`.\n */\nfunction resolveVrtSnapshotDir(options: CliOptions, snapshotDir: string | undefined): string {\n if (!snapshotDir) return path.join(options.output, \"snapshots\");\n return path.resolve(path.dirname(path.resolve(options.config)), snapshotDir);\n}\n\nfunction withoutA11y(vrt: MuseaVrtOptions | undefined): Omit<MuseaVrtOptions, \"a11y\"> {\n if (!vrt) return {};\n const configured: MuseaVrtOptions = { ...vrt };\n delete configured.a11y;\n return configured;\n}\n\n/** Options object `musea-vrt --a11y` passes to `MuseaA11yRunner`. */\nexport function createA11yRunner<T>(options: CliOptions, Runner: new (a11y?: A11yOptions) => T): T {\n return new Runner(options.vrt?.a11y);\n}\n\nexport async function runVrt(options: CliOptions, artFiles: ArtFileInfo[]): Promise<void> {\n const totalVariants = artFiles.reduce(\n (sum, art) => sum + art.variants.filter((v) => !v.skipVrt).length,\n 0,\n );\n\n console.log(` Testing ${totalVariants} variant(s) across ${artFiles.length} art file(s)\\n`);\n\n const runner = new MuseaVrtRunner({\n ...createVrtOptions(options),\n ci: options.ci ? { failOnDiff: true, jsonReport: options.json } : undefined,\n });\n\n try {\n console.log(\" Launching browser...\");\n await runner.init();\n\n console.log(\" Running visual regression tests...\\n\");\n\n // Run tests\n const results = await runner.runAllTests(artFiles, options.baseUrl);\n const summary = runner.getSummary(results);\n\n // Print results\n console.log(\" Results:\");\n console.log(\" ---------\");\n console.log(` Passed: ${summary.passed}`);\n console.log(` Failed: ${summary.failed}`);\n console.log(` New: ${summary.new}`);\n console.log(` Errors: ${summary.errors ?? 0}`);\n console.log(` Skipped: ${summary.skipped}`);\n console.log(` Total: ${summary.total}`);\n console.log(` Duration: ${(summary.duration / 1000).toFixed(2)}s\\n`);\n\n // Run a11y audits if requested\n if (options.a11y) {\n console.log(\" Running accessibility audits...\\n\");\n try {\n const { MuseaA11yRunner } = await import(\"../a11y/index.js\");\n const a11yRunner = createA11yRunner(options, MuseaA11yRunner);\n const a11yResults = await a11yRunner.runAudits(artFiles, options.baseUrl, runner);\n const a11ySummary = a11yRunner.getSummary(a11yResults);\n\n console.log(\" A11y Results:\");\n console.log(\" -------------\");\n console.log(` Components: ${a11ySummary.totalComponents}`);\n console.log(` Variants: ${a11ySummary.totalVariants}`);\n console.log(` Violations: ${a11ySummary.totalViolations}`);\n console.log(` Critical: ${a11ySummary.criticalCount}`);\n console.log(` Serious: ${a11ySummary.seriousCount}`);\n console.log(` Not audited: ${a11ySummary.erroredVariants}\\n`);\n\n // Generate a11y report\n const reportDir = options.output;\n await fs.promises.mkdir(reportDir, { recursive: true });\n\n if (options.json) {\n const a11yJson = a11yRunner.generateJsonReport(a11yResults);\n const a11yPath = path.join(reportDir, \"a11y-report.json\");\n await fs.promises.writeFile(a11yPath, a11yJson);\n console.log(` A11y JSON report: ${a11yPath}\\n`);\n } else {\n const a11yHtml = a11yRunner.generateHtmlReport(a11yResults);\n const a11yPath = path.join(reportDir, \"a11y-report.html\");\n await fs.promises.writeFile(a11yPath, a11yHtml);\n console.log(` A11y HTML report: ${a11yPath}\\n`);\n }\n\n // CI mode - exit with error on critical/serious violations. A variant\n // whose audit never ran fails too, but under its own message: it is\n // not an accessibility finding, and reporting it as one sends people\n // looking for a component defect that does not exist.\n if (options.ci && a11ySummary.erroredVariants > 0) {\n console.log(\n ` CI mode: ${a11ySummary.erroredVariants} variant(s) could not be audited\\n`,\n );\n process.exit(1);\n }\n if (options.ci && (a11ySummary.criticalCount > 0 || a11ySummary.seriousCount > 0)) {\n console.log(\" CI mode: Accessibility violations found\\n\");\n process.exit(1);\n }\n } catch (e) {\n console.warn(\" A11y audits skipped:\", e instanceof Error ? e.message : String(e));\n console.warn(\" Make sure axe-core is installed: npm install axe-core\\n\");\n }\n }\n\n // Update baselines if requested\n if (options.update) {\n console.log(\" Updating baselines...\");\n const updated = await runner.updateBaselines(results);\n console.log(` Updated ${updated} baseline(s)\\n`);\n }\n\n // Generate VRT report\n const reportDir = options.output;\n await fs.promises.mkdir(reportDir, { recursive: true });\n\n if (options.json) {\n const jsonReport = generateVrtJsonReport(results, summary);\n const jsonPath = path.join(reportDir, \"vrt-report.json\");\n await fs.promises.writeFile(jsonPath, jsonReport);\n console.log(` JSON report: ${jsonPath}\\n`);\n } else {\n const htmlReport = generateVrtReport(results, summary);\n const htmlPath = path.join(reportDir, \"vrt-report.html\");\n await fs.promises.writeFile(htmlPath, htmlReport);\n console.log(` HTML report: ${htmlPath}\\n`);\n }\n\n // CI mode - exit with error if visual diffs or runner errors occurred.\n if (options.ci && hasCiBlockingVrtResult(summary)) {\n console.log(\" CI mode: Exiting with error due to failures or errors\\n\");\n process.exit(1);\n }\n } finally {\n await runner.close();\n }\n}\n\nexport async function runApprove(options: CliOptions, artFiles: ArtFileInfo[]): Promise<void> {\n const runner = new MuseaVrtRunner(createVrtOptions(options));\n\n try {\n console.log(\" Launching browser...\");\n await runner.init();\n\n console.log(\" Running tests to find diffs...\\n\");\n\n const results = await runner.runAllTests(artFiles, options.baseUrl);\n const failed = results.filter((r) => !r.passed && !r.error);\n\n if (failed.length === 0) {\n console.log(\" No failed tests to approve.\\n\");\n return;\n }\n\n const pattern = options.pattern;\n if (pattern) {\n console.log(` Approving snapshots matching: ${pattern}\\n`);\n } else {\n console.log(` Approving all ${failed.length} failed snapshot(s)...\\n`);\n }\n\n const approved = await runner.approveResults(results, pattern);\n console.log(` Approved ${approved} snapshot(s)\\n`);\n } finally {\n await runner.close();\n }\n}\n\nexport async function runClean(options: CliOptions, artFiles: ArtFileInfo[]): Promise<void> {\n const runner = new MuseaVrtRunner(createVrtOptions(options));\n\n console.log(\" Scanning for orphaned snapshots...\\n\");\n\n const cleaned = await runner.cleanOrphans(artFiles);\n\n if (cleaned === 0) {\n console.log(\" No orphaned snapshots found.\\n\");\n } else {\n console.log(`\\n Cleaned ${cleaned} orphaned snapshot(s)\\n`);\n }\n}\n\nexport async function runGenerate(options: CliOptions): Promise<void> {\n if (!options.componentPath) {\n console.error(\" Error: Missing component path.\");\n console.error(\" Usage: musea-vrt generate <component.vue>\\n\");\n process.exit(1);\n }\n\n const componentPath = path.resolve(options.componentPath);\n if (isArtFileInput(componentPath)) {\n console.error(\n \" Error: musea-vrt generate expects a source .vue component, not a .art.vue file.\",\n );\n console.error(\" Pass the component file that the art file should wrap.\\n\");\n process.exit(1);\n }\n\n // Check file exists\n try {\n await fs.promises.access(componentPath);\n } catch {\n console.error(` Error: File not found: ${componentPath}\\n`);\n process.exit(1);\n }\n\n console.log(` Generating art file for: ${path.relative(process.cwd(), componentPath)}\\n`);\n\n try {\n const { writeArtFile } = await import(\"../autogen/index.js\");\n const outputPath = await writeArtFile(componentPath);\n const relOutput = path.relative(process.cwd(), outputPath);\n\n console.log(` Generated: ${relOutput}\\n`);\n } catch (e) {\n console.error(\" Generation failed:\", e instanceof Error ? e.message : String(e));\n process.exit(1);\n }\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { loadConfigFromFile, type PluginOption } from \"vite\";\n\nimport type { MuseaOptions, MuseaVrtOptions } from \"../types/index.js\";\nimport { readMuseaOptions } from \"../plugin/options.js\";\n\nconst DEFAULT_INCLUDE = [\"**/*.art.vue\"];\nconst DEFAULT_EXCLUDE = [\"node_modules/**\", \"dist/**\"];\nconst VIZE_CONFIG_NAMES = [\n \"vize.config.ts\",\n \"vize.config.mts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.cjs\",\n];\n\nexport interface MuseaFileSet {\n root: string;\n include: string[];\n exclude: string[];\n}\n\nexport async function loadMuseaVrtOptions(\n configPath: string,\n cwd = process.cwd(),\n): Promise<MuseaVrtOptions | undefined> {\n const loaded = await loadViteConfig(configPath, cwd);\n if (!loaded) return undefined;\n return readPluginMuseaOptions(loaded.plugins)?.vrt;\n}\n\nexport async function loadMuseaFileSet(\n configPath: string,\n cwd = process.cwd(),\n): Promise<MuseaFileSet> {\n const loaded = await loadViteConfig(configPath, cwd);\n const pluginOptions = loaded ? readPluginMuseaOptions(loaded.plugins) : undefined;\n const vizeOptions = pluginOptions?.include\n ? undefined\n : await readVizeMuseaOptions(loaded?.configDir ?? cwd);\n const include = pluginOptions?.include ?? vizeOptions?.include ?? DEFAULT_INCLUDE;\n const exclude = pluginOptions?.exclude ?? vizeOptions?.exclude ?? DEFAULT_EXCLUDE;\n return {\n root: loaded?.root ?? cwd,\n include,\n exclude,\n };\n}\n\nasync function loadViteConfig(\n configPath: string,\n cwd: string,\n): Promise<{ root: string; configDir: string; plugins: unknown[] } | undefined> {\n const resolvedConfigPath = path.isAbsolute(configPath)\n ? configPath\n : path.resolve(cwd, configPath);\n if (!(await fileExists(resolvedConfigPath))) return undefined;\n\n const loaded = await loadConfigFromFile(\n {\n command: \"serve\",\n mode: \"development\",\n isPreview: false,\n isSsrBuild: false,\n },\n resolvedConfigPath,\n );\n if (!loaded) return undefined;\n\n const plugins: unknown[] = [];\n await collectPlugins(loaded.config.plugins, plugins);\n const configDir = path.dirname(resolvedConfigPath);\n const configuredRoot = loaded.config.root;\n return {\n root: configuredRoot ? path.resolve(configDir, configuredRoot) : configDir,\n configDir,\n plugins,\n };\n}\n\nfunction readPluginMuseaOptions(plugins: unknown[]): MuseaOptions | undefined {\n for (const plugin of plugins) {\n const options = readMuseaOptions(plugin);\n if (options) return options;\n }\n return undefined;\n}\n\nasync function readVizeMuseaOptions(\n dir: string,\n): Promise<Pick<MuseaOptions, \"include\" | \"exclude\"> | undefined> {\n for (const name of VIZE_CONFIG_NAMES) {\n const file = path.join(dir, name);\n if (!(await fileExists(file))) continue;\n try {\n const loaded = await loadConfigFromFile(\n {\n command: \"serve\",\n mode: \"development\",\n isPreview: false,\n isSsrBuild: false,\n },\n file,\n );\n const config = loaded?.config as\n | { musea?: Pick<MuseaOptions, \"include\" | \"exclude\"> }\n | undefined;\n const musea = config?.musea;\n if (musea?.include || musea?.exclude) return musea;\n } catch {\n continue;\n }\n }\n return undefined;\n}\n\nasync function collectPlugins(\n input: PluginOption | Promise<PluginOption> | undefined,\n plugins: unknown[],\n) {\n const resolved = await input;\n if (!resolved) return;\n\n if (Array.isArray(resolved)) {\n for (const item of resolved) {\n await collectPlugins(item, plugins);\n }\n return;\n }\n\n plugins.push(resolved);\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.promises.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n","#!/usr/bin/env node\n/**\n * Musea CLI\n *\n * Usage:\n * musea-vrt [command] [options]\n *\n * Commands:\n * (default) Run VRT tests\n * approve [pat] Approve failed snapshots (optionally filtered by pattern)\n * clean Remove orphaned snapshots\n *\n * Options:\n * -u, --update Update baseline snapshots\n * -c, --config Path to vite config (default: vite.config.ts)\n * -o, --output Output directory for reports (default: .vize)\n * -t, --threshold Diff threshold percentage (default: 0.1)\n * -w, --workers Number of concurrent captures (default: 1)\n * --json Output JSON report instead of HTML\n * --ci CI mode - exit with non-zero code on failures\n * --a11y Run accessibility audits alongside VRT\n * -h, --help Show help\n */\n\nimport path from \"node:path\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport type { ArtFileInfo } from \"../types/index.js\";\nimport { parseArtFile } from \"./utils.js\";\nimport { scanArtFiles } from \"../utils.js\";\nimport { runVrt, runApprove, runClean, runGenerate } from \"./commands.js\";\nimport { loadMuseaFileSet, loadMuseaVrtOptions } from \"./config.js\";\nimport type { MuseaVrtOptions } from \"../types/index.js\";\n\ntype Command = \"run\" | \"approve\" | \"clean\" | \"generate\";\n\nexport interface CliOptions {\n command: Command;\n update: boolean;\n config: string;\n output: string;\n threshold: number;\n thresholdProvided: boolean;\n workers: number;\n workersProvided: boolean;\n json: boolean;\n ci: boolean;\n a11y: boolean;\n help: boolean;\n baseUrl: string;\n pattern?: string;\n componentPath?: string;\n vrt?: MuseaVrtOptions;\n}\n\nexport function parseArgs(args: string[]): CliOptions {\n const options: CliOptions = {\n command: \"run\",\n update: false,\n config: \"vite.config.ts\",\n output: \".vize\",\n threshold: 0.1,\n thresholdProvided: false,\n workers: 1,\n workersProvided: false,\n json: false,\n ci: false,\n a11y: false,\n help: false,\n baseUrl: \"http://localhost:5173\",\n };\n\n let i = 0;\n\n // Check for subcommand as first arg\n if (args.length > 0 && !args[0].startsWith(\"-\")) {\n const sub = args[0];\n if (sub === \"approve\") {\n options.command = \"approve\";\n i = 1;\n // Optional pattern argument after approve\n if (args.length > 1 && !args[1].startsWith(\"-\")) {\n options.pattern = args[1];\n i = 2;\n }\n } else if (sub === \"clean\") {\n options.command = \"clean\";\n i = 1;\n } else if (sub === \"generate\") {\n options.command = \"generate\";\n i = 1;\n // Required component path argument\n if (args.length > 1 && !args[1].startsWith(\"-\")) {\n options.componentPath = args[1];\n i = 2;\n }\n }\n }\n\n for (; i < args.length; i++) {\n const arg = args[i];\n switch (arg) {\n case \"-u\":\n case \"--update\":\n options.update = true;\n break;\n case \"-c\":\n case \"--config\":\n options.config = args[++i] || \"vite.config.ts\";\n break;\n case \"-o\":\n case \"--output\":\n options.output = args[++i] || \".vize\";\n break;\n case \"-t\":\n case \"--threshold\":\n options.threshold = parseThreshold(args[++i]);\n options.thresholdProvided = true;\n break;\n case \"-w\":\n case \"--workers\":\n options.workers = parseWorkers(args[++i]);\n options.workersProvided = true;\n break;\n case \"--json\":\n options.json = true;\n break;\n case \"--ci\":\n options.ci = true;\n break;\n case \"--a11y\":\n options.a11y = true;\n break;\n case \"-b\":\n case \"--base-url\":\n options.baseUrl = args[++i] || \"http://localhost:5173\";\n break;\n case \"-h\":\n case \"--help\":\n options.help = true;\n break;\n }\n }\n\n return options;\n}\n\nfunction parseThreshold(value: string | undefined): number {\n const threshold = Number.parseFloat(value ?? \"\");\n return Number.isFinite(threshold) ? threshold : 0.1;\n}\n\nfunction parseWorkers(value: string | undefined): number {\n const workers = Number.parseInt(value ?? \"\", 10);\n return Number.isFinite(workers) ? Math.max(1, workers) : 1;\n}\n\nfunction printHelp(): void {\n console.log(`\nMusea VRT - Visual Regression Testing for Component Gallery\n\nUsage:\n musea-vrt [command] [options]\n\nCommands:\n (default) Run VRT tests\n approve [pattern] Approve failed snapshots and update baselines\n Optional pattern filters which snapshots to approve\n clean Remove orphaned snapshots (no matching art/variant)\n generate <component> Auto-generate .art.vue from a Vue component\n\nOptions:\n -u, --update Update baseline snapshots with current screenshots\n -c, --config <path> Path to vite config file (default: vite.config.ts)\n -o, --output <dir> Output directory for reports (default: .vize)\n -t, --threshold <n> Diff threshold percentage (default: 0.1)\n -b, --base-url <url> Base URL for dev server (default: http://localhost:5173)\n -w, --workers <n> Number of concurrent captures (default: 1)\n --json Output JSON report instead of HTML\n --ci CI mode - exit with non-zero code on failures\n --a11y Run accessibility audits alongside VRT\n -h, --help Show this help message\n\nExamples:\n # Run VRT tests\n musea-vrt\n\n # Update baseline snapshots\n musea-vrt -u\n\n # Run with custom threshold\n musea-vrt -t 0.5\n\n # CI mode with JSON output\n musea-vrt --ci --json\n\n # Run with accessibility audits\n musea-vrt --a11y\n\n # Capture variants concurrently\n musea-vrt --workers 8\n\n # Approve all failed snapshots\n musea-vrt approve\n\n # Approve specific snapshots by pattern\n musea-vrt approve \"Button/*\"\n\n # Clean orphaned snapshots\n musea-vrt clean\n\n # Auto-generate .art.vue from component\n musea-vrt generate src/components/Button.vue\n\n # Custom base URL\n musea-vrt -b http://localhost:3000\n`);\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const options = parseArgs(args);\n\n if (options.help) {\n printHelp();\n process.exit(0);\n }\n\n const cwd = process.cwd();\n\n console.log(\"\\n Musea VRT\");\n console.log(\" =========\\n\");\n\n // Handle generate command early (doesn't need art file scanning)\n if (options.command === \"generate\") {\n try {\n await runGenerate(options);\n } catch (error) {\n console.error(\"\\n Error:\", error);\n process.exit(1);\n }\n return;\n }\n\n options.vrt = await loadMuseaVrtOptions(options.config, cwd);\n const fileSet = await loadMuseaFileSet(options.config, cwd);\n\n // Scan for art files\n console.log(\" Scanning for art files...\");\n const artFilePaths = await scanArtFiles(fileSet.root, fileSet.include, fileSet.exclude);\n\n if (artFilePaths.length === 0) {\n console.log(\" No art files found.\\n\");\n process.exit(0);\n }\n\n console.log(` Found ${artFilePaths.length} art file(s)\\n`);\n\n // Parse art files\n const artFiles: ArtFileInfo[] = [];\n for (const filePath of artFilePaths) {\n const art = await parseArtFile(filePath);\n if (art) {\n artFiles.push(art);\n }\n }\n\n try {\n switch (options.command) {\n case \"run\":\n await runVrt(options, artFiles);\n break;\n case \"approve\":\n await runApprove(options, artFiles);\n break;\n case \"clean\":\n await runClean(options, artFiles);\n break;\n case \"generate\":\n // Handled above before art file scanning\n break;\n }\n } catch (error) {\n console.error(\"\\n Error:\", error);\n process.exit(1);\n }\n}\n\nif (isDirectRun()) {\n main().catch((error) => {\n console.error(\"Fatal error:\", error);\n process.exit(1);\n });\n}\n\nfunction isDirectRun(): boolean {\n const entrypoint = process.argv[1];\n if (!entrypoint) {\n return false;\n }\n\n try {\n return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(path.resolve(entrypoint));\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;AAgDA,eAAsB,aAAa,UAA+C;CAChF,OAAO,oBAAoB,UAAU;EACnC,MAAM,KAAK,QAAQ,QAAQ;EAC3B,SAAS;CACX,CAAC;AACH;;;;;;;;;ACpCA,SAAgB,uBAAuB,SAA8B;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=__vite__mapDeps,d=(m.f||(m.f=["assets/vs-DUMbM4mx.js","assets/index-DJdBoIcR.js","assets/index-DecaxxaH.css","assets/editor.api-z9id08VB.js","assets/editor-8AbsNvUX.css","assets/toggleHighContrast-DioIT9Mn.js","assets/toggleHighContrast-CFGa3V3O.css","assets/register-5BfKof-F.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./index-DJdBoIcR.js";function f(e){return new Worker(`/__musea__/assets/editor.worker-s_hwqnK9.js`,{name:e?.name})}function p(e){return new Worker(`/__musea__/assets/json.worker-CD0GJfW6.js`,{name:e?.name})}function m(e){return new Worker(`/__musea__/assets/css.worker-BjrR-8m8.js`,{name:e?.name})}function h(e){return new Worker(`/__musea__/assets/html.worker-BFmRaMni.js`,{name:e?.name})}function g(e){return new Worker(`/__musea__/assets/ts.worker-BFy34-VB.js`,{name:e?.name})}var _=o(s({__name:`MonacoEditor`,props:{modelValue:{},language:{},theme:{},height:{},readOnly:{type:Boolean},completionItems:{}},emits:[`update:modelValue`],setup(o,{emit:s}){let _=o,v=s,{resolvedTheme:y}=c(),b=n(null),x=null,S=null,C=null,w=i(()=>y.value===`dark`?`musea-dark`:`musea-light`);t(async()=>{b.value&&(self.MonacoEnvironment={getWorker(e,t){switch(t){case`json`:return new p;case`css`:case`scss`:case`less`:return new m;case`html`:case`handlebars`:case`razor`:return new h;case`typescript`:case`javascript`:return new g;default:return new f}}},S=await u(()=>import(`./vs-DUMbM4mx.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),S.editor.defineTheme(`musea-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#1a1a1a`,"editor.foreground":`#e5e5e5`,"editor.lineHighlightBackground":`#252525`,"editorCursor.foreground":`#e07048`,"editor.selectionBackground":`#3d3d3d`}}),S.editor.defineTheme(`musea-light`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#ddd9cd`,"editor.foreground":`#121212`,"editor.lineHighlightBackground":`#d4d0c4`,"editorCursor.foreground":`#121212`,"editor.selectionBackground":`#c8c4b8`}}),_.completionItems&&_.completionItems.length>0&&T(S,_.completionItems),x=S.editor.create(b.value,{value:_.modelValue,language:_.language||`html`,theme:_.theme||w.value,minimap:{enabled:!1},fontSize:12,lineNumbers:`on`,lineNumbersMinChars:3,scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,readOnly:_.readOnly||!1,padding:{top:8,bottom:8},renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:8,horizontalScrollbarSize:8},overviewRulerLanes:0,hideCursorInOverviewRuler:!0,overviewRulerBorder:!1,folding:!1,tabSize:2}),x.onDidChangeModelContent(()=>{v(`update:modelValue`,x?.getValue()||``)}))});function T(e,t){C?.dispose(),C=e.languages.registerCompletionItemProvider(`css`,{triggerCharacters:[`-`,`(`],provideCompletionItems(n,r){let i=n.getLineContent(r.lineNumber).substring(0,r.column-1),a=/var\(\s*-*$/.test(i),o=/:\s*[^;]*$/.test(i);if(!a&&!o)return{suggestions:[]};let s=n.getWordUntilPosition(r),c={startLineNumber:r.lineNumber,startColumn:s.startColumn,endLineNumber:r.lineNumber,endColumn:s.endColumn};return{suggestions:t.map(t=>{let n=`--${t.replace(/\./g,`-`)}`;return{label:n,kind:e.languages.CompletionItemKind.Variable,detail:`Design token: ${t}`,insertText:a?n:`var(${n})`,range:c,sortText:`0`+t}})}}}),C=e.languages.registerCompletionItemProvider(`html`,{triggerCharacters:[`-`,`(`],provideCompletionItems(n,r){let i=n.getLineContent(r.lineNumber).substring(0,r.column-1),a=/var\(\s*-*$/.test(i),o=/:\s*[^;]*$/.test(i);if(!a&&!o)return{suggestions:[]};let s=n.getWordUntilPosition(r),c={startLineNumber:r.lineNumber,startColumn:s.startColumn,endLineNumber:r.lineNumber,endColumn:s.endColumn};return{suggestions:t.map(t=>{let n=`--${t.replace(/\./g,`-`)}`;return{label:n,kind:e.languages.CompletionItemKind.Variable,detail:`Design token: ${t}`,insertText:a?n:`var(${n})`,range:c,sortText:`0`+t}})}}})}return l(()=>{C?.dispose(),x?.dispose()}),d(()=>_.modelValue,e=>{x&&x.getValue()!==e&&x.setValue(e)}),d(()=>_.language,e=>{if(x&&S&&e){let t=x.getModel();t&&S.editor.setModelLanguage(t,e)}}),d(()=>_.completionItems,e=>{S&&e&&e.length>0&&T(S,e)}),d(w,e=>{S&&!_.theme&&S.editor.setTheme(e)}),(t,n)=>(a(),e(`div`,{ref_key:`containerRef`,ref:b,class:`monaco-container`,style:r({height:o.height||`120px`})},null,4))}}),[[`__scopeId`,`data-v-3afbfdb3`]]);export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./editor.api-
|
|
1
|
+
import{m as e}from"./editor.api-z9id08VB.js";import{t}from"./workers-DTy0Zfv5.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./lspLanguageFeatures-T0Yl8WyA.js";var b=120*1e3,x=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>b&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=t({moduleId:`vs/language/css/cssWorker`,createWorker:()=>new Worker(new URL(`/__musea__/assets/css.worker-BjrR-8m8.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function S(t){let n=[],s=[],c=new x(t);n.push(c);let g=(...e)=>c.getLanguageServiceWorker(...e);function y(){let{languageId:n,modeConfiguration:c}=t;w(s),c.completionItems&&s.push(e.registerCompletionItemProvider(n,new _(g,[`/`,`-`,`:`]))),c.hovers&&s.push(e.registerHoverProvider(n,new a(g))),c.documentHighlights&&s.push(e.registerDocumentHighlightProvider(n,new p(g))),c.definitions&&s.push(e.registerDefinitionProvider(n,new f(g))),c.references&&s.push(e.registerReferenceProvider(n,new o(g))),c.documentSymbols&&s.push(e.registerDocumentSymbolProvider(n,new u(g))),c.rename&&s.push(e.registerRenameProvider(n,new m(g))),c.colors&&s.push(e.registerColorProvider(n,new l(g))),c.foldingRanges&&s.push(e.registerFoldingRangeProvider(n,new v(g))),c.diagnostics&&s.push(new h(n,g,t.onDidChange)),c.selectionRanges&&s.push(e.registerSelectionRangeProvider(n,new d(g))),c.documentFormattingEdits&&s.push(e.registerDocumentFormattingEditProvider(n,new r(g))),c.documentRangeFormattingEdits&&s.push(e.registerDocumentRangeFormattingEditProvider(n,new i(g)))}return y(),n.push(C(s)),C(n)}function C(e){return{dispose:()=>w(e)}}function w(e){for(;e.length;)e.pop().dispose()}export{_ as CompletionAdapter,f as DefinitionAdapter,h as DiagnosticsAdapter,l as DocumentColorAdapter,r as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,g as DocumentLinkAdapter,i as DocumentRangeFormattingEditProvider,u as DocumentSymbolAdapter,v as FoldingRangeAdapter,a as HoverAdapter,o as ReferenceAdapter,m as RenameAdapter,d as SelectionRangeAdapter,x as WorkerManager,c as fromPosition,s as fromRange,S as setupMode,n as toRange,y as toTextEdit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-DJdBoIcR.js";function t(){return globalThis._VSCODE_NLS_MESSAGES}function n(){return globalThis._VSCODE_NLS_LANGUAGE}var r=n()===`pseudo`||typeof document<`u`&&document.location&&typeof document.location.hash==`string`&&document.location.hash.indexOf(`pseudo=true`)>=0;function i(e,t){let n;return n=t.length===0?e:e.replace(/\{(\d+)\}/g,(e,n)=>{let r=t[n[0]],i=e;return typeof r==`string`?i=r:(typeof r==`number`||typeof r==`boolean`||r==null)&&(i=String(r)),i}),r&&(n=`[`+n.replace(/[aouei]/g,`$&$&`)+`]`),n}function a(e,t,...n){return i(typeof e==`number`?o(e,t):t,n)}function o(e,n){let r=t()?.[e];if(typeof r!=`string`){if(typeof n==`string`)return n;throw Error(`!!! NLS MISSING: ${e} !!!`)}return r}function s(e,t,...n){let r;r=typeof e==`number`?o(e,t):t;let a=i(r,n);return{value:a,original:t===r?a:i(t,n)}}function c(e,t){let n=e;typeof n.vscodeWindowId!=`number`&&Object.defineProperty(n,"vscodeWindowId",{get:()=>t})}var l=window,u=class e{constructor(){this.mapWindowIdToZoomFactor=new Map}static{this.INSTANCE=new e}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}};function d(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}function f(e){return u.INSTANCE.getZoomFactor(e)}var p=navigator.userAgent,m=p.indexOf(`Firefox`)>=0,h=p.indexOf(`AppleWebKit`)>=0,g=p.indexOf(`Chrome`)>=0,_=!g&&p.indexOf(`Safari`)>=0,v=!g&&!_&&h;p.indexOf(`Electron/`);var y=p.indexOf(`Android`)>=0,b=!1;if(typeof l.matchMedia==`function`){let e=l.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=l.matchMedia(`(display-mode: fullscreen)`);b=e.matches,d(l,e,({matches:e})=>{b&&t.matches||(b=e)})}function x(){return globalThis.MonacoEnvironment}var S=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?le.isErrorNoTelemetry(e)?new le(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m as e}from"./editor.api-
|
|
1
|
+
import{m as e}from"./editor.api-z9id08VB.js";var t=[`assign`,`flush`,`ftl`,`return`,`global`,`import`,`include`,`break`,`continue`,`local`,`nested`,`nt`,`setting`,`stop`,`t`,`lt`,`rt`,`fallback`],n=[`attempt`,`autoesc`,`autoEsc`,`compress`,`comment`,`escape`,`noescape`,`function`,`if`,`list`,`items`,`sep`,`macro`,`noparse`,`noParse`,`noautoesc`,`noAutoEsc`,`outputformat`,`switch`,`visit`,`recurse`],r={close:`>`,id:`angle`,open:`<`},i={close:`\\]`,id:`bracket`,open:`\\[`},a={close:`[>\\]]`,id:`auto`,open:`[<\\[]`},o={close:`\\}`,id:`dollar`,open1:`\\$`,open2:`\\{`},s={close:`\\]`,id:`bracket`,open1:`\\[`,open2:`=`};function c(r){return{brackets:[[`<`,`>`],[`[`,`]`],[`(`,`)`],[`{`,`}`]],comments:{blockComment:[`${r.open}--`,`--${r.close}`]},autoCloseBefore:`
|
|
2
2
|
\r }]),.:;=`,autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`,notIn:[`string`]},{open:`'`,close:`'`,notIn:[`string`]}],surroundingPairs:[{open:`"`,close:`"`},{open:`'`,close:`'`},{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`<`,close:`>`}],folding:{markers:{start:RegExp(`${r.open}#(?:${n.join(`|`)})([^/${r.close}]*(?!/)${r.close})[^${r.open}]*$`),end:RegExp(`${r.open}/#(?:${n.join(`|`)})[\\r\\n\\t ]*>`)}},onEnterRules:[{beforeText:RegExp(`${r.open}#(?!(?:${t.join(`|`)}))([a-zA-Z_]+)([^/${r.close}]*(?!/)${r.close})[^${r.open}]*$`),afterText:RegExp(`^${r.open}/#([a-zA-Z_]+)[\\r\\n\\t ]*${r.close}$`),action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:RegExp(`${r.open}#(?!(?:${t.join(`|`)}))([a-zA-Z_]+)([^/${r.close}]*(?!/)${r.close})[^${r.open}]*$`),action:{indentAction:e.IndentAction.Indent}}]}}function l(){return{brackets:[[`<`,`>`],[`[`,`]`],[`(`,`)`],[`{`,`}`]],autoCloseBefore:`
|
|
3
3
|
\r }]),.:;=`,autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`,notIn:[`string`]},{open:`'`,close:`'`,notIn:[`string`]}],surroundingPairs:[{open:`"`,close:`"`},{open:`'`,close:`'`},{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`<`,close:`>`}],folding:{markers:{start:RegExp(`[<\\[]#(?:${n.join(`|`)})([^/>\\]]*(?!/)[>\\]])[^<\\[]*$`),end:RegExp(`[<\\[]/#(?:${n.join(`|`)})[\\r\\n\\t ]*>`)}},onEnterRules:[{beforeText:RegExp(`[<\\[]#(?!(?:${t.join(`|`)}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`),afterText:RegExp(`^[<\\[]/#([a-zA-Z_]+)[\\r\\n\\t ]*[>\\]]$`),action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:RegExp(`[<\\[]#(?!(?:${t.join(`|`)}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`),action:{indentAction:e.IndentAction.Indent}}]}}function u(e,t){let n=`_${e.id}_${t.id}`,r=e=>e.replace(/__id__/g,n),i=e=>{let t=e.source.replace(/__id__/g,n);return new RegExp(t,e.flags)};return{unicode:!0,includeLF:!1,start:r(`default__id__`),ignoreCase:!1,defaultToken:`invalid`,tokenPostfix:`.freemarker2`,brackets:[{open:`{`,close:`}`,token:`delimiter.curly`},{open:`[`,close:`]`,token:`delimiter.square`},{open:`(`,close:`)`,token:`delimiter.parenthesis`},{open:`<`,close:`>`,token:`delimiter.angle`}],[r(`open__id__`)]:new RegExp(e.open),[r(`close__id__`)]:new RegExp(e.close),[r(`iOpen1__id__`)]:new RegExp(t.open1),[r(`iOpen2__id__`)]:new RegExp(t.open2),[r(`iClose__id__`)]:new RegExp(t.close),[r(`startTag__id__`)]:i(/(@open__id__)(#)/),[r(`endTag__id__`)]:i(/(@open__id__)(\/#)/),[r(`startOrEndTag__id__`)]:i(/(@open__id__)(\/?#)/),[r(`closeTag1__id__`)]:i(/((?:@blank)*)(@close__id__)/),[r(`closeTag2__id__`)]:i(/((?:@blank)*\/?)(@close__id__)/),blank:/[ \t\n\r]/,keywords:[`false`,`true`,`in`,`as`,`using`],directiveStartCloseTag1:/attempt|recover|sep|auto[eE]sc|no(?:autoe|AutoE)sc|compress|default|no[eE]scape|comment|no[pP]arse/,directiveStartCloseTag2:/else|break|continue|return|stop|flush|t|lt|rt|nt|nested|recurse|fallback|ftl/,directiveStartBlank:/if|else[iI]f|list|for[eE]ach|switch|case|assign|global|local|include|import|function|macro|transform|visit|stop|return|call|setting|output[fF]ormat|nested|recurse|escape|ftl|items/,directiveEndCloseTag1:/if|list|items|sep|recover|attempt|for[eE]ach|local|global|assign|function|macro|output[fF]ormat|auto[eE]sc|no(?:autoe|AutoE)sc|compress|transform|switch|escape|no[eE]scape/,escapedChar:/\\(?:[ntrfbgla\\'"\{=]|(?:x[0-9A-Fa-f]{1,4}))/,asciiDigit:/[0-9]/,integer:/[0-9]+/,nonEscapedIdStartChar:/[\$@-Z_a-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u1FFF\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183-\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3006\u3031-\u3035\u303B-\u303C\u3040-\u318F\u31A0-\u31BA\u31F0-\u31FF\u3300-\u337F\u3400-\u4DB5\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,escapedIdChar:/\\[\-\.:#]/,idStartChar:/(?:@nonEscapedIdStartChar)|(?:@escapedIdChar)/,id:/(?:@idStartChar)(?:(?:@idStartChar)|(?:@asciiDigit))*/,specialHashKeys:/\*\*|\*|false|true|in|as|using/,namedSymbols:/<=|>=|\\lte|\\lt|<|\\gte|\\gt|>|&&|\\and|->|->|==|!=|\+=|-=|\*=|\/=|%=|\+\+|--|<=|&&|\|\||:|\.\.\.|\.\.\*|\.\.<|\.\.!|\?\?|=|<|\+|-|\*|\/|%|\||\.\.|\?|!|&|\.|,|;/,arrows:[`->`,`->`],delimiters:[`;`,`:`,`,`,`.`],stringOperators:[`lte`,`lt`,`gte`,`gt`],noParseTags:[`noparse`,`noParse`,`comment`],tokenizer:{[r(`default__id__`)]:[{include:r(`@directive_token__id__`)},{include:r(`@interpolation_and_text_token__id__`)}],[r(`fmExpression__id__.directive`)]:[{include:r(`@blank_and_expression_comment_token__id__`)},{include:r(`@directive_end_token__id__`)},{include:r(`@expression_token__id__`)}],[r(`fmExpression__id__.interpolation`)]:[{include:r(`@blank_and_expression_comment_token__id__`)},{include:r(`@expression_token__id__`)},{include:r(`@greater_operators_token__id__`)}],[r(`inParen__id__.plain`)]:[{include:r(`@blank_and_expression_comment_token__id__`)},{include:r(`@directive_end_token__id__`)},{include:r(`@expression_token__id__`)}],[r(`inParen__id__.gt`)]:[{include:r(`@blank_and_expression_comment_token__id__`)},{include:r(`@expression_token__id__`)},{include:r(`@greater_operators_token__id__`)}],[r(`noSpaceExpression__id__`)]:[{include:r(`@no_space_expression_end_token__id__`)},{include:r(`@directive_end_token__id__`)},{include:r(`@expression_token__id__`)}],[r(`unifiedCall__id__`)]:[{include:r(`@unified_call_token__id__`)}],[r(`singleString__id__`)]:[{include:r(`@string_single_token__id__`)}],[r(`doubleString__id__`)]:[{include:r(`@string_double_token__id__`)}],[r(`rawSingleString__id__`)]:[{include:r(`@string_single_raw_token__id__`)}],[r(`rawDoubleString__id__`)]:[{include:r(`@string_double_raw_token__id__`)}],[r(`expressionComment__id__`)]:[{include:r(`@expression_comment_token__id__`)}],[r(`noParse__id__`)]:[{include:r(`@no_parse_token__id__`)}],[r(`terseComment__id__`)]:[{include:r(`@terse_comment_token__id__`)}],[r(`directive_token__id__`)]:[[i(/(?:@startTag__id__)(@directiveStartCloseTag1)(?:@closeTag1__id__)/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:[{token:`@brackets.directive`},{token:`delimiter.directive`},{cases:{"@noParseTags":{token:`tag`,next:r(`@noParse__id__.$3`)},"@default":{token:`tag`}}},{token:`delimiter.directive`},{token:`@brackets.directive`}]],[i(/(?:@startTag__id__)(@directiveStartCloseTag2)(?:@closeTag2__id__)/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:[{token:`@brackets.directive`},{token:`delimiter.directive`},{token:`tag`},{token:`delimiter.directive`},{token:`@brackets.directive`}]],[i(/(?:@startTag__id__)(@directiveStartBlank)(@blank)/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:[{token:`@brackets.directive`},{token:`delimiter.directive`},{token:`tag`},{token:``,next:r(`@fmExpression__id__.directive`)}]],[i(/(?:@endTag__id__)(@directiveEndCloseTag1)(?:@closeTag1__id__)/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:[{token:`@brackets.directive`},{token:`delimiter.directive`},{token:`tag`},{token:`delimiter.directive`},{token:`@brackets.directive`}]],[i(/(@open__id__)(@)/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:[{token:`@brackets.directive`},{token:`delimiter.directive`,next:r(`@unifiedCall__id__`)}]],[i(/(@open__id__)(\/@)((?:(?:@id)(?:\.(?:@id))*)?)(?:@closeTag1__id__)/),[{token:`@brackets.directive`},{token:`delimiter.directive`},{token:`tag`},{token:`delimiter.directive`},{token:`@brackets.directive`}]],[i(/(@open__id__)#--/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:{token:`comment`,next:r(`@terseComment__id__`)}],[i(/(?:@startOrEndTag__id__)([a-zA-Z_]+)/),e.id===`auto`?{cases:{"$1==<":{token:`@rematch`,switchTo:`@default_angle_${t.id}`},"$1==[":{token:`@rematch`,switchTo:`@default_bracket_${t.id}`}}}:[{token:`@brackets.directive`},{token:`delimiter.directive`},{token:`tag.invalid`,next:r(`@fmExpression__id__.directive`)}]]],[r(`interpolation_and_text_token__id__`)]:[[i(/(@iOpen1__id__)(@iOpen2__id__)/),[{token:t.id===`bracket`?`@brackets.interpolation`:`delimiter.interpolation`},{token:t.id===`bracket`?`delimiter.interpolation`:`@brackets.interpolation`,next:r(`@fmExpression__id__.interpolation`)}]],[/[\$#<\[\{]|(?:@blank)+|[^\$<#\[\{\n\r\t ]+/,{token:`source`}]],[r(`string_single_token__id__`)]:[[/[^'\\]/,{token:`string`}],[/@escapedChar/,{token:`string.escape`}],[/'/,{token:`string`,next:`@pop`}]],[r(`string_double_token__id__`)]:[[/[^"\\]/,{token:`string`}],[/@escapedChar/,{token:`string.escape`}],[/"/,{token:`string`,next:`@pop`}]],[r(`string_single_raw_token__id__`)]:[[/[^']+/,{token:`string.raw`}],[/'/,{token:`string.raw`,next:`@pop`}]],[r(`string_double_raw_token__id__`)]:[[/[^"]+/,{token:`string.raw`}],[/"/,{token:`string.raw`,next:`@pop`}]],[r(`expression_token__id__`)]:[[/(r?)(['"])/,{cases:{"r'":[{token:`keyword`},{token:`string.raw`,next:r(`@rawSingleString__id__`)}],'r"':[{token:`keyword`},{token:`string.raw`,next:r(`@rawDoubleString__id__`)}],"'":[{token:`source`},{token:`string`,next:r(`@singleString__id__`)}],'"':[{token:`source`},{token:`string`,next:r(`@doubleString__id__`)}]}}],[/(?:@integer)(?:\.(?:@integer))?/,{cases:{"(?:@integer)":{token:`number`},"@default":{token:`number.float`}}}],[/(\.)(@blank*)(@specialHashKeys)/,[{token:`delimiter`},{token:``},{token:`identifier`}]],[/(?:@namedSymbols)/,{cases:{"@arrows":{token:`meta.arrow`},"@delimiters":{token:`delimiter`},"@default":{token:`operators`}}}],[/@id/,{cases:{"@keywords":{token:`keyword.$0`},"@stringOperators":{token:`operators`},"@default":{token:`identifier`}}}],[/[\[\]\(\)\{\}]/,{cases:{"\\[":{cases:{"$S2==gt":{token:`@brackets`,next:r(`@inParen__id__.gt`)},"@default":{token:`@brackets`,next:r(`@inParen__id__.plain`)}}},"\\]":{cases:{...t.id===`bracket`?{"$S2==interpolation":{token:`@brackets.interpolation`,next:`@popall`}}:{},...e.id===`bracket`?{"$S2==directive":{token:`@brackets.directive`,next:`@popall`}}:{},[r(`$S1==inParen__id__`)]:{token:`@brackets`,next:`@pop`},"@default":{token:`@brackets`}}},"\\(":{token:`@brackets`,next:r(`@inParen__id__.gt`)},"\\)":{cases:{[r(`$S1==inParen__id__`)]:{token:`@brackets`,next:`@pop`},"@default":{token:`@brackets`}}},"\\{":{cases:{"$S2==gt":{token:`@brackets`,next:r(`@inParen__id__.gt`)},"@default":{token:`@brackets`,next:r(`@inParen__id__.plain`)}}},"\\}":{cases:{...t.id===`bracket`?{}:{"$S2==interpolation":{token:`@brackets.interpolation`,next:`@popall`}},[r(`$S1==inParen__id__`)]:{token:`@brackets`,next:`@pop`},"@default":{token:`@brackets`}}}}}],[/\$\{/,{token:`delimiter.invalid`}]],[r(`blank_and_expression_comment_token__id__`)]:[[/(?:@blank)+/,{token:``}],[/[<\[][#!]--/,{token:`comment`,next:r(`@expressionComment__id__`)}]],[r(`directive_end_token__id__`)]:[[/>/,e.id===`bracket`?{token:`operators`}:{token:`@brackets.directive`,next:`@popall`}],[i(/(\/)(@close__id__)/),[{token:`delimiter.directive`},{token:`@brackets.directive`,next:`@popall`}]]],[r(`greater_operators_token__id__`)]:[[/>/,{token:`operators`}],[/>=/,{token:`operators`}]],[r(`no_space_expression_end_token__id__`)]:[[/(?:@blank)+/,{token:``,switchTo:r(`@fmExpression__id__.directive`)}]],[r(`unified_call_token__id__`)]:[[/(@id)((?:@blank)+)/,[{token:`tag`},{token:``,next:r(`@fmExpression__id__.directive`)}]],[i(/(@id)(\/?)(@close__id__)/),[{token:`tag`},{token:`delimiter.directive`},{token:`@brackets.directive`,next:`@popall`}]],[/./,{token:`@rematch`,next:r(`@noSpaceExpression__id__`)}]],[r(`no_parse_token__id__`)]:[[i(/(@open__id__)(\/#?)([a-zA-Z]+)((?:@blank)*)(@close__id__)/),{cases:{"$S2==$3":[{token:`@brackets.directive`},{token:`delimiter.directive`},{token:`tag`},{token:``},{token:`@brackets.directive`,next:`@popall`}],"$S2==comment":[{token:`comment`},{token:`comment`},{token:`comment`},{token:`comment`},{token:`comment`}],"@default":[{token:`source`},{token:`source`},{token:`source`},{token:`source`},{token:`source`}]}}],[/[^<\[\-]+|[<\[\-]/,{cases:{"$S2==comment":{token:`comment`},"@default":{token:`source`}}}]],[r(`expression_comment_token__id__`)]:[[/--[>\]]/,{token:`comment`,next:`@pop`}],[/[^\->\]]+|[>\]\-]/,{token:`comment`}]],[r(`terse_comment_token__id__`)]:[[i(/--(?:@close__id__)/),{token:`comment`,next:`@popall`}],[/[^<\[\-]+|[<\[\-]/,{token:`comment`}]]}}}function d(e){let t=u(r,e),n=u(i,e),o=u(a,e);return{...t,...n,...o,unicode:!0,includeLF:!1,start:`default_auto_${e.id}`,ignoreCase:!1,defaultToken:`invalid`,tokenPostfix:`.freemarker2`,brackets:[{open:`{`,close:`}`,token:`delimiter.curly`},{open:`[`,close:`]`,token:`delimiter.square`},{open:`(`,close:`)`,token:`delimiter.parenthesis`},{open:`<`,close:`>`,token:`delimiter.angle`}],tokenizer:{...t.tokenizer,...n.tokenizer,...o.tokenizer}}}var f={conf:c(r),language:u(r,o)},p={conf:c(i),language:u(i,o)},m={conf:c(r),language:u(r,s)},h={conf:c(i),language:u(i,s)},g={conf:l(),language:d(o)},_={conf:l(),language:d(s)};export{m as TagAngleInterpolationBracket,f as TagAngleInterpolationDollar,_ as TagAutoInterpolationBracket,g as TagAutoInterpolationDollar,h as TagBracketInterpolationBracket,p as TagBracketInterpolationDollar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./editor.api-
|
|
1
|
+
import{m as e}from"./editor.api-z9id08VB.js";var t=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`menuitem`,`meta`,`param`,`source`,`track`,`wbr`],n={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:[`{{!--`,`--}}`]},brackets:[[`<!--`,`-->`],[`<`,`>`],[`{{`,`}}`],[`{`,`}`],[`(`,`)`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`}],surroundingPairs:[{open:`<`,close:`>`},{open:`"`,close:`"`},{open:`'`,close:`'`}],onEnterRules:[{beforeText:RegExp(`<(?!(?:${t.join(`|`)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,`i`),afterText:/^<\/(\w[\w\d]*)\s*>$/i,action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:RegExp(`<(?!(?:${t.join(`|`)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,`i`),action:{indentAction:e.IndentAction.Indent}}]},r={defaultToken:``,tokenPostfix:``,tokenizer:{root:[[/\{\{!--/,`comment.block.start.handlebars`,`@commentBlock`],[/\{\{!/,`comment.start.handlebars`,`@comment`],[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.root`}],[/<!DOCTYPE/,`metatag.html`,`@doctype`],[/<!--/,`comment.html`,`@commentHtml`],[/(<)(\w+)(\/>)/,[`delimiter.html`,`tag.html`,`delimiter.html`]],[/(<)(script)/,[`delimiter.html`,{token:`tag.html`,next:`@script`}]],[/(<)(style)/,[`delimiter.html`,{token:`tag.html`,next:`@style`}]],[/(<)([:\w]+)/,[`delimiter.html`,{token:`tag.html`,next:`@otherTag`}]],[/(<\/)(\w+)/,[`delimiter.html`,{token:`tag.html`,next:`@otherTag`}]],[/</,`delimiter.html`],[/\{/,`delimiter.html`],[/[^<{]+/]],doctype:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.comment`}],[/[^>]+/,`metatag.content.html`],[/>/,`metatag.html`,`@pop`]],comment:[[/\}\}/,`comment.end.handlebars`,`@pop`],[/./,`comment.content.handlebars`]],commentBlock:[[/--\}\}/,`comment.block.end.handlebars`,`@pop`],[/./,`comment.content.handlebars`]],commentHtml:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.comment`}],[/-->/,`comment.html`,`@pop`],[/[^-]+/,`comment.content.html`],[/./,`comment.content.html`]],otherTag:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.otherTag`}],[/\/?>/,`delimiter.html`,`@pop`],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/[ \t\r\n]+/]],script:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.script`}],[/type/,`attribute.name`,`@scriptAfterType`],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/>/,{token:`delimiter.html`,next:`@scriptEmbedded.text/javascript`,nextEmbedded:`text/javascript`}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,[`delimiter.html`,`tag.html`,{token:`delimiter.html`,next:`@pop`}]]],scriptAfterType:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.scriptAfterType`}],[/=/,`delimiter`,`@scriptAfterTypeEquals`],[/>/,{token:`delimiter.html`,next:`@scriptEmbedded.text/javascript`,nextEmbedded:`text/javascript`}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:`@rematch`,next:`@pop`}]],scriptAfterTypeEquals:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.scriptAfterTypeEquals`}],[/"([^"]*)"/,{token:`attribute.value`,switchTo:`@scriptWithCustomType.$1`}],[/'([^']*)'/,{token:`attribute.value`,switchTo:`@scriptWithCustomType.$1`}],[/>/,{token:`delimiter.html`,next:`@scriptEmbedded.text/javascript`,nextEmbedded:`text/javascript`}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:`@rematch`,next:`@pop`}]],scriptWithCustomType:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.scriptWithCustomType.$S2`}],[/>/,{token:`delimiter.html`,next:`@scriptEmbedded.$S2`,nextEmbedded:`$S2`}],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:`@rematch`,next:`@pop`}]],scriptEmbedded:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInEmbeddedState.scriptEmbedded.$S2`,nextEmbedded:`@pop`}],[/<\/script/,{token:`@rematch`,next:`@pop`,nextEmbedded:`@pop`}]],style:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.style`}],[/type/,`attribute.name`,`@styleAfterType`],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/>/,{token:`delimiter.html`,next:`@styleEmbedded.text/css`,nextEmbedded:`text/css`}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,[`delimiter.html`,`tag.html`,{token:`delimiter.html`,next:`@pop`}]]],styleAfterType:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.styleAfterType`}],[/=/,`delimiter`,`@styleAfterTypeEquals`],[/>/,{token:`delimiter.html`,next:`@styleEmbedded.text/css`,nextEmbedded:`text/css`}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:`@rematch`,next:`@pop`}]],styleAfterTypeEquals:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.styleAfterTypeEquals`}],[/"([^"]*)"/,{token:`attribute.value`,switchTo:`@styleWithCustomType.$1`}],[/'([^']*)'/,{token:`attribute.value`,switchTo:`@styleWithCustomType.$1`}],[/>/,{token:`delimiter.html`,next:`@styleEmbedded.text/css`,nextEmbedded:`text/css`}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:`@rematch`,next:`@pop`}]],styleWithCustomType:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInSimpleState.styleWithCustomType.$S2`}],[/>/,{token:`delimiter.html`,next:`@styleEmbedded.$S2`,nextEmbedded:`$S2`}],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:`@rematch`,next:`@pop`}]],styleEmbedded:[[/\{\{/,{token:`@rematch`,switchTo:`@handlebarsInEmbeddedState.styleEmbedded.$S2`,nextEmbedded:`@pop`}],[/<\/style/,{token:`@rematch`,next:`@pop`,nextEmbedded:`@pop`}]],handlebarsInSimpleState:[[/\{\{\{?/,`delimiter.handlebars`],[/\}\}\}?/,{token:`delimiter.handlebars`,switchTo:`@$S2.$S3`}],{include:`handlebarsRoot`}],handlebarsInEmbeddedState:[[/\{\{\{?/,`delimiter.handlebars`],[/\}\}\}?/,{token:`delimiter.handlebars`,switchTo:`@$S2.$S3`,nextEmbedded:`$S3`}],{include:`handlebarsRoot`}],handlebarsRoot:[[/"[^"]*"/,`string.handlebars`],[/[#/][^\s}]+/,`keyword.helper.handlebars`],[/else\b/,`keyword.helper.handlebars`],[/[\s]+/],[/[^}]/,`variable.parameter.handlebars`]]}};export{n as conf,r as language};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./editor.api-
|
|
1
|
+
import{m as e}from"./editor.api-z9id08VB.js";var t=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`menuitem`,`meta`,`param`,`source`,`track`,`wbr`],n={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:[`<!--`,`-->`]},brackets:[[`<!--`,`-->`],[`<`,`>`],[`{`,`}`],[`(`,`)`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`}],surroundingPairs:[{open:`"`,close:`"`},{open:`'`,close:`'`},{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`<`,close:`>`}],onEnterRules:[{beforeText:RegExp(`<(?!(?:${t.join(`|`)}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,`i`),afterText:/^<\/([_:\w][_:\w-.\d]*)\s*>$/i,action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:RegExp(`<(?!(?:${t.join(`|`)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,`i`),action:{indentAction:e.IndentAction.Indent}}],folding:{markers:{start:RegExp(`^\\s*<!--\\s*#region\\b.*-->`),end:RegExp(`^\\s*<!--\\s*#endregion\\b.*-->`)}}},r={defaultToken:``,tokenPostfix:`.html`,ignoreCase:!0,tokenizer:{root:[[/<!DOCTYPE/,`metatag`,`@doctype`],[/<!--/,`comment`,`@comment`],[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,[`delimiter`,`tag`,``,`delimiter`]],[/(<)(script)/,[`delimiter`,{token:`tag`,next:`@script`}]],[/(<)(style)/,[`delimiter`,{token:`tag`,next:`@style`}]],[/(<)((?:[\w\-]+:)?[\w\-]+)/,[`delimiter`,{token:`tag`,next:`@otherTag`}]],[/(<\/)((?:[\w\-]+:)?[\w\-]+)/,[`delimiter`,{token:`tag`,next:`@otherTag`}]],[/</,`delimiter`],[/[^<]+/]],doctype:[[/[^>]+/,`metatag.content`],[/>/,`metatag`,`@pop`]],comment:[[/-->/,`comment`,`@pop`],[/[^-]+/,`comment.content`],[/./,`comment.content`]],otherTag:[[/\/?>/,`delimiter`,`@pop`],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/[ \t\r\n]+/]],script:[[/type/,`attribute.name`,`@scriptAfterType`],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/>/,{token:`delimiter`,next:`@scriptEmbedded`,nextEmbedded:`text/javascript`}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,[`delimiter`,`tag`,{token:`delimiter`,next:`@pop`}]]],scriptAfterType:[[/=/,`delimiter`,`@scriptAfterTypeEquals`],[/>/,{token:`delimiter`,next:`@scriptEmbedded`,nextEmbedded:`text/javascript`}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:`@rematch`,next:`@pop`}]],scriptAfterTypeEquals:[[/"module"/,{token:`attribute.value`,switchTo:`@scriptWithCustomType.text/javascript`}],[/'module'/,{token:`attribute.value`,switchTo:`@scriptWithCustomType.text/javascript`}],[/"([^"]*)"/,{token:`attribute.value`,switchTo:`@scriptWithCustomType.$1`}],[/'([^']*)'/,{token:`attribute.value`,switchTo:`@scriptWithCustomType.$1`}],[/>/,{token:`delimiter`,next:`@scriptEmbedded`,nextEmbedded:`text/javascript`}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:`@rematch`,next:`@pop`}]],scriptWithCustomType:[[/>/,{token:`delimiter`,next:`@scriptEmbedded.$S2`,nextEmbedded:`$S2`}],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:`@rematch`,next:`@pop`}]],scriptEmbedded:[[/<\/script/,{token:`@rematch`,next:`@pop`,nextEmbedded:`@pop`}],[/[^<]+/,``]],style:[[/type/,`attribute.name`,`@styleAfterType`],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/>/,{token:`delimiter`,next:`@styleEmbedded`,nextEmbedded:`text/css`}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,[`delimiter`,`tag`,{token:`delimiter`,next:`@pop`}]]],styleAfterType:[[/=/,`delimiter`,`@styleAfterTypeEquals`],[/>/,{token:`delimiter`,next:`@styleEmbedded`,nextEmbedded:`text/css`}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:`@rematch`,next:`@pop`}]],styleAfterTypeEquals:[[/"([^"]*)"/,{token:`attribute.value`,switchTo:`@styleWithCustomType.$1`}],[/'([^']*)'/,{token:`attribute.value`,switchTo:`@styleWithCustomType.$1`}],[/>/,{token:`delimiter`,next:`@styleEmbedded`,nextEmbedded:`text/css`}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:`@rematch`,next:`@pop`}]],styleWithCustomType:[[/>/,{token:`delimiter`,next:`@styleEmbedded.$S2`,nextEmbedded:`$S2`}],[/"([^"]*)"/,`attribute.value`],[/'([^']*)'/,`attribute.value`],[/[\w\-]+/,`attribute.name`],[/=/,`delimiter`],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:`@rematch`,next:`@pop`}]],styleEmbedded:[[/<\/style/,{token:`@rematch`,next:`@pop`,nextEmbedded:`@pop`}],[/[^<]+/,``]]}};export{n as conf,r as language};
|