@nxgt/material-core 0.11.1 → 0.13.0

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 (114) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +283 -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/lib/initials.d.ts +12 -0
  52. package/dist/lib/initials.d.ts.map +1 -0
  53. package/dist/lib/initials.js +15 -0
  54. package/dist/lib/initials.js.map +10 -0
  55. package/dist/pdf-viewer/index.d.ts +1 -0
  56. package/dist/pdf-viewer/index.d.ts.map +1 -1
  57. package/dist/pdf-viewer/index.js +68 -38
  58. package/dist/pdf-viewer/index.js.map +6 -5
  59. package/dist/pdf-viewer/pdf-reveal-hit.d.ts +7 -0
  60. package/dist/pdf-viewer/pdf-reveal-hit.d.ts.map +1 -0
  61. package/dist/pdf-viewer/pdf-scroll-spy.d.ts +24 -8
  62. package/dist/pdf-viewer/pdf-scroll-spy.d.ts.map +1 -1
  63. package/dist/states/copy.d.ts +46 -0
  64. package/dist/states/copy.d.ts.map +1 -0
  65. package/dist/states/describe-error.d.ts +18 -0
  66. package/dist/states/describe-error.d.ts.map +1 -0
  67. package/dist/states/illustrations.d.ts +24 -0
  68. package/dist/states/illustrations.d.ts.map +1 -0
  69. package/dist/states/index.d.ts +11 -0
  70. package/dist/states/index.d.ts.map +1 -0
  71. package/dist/states/index.js +253 -0
  72. package/dist/states/index.js.map +13 -0
  73. package/dist/states/kinds.d.ts +28 -0
  74. package/dist/states/kinds.d.ts.map +1 -0
  75. package/dist/vite/csp-dev-header.d.ts +11 -0
  76. package/dist/vite/csp-dev-header.d.ts.map +1 -0
  77. package/dist/vite/csp-hashes.d.ts +23 -0
  78. package/dist/vite/csp-hashes.d.ts.map +1 -0
  79. package/dist/vite/csp-header.d.ts +10 -0
  80. package/dist/vite/csp-header.d.ts.map +1 -0
  81. package/dist/vite/csp-plugin.d.ts +12 -0
  82. package/dist/vite/csp-plugin.d.ts.map +1 -0
  83. package/dist/vite/css-chain.d.ts +13 -0
  84. package/dist/vite/css-chain.d.ts.map +1 -0
  85. package/dist/vite/dependency-closure.d.ts +8 -0
  86. package/dist/vite/dependency-closure.d.ts.map +1 -0
  87. package/dist/vite/fonts-inter.d.ts +15 -0
  88. package/dist/vite/fonts-inter.d.ts.map +1 -0
  89. package/dist/vite/fonts-plugin.d.ts +12 -0
  90. package/dist/vite/fonts-plugin.d.ts.map +1 -0
  91. package/dist/vite/index.d.ts +17 -81
  92. package/dist/vite/index.d.ts.map +1 -1
  93. package/dist/vite/index.js +478 -2
  94. package/dist/vite/index.js.map +18 -4
  95. package/dist/vite/libraries.d.ts +13 -0
  96. package/dist/vite/libraries.d.ts.map +1 -0
  97. package/dist/vite/nxgt-material.d.ts +12 -0
  98. package/dist/vite/nxgt-material.d.ts.map +1 -0
  99. package/dist/vite/options.d.ts +56 -0
  100. package/dist/vite/options.d.ts.map +1 -0
  101. package/dist/vite/pdf-plugin.d.ts +19 -0
  102. package/dist/vite/pdf-plugin.d.ts.map +1 -0
  103. package/dist/vite/pdfkit-standard-fonts.d.ts +74 -0
  104. package/dist/vite/pdfkit-standard-fonts.d.ts.map +1 -0
  105. package/dist/vite/styles-plugin.d.ts +27 -0
  106. package/dist/vite/styles-plugin.d.ts.map +1 -0
  107. package/dist/vite/styles-scan.d.ts +14 -0
  108. package/dist/vite/styles-scan.d.ts.map +1 -0
  109. package/docs/README.md +4 -0
  110. package/docs/backgrounds.md +95 -0
  111. package/docs/roadmap.md +37 -23
  112. package/docs/states.md +85 -0
  113. package/docs/troubleshooting.md +174 -3
  114. package/package.json +40 -4
