@nxgt/material-core 0.12.0 → 0.13.1

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +275 -24
  3. package/dist/backgrounds/activity.d.ts +11 -0
  4. package/dist/backgrounds/activity.d.ts.map +1 -0
  5. package/dist/backgrounds/build.d.ts +9 -0
  6. package/dist/backgrounds/build.d.ts.map +1 -0
  7. package/dist/backgrounds/id-prefix.d.ts +8 -0
  8. package/dist/backgrounds/id-prefix.d.ts.map +1 -0
  9. package/dist/backgrounds/index.d.ts +20 -0
  10. package/dist/backgrounds/index.d.ts.map +1 -0
  11. package/dist/backgrounds/index.js +467 -0
  12. package/dist/backgrounds/index.js.map +20 -0
  13. package/dist/backgrounds/noise.d.ts +7 -0
  14. package/dist/backgrounds/noise.d.ts.map +1 -0
  15. package/dist/backgrounds/presets/grain.d.ts +9 -0
  16. package/dist/backgrounds/presets/grain.d.ts.map +1 -0
  17. package/dist/backgrounds/presets.d.ts +16 -0
  18. package/dist/backgrounds/presets.d.ts.map +1 -0
  19. package/dist/backgrounds/primitives.d.ts +22 -0
  20. package/dist/backgrounds/primitives.d.ts.map +1 -0
  21. package/dist/backgrounds/rng.d.ts +12 -0
  22. package/dist/backgrounds/rng.d.ts.map +1 -0
  23. package/dist/backgrounds/scatter.d.ts +25 -0
  24. package/dist/backgrounds/scatter.d.ts.map +1 -0
  25. package/dist/backgrounds/scene.d.ts +21 -0
  26. package/dist/backgrounds/scene.d.ts.map +1 -0
  27. package/dist/backgrounds/tones.d.ts +4 -0
  28. package/dist/backgrounds/tones.d.ts.map +1 -0
  29. package/dist/backgrounds/types.d.ts +53 -0
  30. package/dist/backgrounds/types.d.ts.map +1 -0
  31. package/dist/chunks/index-mw5fa8qa.js +119 -0
  32. package/dist/chunks/index-mw5fa8qa.js.map +12 -0
  33. package/dist/csp/index.d.ts +10 -0
  34. package/dist/csp/index.d.ts.map +1 -0
  35. package/dist/csp/index.js +21 -0
  36. package/dist/csp/index.js.map +9 -0
  37. package/dist/csp/nonce.d.ts +35 -0
  38. package/dist/csp/nonce.d.ts.map +1 -0
  39. package/dist/csp/policy.d.ts +33 -0
  40. package/dist/csp/policy.d.ts.map +1 -0
  41. package/dist/csp/zod-jitless.d.ts +4 -0
  42. package/dist/csp/zod-jitless.d.ts.map +1 -0
  43. package/dist/lib/drawer-room.d.ts +8 -0
  44. package/dist/lib/drawer-room.d.ts.map +1 -0
  45. package/dist/lib/drawer-room.js +17 -0
  46. package/dist/lib/drawer-room.js.map +10 -0
  47. package/dist/lib/escape-forward.d.ts +14 -0
  48. package/dist/lib/escape-forward.d.ts.map +1 -1
  49. package/dist/lib/escape-forward.js +22 -2
  50. package/dist/lib/escape-forward.js.map +3 -3
  51. package/dist/pdf-viewer/index.d.ts +1 -0
  52. package/dist/pdf-viewer/index.d.ts.map +1 -1
  53. package/dist/pdf-viewer/index.js +77 -38
  54. package/dist/pdf-viewer/index.js.map +6 -5
  55. package/dist/pdf-viewer/pdf-pin-page.d.ts +9 -0
  56. package/dist/pdf-viewer/pdf-pin-page.d.ts.map +1 -1
  57. package/dist/pdf-viewer/pdf-reveal-hit.d.ts +7 -0
  58. package/dist/pdf-viewer/pdf-reveal-hit.d.ts.map +1 -0
  59. package/dist/pdf-viewer/pdf-scroll-spy.d.ts +21 -8
  60. package/dist/pdf-viewer/pdf-scroll-spy.d.ts.map +1 -1
  61. package/dist/states/copy.d.ts +46 -0
  62. package/dist/states/copy.d.ts.map +1 -0
  63. package/dist/states/describe-error.d.ts +18 -0
  64. package/dist/states/describe-error.d.ts.map +1 -0
  65. package/dist/states/illustrations.d.ts +24 -0
  66. package/dist/states/illustrations.d.ts.map +1 -0
  67. package/dist/states/index.d.ts +11 -0
  68. package/dist/states/index.d.ts.map +1 -0
  69. package/dist/states/index.js +253 -0
  70. package/dist/states/index.js.map +13 -0
  71. package/dist/states/kinds.d.ts +28 -0
  72. package/dist/states/kinds.d.ts.map +1 -0
  73. package/dist/vite/csp-dev-header.d.ts +11 -0
  74. package/dist/vite/csp-dev-header.d.ts.map +1 -0
  75. package/dist/vite/csp-hashes.d.ts +23 -0
  76. package/dist/vite/csp-hashes.d.ts.map +1 -0
  77. package/dist/vite/csp-header.d.ts +10 -0
  78. package/dist/vite/csp-header.d.ts.map +1 -0
  79. package/dist/vite/csp-plugin.d.ts +12 -0
  80. package/dist/vite/csp-plugin.d.ts.map +1 -0
  81. package/dist/vite/css-chain.d.ts +13 -0
  82. package/dist/vite/css-chain.d.ts.map +1 -0
  83. package/dist/vite/dependency-closure.d.ts +8 -0
  84. package/dist/vite/dependency-closure.d.ts.map +1 -0
  85. package/dist/vite/fonts-inter.d.ts +15 -0
  86. package/dist/vite/fonts-inter.d.ts.map +1 -0
  87. package/dist/vite/fonts-plugin.d.ts +12 -0
  88. package/dist/vite/fonts-plugin.d.ts.map +1 -0
  89. package/dist/vite/index.d.ts +17 -81
  90. package/dist/vite/index.d.ts.map +1 -1
  91. package/dist/vite/index.js +478 -2
  92. package/dist/vite/index.js.map +18 -4
  93. package/dist/vite/libraries.d.ts +13 -0
  94. package/dist/vite/libraries.d.ts.map +1 -0
  95. package/dist/vite/nxgt-material.d.ts +12 -0
  96. package/dist/vite/nxgt-material.d.ts.map +1 -0
  97. package/dist/vite/options.d.ts +56 -0
  98. package/dist/vite/options.d.ts.map +1 -0
  99. package/dist/vite/pdf-plugin.d.ts +19 -0
  100. package/dist/vite/pdf-plugin.d.ts.map +1 -0
  101. package/dist/vite/pdfkit-standard-fonts.d.ts +74 -0
  102. package/dist/vite/pdfkit-standard-fonts.d.ts.map +1 -0
  103. package/dist/vite/styles-plugin.d.ts +27 -0
  104. package/dist/vite/styles-plugin.d.ts.map +1 -0
  105. package/dist/vite/styles-scan.d.ts +14 -0
  106. package/dist/vite/styles-scan.d.ts.map +1 -0
  107. package/docs/README.md +4 -0
  108. package/docs/backgrounds.md +95 -0
  109. package/docs/roadmap.md +34 -23
  110. package/docs/states.md +85 -0
  111. package/docs/troubleshooting.md +174 -3
  112. package/package.json +34 -4
@@ -1,10 +1,357 @@
1
+ import {
2
+ CSP_NONCE_PLACEHOLDER2,
3
+ assertCspNonce,
4
+ cspHash2,
5
+ cspPolicy2,
6
+ ZOD_JITLESS_SCRIPT2
7
+ } from "../chunks/index-mw5fa8qa.js";
1
8
  // src/vite/csp-assets-inline-limit.ts
2
9
  var FONT = /\.(woff2?|ttf|otf|eot)(\?.*)?$/i;
3
10
  function cspAssetsInlineLimit(file, _content) {
4
11
  return FONT.test(file) ? false : undefined;
5
12
  }
13
+ // src/vite/csp-header.ts
14
+ var STAND_IN = "NXGTPLACEHOLDERSTANDIN";
15
+ function placeholderHeader(placeholder, options) {
16
+ const { header } = cspPolicy2({ ...options, nonce: STAND_IN });
17
+ return header.split(STAND_IN).join(placeholder);
18
+ }
19
+ function buildHeader(mode, placeholder, options) {
20
+ return mode === "nonce" ? placeholderHeader(placeholder, options) : cspPolicy2(options).header;
21
+ }
6
22
 
