@nxgt/material-vue 0.23.0 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -0
  2. package/dist/{Button-DcFHQ3oH.js → Button-CVIR6uLK.js} +1 -1
  3. package/dist/{HoverCardTrigger-D99aHKDX.js → HoverCardTrigger-iAL5ALrL.js} +2 -2
  4. package/dist/{camera-C7V5U_xH.js → camera-CZ8rAJJw.js} +4 -4
  5. package/dist/{components-BSnW1NZK.js → components-rxjZLVgg.js} +13601 -13611
  6. package/dist/components.js +5 -5
  7. package/dist/composables.js +2 -2
  8. package/dist/dnd.js +1 -1
  9. package/dist/{i18n-provider-BTm3J_K9.js → i18n-provider-BqWxpaKu.js} +1 -1
  10. package/dist/i18n.js +4 -4
  11. package/dist/{icon-button-DnjboAtZ.js → icon-button-DbEME76t.js} +1 -1
  12. package/dist/{image-cropper-canvas-DZGLMjV6.js → image-cropper-canvas-HzYWblQm.js} +435 -428
  13. package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.utils.d.ts +0 -1
  14. package/dist/lib/i18n/resources/fr/material.json.d.ts +1 -1
  15. package/dist/lib/nuxt/module.d.ts +3 -1
  16. package/dist/lib/nuxt/pdf-fonts.d.ts +30 -1
  17. package/dist/lib.js +2 -2
  18. package/dist/main.js +10 -10
  19. package/dist/map.js +4 -4
  20. package/dist/{pdf-outline-sidebar-D45RuliO.js → pdf-outline-sidebar-OS2Y1474.js} +2 -2
  21. package/dist/{pdf-page-QUKMeod_.js → pdf-page-JmniMEx_.js} +1 -1
  22. package/dist/{pdf-page-list-DzfNykQj.js → pdf-page-list-B0lztX0G.js} +2 -2
  23. package/dist/{pdf-reader-Bmj2kN0E.js → pdf-reader-B1VMEqB1.js} +8 -8
  24. package/dist/{pdf-sidebar-CV_Hy9vw.js → pdf-sidebar-lzuYwLJg.js} +3 -3
  25. package/dist/{pdf-thumbnail-sidebar-Cgk8Y79g.js → pdf-thumbnail-sidebar-CD048QuU.js} +3 -3
  26. package/dist/{pdf-toolbar-Cj_fCmo3.js → pdf-toolbar-B6gRRcsv.js} +4 -4
  27. package/dist/pdf.js +2 -2
  28. package/dist/{sortable-provider-CxI3cMbb.js → sortable-provider-oEVjQiCl.js} +2 -2
  29. package/dist/{stored-language-D7FRT1hD.js → stored-language-rjOMJkyX.js} +1 -1
  30. package/dist/{stx-player-C3g6Pcxu.js → stx-player-QAMhUdS_.js} +2 -2
  31. package/dist/{translator-BJPRdlc8.js → translator-BCSJSO1-.js} +1 -1
  32. package/dist/{use-heading-spy-xe2FFmGU.js → use-heading-spy-d50_nxgR.js} +1 -1
  33. package/dist/{use-material-translation-gr5V24w5.js → use-material-translation-C5zPFhbk.js} +3 -3
  34. package/docs/getting-started.md +4 -1
  35. package/docs/guides/pdf.md +5 -2
  36. package/docs/roadmap.md +9 -0
  37. package/docs/troubleshooting.md +51 -2
  38. package/lib/nuxt/module.ts +23 -6
  39. package/lib/nuxt/pdf-fonts.ts +101 -1
  40. package/package.json +2 -2
@@ -1,14 +1,18 @@
1
+ import { createRequire } from 'node:module';
2
+ import { join } from 'node:path';
1
3
  import { pdfkitStandardFonts } from '../vite/index';
2
4
 
3
5
  type NitroConfigLike = {
4
6
  rollupConfig?: { plugins?: unknown };
7
+ externals?: boolean | { traceInclude?: string[] };
5
8
  };
6
9
 
7
10
  /**
8
11
  * Adds `pdfkitStandardFonts()` to a Nitro config's Rollup plugins, for the
9
12
  * `pdf.bundleStandardFonts` module option. Only a fully inlined server
10
13
  * (no `node_modules` in the runtime image) needs it: Nitro keeps
11
- * `@react-pdf/renderer` external by default, where pdfkit finds its fonts.
14
+ * `@react-pdf/renderer` external by default, and `addPdfFontsTrace` copies
15
+ * the fonts pdfkit loads into `.output/server/node_modules`.
12
16
  */