@@ -0,0 +1,253 @@
1
+ // src/states/kinds.ts
2
+ var EMPTY_STATE_KINDS = [
3
+ "empty",
4
+ "search",
5
+ "not-found",
6
+ "unauthorized"
7
+ ];
8
+ var ERROR_STATE_KINDS = ["generic", "offline", "maintenance"];
9
+ function isErrorKind(kind) {
10
+ return ERROR_STATE_KINDS.includes(kind);
11
+ }
12
+ function resolveEmptyStateKind(input) {
13
+ return input.kind ?? input.variant ?? "generic";
14
+ }
15
+
16
+ // src/states/copy.ts
17
+ var COPY = {
18
+ empty: {
19
+ title: "No Data Found",
20
+ description: "There is nothing to display here at the moment."
21
+ },
22
+ search: {
23
+ title: "No results",
24
+ description: "Try a different query or clear the filters."
25
+ },
26
+ "not-found": {
27
+ title: "Page Not Found",
28
+ description: "The page you are looking for doesn't exist or has been moved."
29
+ },
30
+ unauthorized: {
31
+ title: "Access Denied",
32
+ description: "You don't have permission to view this content."
33
+ },
34
+ generic: {
35
+ title: "Something Went Wrong",
36
+ description: "An unexpected error occurred. Please try again later."
37
+ },
38
+ offline: {
39
+ title: "You are offline",
40
+ description: "Check your connection and try again."
41
+ },
42
+ maintenance: {
43
+ title: "We'll be right back",
44
+ description: "The service is down for a short update."
45
+ }
46
+ };
47
+ function stateCopy(kind, family) {
48
+ const ns = family === "error-state" && isErrorKind(kind) ? family : "empty-state";
49
+ return {
50
+ titleKey: `material.${ns}.${kind}.title`,
51
+ descriptionKey: `material.${ns}.${kind}.description`,
52
+ ...COPY[kind]
53
+ };
54
+ }
55
+ var STATE_ACTION_KEYS = {
56
+ retry: { key: "material.error-state.retry", fallback: "Retry" },
57
+ details: {
58
+ key: "material.error-state.details",
59
+ fallback: "Technical details"
60
+ },
61
+ detailsName: { key: "material.error-state.details-name", fallback: "Name" },
62
+ detailsMessage: {
63
+ key: "material.error-state.details-message",
64
+ fallback: "Message"
65
+ },
66
+ detailsCause: {
67
+ key: "material.error-state.details-cause",
68
+ fallback: "Cause"
69
+ }
70
+ };
71
+ // src/states/describe-error.ts
72
+ var FALLBACK_NAME = "Error";
73
+ var UNKNOWN_MESSAGE = "Unknown error";
74
+ function read(source, key) {
75
+ try {
76
+ return source[key];
77
+ } catch {
78
+ return;
79
+ }
80
+ }
81
+ function detailOf(value) {
82
+ if (typeof value === "object" && value !== null) {
83
+ const message = read(value, "message");
84
+ const name = read(value, "name");
85
+ return {
86
+ name: typeof name === "string" && name !== "" ? name : FALLBACK_NAME,
87
+ message: typeof message === "string" ? message : UNKNOWN_MESSAGE
88
+ };
89
+ }
90
+ return { name: FALLBACK_NAME, message: String(value) };
91
+ }
92
+ function describeError(error, options = {}) {
93
+ const maxDepth = options.maxDepth ?? 3;
94
+ const details = [];
95
+ const seen = new Set;
96
+ let current = error;
97
+ while (current !== undefined && current !== null && details.length < maxDepth && !seen.has(current)) {
98
+ seen.add(current);
99
+ details.push(detailOf(current));
100
+ current = typeof current === "object" ? read(current, "cause") : undefined;
101
+ }
102
+ return details;
103
+ }
104
+ // src/states/illustrations.ts
105
+ var STATE_ACCENT = {
106
+ empty: "primary",
107
+ search: "primary",
108
+ "not-found": "neutral",
109
+ unauthorized: "error",
110
+ generic: "error",
111
+ offline: "info",
112
+ maintenance: "warning"
113
+ };
114
+ var STATE_ICON = {
115
+ empty: "package-open",
116
+ search: "search",
117
+ "not-found": "file-question",
118
+ unauthorized: "shield-alert",
119
+ generic: "alert-circle",
120
+ offline: "wifi-off",
121
+ maintenance: "construction"
122
+ };
123
+ var VIEW_BOX = "0 0 160 120";
124
+ var shape = (el, tone, attrs) => ({ el, tone, attrs });
125
+ var GROUND = shape("ellipse", "muted", { cx: 80, cy: 110, rx: 50, ry: 6 });
126
+ var gearBar = (angle) => shape("rect", "muted", {
127
+ x: 74,
128
+ y: 26,
129
+ width: 12,
130
+ height: 68,
131
+ rx: 3,
132
+ transform: `rotate(${angle} 80 60)`
133
+ });
134
+ var wifiArc = (d) => shape("path", "outline", { d });
135
+ var STATE_ILLUSTRATIONS = {
136
+ empty: {
137
+ viewBox: VIEW_BOX,
138
+ shapes: [
139
+ GROUND,
140
+ shape("path", "surface", { d: "M44 58 L80 72 L80 106 L44 92 Z" }),
141
+ shape("path", "accent-soft", { d: "M80 72 L116 58 L116 92 L80 106 Z" }),
142
+ shape("path", "outline", { d: "M44 58 L80 44 L116 58 L80 72 Z" }),
143
+ shape("path", "outline", { d: "M44 58 L34 44 L70 32 L80 44" }),
144
+ shape("path", "outline", { d: "M116 58 L126 44 L90 32 L80 44" }),
145
+ shape("circle", "accent", { cx: 128, cy: 24, r: 4 }),
146
+ shape("circle", "accent-soft", { cx: 34, cy: 26, r: 3 })
147
+ ]
148
+ },
149
+ search: {
150
+ viewBox: VIEW_BOX,
151
+ shapes: [
152
+ GROUND,
153
+ shape("rect", "surface", { x: 36, y: 14, width: 66, height: 86, rx: 6 }),
154
+ shape("line", "outline", { x1: 48, y1: 32, x2: 88, y2: 32 }),
155
+ shape("line", "outline", { x1: 48, y1: 46, x2: 76, y2: 46 }),
156
+ shape("line", "outline", { x1: 48, y1: 60, x2: 68, y2: 60 }),
157
+ shape("circle", "accent-soft", { cx: 98, cy: 68, r: 22 }),
158
+ shape("circle", "outline", { cx: 98, cy: 68, r: 22 }),
159
+ shape("rect", "accent", {
160
+ x: 114,
161
+ y: 82,
162
+ width: 26,
163
+ height: 9,
164
+ rx: 4.5,
165
+ transform: "rotate(45 114 86)"
166
+ })
167
+ ]
168
+ },
169
+ "not-found": {
170
+ viewBox: VIEW_BOX,
171
+ shapes: [
172
+ GROUND,
173
+ shape("path", "surface", {
174
+ d: "M44 14 H98 L118 34 V98 Q118 104 112 104 H50 Q44 104 44 98 Z"
175
+ }),
176
+ shape("path", "accent-soft", { d: "M98 14 L118 34 H104 Q98 34 98 28 Z" }),
177
+ shape("path", "outline", {
178
+ d: "M68 54 A12 12 0 1 1 86 64 C82 67 80 69 80 76"
179
+ }),
180
+ shape("circle", "accent", { cx: 80, cy: 88, r: 4 })
181
+ ]
182
+ },
183
+ unauthorized: {
184
+ viewBox: VIEW_BOX,
185
+ shapes: [
186
+ GROUND,
187
+ shape("path", "surface", {
188
+ d: "M80 12 L118 26 V58 C118 82 102 98 80 106 C58 98 42 82 42 58 V26 Z"
189
+ }),
190
+ shape("path", "outline", { d: "M70 58 V52 A10 10 0 0 1 90 52 V58" }),
191
+ shape("rect", "accent", { x: 64, y: 58, width: 32, height: 26, rx: 5 }),
192
+ shape("circle", "surface", { cx: 80, cy: 68, r: 4 }),
193
+ shape("rect", "surface", { x: 78, y: 70, width: 4, height: 8, rx: 2 })
194
+ ]
195
+ },
196
+ generic: {
197
+ viewBox: VIEW_BOX,
198
+ shapes: [
199
+ GROUND,
200
+ shape("path", "accent-soft", { d: "M80 14 L128 98 H32 Z" }),
201
+ shape("path", "outline", { d: "M80 14 L128 98 H32 Z" }),
202
+ shape("rect", "accent", { x: 76, y: 44, width: 8, height: 30, rx: 4 }),
203
+ shape("circle", "accent", { cx: 80, cy: 85, r: 5 })
204
+ ]
205
+ },
206
+ offline: {
207
+ viewBox: VIEW_BOX,
208
+ shapes: [
209
+ GROUND,
210
+ shape("circle", "surface", { cx: 80, cy: 58, r: 48 }),
211
+ wifiArc("M42 50 A54 54 0 0 1 118 50"),
212
+ wifiArc("M54 64 A36 36 0 0 1 106 64"),
213
+ wifiArc("M66 78 A18 18 0 0 1 94 78"),
214
+ shape("circle", "accent", { cx: 80, cy: 90, r: 5 }),
215
+ shape("rect", "accent", {
216
+ x: 76,
217
+ y: 8,
218
+ width: 8,
219
+ height: 100,
220
+ rx: 4,
221
+ transform: "rotate(-45 80 58)"
222
+ })
223
+ ]
224
+ },
225
+ maintenance: {
226
+ viewBox: VIEW_BOX,
227
+ shapes: [
228
+ GROUND,
229
+ gearBar(0),
230
+ gearBar(45),
231
+ gearBar(90),
232
+ gearBar(135),
233
+ shape("circle", "surface", { cx: 80, cy: 60, r: 28 }),
234
+ shape("circle", "accent-soft", { cx: 80, cy: 60, r: 16 }),
235
+ shape("circle", "accent", { cx: 80, cy: 60, r: 7 })
236
+ ]
237
+ }
238
+ };
239
+ export {
240
+ EMPTY_STATE_KINDS,
241
+ ERROR_STATE_KINDS,
242
+ STATE_ACCENT,
243
+ STATE_ACTION_KEYS,
244
+ STATE_ICON,
245
+ STATE_ILLUSTRATIONS,
246
+ describeError,
247
+ isErrorKind,
248
+ resolveEmptyStateKind,
249
+ stateCopy
250
+ };
251
+
252
+ //# debugId=1CB30AF934D7A07664756E2164756E21
253
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/states/kinds.ts", "../src/states/copy.ts", "../src/states/describe-error.ts", "../src/states/illustrations.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The kinds of state a screen can be in when it has nothing to show: an\n * `EmptyState` is a calm absence (nothing yet, nothing found, no such page, no\n * access), an `ErrorState` is something that failed (a request, the network, a\n * service in maintenance). The names are the same in both libraries.\n */\nexport const EMPTY_STATE_KINDS = [\n\t'empty',\n\t'search',\n\t'not-found',\n\t'unauthorized',\n] as const;\n\nexport const ERROR_STATE_KINDS = ['generic', 'offline', 'maintenance'] as const;\n\nexport type EmptyStateKind = (typeof EMPTY_STATE_KINDS)[number];\nexport type ErrorStateKind = (typeof ERROR_STATE_KINDS)[number];\nexport type StateKind = EmptyStateKind | ErrorStateKind;\n\n/**\n * The seven values `EmptyState`'s deprecated `variant` prop accepts: the empty\n * kinds and the error kinds together. Removed with `variant` in the next major of each library (`@nxgt/material` 3.0, `@nxgt/material-vue` 1.0).\n */\nexport type LegacyEmptyStateVariant = StateKind;\n\n/** Whether `kind` is one of the error kinds (`ErrorState`'s). */\nexport function isErrorKind(kind: StateKind): kind is ErrorStateKind {\n\treturn (ERROR_STATE_KINDS as readonly string[]).includes(kind);\n}\n\n/**\n * The kind an `EmptyState` renders: `kind` when given, else the legacy\n * `variant`, else `'generic'` — the default `EmptyState` has always had, kept\n * until the next major of each library (`@nxgt/material` 3.0, `@nxgt/material-vue` 1.0) so `<EmptyState />` does not change under its consumers.\n */\nexport function resolveEmptyStateKind(input: {\n\tkind?: StateKind | undefined;\n\tvariant?: LegacyEmptyStateVariant | undefined;\n}): StateKind {\n\treturn input.kind ?? input.variant ?? 'generic';\n}\n",
6
+ "import { isErrorKind, type StateKind } from './kinds';\n\n/**\n * Which i18n namespace a state's copy lives in. `EmptyState` reads\n * `material.empty-state.*` (its seven legacy variants included, so an app's\n * overrides keep working); `ErrorState` reads `material.error-state.*`.\n */\nexport type StateFamily = 'empty-state' | 'error-state';\n\nexport type StateCopy = {\n\ttitleKey: string;\n\tdescriptionKey: string;\n\t/** The English title, the fallback of `titleKey`. */\n\ttitle: string;\n\t/** The English description, the fallback of `descriptionKey`. */\n\tdescription: string;\n};\n\nconst COPY: Record<StateKind, { title: string; description: string }> = {\n\tempty: {\n\t\ttitle: 'No Data Found',\n\t\tdescription: 'There is nothing to display here at the moment.',\n\t},\n\tsearch: {\n\t\ttitle: 'No results',\n\t\tdescription: 'Try a different query or clear the filters.',\n\t},\n\t'not-found': {\n\t\ttitle: 'Page Not Found',\n\t\tdescription:\n\t\t\t\"The page you are looking for doesn't exist or has been moved.\",\n\t},\n\tunauthorized: {\n\t\ttitle: 'Access Denied',\n\t\tdescription: \"You don't have permission to view this content.\",\n\t},\n\tgeneric: {\n\t\ttitle: 'Something Went Wrong',\n\t\tdescription: 'An unexpected error occurred. Please try again later.',\n\t},\n\toffline: {\n\t\ttitle: 'You are offline',\n\t\tdescription: 'Check your connection and try again.',\n\t},\n\tmaintenance: {\n\t\ttitle: \"We'll be right back\",\n\t\tdescription: 'The service is down for a short update.',\n\t},\n};\n\n/**\n * The i18n keys and English fallbacks of a state's title and description.\n * `'error-state'` applies to the error kinds only; any other kind reads\n * `material.empty-state.<kind>.*`, which is where an `EmptyState` given a\n * legacy error `variant` looks too.\n */\nexport function stateCopy(kind: StateKind, family: StateFamily): StateCopy {\n\tconst ns =\n\t\tfamily === 'error-state' && isErrorKind(kind) ? family : 'empty-state';\n\treturn {\n\t\ttitleKey: `material.${ns}.${kind}.title`,\n\t\tdescriptionKey: `material.${ns}.${kind}.description`,\n\t\t...COPY[kind],\n\t};\n}\n\n/** The i18n keys and English fallbacks of `ErrorState`'s actions and details. */\nexport const STATE_ACTION_KEYS = {\n\tretry: { key: 'material.error-state.retry', fallback: 'Retry' },\n\tdetails: {\n\t\tkey: 'material.error-state.details',\n\t\tfallback: 'Technical details',\n\t},\n\tdetailsName: { key: 'material.error-state.details-name', fallback: 'Name' },\n\tdetailsMessage: {\n\t\tkey: 'material.error-state.details-message',\n\t\tfallback: 'Message',\n\t},\n\tdetailsCause: {\n\t\tkey: 'material.error-state.details-cause',\n\t\tfallback: 'Cause',\n\t},\n} as const;\n",
7
+ "/** One link of an error's chain, safe to show: never a stack. */\nexport type ErrorDetail = { name: string; message: string };\n\nconst FALLBACK_NAME = 'Error';\nconst UNKNOWN_MESSAGE = 'Unknown error';\n\n/** A property read that cannot throw (a getter or a Proxy may). */\nfunction read(source: object, key: string): unknown {\n\ttry {\n\t\treturn (source as Record<string, unknown>)[key];\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction detailOf(value: unknown): ErrorDetail {\n\tif (typeof value === 'object' && value !== null) {\n\t\tconst message = read(value, 'message');\n\t\tconst name = read(value, 'name');\n\t\treturn {\n\t\t\tname: typeof name === 'string' && name !== '' ? name : FALLBACK_NAME,\n\t\t\tmessage: typeof message === 'string' ? message : UNKNOWN_MESSAGE,\n\t\t};\n\t}\n\treturn { name: FALLBACK_NAME, message: String(value) };\n}\n\n/**\n * What an `ErrorState` may show of a thrown value: its name and message, then\n * those of its `cause`, and so on, at most `maxDepth` entries (3 by default).\n * It takes an `Error`, a `{ message }` object, a string or any primitive, and\n * stops at a cycle. `null` and `undefined` describe nothing (`[]`).\n *\n * It **never reads `.stack`**: a stack names files and paths, which an\n * interface must not print.\n */\nexport function describeError(\n\terror: unknown,\n\toptions: { maxDepth?: number } = {},\n): ErrorDetail[] {\n\tconst maxDepth = options.maxDepth ?? 3;\n\tconst details: ErrorDetail[] = [];\n\tconst seen = new Set<unknown>();\n\tlet current = error;\n\twhile (\n\t\tcurrent !== undefined &&\n\t\tcurrent !== null &&\n\t\tdetails.length < maxDepth &&\n\t\t!seen.has(current)\n\t) {\n\t\tseen.add(current);\n\t\tdetails.push(detailOf(current));\n\t\tcurrent = typeof current === 'object' ? read(current, 'cause') : undefined;\n\t}\n\treturn details;\n}\n",
8
+ "import type { StateKind } from './kinds';\n\n/**\n * How a shape is painted. The libraries map a tone (and the kind's accent) to\n * theme-token classes, so no colour is written here and no inline style is\n * needed (CSP-safe).\n */\nexport type IllustrationTone =\n\t| 'surface'\n\t| 'outline'\n\t| 'accent'\n\t| 'accent-soft'\n\t| 'muted';\n\n/** SVG attributes with single-word names (`d`, `cx`, `rx`, `transform`…). */\nexport type IllustrationShape = {\n\tel: 'path' | 'circle' | 'rect' | 'ellipse' | 'line';\n\ttone: IllustrationTone;\n\tattrs: Readonly<Record<string, string | number>>;\n};\n\nexport type StateIllustration = {\n\tviewBox: string;\n\tshapes: readonly IllustrationShape[];\n};\n\nexport type StateAccent = 'primary' | 'error' | 'warning' | 'info' | 'neutral';\n\n/** The lucide icon (kebab-case name) each library maps to its own component. */\nexport type StateIconName =\n\t| 'package-open'\n\t| 'search'\n\t| 'file-question'\n\t| 'shield-alert'\n\t| 'alert-circle'\n\t| 'wifi-off'\n\t| 'construction';\n\nexport const STATE_ACCENT: Record<StateKind, StateAccent> = {\n\tempty: 'primary',\n\tsearch: 'primary',\n\t'not-found': 'neutral',\n\tunauthorized: 'error',\n\tgeneric: 'error',\n\toffline: 'info',\n\tmaintenance: 'warning',\n};\n\nexport const STATE_ICON: Record<StateKind, StateIconName> = {\n\tempty: 'package-open',\n\tsearch: 'search',\n\t'not-found': 'file-question',\n\tunauthorized: 'shield-alert',\n\tgeneric: 'alert-circle',\n\toffline: 'wifi-off',\n\tmaintenance: 'construction',\n};\n\nconst VIEW_BOX = '0 0 160 120';\n\nconst shape = (\n\tel: IllustrationShape['el'],\n\ttone: IllustrationTone,\n\tattrs: IllustrationShape['attrs'],\n): IllustrationShape => ({ el, tone, attrs });\n\n/** The soft shadow every illustration stands on. */\nconst GROUND = shape('ellipse', 'muted', { cx: 80, cy: 110, rx: 50, ry: 6 });\n\nconst gearBar = (angle: number) =>\n\tshape('rect', 'muted', {\n\t\tx: 74,\n\t\ty: 26,\n\t\twidth: 12,\n\t\theight: 68,\n\t\trx: 3,\n\t\ttransform: `rotate(${angle} 80 60)`,\n\t});\n\nconst wifiArc = (d: string) => shape('path', 'outline', { d });\n\nexport const STATE_ILLUSTRATIONS: Record<StateKind, StateIllustration> = {\n\t// An open box with nothing in it.\n\tempty: {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tshape('path', 'surface', { d: 'M44 58 L80 72 L80 106 L44 92 Z' }),\n\t\t\tshape('path', 'accent-soft', { d: 'M80 72 L116 58 L116 92 L80 106 Z' }),\n\t\t\tshape('path', 'outline', { d: 'M44 58 L80 44 L116 58 L80 72 Z' }),\n\t\t\tshape('path', 'outline', { d: 'M44 58 L34 44 L70 32 L80 44' }),\n\t\t\tshape('path', 'outline', { d: 'M116 58 L126 44 L90 32 L80 44' }),\n\t\t\tshape('circle', 'accent', { cx: 128, cy: 24, r: 4 }),\n\t\t\tshape('circle', 'accent-soft', { cx: 34, cy: 26, r: 3 }),\n\t\t],\n\t},\n\t// A page and a magnifying glass over it.\n\tsearch: {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tshape('rect', 'surface', { x: 36, y: 14, width: 66, height: 86, rx: 6 }),\n\t\t\tshape('line', 'outline', { x1: 48, y1: 32, x2: 88, y2: 32 }),\n\t\t\tshape('line', 'outline', { x1: 48, y1: 46, x2: 76, y2: 46 }),\n\t\t\tshape('line', 'outline', { x1: 48, y1: 60, x2: 68, y2: 60 }),\n\t\t\tshape('circle', 'accent-soft', { cx: 98, cy: 68, r: 22 }),\n\t\t\tshape('circle', 'outline', { cx: 98, cy: 68, r: 22 }),\n\t\t\tshape('rect', 'accent', {\n\t\t\t\tx: 114,\n\t\t\t\ty: 82,\n\t\t\t\twidth: 26,\n\t\t\t\theight: 9,\n\t\t\t\trx: 4.5,\n\t\t\t\ttransform: 'rotate(45 114 86)',\n\t\t\t}),\n\t\t],\n\t},\n\t// A page with a question mark.\n\t'not-found': {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tshape('path', 'surface', {\n\t\t\t\td: 'M44 14 H98 L118 34 V98 Q118 104 112 104 H50 Q44 104 44 98 Z',\n\t\t\t}),\n\t\t\tshape('path', 'accent-soft', { d: 'M98 14 L118 34 H104 Q98 34 98 28 Z' }),\n\t\t\tshape('path', 'outline', {\n\t\t\t\td: 'M68 54 A12 12 0 1 1 86 64 C82 67 80 69 80 76',\n\t\t\t}),\n\t\t\tshape('circle', 'accent', { cx: 80, cy: 88, r: 4 }),\n\t\t],\n\t},\n\t// A shield with a lock.\n\tunauthorized: {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tshape('path', 'surface', {\n\t\t\t\td: 'M80 12 L118 26 V58 C118 82 102 98 80 106 C58 98 42 82 42 58 V26 Z',\n\t\t\t}),\n\t\t\tshape('path', 'outline', { d: 'M70 58 V52 A10 10 0 0 1 90 52 V58' }),\n\t\t\tshape('rect', 'accent', { x: 64, y: 58, width: 32, height: 26, rx: 5 }),\n\t\t\tshape('circle', 'surface', { cx: 80, cy: 68, r: 4 }),\n\t\t\tshape('rect', 'surface', { x: 78, y: 70, width: 4, height: 8, rx: 2 }),\n\t\t],\n\t},\n\t// A warning triangle.\n\tgeneric: {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tshape('path', 'accent-soft', { d: 'M80 14 L128 98 H32 Z' }),\n\t\t\tshape('path', 'outline', { d: 'M80 14 L128 98 H32 Z' }),\n\t\t\tshape('rect', 'accent', { x: 76, y: 44, width: 8, height: 30, rx: 4 }),\n\t\t\tshape('circle', 'accent', { cx: 80, cy: 85, r: 5 }),\n\t\t],\n\t},\n\t// Wi-Fi arcs struck through.\n\toffline: {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tshape('circle', 'surface', { cx: 80, cy: 58, r: 48 }),\n\t\t\twifiArc('M42 50 A54 54 0 0 1 118 50'),\n\t\t\twifiArc('M54 64 A36 36 0 0 1 106 64'),\n\t\t\twifiArc('M66 78 A18 18 0 0 1 94 78'),\n\t\t\tshape('circle', 'accent', { cx: 80, cy: 90, r: 5 }),\n\t\t\tshape('rect', 'accent', {\n\t\t\t\tx: 76,\n\t\t\t\ty: 8,\n\t\t\t\twidth: 8,\n\t\t\t\theight: 100,\n\t\t\t\trx: 4,\n\t\t\t\ttransform: 'rotate(-45 80 58)',\n\t\t\t}),\n\t\t],\n\t},\n\t// A gear.\n\tmaintenance: {\n\t\tviewBox: VIEW_BOX,\n\t\tshapes: [\n\t\t\tGROUND,\n\t\t\tgearBar(0),\n\t\t\tgearBar(45),\n\t\t\tgearBar(90),\n\t\t\tgearBar(135),\n\t\t\tshape('circle', 'surface', { cx: 80, cy: 60, r: 28 }),\n\t\t\tshape('circle', 'accent-soft', { cx: 80, cy: 60, r: 16 }),\n\t\t\tshape('circle', 'accent', { cx: 80, cy: 60, r: 7 }),\n\t\t],\n\t},\n};\n"
9
+ ],
10
+ "mappings": ";AAMO,IAAM,oBAAoB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,oBAAoB,CAAC,WAAW,WAAW,aAAa;AAa9D,SAAS,WAAW,CAAC,MAAyC;AAAA,EACpE,OAAQ,kBAAwC,SAAS,IAAI;AAAA;AAQvD,SAAS,q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IAAI,IAAI,GAAG,EAAE,CAAC;AAAA,IACnD;AAAA,EACD;AACD;",
11
+ "debugId": "1CB30AF934D7A07664756E2164756E21",
12
+ "names": []
13
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The kinds of state a screen can be in when it has nothing to show: an
3
+ * `EmptyState` is a calm absence (nothing yet, nothing found, no such page, no
4
+ * access), an `ErrorState` is something that failed (a request, the network, a
5
+ * service in maintenance). The names are the same in both libraries.
6
+ */
7
+ export declare const EMPTY_STATE_KINDS: readonly ["empty", "search", "not-found", "unauthorized"];
8
+ export declare const ERROR_STATE_KINDS: readonly ["generic", "offline", "maintenance"];
9
+ export type EmptyStateKind = (typeof EMPTY_STATE_KINDS)[number];
10
+ export type ErrorStateKind = (typeof ERROR_STATE_KINDS)[number];
11
+ export type StateKind = EmptyStateKind | ErrorStateKind;
12
+ /**
13
+ * The seven values `EmptyState`'s deprecated `variant` prop accepts: the empty
14
+ * kinds and the error kinds together. Removed with `variant` in the next major of each library (`@nxgt/material` 3.0, `@nxgt/material-vue` 1.0).
15
+ */
16
+ export type LegacyEmptyStateVariant = StateKind;
17
+ /** Whether `kind` is one of the error kinds (`ErrorState`'s). */
18
+ export declare function isErrorKind(kind: StateKind): kind is ErrorStateKind;
19
+ /**
20
+ * The kind an `EmptyState` renders: `kind` when given, else the legacy
21
+ * `variant`, else `'generic'` — the default `EmptyState` has always had, kept
22
+ * until the next major of each library (`@nxgt/material` 3.0, `@nxgt/material-vue` 1.0) so `<EmptyState />` does not change under its consumers.
23
+ */
24
+ export declare function resolveEmptyStateKind(input: {
25
+ kind?: StateKind | undefined;
26
+ variant?: LegacyEmptyStateVariant | undefined;
27
+ }): StateKind;
28
+ //# sourceMappingURL=kinds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../src/states/kinds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,2DAKpB,CAAC;AAEX,eAAO,MAAM,iBAAiB,gDAAiD,CAAC;AAEhF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC;AAEhD,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI,cAAc,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC5C,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;CAC9C,GAAG,SAAS,CAEZ"}
@@ -0,0 +1,11 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { ResolvedCsp } from './options';
3
+ /**
4
+ * Report-Only on the dev server: shows the violations a production policy
5
+ * would raise without breaking the page (HMR's inline scripts are reported,
6
+ * which is expected, as are Vite's dev `<style>` elements in hash mode). In
7
+ * nonce mode it carries the placeholder, as the dev HTML does; in hash mode,
8
+ * the hash of the zod jitless script the HTML is given.
9
+ */
10
+ export declare function cspDevHeaderPlugin(csp: ResolvedCsp, placeholder: () => string): Plugin;
11
+ //# sourceMappingURL=csp-dev-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp-dev-header.d.ts","sourceRoot":"","sources":["../../src/vite/csp-dev-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,MAAM,GACvB,MAAM,CAqBR"}
@@ -0,0 +1,23 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { ResolvedCsp } from './options';
3
+ /** The text of every inline script and style of an HTML document. */
4
+ export declare function inlineSources(html: string): {
5
+ scripts: string[];
6
+ styles: string[];
7
+ };
8
+ export declare const 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.";
9
+ type Logger = {
10
+ info(message: string): void;
11
+ warn(message: string): void;
12
+ };
13
+ /**
14
+ * Hash mode: the sha256 of every inline script and style of the built HTML,
15
+ * written to `.vite/nxgt-csp.json` with the header (which allows the scripts
16
+ * by hash and style elements by `'unsafe-inline'`; `styleHashes` is for a
17
+ * stricter policy of your own); nonce mode: the same file
18
+ * with the placeholder header, as a template. Runs after every other
19
+ * `generateBundle`, so it hashes the HTML that is written.
20
+ */
21
+ export declare function cspHashesHook(csp: ResolvedCsp, placeholder: () => string, logger: () => Logger, isSsr: () => boolean): NonNullable<Plugin['generateBundle']>;
22
+ export {};
23
+ //# sourceMappingURL=csp-hashes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp-hashes.d.ts","sourceRoot":"","sources":["../../src/vite/csp-hashes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAS7C,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAC5C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CACjB,CAQA;AAID,eAAO,MAAM,eAAe,mLACqJ,CAAC;AAElL,KAAK,MAAM,GAAG;IAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,MAAM,EACzB,MAAM,EAAE,MAAM,MAAM,EACpB,KAAK,EAAE,MAAM,OAAO,GAClB,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAyDvC"}
@@ -0,0 +1,10 @@
1
+ import { type CspPolicyOptions } from '../csp';
2
+ /**
3
+ * The header for a page whose nonce is a build placeholder: `cspPolicy`
4
+ * refuses the public placeholder as a nonce on purpose, so the policy is built
5
+ * with a stand-in that is swapped afterwards. Never serve this as it is.
6
+ */
7
+ export declare function placeholderHeader(placeholder: string, options: CspPolicyOptions): string;
8
+ /** The header of a hash-mode page, or of a nonce-mode one with its placeholder. */
9
+ export declare function buildHeader(mode: 'hash' | 'nonce', placeholder: string, options: CspPolicyOptions): string;
10
+ //# sourceMappingURL=csp-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp-header.d.ts","sourceRoot":"","sources":["../../src/vite/csp-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,QAAQ,CAAC;AAK1D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,gBAAgB,GACvB,MAAM,CAGR;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAC1B,IAAI,EAAE,MAAM,GAAG,OAAO,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,gBAAgB,GACvB,MAAM,CAIR"}
@@ -0,0 +1,12 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { ResolvedCsp } from './options';
3
+ /**
4
+ * The CSP part of `nxgtMaterial()`. Hash mode (default) leaves no placeholder
5
+ * anywhere: the build hashes the inline scripts and styles of the HTML.
6
+ * Nonce mode asks Vite for its `html.cspNonce` placeholder, which the server
7
+ * replaces per request.
8
+ */
9
+ export declare function cspPlugin(csp: ResolvedCsp): Plugin & {
10
+ placeholder(): string;
11
+ };
12
+ //# sourceMappingURL=csp-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp-plugin.d.ts","sourceRoot":"","sources":["../../src/vite/csp-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAInD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,SAAS,CACxB,GAAG,EAAE,WAAW,GACd,MAAM,GAAG;IAAE,WAAW,IAAI,MAAM,CAAA;CAAE,CA6CpC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Every `@import` specifier and `@source` path of a stylesheet and of the
3
+ * relative files it imports, read from disk: Tailwind's own resolver reads
4
+ * those files, so they never pass through a bundler's `transform`.
5
+ */
6
+ export declare function cssChain(file: string, css: string, seen?: Set<string>): Promise<{
7
+ imports: string[];
8
+ sources: string[];
9
+ fontSans: boolean;
10
+ }>;
11
+ /** Whether a module id is a dependency, relative to the project's root. */
12
+ export declare function inDependency(id: string, root: string): boolean;
13
+ //# sourceMappingURL=css-chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-chain.d.ts","sourceRoot":"","sources":["../../src/vite/css-chain.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAsB,QAAQ,CAC7B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,cAA0B,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAkBtE;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG9D"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The names of `roots` and of everything they depend on (`dependencies`,
3
+ * transitively), looked up from `from` the way Node would. A root or a
4
+ * dependency that is not installed is skipped. Peer and optional
5
+ * dependencies are not followed: they are the app's to bundle.
6
+ */
7
+ export declare function dependencyClosure(roots: string[], from: string): string[];
8
+ //# sourceMappingURL=dependency-closure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-closure.d.ts","sourceRoot":"","sources":["../../src/vite/dependency-closure.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBzE"}
@@ -0,0 +1,15 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { LibraryDescriptor } from './libraries';
3
+ /** Unlayered, so it beats Tailwind's layered `@theme` variable. */
4
+ export declare const 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\";}";
5
+ export declare function missingInterMessage(): string;
6
+ /**
7
+ * Loads Inter (self-hosted, `font-src 'self'`) when the app has it installed,
8
+ * else warns once and keeps the system font: the build never fails. It goes
9
+ * in the stylesheet that imports the library's: its `@import` goes first,
10
+ * the `--font-sans` override last.
11
+ * Skipped when that stylesheet already imports Inter or sets `--font-sans`
12
+ * itself, anywhere in its chain.
13
+ */
14
+ export declare function fontsInterPlugin(lib: LibraryDescriptor): Plugin;
15
+ //# sourceMappingURL=fonts-inter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts-inter.d.ts","sourceRoot":"","sources":["../../src/vite/fonts-inter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKrD,mEAAmE;AACnE,eAAO,MAAM,cAAc,gKACyH,CAAC;AAErJ,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAsC/D"}
@@ -0,0 +1,12 @@
1
+ import type { Plugin } from 'vite';
2
+ type Limit = number | boolean | ((file: string, content: Buffer) => boolean | undefined) | undefined;
3
+ /**
4
+ * `build.assetsInlineLimit` with fonts never inlined (`data:` fonts break
5
+ * `font-src 'self'`) and everything else left to the app's own value: its
6
+ * function is asked first, its number is Vite's size limit, absent is Vite's
7
+ * default.
8
+ */
9
+ export declare function composeAssetsInlineLimit(user: Limit): (file: string, content: Buffer) => boolean | undefined;
10
+ export declare function fontsPlugin(): Plugin;
11
+ export {};
12
+ //# sourceMappingURL=fonts-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts-plugin.d.ts","sourceRoot":"","sources":["../../src/vite/fonts-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,KAAK,KAAK,GACP,MAAM,GACN,OAAO,GACP,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC,GACxD,SAAS,CAAC;AAEb;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,KAAK,IAC3C,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,GAAG,SAAS,CAO3D;AAED,wBAAgB,WAAW,IAAI,MAAM,CAapC"}
@@ -1,85 +1,21 @@
1
1
  /**
2
- * Build-time helpers for the apps that consume this library.
3
- *
4
- * This entry is the odd one out: everything else here runs in a browser or in
5
- * an SSR server, and the `/vite` entry is Node code that runs inside a
6
- * consumer's `vite.config.ts` (or a Nuxt app's Nitro build). It is here anyway
7
- * because the problem it solves is this package's to own — a consumer should
8
- * not have to rediscover it — and because there is exactly one copy of the fix
9
- * to maintain, shared by `@nxgt/material` and `@nxgt/material-vue`.
10
- *
11
- * It also holds `cspAssetsInlineLimit`, the `build.assetsInlineLimit` that
12
- * keeps fonts out of `data:` URIs for a strict Content Security Policy.
13
- *
14
- * It imports nothing at runtime: `Plugin` is a type, erased by the compiler, so
15
- * the built `dist/vite.js` has no dependency on `vite` at all.
2
+ * Build-time helpers for the apps that consume the libraries: Node code that
3
+ * runs inside a consumer's `vite.config.ts` (or a Nuxt app's Nitro build).
4
+ * It is here because the problems it solves are this package's to own, with
5
+ * one copy shared by `@nxgt/material` and `@nxgt/material-vue`.
6
+ *
7
+ * `nxgtMaterial()` is the one plugin to add; `cspAssetsInlineLimit` and
8
+ * `pdfkitStandardFonts` are its parts, still exported on their own.
9
+ *
10
+ * The built `dist/vite/index.js` imports `node:fs/promises`, `node:fs` and
11
+ * `node:path` (the styles check reads the stylesheets Tailwind resolves
12
+ * itself; `pdf: { bundle: true }` reads the installed packages' `package.json`)
13
+ * and nothing from `vite`: `Plugin` is a type, erased by the compiler.
16
14
  */