7
- // src/vite/index.ts
23
+ // src/vite/csp-dev-header.ts
24
+ function cspDevHeaderPlugin(csp, placeholder) {
25
+ return {
26
+ name: "nxgt-material:csp-dev-header",
27
+ apply: "serve",
28
+ async configureServer(server) {
29
+ const { hashes = {} } = csp.policy;
30
+ const script = [...hashes.script ?? []];
31
+ if (csp.mode === "hash" && csp.zodJitless) {
32
+ script.push(await cspHash2(ZOD_JITLESS_SCRIPT2));
33
+ }
34
+ const header = buildHeader(csp.mode, placeholder(), {
35
+ ...csp.policy,
36
+ hashes: { ...hashes, script },
37
+ dev: true
38
+ });
39
+ server.middlewares.use((_req, res, next) => {
40
+ res.setHeader("Content-Security-Policy-Report-Only", header);
41
+ next();
42
+ });
43
+ }
44
+ };
45
+ }
46
+
47
+ // src/vite/csp-hashes.ts
48
+ var INLINE_SCRIPT = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
49
+ var INLINE_STYLE = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
50
+ var SRC = /(?:^|\s)src\s*=/;
51
+ var normalise = (text) => text.replace(/\r\n?/g, `
52
+ `);
53
+ function inlineSources(html) {
54
+ const scripts = [...html.matchAll(INLINE_SCRIPT)].filter((m) => !SRC.test(m[1]) && m[2] !== "").map((m) => normalise(m[2]));
55
+ const styles = [...html.matchAll(INLINE_STYLE)].map((m) => normalise(m[1])).filter((s) => s !== "");
56
+ return { scripts, styles };
57
+ }
58
+ var unique = (list) => [...new Set(list)];
59
+ var NO_HTML_WARNING = "[nxgt-material] no index.html in this build: the CSP part did nothing. On a server, send cspPolicy({ nonce }).header and zodJitlessTag(nonce) per request, or pass csp: false.";
60
+ function cspHashesHook(csp, placeholder, logger, isSsr) {
61
+ let warned = false;
62
+ return {
63
+ order: "post",
64
+ async handler(_options, bundle) {
65
+ const env = this.environment?.name;
66
+ if (env !== undefined && env !== "client" || isSsr())
67
+ return;
68
+ const nonceMode = csp.mode === "nonce";
69
+ const scripts = [];
70
+ const styles = [];
71
+ let pages = 0;
72
+ for (const file of Object.values(bundle)) {
73
+ if (file.type !== "asset" || !file.fileName.endsWith(".html"))
74
+ continue;
75
+ pages++;
76
+ const found = inlineSources(String(file.source));
77
+ scripts.push(...found.scripts);
78
+ styles.push(...found.styles);
79
+ }
80
+ if (pages === 0) {
81
+ if (!warned)
82
+ logger().warn(NO_HTML_WARNING);
83
+ warned = true;
84
+ return;
85
+ }
86
+ const scriptHashes = unique(await Promise.all(scripts.map((s) => cspHash2(s))));
87
+ const styleHashes = unique(await Promise.all(styles.map((s) => cspHash2(s))));
88
+ const marker = placeholder();
89
+ const header = buildHeader(csp.mode, marker, {
90
+ ...csp.policy,
91
+ hashes: nonceMode ? csp.policy.hashes : {
92
+ ...csp.policy.hashes,
93
+ script: [...csp.policy.hashes?.script ?? [], ...scriptHashes]
94
+ }
95
+ });
96
+ const out = { mode: csp.mode, scriptHashes, styleHashes, header };
97
+ this.emitFile({
98
+ type: "asset",
99
+ fileName: ".vite/nxgt-csp.json",
100
+ source: `${JSON.stringify(out, null, 2)}
101
+ `
102
+ });
103
+ logger().info(nonceMode ? `
104
+ [nxgt-material] CSP (nonce mode): the HTML carries the placeholder "${marker}".
105
+ ` + `Never serve it as it is: call applyCspNonce(html, createCspNonce()) on every response and send
106
+ ` + `Content-Security-Policy: ${header.split(marker).join("<nonce>")}
107
+ ` : `
108
+ [nxgt-material] CSP (hash mode), send this header (also in dist/.vite/nxgt-csp.json):
109
+ Content-Security-Policy: ${header}
110
+ `);
111
+ }
112
+ };
113
+ }
114
+
115
+ // src/vite/csp-plugin.ts
116
+ function cspPlugin(csp) {
117
+ let config;
118
+ let placeholder = csp.placeholder;
119
+ const nonceMode = csp.mode === "nonce";
120
+ return {
121
+ name: "nxgt-material:csp",
122
+ placeholder: () => placeholder,
123
+ config(user) {
124
+ if (!nonceMode)
125
+ return;
126
+ if (user.html?.cspNonce)
127
+ placeholder = user.html.cspNonce;
128
+ else
129
+ return { html: { cspNonce: placeholder } };
130
+ },
131
+ configResolved(resolved) {
132
+ config = resolved;
133
+ if (nonceMode) {
134
+ assertCspNonce(placeholder);
135
+ } else if (resolved.html?.cspNonce) {
136
+ throw new Error("[nxgt-material] html.cspNonce is set, but the CSP is in hash mode (the default): set nxgtMaterial({ csp: { mode: 'nonce' } }) or drop html.cspNonce.");
137
+ }
138
+ },
139
+ transformIndexHtml: {
140
+ order: "pre",
141
+ handler() {
142
+ if (!csp.zodJitless)
143
+ return;
144
+ return [
145
+ {
146
+ tag: "script",
147
+ attrs: nonceMode ? { nonce: placeholder } : undefined,
148
+ children: ZOD_JITLESS_SCRIPT2,
149
+ injectTo: "head-prepend"
150
+ }
151
+ ];
152
+ }
153
+ },
154
+ generateBundle: cspHashesHook(csp, () => placeholder, () => config.logger, () => Boolean(config.build.ssr))
155
+ };
156
+ }
157
+
158
+ // src/vite/css-chain.ts
159
+ import { readFile } from "node:fs/promises";
160
+ import { dirname, resolve } from "node:path";
161
+
162
+ // src/vite/styles-scan.ts
163
+ var COMMENTS = /\/\*[\s\S]*?\*\//g;
164
+ var IMPORT = /@import\s+(?:url\(\s*)?(?:"([^"]+)"|'([^']+)')|@import\s+url\(\s*([^'")\s]+)\s*\)/g;
165
+ var SOURCE = /@source\s+(?:"([^"]+)"|'([^']+)')/g;
166
+ var strip = (css) => css.replace(COMMENTS, "");
167
+ function cssImports(css) {
168
+ return [...strip(css).matchAll(IMPORT)].map((m) => m[1] ?? m[2] ?? m[3]);
169
+ }
170
+ function cssSources(css) {
171
+ return [...strip(css).matchAll(SOURCE)].map((m) => m[1] ?? m[2]);
172
+ }
173
+ function relativeImports(css) {
174
+ return cssImports(css).filter((s) => /^\.\.?\//.test(s));
175
+ }
176
+ function sourceCovers(path, name) {
177
+ const p = path.replace(/\/+$/, "");
178
+ return p.endsWith(name) || p.includes(`${name}/`);
179
+ }
180
+ function jsImports(code, specifier) {
181
+ const quoted = specifier.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
182
+ return new RegExp(`(?:from\\s*|import\\s*\\(?\\s*)['"]${quoted}['"]`).test(code);
183
+ }
184
+ function declaresFontSans(css) {
185
+ return /--font-sans\s*:/.test(strip(css));
186
+ }
187
+
188
+ // src/vite/css-chain.ts
189
+ async function cssChain(file, css, seen = new Set([file])) {
190
+ const imports = cssImports(css);
191
+ const sources = cssSources(css);
192
+ let fontSans = declaresFontSans(css);
193
+ for (const spec of relativeImports(css)) {
194
+ const next = resolve(dirname(file), spec);
195
+ if (seen.has(next))
196
+ continue;
197
+ seen.add(next);
198
+ try {
199
+ const inner = await cssChain(next, await readFile(next, "utf8"), seen);
200
+ imports.push(...inner.imports);
201
+ sources.push(...inner.sources);
202
+ fontSans ||= inner.fontSans;
203
+ } catch {}
204
+ }
205
+ return { imports, sources, fontSans };
206
+ }
207
+ function inDependency(id, root) {
208
+ const below = id.startsWith(root) ? id.slice(root.length) : id;
209
+ return below.includes("/node_modules/");
210
+ }
211
+
212
+ // src/vite/fonts-inter.ts
213
+ var INTER = "@fontsource-variable/inter";
214
+ var CSS = /\.(css|scss|sass|less|styl|pcss|postcss)(\?|$)/;
215
+ var INTER_OVERRIDE = ':root{--font-sans:"Inter Variable",ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";}';
216
+ function missingInterMessage() {
217
+ return `[nxgt-material] ${INTER} is not installed: keeping the system font. ` + `Install it to use Inter (bun add ${INTER}), ` + "or set nxgtMaterial({ fonts: { sans: false } }) to silence this.";
218
+ }
219
+ function fontsInterPlugin(lib) {
220
+ let inter = null;
221
+ let root = "";
222
+ return {
223
+ name: "nxgt-material:fonts-inter",
224
+ configResolved(config) {
225
+ root = config.root;
226
+ },
227
+ async buildStart() {
228
+ const resolved = await this.resolve(`${INTER}/index.css`, `${root}/index.html`, { skipSelf: true });
229
+ inter = resolved?.id ?? null;
230
+ const env = this.environment?.name;
231
+ if (!inter && (env === undefined || env === "client")) {
232
+ this.warn(missingInterMessage());
233
+ }
234
+ },
235
+ transform: {
236
+ order: "pre",
237
+ async handler(code, id) {
238
+ if (!inter || !CSS.test(id) || inDependency(id, root))
239
+ return null;
240
+ const chain = await cssChain(id.split("?")[0], code);
241
+ if (!chain.imports.includes(lib.stylesheet))
242
+ return null;
243
+ if (chain.fontSans || chain.imports.some((s) => s.startsWith(INTER))) {
244
+ return null;
245
+ }
246
+ return {
247
+ code: `@import "${inter}";
248
+ ${code}
249
+ ${INTER_OVERRIDE}
250
+ `,
251
+ map: null
252
+ };
253
+ }
254
+ }
255
+ };
256
+ }
257
+
258
+ // src/vite/fonts-plugin.ts
259
+ function composeAssetsInlineLimit(user) {
260
+ return (file, content) => {
261
+ if (cspAssetsInlineLimit(file) === false)
262
+ return false;
263
+ if (typeof user === "function")
264
+ return user(file, content);
265
+ if (typeof user === "boolean")
266
+ return user;
267
+ if (typeof user === "number")
268
+ return content.length < user;
269
+ return;
270
+ };
271
+ }
272
+ function fontsPlugin() {
273
+ return {
274
+ name: "nxgt-material:fonts",
275
+ config(user) {
276
+ return {
277
+ build: {
278
+ assetsInlineLimit: composeAssetsInlineLimit(user.build?.assetsInlineLimit)
279
+ }
280
+ };
281
+ }
282
+ };
283
+ }
284
+
285
+ // src/vite/libraries.ts
286
+ function describeLibrary(name) {
287
+ return {
288
+ name,
289
+ stylesheet: `${name}/styles.css`,
290
+ needsSource: name === "@nxgt/material",
291
+ importLine: `@import "${name}/styles.css";`,
292
+ sourceLine: `@source "../node_modules/${name}/";`
293
+ };
294
+ }
295
+
296
+ // src/vite/options.ts
297
+ function resolveOptions(options = {}) {
298
+ const { csp, fonts, styles, pdf } = options;
299
+ const c = typeof csp === "object" ? csp : {};
300
+ const f = typeof fonts === "object" ? fonts : {};
301
+ const s = typeof styles === "object" ? styles : {};
302
+ return {
303
+ csp: csp === false ? false : {
304
+ mode: c.mode ?? "hash",
305
+ placeholder: c.placeholder ?? CSP_NONCE_PLACEHOLDER2,
306
+ zodJitless: c.zodJitless ?? true,
307
+ dev: c.dev ?? true,
308
+ policy: c.policy ?? {}
309
+ },
310
+ fonts: fonts === false ? { katex: false, sans: false } : {
311
+ katex: f.katex ?? true,
312
+ sans: f.sans === undefined ? "inter" : f.sans
313
+ },
314
+ styles: { check: styles === false ? false : s.check ?? true },
315
+ pdf: pdf === false ? false : { bundle: typeof pdf === "object" && !!pdf.bundle }
316
+ };
317
+ }
318
+
319
+ // src/vite/pdf-plugin.ts
320
+ import { resolve as resolve3 } from "node:path";
321
+
322
+ // src/vite/dependency-closure.ts
323
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
324
+ import { dirname as dirname2, join, resolve as resolve2 } from "node:path";
325
+ function findPackage(name, from) {
326
+ for (let dir = resolve2(from);; dir = dirname2(dir)) {
327
+ const candidate = join(dir, "node_modules", name);
328
+ if (existsSync(join(candidate, "package.json"))) {
329
+ return realpathSync(candidate);
330
+ }
331
+ if (dirname2(dir) === dir)
332
+ return;
333
+ }
334
+ }
335
+ function dependencyClosure(roots, from) {
336
+ const seen = new Set;
337
+ const walk = (name, parent) => {
338
+ if (seen.has(name))
339
+ return;
340
+ const dir = findPackage(name, parent);
341
+ if (!dir)
342
+ return;
343
+ seen.add(name);
344
+ const manifest = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
345
+ for (const dependency of Object.keys(manifest.dependencies ?? {})) {
346
+ walk(dependency, dir);
347
+ }
348
+ };
349
+ for (const root of roots)
350
+ walk(root, from);
351
+ return [...seen];
352
+ }
353
+
354
+ // src/vite/pdfkit-standard-fonts.ts
8
355
  function pdfkitStandardFonts() {
9
356
  const CALL = /[A-Za-z_$][\w$]*\(\s*(['"])#standard-fonts\/(\w+)\1\s*\)/g;
10
357
  return {
@@ -29,10 +376,139 @@ ${out}`, map: null };
29
376
  }
30
377
  };
31
378
  }
379
+
380
+ // src/vite/pdf-plugin.ts
381
+ var PDF_ROOTS = ["@react-pdf/renderer", "pdfkit", "intl-messageformat"];
382
+ function pdfNoExternal(root, library) {
383
+ return [
384
+ ...library ? [library] : [],
385
+ "@nxgt/material-core",
386
+ "pdfkit",
387
+ /^@react-pdf\//,
388
+ ...dependencyClosure(PDF_ROOTS, root)
389
+ ];
390
+ }
391
+ function pdfBundlePlugin(library) {
392
+ return {
393
+ name: "nxgt-material:pdf-bundle",
394
+ apply: "build",
395
+ config: (user) => ({
396
+ ssr: {
397
+ noExternal: pdfNoExternal(resolve3(user.root ?? process.cwd()), library)
398
+ }
399
+ })
400
+ };
401
+ }
402
+ function pdfPlugins(pdf, library) {
403
+ return [
404
+ pdfkitStandardFonts(),
405
+ ...pdf.bundle ? [pdfBundlePlugin(library)] : []
406
+ ];
407
+ }
408
+
409
+ // src/vite/styles-plugin.ts
410
+ var CSS2 = /\.(css|scss|sass|less|styl|pcss|postcss)(\?|$)/;
411
+ var JS = /\.(m?[jt]sx?|vue|svelte)(\?|$)/;
412
+ function createStylesState() {
413
+ return {
414
+ roots: new Set,
415
+ compiledRoots: new Set,
416
+ jsImporters: new Set,
417
+ sourceOk: false
418
+ };
419
+ }
420
+ function missingStylesheetMessage(lib) {
421
+ return `[nxgt-material] ${lib.name}'s stylesheet is never imported, so every component renders unstyled.
422
+ ` + `Add this line to your main stylesheet, after \`@import "tailwindcss";\`:
423
+
424
+ ${lib.importLine}
425
+
426
+ ` + `or import '${lib.stylesheet}' from your entry. To silence this check: nxgtMaterial({ styles: false }).`;
427
+ }
428
+ function missingSourceMessage(lib) {
429
+ return `[nxgt-material] ${lib.name}'s stylesheet is imported but Tailwind is not told to scan the package, so its classes are never generated.
430
+ ` + `Add this line to the same stylesheet (adjust the path to where node_modules is):
431
+
432
+ ${lib.sourceLine}
433
+
434
+ ` + "To silence this check: nxgtMaterial({ styles: false }).";
435
+ }
436
+ function stylesPlugin(lib, state) {
437
+ let enabled = false;
438
+ let root = "";
439
+ return {
440
+ name: "nxgt-material:styles",
441
+ apply: "build",
442
+ configResolved(config) {
443
+ root = config.root;
444
+ enabled = !process.env.VITEST && !config.build.ssr;
445
+ },
446
+ transform: {
447
+ order: "pre",
448
+ async handler(code, id) {
449
+ if (!enabled || inDependency(id, root))
450
+ return null;
451
+ const file = id.split("?")[0];
452
+ if (CSS2.test(id)) {
453
+ const { imports, sources } = await cssChain(file, code);
454
+ if (imports.includes(lib.name))
455
+ state.compiledRoots.add(file);
456
+ if (!imports.includes(lib.stylesheet))
457
+ return null;
458
+ state.roots.add(file);
459
+ if (sources.some((s) => sourceCovers(s, lib.name)))
460
+ state.sourceOk = true;
461
+ } else if (JS.test(id) && jsImports(code, lib.stylesheet)) {
462
+ state.jsImporters.add(file);
463
+ }
464
+ return null;
465
+ }
466
+ },
467
+ buildEnd(error) {
468
+ const env = this.environment?.name;
469
+ if (!enabled || error || env !== undefined && env !== "client")
470
+ return;
471
+ const imported = state.roots.size + state.compiledRoots.size + state.jsImporters.size;
472
+ if (imported === 0) {
473
+ this.error(missingStylesheetMessage(lib));
474
+ }
475
+ if (lib.needsSource && state.roots.size > 0 && !state.sourceOk) {
476
+ this.error(missingSourceMessage(lib));
477
+ }
478
+ }
479
+ };
480
+ }
481
+
482
+ // src/vite/nxgt-material.ts
483
+ function nxgtMaterial(options, library) {
484
+ const resolved = resolveOptions(options);
485
+ const lib = library ? describeLibrary(library) : undefined;
486
+ const plugins = [];
487
+ if (resolved.csp) {
488
+ const csp = cspPlugin(resolved.csp);
489
+ plugins.push(csp);
490
+ if (resolved.csp.dev) {
491
+ plugins.push(cspDevHeaderPlugin(resolved.csp, csp.placeholder));
492
+ }
493
+ }
494
+ if (resolved.fonts.katex)
495
+ plugins.push(fontsPlugin());
496
+ if (lib && resolved.fonts.sans === "inter")
497
+ plugins.push(fontsInterPlugin(lib));
498
+ if (lib && resolved.styles.check) {
499
+ plugins.push(stylesPlugin(lib, createStylesState()));
500
+ }
501
+ if (resolved.pdf)
502
+ plugins.push(...pdfPlugins(resolved.pdf, library));
503
+ return plugins;
504
+ }
32
505
  export {
506
+ CSP_NONCE_PLACEHOLDER2 as CSP_NONCE_PLACEHOLDER,
507
+ ZOD_JITLESS_SCRIPT2 as ZOD_JITLESS_SCRIPT,
33
508
  cspAssetsInlineLimit,
509
+ nxgtMaterial,
34
510
  pdfkitStandardFonts
35
511
  };
36
512
 
37
- //# debugId=C84B59B7E2D9781E64756E2164756E21
513
+ //# debugId=01446DBBB7A2C3D564756E2164756E21
38
514
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,25 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/vite/csp-assets-inline-limit.ts", "../src/vite/index.ts"],
3
+ "sources": ["../src/vite/csp-assets-inline-limit.ts", "../src/vite/csp-header.ts", "../src/vite/csp-dev-header.ts", "../src/vite/csp-hashes.ts", "../src/vite/csp-plugin.ts", "../src/vite/css-chain.ts", "../src/vite/styles-scan.ts", "../src/vite/fonts-inter.ts", "../src/vite/fonts-plugin.ts", "../src/vite/libraries.ts", "../src/vite/options.ts", "../src/vite/pdf-plugin.ts", "../src/vite/dependency-closure.ts", "../src/vite/pdfkit-standard-fonts.ts", "../src/vite/styles-plugin.ts", "../src/vite/nxgt-material.ts"],
4
4
  "sourcesContent": [
5
5
  "/** A font file, by extension, with or without a query string. */\nconst FONT = /\\.(woff2?|ttf|otf|eot)(\\?.*)?$/i;\n\n/**\n * Vite's `build.assetsInlineLimit` for a page under a strict Content Security\n * Policy: a font is **never** inlined, every other asset keeps Vite's default\n * (inlined under 4096 bytes).\n *\n * Vite turns a small asset into a `data:` URI, and `font-src 'self'` blocks a\n * font served that way (KaTeX's `KaTeX_Size3-Regular.woff2` is 3.6 KB). Images\n * are usually fine as `data:` URIs (`img-src 'self' data:`), so only fonts are\n * kept as files. Returning `undefined` hands the decision back to Vite.\n *\n * ```ts\n * // vite.config.ts\n * import { cspAssetsInlineLimit } from '@nxgt/material-core/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({ build: { assetsInlineLimit: cspAssetsInlineLimit } });\n * ```\n *\n * To keep more out (an SVG, say), wrap it:\n * `(file, content) => file.endsWith('.svg') ? false : cspAssetsInlineLimit(file, content)`.\n *\n * `content` is typed as a `Uint8Array` (Vite passes a `Buffer`, which is one),\n * so the declaration needs no Node types; it is not read.\n */\nexport function cspAssetsInlineLimit(\n\tfile: string,\n\t_content?: Uint8Array,\n): boolean | undefined {\n\treturn FONT.test(file) ? false : undefined;\n}\n",
6
- "/**\n * Build-time helpers for the apps that consume this library.\n *\n * This entry is the odd one out: everything else here runs in a browser or in\n * an SSR server, and the `/vite` entry is Node code that runs inside a\n * consumer's `vite.config.ts` (or a Nuxt app's Nitro build). It is here anyway\n * because the problem it solves is this package's to own — a consumer should\n * not have to rediscover it — and because there is exactly one copy of the fix\n * to maintain, shared by `@nxgt/material` and `@nxgt/material-vue`.\n *\n * It also holds `cspAssetsInlineLimit`, the `build.assetsInlineLimit` that\n * keeps fonts out of `data:` URIs for a strict Content Security Policy.\n *\n * It imports nothing at runtime: `Plugin` is a type, erased by the compiler, so\n * the built `dist/vite.js` has no dependency on `vite` at all.\n */\n\nimport type { Plugin } from 'vite';\n\nexport { cspAssetsInlineLimit } from './csp-assets-inline-limit';\n\n/**\n * Bundles pdfkit's fourteen standard fonts instead of leaving them to a\n * `require` that cannot work in a bundle.\n *\n * **Only needed by an app that renders PDFs** (`@nxgt/material/print`, or\n * `@nxgt/material-vue/pdf`). No other entry reaches `@react-pdf/renderer`, so\n * an app that does not print never sees this at all.\n * If you do print, read on, because the failure is spectacular and silent until\n * production.\n *\n * Both are built on `@react-pdf/renderer`, which is built on\n * `pdfkit`, whose node build ends with:\n *\n * ```js\n * const require$1 = createRequire(import.meta.url);\n * registerStdFontLoaders({ Helvetica: () => require$1('#standard-fonts/Helvetica'), … });\n * ```\n *\n * `#standard-fonts/*` is a package-`imports` entry **private to pdfkit**, and\n * that is a RUNTIME call, not an import — so no bundler resolves it. Bundle\n * pdfkit into an SSR server (`ssr.noExternal`) and the literal survives into the\n * output, where `createRequire` is rooted at the build directory and the importer\n * is no longer inside pdfkit. The server then throws on **every request**,\n * `/health` included:\n *\n * ```\n * error: Cannot find module '#standard-fonts/Helvetica' from '…/build/app.js'\n * ```\n *\n * A compose healthcheck that fetches a route never goes healthy either, so the\n * container looks like it is failing to start rather than failing to serve.\n *\n * This plugin rewrites those calls into static imports of\n * `./standard-fonts/<name>.mjs`, so the font data lands in the bundle and the\n * server stays self-contained. Use it when the runtime image has **no\n * `node_modules`** — a single-file `bun build` artifact copied alone into the\n * image. When the image does keep `node_modules`, the lighter answer is to leave\n * the library external instead (`--external` it in the bundle step, and keep it\n * out of `ssr.noExternal`), which also keeps ~12 MB of\n * pdfkit out of the artifact. In Nuxt, `nxgtMaterial: { pdf: {\n * bundleStandardFonts: true } }` adds this plugin to the Nitro build.\n *\n * ```ts\n * // `@nxgt/material/vite` in a React app: the same function\n * import { pdfkitStandardFonts } from '@nxgt/material-vue/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [pdfkitStandardFonts()],\n * ssr: { noExternal: ['@nxgt/material-vue', '@nxgt/material-core'] },\n * });\n * ```\n *\n * Two things that look like fixes and are not:\n *\n * - **`resolve.alias`** mapping `#standard-fonts/` to `pdfkit/standard-fonts/`.\n * An alias rewrites specifiers the resolver is *asked* about; this one is a\n * string handed to `createRequire` at runtime, which the resolver never sees.\n * - **`--external pdfkit`**. It is a transitive dependency, so the runtime cannot\n * resolve it from the app's own directory: `Cannot find package 'pdfkit'`.\n *\n * The plugin throws if a `#standard-fonts/` reference survives the rewrite, so a\n * future pdfkit that changes the shape of those calls fails the build instead of\n * the first request.\n */\nexport function pdfkitStandardFonts(): Plugin {\n\t/**\n\t * Any call whose only argument is that literal. Deliberately not pinned to\n\t * `require$1`, which is a name rollup generated for pdfkit's own build and is\n\t * free to change on any release — there is nothing else one can do with a\n\t * `#standard-fonts/*` specifier but require it.\n\t */\n\tconst CALL = /[A-Za-z_$][\\w$]*\\(\\s*(['\"])#standard-fonts\\/(\\w+)\\1\\s*\\)/g;\n\n\treturn {\n\t\tname: 'nxgt-material:pdfkit-standard-fonts',\n\t\tenforce: 'pre',\n\t\ttransform(code, id) {\n\t\t\tif (!id.includes('pdfkit') || !code.includes('#standard-fonts/')) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst fonts = new Set<string>();\n\t\t\tconst out = code.replace(CALL, (_match, _quote, font: string) => {\n\t\t\t\tfonts.add(font);\n\t\t\t\treturn `__stdFont_${font}`;\n\t\t\t});\n\n\t\t\t// Fail the build rather than ship a server that dies on its first\n\t\t\t// request: an unmatched occurrence means pdfkit changed the shape of\n\t\t\t// these calls, and the whole point of this plugin is that nothing\n\t\t\t// downstream notices the difference until runtime.\n\t\t\tif (out.includes('#standard-fonts/')) {\n\t\t\t\tthis.error(\n\t\t\t\t\t`${id} still references '#standard-fonts/' after the transform — ` +\n\t\t\t\t\t\t'pdfkit changed how it loads its standard fonts. See the doc ' +\n\t\t\t\t\t\t'comment on pdfkitStandardFonts() in the /vite entry.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst imports = [...fonts]\n\t\t\t\t.map(\n\t\t\t\t\t(font) =>\n\t\t\t\t\t\t`import __stdFont_${font} from './standard-fonts/${font}.mjs';`,\n\t\t\t\t)\n\t\t\t\t.join('\\n');\n\n\t\t\treturn { code: `${imports}\\n${out}`, map: null };\n\t\t},\n\t};\n}\n"
6
+ "import { type CspPolicyOptions, cspPolicy } from '../csp';\n\n/** The nonce `cspPolicy` is given instead of the (refused) public placeholder. */\nconst STAND_IN = 'NXGTPLACEHOLDERSTANDIN';\n\n/**\n * The header for a page whose nonce is a build placeholder: `cspPolicy`\n * refuses the public placeholder as a nonce on purpose, so the policy is built\n * with a stand-in that is swapped afterwards. Never serve this as it is.\n */\nexport function placeholderHeader(\n\tplaceholder: string,\n\toptions: CspPolicyOptions,\n): string {\n\tconst { header } = cspPolicy({ ...options, nonce: STAND_IN });\n\treturn header.split(STAND_IN).join(placeholder);\n}\n\n/** The header of a hash-mode page, or of a nonce-mode one with its placeholder. */\nexport function buildHeader(\n\tmode: 'hash' | 'nonce',\n\tplaceholder: string,\n\toptions: CspPolicyOptions,\n): string {\n\treturn mode === 'nonce'\n\t\t? placeholderHeader(placeholder, options)\n\t\t: cspPolicy(options).header;\n}\n",
7
+ "import type { Plugin } from 'vite';\nimport { cspHash, ZOD_JITLESS_SCRIPT } from '../csp';\nimport { buildHeader } from './csp-header';\nimport type { ResolvedCsp } from './options';\n\n/**\n * Report-Only on the dev server: shows the violations a production policy\n * would raise without breaking the page (HMR's inline scripts are reported,\n * which is expected, as are Vite's dev `<style>` elements in hash mode). In\n * nonce mode it carries the placeholder, as the dev HTML does; in hash mode,\n * the hash of the zod jitless script the HTML is given.\n */\nexport function cspDevHeaderPlugin(\n\tcsp: ResolvedCsp,\n\tplaceholder: () => string,\n): Plugin {\n\treturn {\n\t\tname: 'nxgt-material:csp-dev-header',\n\t\tapply: 'serve',\n\t\tasync configureServer(server) {\n\t\t\tconst { hashes = {} } = csp.policy;\n\t\t\tconst script = [...(hashes.script ?? [])];\n\t\t\tif (csp.mode === 'hash' && csp.zodJitless) {\n\t\t\t\tscript.push(await cspHash(ZOD_JITLESS_SCRIPT));\n\t\t\t}\n\t\t\tconst header = buildHeader(csp.mode, placeholder(), {\n\t\t\t\t...csp.policy,\n\t\t\t\thashes: { ...hashes, script },\n\t\t\t\tdev: true,\n\t\t\t});\n\t\t\tserver.middlewares.use((_req, res, next) => {\n\t\t\t\tres.setHeader('Content-Security-Policy-Report-Only', header);\n\t\t\t\tnext();\n\t\t\t});\n\t\t},\n\t};\n}\n",
8
+ "import type { Plugin } from 'vite';\nimport { cspHash } from '../csp';\nimport { buildHeader } from './csp-header';\nimport type { ResolvedCsp } from './options';\n\nconst INLINE_SCRIPT = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script>/gi;\nconst INLINE_STYLE = /<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi;\nconst SRC = /(?:^|\\s)src\\s*=/;\n\n/** A browser hashes the text with every line break as `\\n`. */\nconst normalise = (text: string) => text.replace(/\\r\\n?/g, '\\n');\n\n/** The text of every inline script and style of an HTML document. */\nexport function inlineSources(html: string): {\n\tscripts: string[];\n\tstyles: string[];\n} {\n\tconst scripts = [...html.matchAll(INLINE_SCRIPT)]\n\t\t.filter((m) => !SRC.test(m[1] as string) && (m[2] as string) !== '')\n\t\t.map((m) => normalise(m[2] as string));\n\tconst styles = [...html.matchAll(INLINE_STYLE)]\n\t\t.map((m) => normalise(m[1] as string))\n\t\t.filter((s) => s !== '');\n\treturn { scripts, styles };\n}\n\nconst unique = (list: string[]) => [...new Set(list)];\n\nexport const NO_HTML_WARNING =\n\t'[nxgt-material] no index.html in this build: the CSP part did nothing. On a server, send cspPolicy({ nonce }).header and zodJitlessTag(nonce) per request, or pass csp: false.';\n\ntype Logger = { info(message: string): void; warn(message: string): void };\n\n/**\n * Hash mode: the sha256 of every inline script and style of the built HTML,\n * written to `.vite/nxgt-csp.json` with the header (which allows the scripts\n * by hash and style elements by `'unsafe-inline'`; `styleHashes` is for a\n * stricter policy of your own); nonce mode: the same file\n * with the placeholder header, as a template. Runs after every other\n * `generateBundle`, so it hashes the HTML that is written.\n */\nexport function cspHashesHook(\n\tcsp: ResolvedCsp,\n\tplaceholder: () => string,\n\tlogger: () => Logger,\n\tisSsr: () => boolean,\n): NonNullable<Plugin['generateBundle']> {\n\tlet warned = false;\n\treturn {\n\t\torder: 'post',\n\t\tasync handler(_options, bundle) {\n\t\t\t// No environment before Vite 6 (Nuxt >= 3.13 allows Vite 5): the client.\n\t\t\tconst env = this.environment?.name;\n\t\t\tif ((env !== undefined && env !== 'client') || isSsr()) return;\n\t\t\tconst nonceMode = csp.mode === 'nonce';\n\t\t\tconst scripts: string[] = [];\n\t\t\tconst styles: string[] = [];\n\t\t\tlet pages = 0;\n\t\t\tfor (const file of Object.values(bundle)) {\n\t\t\t\tif (file.type !== 'asset' || !file.fileName.endsWith('.html')) continue;\n\t\t\t\tpages++;\n\t\t\t\tconst found = inlineSources(String(file.source));\n\t\t\t\tscripts.push(...found.scripts);\n\t\t\t\tstyles.push(...found.styles);\n\t\t\t}\n\t\t\tif (pages === 0) {\n\t\t\t\tif (!warned) logger().warn(NO_HTML_WARNING);\n\t\t\t\twarned = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst scriptHashes = unique(\n\t\t\t\tawait Promise.all(scripts.map((s) => cspHash(s))),\n\t\t\t);\n\t\t\tconst styleHashes = unique(\n\t\t\t\tawait Promise.all(styles.map((s) => cspHash(s))),\n\t\t\t);\n\t\t\tconst marker = placeholder();\n\t\t\tconst header = buildHeader(csp.mode, marker, {\n\t\t\t\t...csp.policy,\n\t\t\t\t// Styles stay out of the header: a hash would void the\n\t\t\t\t// 'unsafe-inline' the components' runtime <style> elements need.\n\t\t\t\thashes: nonceMode\n\t\t\t\t\t? csp.policy.hashes\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...csp.policy.hashes,\n\t\t\t\t\t\t\tscript: [...(csp.policy.hashes?.script ?? []), ...scriptHashes],\n\t\t\t\t\t\t},\n\t\t\t});\n\t\t\tconst out = { mode: csp.mode, scriptHashes, styleHashes, header };\n\t\t\tthis.emitFile({\n\t\t\t\ttype: 'asset',\n\t\t\t\tfileName: '.vite/nxgt-csp.json',\n\t\t\t\tsource: `${JSON.stringify(out, null, 2)}\\n`,\n\t\t\t});\n\t\t\tlogger().info(\n\t\t\t\tnonceMode\n\t\t\t\t\t? `\\n[nxgt-material] CSP (nonce mode): the HTML carries the placeholder \"${marker}\".\\n` +\n\t\t\t\t\t\t\t'Never serve it as it is: call applyCspNonce(html, createCspNonce()) on every response and send\\n' +\n\t\t\t\t\t\t\t`Content-Security-Policy: ${header.split(marker).join('<nonce>')}\\n`\n\t\t\t\t\t: `\\n[nxgt-material] CSP (hash mode), send this header (also in dist/.vite/nxgt-csp.json):\\nContent-Security-Policy: ${header}\\n`,\n\t\t\t);\n\t\t},\n\t};\n}\n",
9
+ "import type { Plugin, ResolvedConfig } from 'vite';\nimport { ZOD_JITLESS_SCRIPT } from '../csp';\nimport { assertCspNonce } from '../csp/nonce';\nimport { cspHashesHook } from './csp-hashes';\nimport type { ResolvedCsp } from './options';\n\n/**\n * The CSP part of `nxgtMaterial()`. Hash mode (default) leaves no placeholder\n * anywhere: the build hashes the inline scripts and styles of the HTML.\n * Nonce mode asks Vite for its `html.cspNonce` placeholder, which the server\n * replaces per request.\n */\nexport function cspPlugin(\n\tcsp: ResolvedCsp,\n): Plugin & { placeholder(): string } {\n\tlet config: ResolvedConfig;\n\t// The user's own html.cspNonce wins over ours.\n\tlet placeholder = csp.placeholder;\n\tconst nonceMode = csp.mode === 'nonce';\n\n\treturn {\n\t\tname: 'nxgt-material:csp',\n\t\tplaceholder: () => placeholder,\n\t\tconfig(user) {\n\t\t\tif (!nonceMode) return;\n\t\t\tif (user.html?.cspNonce) placeholder = user.html.cspNonce;\n\t\t\telse return { html: { cspNonce: placeholder } };\n\t\t},\n\t\tconfigResolved(resolved) {\n\t\t\tconfig = resolved;\n\t\t\tif (nonceMode) {\n\t\t\t\tassertCspNonce(placeholder);\n\t\t\t} else if (resolved.html?.cspNonce) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"[nxgt-material] html.cspNonce is set, but the CSP is in hash mode (the default): set nxgtMaterial({ csp: { mode: 'nonce' } }) or drop html.cspNonce.\",\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\ttransformIndexHtml: {\n\t\t\torder: 'pre',\n\t\t\thandler() {\n\t\t\t\tif (!csp.zodJitless) return;\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'script',\n\t\t\t\t\t\tattrs: nonceMode ? { nonce: placeholder } : undefined,\n\t\t\t\t\t\tchildren: ZOD_JITLESS_SCRIPT,\n\t\t\t\t\t\tinjectTo: 'head-prepend',\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t},\n\t\t},\n\t\tgenerateBundle: cspHashesHook(\n\t\t\tcsp,\n\t\t\t() => placeholder,\n\t\t\t() => config.logger,\n\t\t\t() => Boolean(config.build.ssr),\n\t\t),\n\t};\n}\n",
10
+ "import { readFile } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport {\n\tcssImports,\n\tcssSources,\n\tdeclaresFontSans,\n\trelativeImports,\n} from './styles-scan';\n\n/**\n * Every `@import` specifier and `@source` path of a stylesheet and of the\n * relative files it imports, read from disk: Tailwind's own resolver reads\n * those files, so they never pass through a bundler's `transform`.\n */\nexport async function cssChain(\n\tfile: string,\n\tcss: string,\n\tseen = new Set<string>([file]),\n): Promise<{ imports: string[]; sources: string[]; fontSans: boolean }> {\n\tconst imports = cssImports(css);\n\tconst sources = cssSources(css);\n\tlet fontSans = declaresFontSans(css);\n\tfor (const spec of relativeImports(css)) {\n\t\tconst next = resolve(dirname(file), spec);\n\t\tif (seen.has(next)) continue;\n\t\tseen.add(next);\n\t\ttry {\n\t\t\tconst inner = await cssChain(next, await readFile(next, 'utf8'), seen);\n\t\t\timports.push(...inner.imports);\n\t\t\tsources.push(...inner.sources);\n\t\t\tfontSans ||= inner.fontSans;\n\t\t} catch {\n\t\t\t// An import that is not a readable file is the bundler's to report.\n\t\t}\n\t}\n\treturn { imports, sources, fontSans };\n}\n\n/** Whether a module id is a dependency, relative to the project's root. */\nexport function inDependency(id: string, root: string): boolean {\n\tconst below = id.startsWith(root) ? id.slice(root.length) : id;\n\treturn below.includes('/node_modules/');\n}\n",
11
+ "/** Pure scans of a stylesheet's text. */\n\nconst COMMENTS = /\\/\\*[\\s\\S]*?\\*\\//g;\nconst IMPORT =\n\t/@import\\s+(?:url\\(\\s*)?(?:\"([^\"]+)\"|'([^']+)')|@import\\s+url\\(\\s*([^'\")\\s]+)\\s*\\)/g;\nconst SOURCE = /@source\\s+(?:\"([^\"]+)\"|'([^']+)')/g;\n\nconst strip = (css: string) => css.replace(COMMENTS, '');\n\n/** The specifiers of every `@import` (both quote styles, `url()`), comments skipped. */\nexport function cssImports(css: string): string[] {\n\treturn [...strip(css).matchAll(IMPORT)].map(\n\t\t(m) => (m[1] ?? m[2] ?? m[3]) as string,\n\t);\n}\n\n/** The paths of every plain `@source` (`not` and `inline()` forms add nothing to scan). */\nexport function cssSources(css: string): string[] {\n\treturn [...strip(css).matchAll(SOURCE)].map((m) => (m[1] ?? m[2]) as string);\n}\n\n/** The `@import`s that point at a file next to the stylesheet. */\nexport function relativeImports(css: string): string[] {\n\treturn cssImports(css).filter((s) => /^\\.\\.?\\//.test(s));\n}\n\n/** Whether a `@source` path points at the package (`…/node_modules/@nxgt/material/`). */\nexport function sourceCovers(path: string, name: string): boolean {\n\tconst p = path.replace(/\\/+$/, '');\n\treturn p.endsWith(name) || p.includes(`${name}/`);\n}\n\n/** Whether a module's code imports `specifier` (static or dynamic, any quotes). */\nexport function jsImports(code: string, specifier: string): boolean {\n\tconst quoted = specifier.replace(/[.*+?^${}()|[\\]\\\\/]/g, '\\\\$&');\n\treturn new RegExp(`(?:from\\\\s*|import\\\\s*\\\\(?\\\\s*)['\"]${quoted}['\"]`).test(\n\t\tcode,\n\t);\n}\n\n/** Whether the stylesheet sets Tailwind's `--font-sans` itself. */\nexport function declaresFontSans(css: string): boolean {\n\treturn /--font-sans\\s*:/.test(strip(css));\n}\n",
12
+ "import type { Plugin } from 'vite';\nimport { cssChain, inDependency } from './css-chain';\nimport type { LibraryDescriptor } from './libraries';\n\nconst INTER = '@fontsource-variable/inter';\nconst CSS = /\\.(css|scss|sass|less|styl|pcss|postcss)(\\?|$)/;\n\n/** Unlayered, so it beats Tailwind's layered `@theme` variable. */\nexport const INTER_OVERRIDE =\n\t':root{--font-sans:\"Inter Variable\",ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";}';\n\nexport function missingInterMessage(): string {\n\treturn (\n\t\t`[nxgt-material] ${INTER} is not installed: keeping the system font. ` +\n\t\t`Install it to use Inter (bun add ${INTER}), ` +\n\t\t'or set nxgtMaterial({ fonts: { sans: false } }) to silence this.'\n\t);\n}\n\n/**\n * Loads Inter (self-hosted, `font-src 'self'`) when the app has it installed,\n * else warns once and keeps the system font: the build never fails. It goes\n * in the stylesheet that imports the library's: its `@import` goes first,\n * the `--font-sans` override last.\n * Skipped when that stylesheet already imports Inter or sets `--font-sans`\n * itself, anywhere in its chain.\n */\nexport function fontsInterPlugin(lib: LibraryDescriptor): Plugin {\n\tlet inter: string | null = null;\n\tlet root = '';\n\treturn {\n\t\tname: 'nxgt-material:fonts-inter',\n\t\tconfigResolved(config) {\n\t\t\troot = config.root;\n\t\t},\n\t\tasync buildStart() {\n\t\t\tconst resolved = await this.resolve(\n\t\t\t\t`${INTER}/index.css`,\n\t\t\t\t`${root}/index.html`,\n\t\t\t\t{ skipSelf: true },\n\t\t\t);\n\t\t\tinter = resolved?.id ?? null;\n\t\t\t// Each environment (client, ssr) starts its own build: warn once,\n\t\t\t// from the client's (no environment before Vite 6).\n\t\t\tconst env = this.environment?.name;\n\t\t\tif (!inter && (env === undefined || env === 'client')) {\n\t\t\t\tthis.warn(missingInterMessage());\n\t\t\t}\n\t\t},\n\t\ttransform: {\n\t\t\torder: 'pre',\n\t\t\tasync handler(code, id) {\n\t\t\t\tif (!inter || !CSS.test(id) || inDependency(id, root)) return null;\n\t\t\t\tconst chain = await cssChain(id.split('?')[0] as string, code);\n\t\t\t\tif (!chain.imports.includes(lib.stylesheet)) return null;\n\t\t\t\tif (chain.fontSans || chain.imports.some((s) => s.startsWith(INTER))) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcode: `@import \"${inter}\";\\n${code}\\n${INTER_OVERRIDE}\\n`,\n\t\t\t\t\tmap: null,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n}\n",
13
+ "import type { Plugin } from 'vite';\nimport { cspAssetsInlineLimit } from './csp-assets-inline-limit';\n\ntype Limit =\n\t| number\n\t| boolean\n\t| ((file: string, content: Buffer) => boolean | undefined)\n\t| undefined;\n\n/**\n * `build.assetsInlineLimit` with fonts never inlined (`data:` fonts break\n * `font-src 'self'`) and everything else left to the app's own value: its\n * function is asked first, its number is Vite's size limit, absent is Vite's\n * default.\n */\nexport function composeAssetsInlineLimit(user: Limit) {\n\treturn (file: string, content: Buffer): boolean | undefined => {\n\t\tif (cspAssetsInlineLimit(file) === false) return false;\n\t\tif (typeof user === 'function') return user(file, content);\n\t\tif (typeof user === 'boolean') return user;\n\t\tif (typeof user === 'number') return content.length < user;\n\t\treturn undefined;\n\t};\n}\n\nexport function fontsPlugin(): Plugin {\n\treturn {\n\t\tname: 'nxgt-material:fonts',\n\t\tconfig(user) {\n\t\t\treturn {\n\t\t\t\tbuild: {\n\t\t\t\t\tassetsInlineLimit: composeAssetsInlineLimit(\n\t\t\t\t\t\tuser.build?.assetsInlineLimit as Limit,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n",
14
+ "/** What the plugin needs to know about the library it runs for. */\nexport type NxgtMaterialLibrary = '@nxgt/material' | '@nxgt/material-vue';\n\nexport type LibraryDescriptor = {\n\tname: NxgtMaterialLibrary;\n\t/** The stylesheet an app imports. */\n\tstylesheet: string;\n\t/** Whether the app's own Tailwind build must be told to scan the package. */\n\tneedsSource: boolean;\n\timportLine: string;\n\tsourceLine: string;\n};\n\nexport function describeLibrary(name: NxgtMaterialLibrary): LibraryDescriptor {\n\treturn {\n\t\tname,\n\t\tstylesheet: `${name}/styles.css`,\n\t\tneedsSource: name === '@nxgt/material',\n\t\timportLine: `@import \"${name}/styles.css\";`,\n\t\tsourceLine: `@source \"../node_modules/${name}/\";`,\n\t};\n}\n",
15
+ "import { CSP_NONCE_PLACEHOLDER, type CspPolicyOptions } from '../csp';\n\nexport type NxgtMaterialCspOptions = {\n\t/**\n\t * `'hash'` (default): the sha256 of every inline script and style of\n\t * `index.html` goes to `dist/.vite/nxgt-csp.json`; nothing public is ever\n\t * written into the HTML, so a static host is safe. `'nonce'`: the HTML\n\t * carries a placeholder your server replaces per request (`applyCspNonce`).\n\t */\n\tmode?: 'hash' | 'nonce';\n\t/** Nonce mode only: your own placeholder instead of `CSP_NONCE_PLACEHOLDER`. */\n\tplaceholder?: string;\n\t/** An inline script that switches zod's `new Function` probe off. Default on. */\n\tzodJitless?: boolean;\n\t/** A `Content-Security-Policy-Report-Only` header on the dev server. Default on. */\n\tdev?: boolean;\n\t/** Refines the dev header and the generated one. */\n\tpolicy?: CspPolicyOptions;\n};\n\nexport type NxgtMaterialOptions = {\n\tcsp?: boolean | NxgtMaterialCspOptions;\n\tfonts?: boolean | { katex?: boolean; sans?: 'inter' | false };\n\tstyles?: boolean | { check?: boolean };\n\t/**\n\t * pdfkit's standard fonts (`pdfkitStandardFonts()`), on by default: it does\n\t * nothing unless pdfkit goes through the bundle. `bundle: true` also puts\n\t * the renderer into an SSR build (`ssr.noExternal`), for a server whose\n\t * runtime image has no `node_modules`.\n\t */\n\tpdf?: boolean | { bundle?: boolean };\n};\n\nexport type ResolvedCsp = Required<Omit<NxgtMaterialCspOptions, 'policy'>> & {\n\tpolicy: CspPolicyOptions;\n};\n\nexport type ResolvedOptions = {\n\tcsp: false | ResolvedCsp;\n\tfonts: { katex: boolean; sans: 'inter' | false };\n\tstyles: { check: boolean };\n\tpdf: false | { bundle: boolean };\n};\n\n/** Booleans and objects normalised; everything is on by default. */\nexport function resolveOptions(\n\toptions: NxgtMaterialOptions = {},\n): ResolvedOptions {\n\tconst { csp, fonts, styles, pdf } = options;\n\tconst c = typeof csp === 'object' ? csp : {};\n\tconst f = typeof fonts === 'object' ? fonts : {};\n\tconst s = typeof styles === 'object' ? styles : {};\n\treturn {\n\t\tcsp:\n\t\t\tcsp === false\n\t\t\t\t? false\n\t\t\t\t: {\n\t\t\t\t\t\tmode: c.mode ?? 'hash',\n\t\t\t\t\t\tplaceholder: c.placeholder ?? CSP_NONCE_PLACEHOLDER,\n\t\t\t\t\t\tzodJitless: c.zodJitless ?? true,\n\t\t\t\t\t\tdev: c.dev ?? true,\n\t\t\t\t\t\tpolicy: c.policy ?? {},\n\t\t\t\t\t},\n\t\tfonts:\n\t\t\tfonts === false\n\t\t\t\t? { katex: false, sans: false }\n\t\t\t\t: {\n\t\t\t\t\t\tkatex: f.katex ?? true,\n\t\t\t\t\t\tsans: f.sans === undefined ? 'inter' : f.sans,\n\t\t\t\t\t},\n\t\tstyles: { check: styles === false ? false : (s.check ?? true) },\n\t\tpdf:\n\t\t\tpdf === false\n\t\t\t\t? false\n\t\t\t\t: { bundle: typeof pdf === 'object' && !!pdf.bundle },\n\t};\n}\n",
16
+ "import { resolve } from 'node:path';\nimport type { Plugin } from 'vite';\nimport { dependencyClosure } from './dependency-closure';\nimport type { NxgtMaterialLibrary } from './libraries';\nimport { pdfkitStandardFonts } from './pdfkit-standard-fonts';\n\n/**\n * Where the closure starts: the renderer, pdfkit and core's one dependency.\n * The library is not a root: its dependencies (a router, charts…) are the\n * app's, and a second bundled copy would split their contexts.\n */\nconst PDF_ROOTS = ['@react-pdf/renderer', 'pdfkit', 'intl-messageformat'];\n\n/**\n * What an SSR build must bundle for pdfkit's standard fonts to be rewritten\n * and for the result to run with no `node_modules`: pdfkit (its\n * `#standard-fonts/*` calls are what the transform rewrites), the renderer and\n * the dependencies it needs at runtime (fontkit, yoga, png-js…), read from the\n * installed packages so the list follows its releases. The library and core\n * are named only, not walked. `react` is a peer and stays the app's to bundle.\n * Under Yarn PnP there is no node_modules to read: only the fixed names apply.\n */\nexport function pdfNoExternal(\n\troot: string,\n\tlibrary?: NxgtMaterialLibrary,\n): (string | RegExp)[] {\n\treturn [\n\t\t...(library ? [library] : []),\n\t\t'@nxgt/material-core',\n\t\t'pdfkit',\n\t\t/^@react-pdf\\//,\n\t\t...dependencyClosure(PDF_ROOTS, root),\n\t];\n}\n\n/** Adds the packages above to `ssr.noExternal`; vite's merge keeps `true`. */\nexport function pdfBundlePlugin(library?: NxgtMaterialLibrary): Plugin {\n\treturn {\n\t\tname: 'nxgt-material:pdf-bundle',\n\t\tapply: 'build',\n\t\tconfig: (user) => ({\n\t\t\tssr: {\n\t\t\t\tnoExternal: pdfNoExternal(resolve(user.root ?? process.cwd()), library),\n\t\t\t},\n\t\t}),\n\t};\n}\n\n/** The pdf part of `nxgtMaterial()`. */\nexport function pdfPlugins(\n\tpdf: { bundle: boolean },\n\tlibrary?: NxgtMaterialLibrary,\n): Plugin[] {\n\treturn [\n\t\tpdfkitStandardFonts(),\n\t\t...(pdf.bundle ? [pdfBundlePlugin(library)] : []),\n\t];\n}\n",
17
+ "import { existsSync, readFileSync, realpathSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\n\ntype Manifest = { dependencies?: Record<string, string> };\n\n/** The directory of package `name` as Node would find it from `from`. */\nfunction findPackage(name: string, from: string): string | undefined {\n\tfor (let dir = resolve(from); ; dir = dirname(dir)) {\n\t\tconst candidate = join(dir, 'node_modules', name);\n\t\tif (existsSync(join(candidate, 'package.json'))) {\n\t\t\t// Real path: a symlinked layout (bun, pnpm) keeps a package's own\n\t\t\t// dependencies next to its real location.\n\t\t\treturn realpathSync(candidate);\n\t\t}\n\t\tif (dirname(dir) === dir) return undefined;\n\t}\n}\n\n/**\n * The names of `roots` and of everything they depend on (`dependencies`,\n * transitively), looked up from `from` the way Node would. A root or a\n * dependency that is not installed is skipped. Peer and optional\n * dependencies are not followed: they are the app's to bundle.\n */\nexport function dependencyClosure(roots: string[], from: string): string[] {\n\tconst seen = new Set<string>();\n\tconst walk = (name: string, parent: string) => {\n\t\tif (seen.has(name)) return;\n\t\tconst dir = findPackage(name, parent);\n\t\tif (!dir) return;\n\t\tseen.add(name);\n\t\tconst manifest = JSON.parse(\n\t\t\treadFileSync(join(dir, 'package.json'), 'utf8'),\n\t\t) as Manifest;\n\t\tfor (const dependency of Object.keys(manifest.dependencies ?? {})) {\n\t\t\twalk(dependency, dir);\n\t\t}\n\t};\n\tfor (const root of roots) walk(root, from);\n\treturn [...seen];\n}\n",
18
+ "/**\n * The pdfkit standard fonts plugin of the `/vite` entry (Node code that runs\n * inside a consumer's `vite.config.ts` or a Nuxt app's Nitro build). It\n * imports nothing at runtime: `Plugin` is a type, erased by the compiler.\n */\n\nimport type { Plugin } from 'vite';\n\n/**\n * Bundles pdfkit's fourteen standard fonts instead of leaving them to a\n * `require` that cannot work in a bundle.\n *\n * **Only needed by an app that renders PDFs** (`@nxgt/material/print`, or\n * `@nxgt/material-vue/pdf`). No other entry reaches `@react-pdf/renderer`, so\n * an app that does not print never sees this at all.\n * If you do print, read on, because the failure is spectacular and silent until\n * production.\n *\n * Both are built on `@react-pdf/renderer`, which is built on\n * `pdfkit`, whose node build ends with:\n *\n * ```js\n * const require$1 = createRequire(import.meta.url);\n * registerStdFontLoaders({ Helvetica: () => require$1('#standard-fonts/Helvetica'), … });\n * ```\n *\n * `#standard-fonts/*` is a package-`imports` entry **private to pdfkit**, and\n * that is a RUNTIME call, not an import — so no bundler resolves it. Bundle\n * pdfkit into an SSR server (`ssr.noExternal`) and the literal survives into the\n * output, where `createRequire` is rooted at the build directory and the importer\n * is no longer inside pdfkit. The server then throws on **every request**,\n * `/health` included:\n *\n * ```\n * error: Cannot find module '#standard-fonts/Helvetica' from '…/build/app.js'\n * ```\n *\n * A compose healthcheck that fetches a route never goes healthy either, so the\n * container looks like it is failing to start rather than failing to serve.\n *\n * This plugin rewrites those calls into static imports of\n * `./standard-fonts/<name>.mjs`, so the font data lands in the bundle and the\n * server stays self-contained. Use it when the runtime image has **no\n * `node_modules`** — a single-file `bun build` artifact copied alone into the\n * image. When the image does keep `node_modules`, the lighter answer is to leave\n * the library external instead (`--external` it in the bundle step, and keep it\n * out of `ssr.noExternal`), which also keeps ~12 MB of\n * pdfkit out of the artifact. `nxgtMaterial({ pdf: { bundle: true } })` adds this\n * plugin and the `ssr.noExternal` list it needs; in Nuxt, `nxgtMaterial: { pdf: {\n * bundle: true } }` adds this plugin to the Nitro build.\n *\n * ```ts\n * // `@nxgt/material/vite` in a React app: the same function\n * import { pdfkitStandardFonts } from '@nxgt/material-vue/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [pdfkitStandardFonts()],\n * ssr: { noExternal: ['@nxgt/material-vue', '@nxgt/material-core'] },\n * });\n * ```\n *\n * Two things that look like fixes and are not:\n *\n * - **`resolve.alias`** mapping `#standard-fonts/` to `pdfkit/standard-fonts/`.\n * An alias rewrites specifiers the resolver is *asked* about; this one is a\n * string handed to `createRequire` at runtime, which the resolver never sees.\n * - **`--external pdfkit`**. It is a transitive dependency, so the runtime cannot\n * resolve it from the app's own directory: `Cannot find package 'pdfkit'`.\n *\n * The plugin throws if a `#standard-fonts/` reference survives the rewrite, so a\n * future pdfkit that changes the shape of those calls fails the build instead of\n * the first request.\n */\nexport function pdfkitStandardFonts(): Plugin {\n\t/**\n\t * Any call whose only argument is that literal. Deliberately not pinned to\n\t * `require$1`, which is a name rollup generated for pdfkit's own build and is\n\t * free to change on any release — there is nothing else one can do with a\n\t * `#standard-fonts/*` specifier but require it.\n\t */\n\tconst CALL = /[A-Za-z_$][\\w$]*\\(\\s*(['\"])#standard-fonts\\/(\\w+)\\1\\s*\\)/g;\n\n\treturn {\n\t\tname: 'nxgt-material:pdfkit-standard-fonts',\n\t\tenforce: 'pre',\n\t\ttransform(code, id) {\n\t\t\tif (!id.includes('pdfkit') || !code.includes('#standard-fonts/')) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst fonts = new Set<string>();\n\t\t\tconst out = code.replace(CALL, (_match, _quote, font: string) => {\n\t\t\t\tfonts.add(font);\n\t\t\t\treturn `__stdFont_${font}`;\n\t\t\t});\n\n\t\t\t// Fail the build rather than ship a server that dies on its first\n\t\t\t// request: an unmatched occurrence means pdfkit changed the shape of\n\t\t\t// these calls, and the whole point of this plugin is that nothing\n\t\t\t// downstream notices the difference until runtime.\n\t\t\tif (out.includes('#standard-fonts/')) {\n\t\t\t\tthis.error(\n\t\t\t\t\t`${id} still references '#standard-fonts/' after the transform — ` +\n\t\t\t\t\t\t'pdfkit changed how it loads its standard fonts. See the doc ' +\n\t\t\t\t\t\t'comment on pdfkitStandardFonts() in the /vite entry.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst imports = [...fonts]\n\t\t\t\t.map(\n\t\t\t\t\t(font) =>\n\t\t\t\t\t\t`import __stdFont_${font} from './standard-fonts/${font}.mjs';`,\n\t\t\t\t)\n\t\t\t\t.join('\\n');\n\n\t\t\treturn { code: `${imports}\\n${out}`, map: null };\n\t\t},\n\t};\n}\n",
19
+ "import type { Plugin } from 'vite';\nimport { cssChain, inDependency } from './css-chain';\nimport type { LibraryDescriptor } from './libraries';\nimport { jsImports, sourceCovers } from './styles-scan';\n\nconst CSS = /\\.(css|scss|sass|less|styl|pcss|postcss)(\\?|$)/;\nconst JS = /\\.(m?[jt]sx?|vue|svelte)(\\?|$)/;\n\n/** What the build saw of the library's stylesheet; shared with the fonts part. */\nexport type StylesState = {\n\t/** The stylesheets (ids) that import the library's `styles.css` (Tailwind's route). */\n\troots: Set<string>;\n\t/**\n\t * The stylesheets that `@import` the package itself: its root export's\n\t * `style` condition, the compiled stylesheet of an app without Tailwind,\n\t * which needs no `@source`.\n\t */\n\tcompiledRoots: Set<string>;\n\t/** Modules that import it from JavaScript. */\n\tjsImporters: Set<string>;\n\tsourceOk: boolean;\n};\n\nexport function createStylesState(): StylesState {\n\treturn {\n\t\troots: new Set(),\n\t\tcompiledRoots: new Set(),\n\t\tjsImporters: new Set(),\n\t\tsourceOk: false,\n\t};\n}\n\nexport function missingStylesheetMessage(lib: LibraryDescriptor): string {\n\treturn (\n\t\t`[nxgt-material] ${lib.name}'s stylesheet is never imported, so every component renders unstyled.\\n` +\n\t\t`Add this line to your main stylesheet, after \\`@import \"tailwindcss\";\\`:\\n\\n ${lib.importLine}\\n\\n` +\n\t\t`or import '${lib.stylesheet}' from your entry. To silence this check: nxgtMaterial({ styles: false }).`\n\t);\n}\n\nexport function missingSourceMessage(lib: LibraryDescriptor): string {\n\treturn (\n\t\t`[nxgt-material] ${lib.name}'s stylesheet is imported but Tailwind is not told to scan the package, so its classes are never generated.\\n` +\n\t\t`Add this line to the same stylesheet (adjust the path to where node_modules is):\\n\\n ${lib.sourceLine}\\n\\n` +\n\t\t'To silence this check: nxgtMaterial({ styles: false }).'\n\t);\n}\n\n/**\n * Fails a client `vite build` that never imports the library's stylesheet\n * (`styles.css`, or the compiled one through `@import \"<package>\";`), or\n * (React) imports `styles.css` without the `@source` line. `order: 'pre'` makes it see\n * the raw stylesheet before `@tailwindcss/vite` rewrites it.\n */\nexport function stylesPlugin(\n\tlib: LibraryDescriptor,\n\tstate: StylesState,\n): Plugin {\n\tlet enabled = false;\n\tlet root = '';\n\treturn {\n\t\tname: 'nxgt-material:styles',\n\t\tapply: 'build',\n\t\tconfigResolved(config) {\n\t\t\troot = config.root;\n\t\t\tenabled = !process.env.VITEST && !config.build.ssr;\n\t\t},\n\t\ttransform: {\n\t\t\torder: 'pre',\n\t\t\tasync handler(code, id) {\n\t\t\t\tif (!enabled || inDependency(id, root)) return null;\n\t\t\t\tconst file = id.split('?')[0] as string;\n\t\t\t\tif (CSS.test(id)) {\n\t\t\t\t\tconst { imports, sources } = await cssChain(file, code);\n\t\t\t\t\tif (imports.includes(lib.name)) state.compiledRoots.add(file);\n\t\t\t\t\tif (!imports.includes(lib.stylesheet)) return null;\n\t\t\t\t\tstate.roots.add(file);\n\t\t\t\t\tif (sources.some((s) => sourceCovers(s, lib.name)))\n\t\t\t\t\t\tstate.sourceOk = true;\n\t\t\t\t} else if (JS.test(id) && jsImports(code, lib.stylesheet)) {\n\t\t\t\t\tstate.jsImporters.add(file);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\t\t},\n\t\tbuildEnd(error) {\n\t\t\t// No environment before Vite 6 (Nuxt >= 3.13 allows Vite 5): the client.\n\t\t\tconst env = this.environment?.name;\n\t\t\tif (!enabled || error || (env !== undefined && env !== 'client')) return;\n\t\t\tconst imported =\n\t\t\t\tstate.roots.size + state.compiledRoots.size + state.jsImporters.size;\n\t\t\tif (imported === 0) {\n\t\t\t\tthis.error(missingStylesheetMessage(lib));\n\t\t\t}\n\t\t\tif (lib.needsSource && state.roots.size > 0 && !state.sourceOk) {\n\t\t\t\tthis.error(missingSourceMessage(lib));\n\t\t\t}\n\t\t},\n\t};\n}\n",
20
+ "import type { Plugin } from 'vite';\nimport { cspDevHeaderPlugin } from './csp-dev-header';\nimport { cspPlugin } from './csp-plugin';\nimport { fontsInterPlugin } from './fonts-inter';\nimport { fontsPlugin } from './fonts-plugin';\nimport { describeLibrary, type NxgtMaterialLibrary } from './libraries';\nimport { type NxgtMaterialOptions, resolveOptions } from './options';\nimport { pdfPlugins } from './pdf-plugin';\nimport { createStylesState, stylesPlugin } from './styles-plugin';\n\n/**\n * The one Vite plugin for `@nxgt/material` and `@nxgt/material-vue`: a strict\n * Content Security Policy (hashes of the inline scripts, or a nonce\n * placeholder), fonts that survive `font-src 'self'`, pdfkit's standard fonts, and a build that fails\n * when the stylesheet is not wired. Everything is on; each part has an opt-out.\n * Import it from the library: `import { nxgtMaterial } from '@nxgt/material/vite'`.\n */\nexport function nxgtMaterial(\n\toptions?: NxgtMaterialOptions,\n\tlibrary?: NxgtMaterialLibrary,\n): Plugin[] {\n\tconst resolved = resolveOptions(options);\n\tconst lib = library ? describeLibrary(library) : undefined;\n\tconst plugins: Plugin[] = [];\n\tif (resolved.csp) {\n\t\tconst csp = cspPlugin(resolved.csp);\n\t\tplugins.push(csp);\n\t\tif (resolved.csp.dev) {\n\t\t\tplugins.push(cspDevHeaderPlugin(resolved.csp, csp.placeholder));\n\t\t}\n\t}\n\tif (resolved.fonts.katex) plugins.push(fontsPlugin());\n\tif (lib && resolved.fonts.sans === 'inter')\n\t\tplugins.push(fontsInterPlugin(lib));\n\tif (lib && resolved.styles.check) {\n\t\tplugins.push(stylesPlugin(lib, createStylesState()));\n\t}\n\tif (resolved.pdf) plugins.push(...pdfPlugins(resolved.pdf, library));\n\treturn plugins;\n}\n"
7
21
  ],
8
- "mappings": ";AACA,IAAM,OAAO;AA0BN,SAAS,oBAAoB,CACnC,MACA,UACsB;AAAA,EACtB,OAAO,KAAK,KAAK,IAAI,IAAI,QAAQ;AAAA;;;ACuD3B,SAAS,mBAAmB,GAAW;AAAA,EAO7C,MAAM,OAAO;AAAA,EAEb,OAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,CAAC,MAAM,IAAI;AAAA,MACnB,IAAI,CAAC,GAAG,SAAS,QAAQ,KAAK,CAAC,KAAK,SAAS,kBAAkB,GAAG;AAAA,QACjE,OAAO;AAAA,MACR;AAAA,MAEA,MAAM,QAAQ,IAAI;AAAA,MAClB,MAAM,MAAM,KAAK,QAAQ,MAAM,CAAC,QAAQ,QAAQ,SAAiB;AAAA,QAChE,MAAM,IAAI,IAAI;AAAA,QACd,OAAO,aAAa;AAAA,OACpB;AAAA,MAMD,IAAI,IAAI,SAAS,kBAAkB,GAAG;AAAA,QACrC,KAAK,MACJ,GA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,KAAK;AAAA,MACrB,QAAQ,KAAK,mBAAmB,SAAS,KAAK,IAAI,WAAW,CAAC;AAAA,IAC/D;AAAA,EACD;AAAA,EACA,IAAI,SAAS,MAAM;AAAA,IAAO,QAAQ,KAAK,YAAY,CAAC;AAAA,EACpD,IAAI,OAAO,SAAS,MAAM,SAAS;AAAA,IAClC,QAAQ,KAAK,iBAAiB,GAAG,CAAC;AAAA,EACnC,IAAI,OAAO,SAAS,OAAO,OAAO;AAAA,IACjC,QAAQ,KAAK,aAAa,KAAK,kBAAkB,CAAC,CAAC;AAAA,EACpD;AAAA,EACA,IAAI,SAAS;AAAA,IAAK,QAAQ,KAAK,GAAG,WAAW,SAAS,KAAK,OAAO,CAAC;AAAA,EACnE,OAAO;AAAA;",
23
+ "debugId": "01446DBBB7A2C3D564756E2164756E21",
10
24
  "names": []
11
25
  }
@@ -0,0 +1,13 @@
1
+ /** What the plugin needs to know about the library it runs for. */
2
+ export type NxgtMaterialLibrary = '@nxgt/material' | '@nxgt/material-vue';
3
+ export type LibraryDescriptor = {
4
+ name: NxgtMaterialLibrary;
5
+ /** The stylesheet an app imports. */
6
+ stylesheet: string;
7
+ /** Whether the app's own Tailwind build must be told to scan the package. */
8
+ needsSource: boolean;
9
+ importLine: string;
10
+ sourceLine: string;
11
+ };
12
+ export declare function describeLibrary(name: NxgtMaterialLibrary): LibraryDescriptor;
13
+ //# sourceMappingURL=libraries.d.ts.map