13
17
  export function addPdfFontsPlugin(config: NitroConfigLike): void {
14
18
  config.rollupConfig ??= {};
@@ -16,3 +20,99 @@ export function addPdfFontsPlugin(config: NitroConfigLike): void {
16
20
  const plugins = Array.isArray(current) ? current : current ? [current] : [];
17
21
  config.rollupConfig.plugins = [...plugins, pdfkitStandardFonts()];
18
22
  }
23
+
24
+ /** The fourteen standard PDF fonts, as pdfkit exports them. */
25
+ export const PDFKIT_STANDARD_FONTS = [
26
+ 'Courier',
27
+ 'CourierBold',
28
+ 'CourierBoldOblique',
29
+ 'CourierOblique',
30
+ 'Helvetica',
31
+ 'HelveticaBold',
32
+ 'HelveticaBoldOblique',
33
+ 'HelveticaOblique',
34
+ 'Symbol',
35
+ 'TimesBold',
36
+ 'TimesBoldItalic',
37
+ 'TimesItalic',
38
+ 'TimesRoman',
39
+ 'ZapfDingbats',
40
+ ] as const;
41
+
42
+ const isNotFound = (error: unknown) =>
43
+ (error as { code?: string } | null)?.code === 'MODULE_NOT_FOUND';
44
+
45
+ /**
46
+ * pdfkit's standard-font modules as the app at `rootDir` loads them: through
47
+ * pdfkit's own `standard-fonts/<Name>` exports under the `require` condition
48
+ * (the `.cjs` files its runtime `require('#standard-fonts/<Name>')` reads),
49
+ * for the pdfkit `@react-pdf/renderer` depends on and the one
50
+ * `@react-pdf/font` depends on, without duplicates.
51
+ *
52
+ * None, silently, when the app does not install `@react-pdf/renderer` (an
53
+ * optional peer). Any other failure is passed to `warn` — a font that
54
+ * cannot be resolved here is a PDF route that fails in production.
55
+ */
56
+ export function pdfkitStandardFontFiles(
57
+ rootDir: string,
58
+ warn: (message: string) => void = () => {},
59
+ ): string[] {
60
+ let renderer: string;
61
+ try {
62
+ renderer = createRequire(join(rootDir, 'package.json')).resolve(
63
+ '@react-pdf/renderer',
64
+ );
65
+ } catch (error) {
66
+ if (!isNotFound(error)) {
67
+ warn(`could not resolve @react-pdf/renderer: ${String(error)}`);
68
+ }
69
+ return [];
70
+ }
71
+ const fromRenderer = createRequire(renderer);
72
+ const owners: [string, ReturnType<typeof createRequire>][] = [
73
+ ['@react-pdf/renderer', fromRenderer],
74
+ ];
75
+ try {
76
+ owners.push([
77
+ '@react-pdf/font',
78
+ createRequire(fromRenderer.resolve('@react-pdf/font')),
79
+ ]);
80
+ } catch (error) {
81
+ warn(`could not resolve @react-pdf/font: ${String(error)}`);
82
+ }
83
+ const files = new Set<string>();
84
+ for (const [owner, from] of owners) {
85
+ for (const font of PDFKIT_STANDARD_FONTS) {
86
+ try {
87
+ files.add(from.resolve(`pdfkit/standard-fonts/${font}`));
88
+ } catch (error) {
89
+ warn(
90
+ `could not resolve pdfkit's ${font} font for ${owner}: ${String(error)}`,
91
+ );
92
+ }
93
+ }
94
+ }
95
+ return [...files];
96
+ }
97
+
98
+ /**
99
+ * Adds pdfkit's standard fonts to what Nitro traces into
100
+ * `.output/server/node_modules`. pdfkit loads them with a runtime
101
+ * `require('#standard-fonts/<name>')`, which resolves to a `.cjs` file its
102
+ * tracer never sees: without this, a default Nuxt build copies pdfkit but not
103
+ * those files, and every PDF rendered on the server fails with
104
+ * `Cannot find module '…/pdfkit/js/standard-fonts/Helvetica.cjs'`.
105
+ * Nothing changes for a server built with `noExternals`, which traces nothing,
106
+ * nor for an `externals` set to a boolean, which is left as it is.
107
+ */
108
+ export function addPdfFontsTrace(
109
+ config: NitroConfigLike,
110
+ fontFiles: string[],
111
+ ): void {
112
+ if (fontFiles.length === 0 || typeof config.externals === 'boolean') return;
113
+ config.externals ??= {};
114
+ config.externals.traceInclude = [
115
+ ...(config.externals.traceInclude ?? []),
116
+ ...fontFiles,
117
+ ];
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material-vue",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"
@@ -118,7 +118,7 @@
118
118
  "docs:previews": "vitest run --project previews"
119
119
  },
120
120
  "dependencies": {
121
- "@nxgt/material-core": "^0.1.0",
121
+ "@nxgt/material-core": "^0.1.1",
122
122
  "@floating-ui/dom": "^1.8.0",
123
123
  "@fortawesome/fontawesome-common-types": "7.3.1",
124
124
  "@lucide/vue": "^1.45.0",