17
- import type { Plugin } from 'vite';
15
+ export { CSP_NONCE_PLACEHOLDER, ZOD_JITLESS_SCRIPT } from '../csp';
18
16
  export { cspAssetsInlineLimit } from './csp-assets-inline-limit';
19
- /**
20
- * Bundles pdfkit's fourteen standard fonts instead of leaving them to a
21
- * `require` that cannot work in a bundle.
22
- *
23
- * **Only needed by an app that renders PDFs** (`@nxgt/material/print`, or
24
- * `@nxgt/material-vue/pdf`). No other entry reaches `@react-pdf/renderer`, so
25
- * an app that does not print never sees this at all.
26
- * If you do print, read on, because the failure is spectacular and silent until
27
- * production.
28
- *
29
- * Both are built on `@react-pdf/renderer`, which is built on
30
- * `pdfkit`, whose node build ends with:
31
- *
32
- * ```js
33
- * const require$1 = createRequire(import.meta.url);
34
- * registerStdFontLoaders({ Helvetica: () => require$1('#standard-fonts/Helvetica'), … });
35
- * ```
36
- *
37
- * `#standard-fonts/*` is a package-`imports` entry **private to pdfkit**, and
38
- * that is a RUNTIME call, not an import — so no bundler resolves it. Bundle
39
- * pdfkit into an SSR server (`ssr.noExternal`) and the literal survives into the
40
- * output, where `createRequire` is rooted at the build directory and the importer
41
- * is no longer inside pdfkit. The server then throws on **every request**,
42
- * `/health` included:
43
- *
44
- * ```
45
- * error: Cannot find module '#standard-fonts/Helvetica' from '…/build/app.js'
46
- * ```
47
- *
48
- * A compose healthcheck that fetches a route never goes healthy either, so the
49
- * container looks like it is failing to start rather than failing to serve.
50
- *
51
- * This plugin rewrites those calls into static imports of
52
- * `./standard-fonts/<name>.mjs`, so the font data lands in the bundle and the
53
- * server stays self-contained. Use it when the runtime image has **no
54
- * `node_modules`** — a single-file `bun build` artifact copied alone into the
55
- * image. When the image does keep `node_modules`, the lighter answer is to leave
56
- * the library external instead (`--external` it in the bundle step, and keep it
57
- * out of `ssr.noExternal`), which also keeps ~12 MB of
58
- * pdfkit out of the artifact. In Nuxt, `nxgtMaterial: { pdf: {
59
- * bundleStandardFonts: true } }` adds this plugin to the Nitro build.
60
- *
61
- * ```ts
62
- * // `@nxgt/material/vite` in a React app: the same function
63
- * import { pdfkitStandardFonts } from '@nxgt/material-vue/vite';
64
- * import { defineConfig } from 'vite';
65
- *
66
- * export default defineConfig({
67
- * plugins: [pdfkitStandardFonts()],
68
- * ssr: { noExternal: ['@nxgt/material-vue', '@nxgt/material-core'] },
69
- * });
70
- * ```
71
- *
72
- * Two things that look like fixes and are not:
73
- *
74
- * - **`resolve.alias`** mapping `#standard-fonts/` to `pdfkit/standard-fonts/`.
75
- * An alias rewrites specifiers the resolver is *asked* about; this one is a
76
- * string handed to `createRequire` at runtime, which the resolver never sees.
77
- * - **`--external pdfkit`**. It is a transitive dependency, so the runtime cannot
78
- * resolve it from the app's own directory: `Cannot find package 'pdfkit'`.
79
- *
80
- * The plugin throws if a `#standard-fonts/` reference survives the rewrite, so a
81
- * future pdfkit that changes the shape of those calls fails the build instead of
82
- * the first request.
83
- */
84
- export declare function pdfkitStandardFonts(): Plugin;
17
+ export type { NxgtMaterialLibrary } from './libraries';
18
+ export { nxgtMaterial } from './nxgt-material';
19
+ export type { NxgtMaterialCspOptions, NxgtMaterialOptions, } from './options';
20
+ export { pdfkitStandardFonts } from './pdfkit-standard-fonts';
85
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CA6C5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACX,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}