@nxgt/material-vue 0.23.0 → 0.23.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.
- package/README.md +1 -0
- package/dist/{camera-C7V5U_xH.js → camera-G80plUZO.js} +1 -1
- package/dist/{components-BSnW1NZK.js → components-D3nLHMxx.js} +4 -4
- package/dist/components.js +1 -1
- package/dist/{image-cropper-canvas-DZGLMjV6.js → image-cropper-canvas-HzYWblQm.js} +435 -428
- package/dist/lib/nuxt/module.d.ts +3 -1
- package/dist/lib/nuxt/pdf-fonts.d.ts +30 -1
- package/dist/main.js +1 -1
- package/dist/{pdf-outline-sidebar-D45RuliO.js → pdf-outline-sidebar-DycVwjfJ.js} +1 -1
- package/dist/{pdf-page-QUKMeod_.js → pdf-page-CHfDMJ_4.js} +1 -1
- package/dist/{pdf-page-list-DzfNykQj.js → pdf-page-list-Cy3Qgm2N.js} +2 -2
- package/dist/{pdf-reader-Bmj2kN0E.js → pdf-reader-D8CFeq1E.js} +4 -4
- package/dist/{pdf-sidebar-CV_Hy9vw.js → pdf-sidebar-D4BpuyNy.js} +2 -2
- package/dist/{pdf-thumbnail-sidebar-Cgk8Y79g.js → pdf-thumbnail-sidebar-Cl9o8zQp.js} +2 -2
- package/dist/{stx-player-C3g6Pcxu.js → stx-player-CpzcZSMq.js} +1 -1
- package/docs/getting-started.md +4 -1
- package/docs/guides/pdf.md +5 -2
- package/docs/roadmap.md +9 -0
- package/docs/troubleshooting.md +51 -2
- package/lib/nuxt/module.ts +23 -6
- package/lib/nuxt/pdf-fonts.ts +101 -1
- package/package.json +2 -2
|
@@ -9,7 +9,9 @@ export type ModuleOptions = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Bundle pdfkit's standard fonts into the Nitro server, for
|
|
11
11
|
* `@nxgt/material-vue/pdf` in a server whose runtime image has no
|
|
12
|
-
* `node_modules
|
|
12
|
+
* `node_modules` (`nitro.noExternals`). Default false: Nitro keeps the
|
|
13
|
+
* renderer external, and the module adds pdfkit's font files to what
|
|
14
|
+
* Nitro traces into `.output/server/node_modules`.
|
|
13
15
|
*/
|
|
14
16
|
bundleStandardFonts?: boolean;
|
|
15
17
|
};
|
|
@@ -2,12 +2,41 @@ type NitroConfigLike = {
|
|
|
2
2
|
rollupConfig?: {
|
|
3
3
|
plugins?: unknown;
|
|
4
4
|
};
|
|
5
|
+
externals?: boolean | {
|
|
6
|
+
traceInclude?: string[];
|
|
7
|
+
};
|
|
5
8
|
};
|
|
6
9
|
/**
|
|
7
10
|
* Adds `pdfkitStandardFonts()` to a Nitro config's Rollup plugins, for the
|
|
8
11
|
* `pdf.bundleStandardFonts` module option. Only a fully inlined server
|
|
9
12
|
* (no `node_modules` in the runtime image) needs it: Nitro keeps
|
|
10
|
-
* `@react-pdf/renderer` external by default,
|
|
13
|
+
* `@react-pdf/renderer` external by default, and `addPdfFontsTrace` copies
|
|
14
|
+
* the fonts pdfkit loads into `.output/server/node_modules`.
|
|
11
15
|
*/
|
|
12
16
|
export declare function addPdfFontsPlugin(config: NitroConfigLike): void;
|
|
17
|
+
/** The fourteen standard PDF fonts, as pdfkit exports them. */
|
|
18
|
+
export declare const PDFKIT_STANDARD_FONTS: readonly ["Courier", "CourierBold", "CourierBoldOblique", "CourierOblique", "Helvetica", "HelveticaBold", "HelveticaBoldOblique", "HelveticaOblique", "Symbol", "TimesBold", "TimesBoldItalic", "TimesItalic", "TimesRoman", "ZapfDingbats"];
|
|
19
|
+
/**
|
|
20
|
+
* pdfkit's standard-font modules as the app at `rootDir` loads them: through
|
|
21
|
+
* pdfkit's own `standard-fonts/<Name>` exports under the `require` condition
|
|
22
|
+
* (the `.cjs` files its runtime `require('#standard-fonts/<Name>')` reads),
|
|
23
|
+
* for the pdfkit `@react-pdf/renderer` depends on and the one
|
|
24
|
+
* `@react-pdf/font` depends on, without duplicates.
|
|
25
|
+
*
|
|
26
|
+
* None, silently, when the app does not install `@react-pdf/renderer` (an
|
|
27
|
+
* optional peer). Any other failure is passed to `warn` — a font that
|
|
28
|
+
* cannot be resolved here is a PDF route that fails in production.
|
|
29
|
+
*/
|
|
30
|
+
export declare function pdfkitStandardFontFiles(rootDir: string, warn?: (message: string) => void): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Adds pdfkit's standard fonts to what Nitro traces into
|
|
33
|
+
* `.output/server/node_modules`. pdfkit loads them with a runtime
|
|
34
|
+
* `require('#standard-fonts/<name>')`, which resolves to a `.cjs` file its
|
|
35
|
+
* tracer never sees: without this, a default Nuxt build copies pdfkit but not
|
|
36
|
+
* those files, and every PDF rendered on the server fails with
|
|
37
|
+
* `Cannot find module '…/pdfkit/js/standard-fonts/Helvetica.cjs'`.
|
|
38
|
+
* Nothing changes for a server built with `noExternals`, which traces nothing,
|
|
39
|
+
* nor for an `externals` set to a boolean, which is left as it is.
|
|
40
|
+
*/
|
|
41
|
+
export declare function addPdfFontsTrace(config: NitroConfigLike, fontFiles: string[]): void;
|
|
13
42
|
export {};
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ee } from "./utils-CykWQ0iJ.js";
|
|
2
|
-
import { $ as te, $a as ne, $c as re, $d as e, $f as t, $i as n, $l as r, $n as i, $o as a, $p as o, $r as s, $s as c, $t as l, $u as u, A as d, Aa as f, Ac as p, Ad as m, Af as h, Ai as g, Al as _, An as v, Ao as y, Ap as b, Ar as x, As as S, At as C, Au as w, B as T, Ba as E, Bc as D, Bd as O, Bf as k, Bi as A, Bl as j, Bn as M, Bo as N, Bp as P, Br as F, Bs as I, Bt as L, Bu as R, C as z, Ca as B, Cc as V, Cd as H, Cf as U, Ci as W, Cl as G, Cn as K, Co as q, Cp as J, Cr as Y, Cs as X, Ct as ie, Cu as ae, D as oe, Da as se, Dc as ce, Dd as le, Df as ue, Di as de, Dl as fe, Dn as pe, Do as me, Dp as he, Dr as ge, Ds as _e, Dt as ve, Du as ye, E as be, Ea as xe, Ec as Se, Ed as Ce, Ef as we, Ei as Te, El as Ee, En as De, Eo as Oe, Ep as ke, Er as Ae, Es as je, Et as Me, Eu as Ne, F as Pe, Fa as Fe, Fc as Ie, Fd as Le, Ff as Re, Fi as ze, Fl as Be, Fn as Ve, Fo as He, Fp as Ue, Fr as We, Fs as Ge, Ft as Ke, Fu as qe, G as Je, Ga as Ye, Gc as Xe, Gd as Ze, Gf as Qe, Gi as $e, Gl as et, Gn as tt, Go as nt, Gp as rt, Gr as it, Gs as at, Gt as ot, Gu as st, H as ct, Ha as lt, Hc as ut, Hd as dt, Hf as ft, Hi as pt, Hl as mt, Hn as ht, Ho as gt, Hp as _t, Hr as vt, Hs as yt, Ht as Z, Hu as bt, I as xt, Ia as St, Ic as Ct, Id as wt, If as Tt, Ii as Et, Il as Dt, In as Ot, Io as kt, Ip as At, Ir as jt, Is as Mt, It as Nt, Iu as Pt, J as Ft, Ja as It, Jc as Lt, Jd as Rt, Jf as zt, Ji as Bt, Jl as Vt, Jn as Ht, Jo as Ut, Jp as Wt, Jr as Gt, Js as Kt, Jt as qt, Ju as Jt, K as Yt, Ka as Xt, Kc as Zt, Kd as Qt, Kf as $t, Ki as en, Kl as tn, Kn as nn, Ko as rn, Kp as an, Kr as on, Ks as sn, Kt as cn, Ku as ln, L as un, La as dn, Lc as fn, Ld as pn, Lf as mn, Li as hn, Ll as gn, Ln as _n, Lo as vn, Lp as yn, Lr as bn, Ls as xn, Lt as Sn, Lu as Cn, M as wn, Ma as Tn, Mc as En, Md as Dn, Mf as On, Mi as kn, Ml as An, Mn as jn, Mo as Mn, Mp as Nn, Mr as Pn, Ms as Fn, Mt as In, Mu as Ln, N as Rn, Na as zn, Nc as Bn, Nd as Vn, Nf as Hn, Ni as Un, Nl as Wn, Nn as Gn, No as Kn, Np as qn, Nr as Jn, Ns as Yn, Nt as Xn, Nu as Zn, O as Qn, Oa as $n, Oc as er, Od as tr, Of as nr, Oi as rr, Ol as ir, On as ar, Oo as or, Op as sr, Or as cr, Os as lr, Ot as ur, Ou as dr, P as fr, Pa as pr, Pc as mr, Pd as hr, Pf as gr, Pi as _r, Pl as vr, Pn as yr, Po as br, Pp as xr, Pr as Sr, Ps as Cr, Pt as wr, Pu as Tr, Q as Er, Qa as Dr, Qc as Or, Qd as kr, Qf as Ar, Qi as jr, Ql as Mr, Qn as Nr, Qo as Pr, Qp as Fr, Qr as Ir, Qs as Lr, Qt as Rr, Qu as zr, R as Br, Ra as Vr, Rc as Hr, Rd as Ur, Rf as Wr, Ri as Gr, Rl as Kr, Rn as qr, Ro as Jr, Rp as Yr, Rr as Xr, Rs as Zr, Rt as Qr, Ru as $r, S as ei, Sa as ti, Sc as ni, Sd as ri, Sf as ii, Si as ai, Sl as oi, Sn as si, So as ci, Sp as li, Sr as ui, Ss as di, St as fi, Su as pi, T as mi, Ta as hi, Tc as gi, Td as _i, Tf as vi, Ti as yi, Tl as bi, Tn as xi, To as Si, Tp as Ci, Tr as wi, Ts as Ti, Tt as Ei, Tu as Di, U as Oi, Ua as ki, Uc as Ai, Ud as ji, Uf as Mi, Ui as Ni, Ul as Pi, Un as Fi, Uo as Ii, Up as Li, Ur as Ri, Us as zi, Ut as Bi, Uu as Vi, V as Hi, Va as Ui, Vc as Wi, Vd as Gi, Vf as Ki, Vi as qi, Vl as Ji, Vn as Yi, Vo as Xi, Vp as Zi, Vr as Qi, Vs as $i, Vt as ea, Vu as ta, W as na, Wa as ra, Wc as ia, Wd as aa, Wf as oa, Wi as sa, Wl as ca, Wn as la, Wo as ua, Wp as da, Wr as fa, Ws as pa, Wt as ma, Wu as ha, X as ga, Xa as _a, Xc as va, Xd as ya, Xf as ba, Xi as xa, Xl as Sa, Xn as Ca, Xo as wa, Xp as Ta, Xr as Ea, Xs as Da, Xt as Oa, Xu as ka, Y as Aa, Ya as ja, Yc as Ma, Yd as Na, Yf as Pa, Yi as Fa, Yl as Ia, Yn as La, Yo as Ra, Yp as za, Yr as Ba, Ys as Va, Yt as Ha, Yu as Ua, Z as Wa, Za as Ga, Zc as Ka, Zd as qa, Zf as Ja, Zi as Ya, Zl as Xa, Zn as Za, Zo as Qa, Zp as $a, Zr as eo, Zs as to, Zt as no, Zu as ro, _ as io, _a as ao, _c as oo, _d as so, _f as co, _i as lo, _l as uo, _n as fo, _o as po, _p as mo, _r as ho, _s as go, _t as _o, _u as vo, a as yo, aa as bo, ac as xo, ad as So, af as Co, ai as wo, al as To, am as Eo, an as Do, ao as Oo, ap as ko, ar as Ao, as as jo, at as Mo, au as No, b as Po, ba as Fo, bc as Io, bd as Lo, bf as Ro, bi as zo, bl as Bo, bn as Vo, bo as Ho, bp as Uo, br as Wo, bs as Go, bt as Ko, bu as qo, c as Jo, ca as Yo, cc as Xo, cd as Zo, cf as Qo, ci as $o, cl as es, cm as ts, cn as ns, co as rs, cp as is, cr as as, cs as os, ct as ss, cu as cs, d as ls, da as us, dc as ds, dd as fs, df as ps, di as ms, dl as hs, dm as gs, dn as _s, do as vs, dp as ys, dr as bs, ds as xs, dt as Ss, du as Cs, ea as ws, ec as Ts, ed as Es, ef as Ds, ei as Os, el as ks, em as As, en as js, eo as Ms, ep as Ns, er as Ps, es as Fs, et as Is, eu as Ls, f as Rs, fa as zs, fc as Bs, fd as Vs, ff as Hs, fi as Us, fl as Ws, fn as Gs, fo as Ks, fp as qs, fr as Js, fs as Ys, ft as Xs, fu as Zs, g as Qs, ga as $s, gc as ec, gd as tc, gf as nc, gi as rc, gl as ic, gn as ac, go as oc, gp as sc, gr as cc, gs as lc, gt as uc, gu as dc, h as fc, ha as pc, hc as mc, hd as hc, hf as gc, hi as _c, hl as vc, hn as yc, ho as bc, hp as xc, hr as Sc, hs as Cc, ht as wc, hu as Tc, i as Q, ia as Ec, ic as Dc, id as Oc, if as kc, ii as Ac, il as jc, im as Mc, in as Nc, io as Pc, ip as Fc, ir as Ic, is as Lc, it as Rc, iu as zc, j as Bc, ja as Vc, jc as Hc, jd as Uc, jf as Wc, ji as Gc, jl as Kc, jn as qc, jo as Jc, jp as Yc, jr as Xc, js as Zc, jt as Qc, ju as $c, k as el, ka as tl, kc as nl, kd as rl, kf as il, ki as al, kl as ol, kn as sl, ko as cl, kp as ll, kr as ul, ks as dl, kt as fl, ku as pl, l as ml, la as hl, lc as gl, ld as _l, lf as vl, li as yl, ll as bl, lm as xl, ln as Sl, lo as Cl, lp as wl, lr as Tl, ls as El, lt as Dl, lu as Ol, m as kl, ma as Al, mc as jl, md as Ml, mf as Nl, mi as Pl, ml as Fl, mn as Il, mo as Ll, mp as Rl, mr as zl, ms as Bl, mt as Vl, mu as Hl, n as Ul, na as Wl, nc as Gl, nd as Kl, nf as ql, ni as Jl, nl as Yl, nm as Xl, nn as Zl, no as Ql, np as $l, nr as eu, ns as tu, nt as nu, nu as ru, o as iu, oa as au, oc as ou, od as su, of as cu, oi as lu, ol as uu, om as du, on as fu, oo as pu, op as mu, or as hu, os as gu, ot as _u, ou as vu, p as yu, pa as bu, pc as xu, pd as Su, pf as Cu, pi as wu, pl as Tu, pn as Eu, po as Du, pp as Ou, pr as ku, ps as Au, pt as ju, pu as Mu, q as Nu, qa as Pu, qc as Fu, qd as Iu, qf as Lu, qi as Ru, ql as zu, qn as Bu, qo as Vu, qp as Hu, qr as Uu, qs as Wu, qt as Gu, qu as Ku, r as qu, ra as Ju, rc as Yu, rd as Xu, rf as Zu, ri as Qu, rl as $u, rm as ed, rn as td, ro as nd, rp as rd, rs as id, rt as ad, ru as od, s as sd, sa as cd, sc as ld, sd as ud, sf as dd, si as fd, sl as pd, sm as md, sn as hd, so as gd, sp as _d, sr as vd, ss as yd, st as bd, su as xd, t as Sd, ta as Cd, tc as wd, td as Td, tf as Ed, ti as Dd, tl as Od, tm as kd, tn as Ad, to as jd, tp as Md, tr as Nd, ts as Pd, tt as Fd, tu as Id, u as Ld, ua as Rd, uc as zd, ud as Bd, uf as Vd, ui as Hd, ul as Ud, um as Wd, un as Gd, uo as Kd, up as qd, ur as Jd, us as Yd, ut as Xd, uu as Zd, v as Qd, va as $d, vc as ef, vd as tf, vf as nf, vi as rf, vl as af, vn as of, vo as sf, vp as cf, vr as lf, vs as uf, vt as df, vu as ff, w as pf, wa as mf, wc as hf, wd as gf, wf as _f, wi as vf, wl as yf, wn as bf, wo as xf, wp as Sf, wr as Cf, ws as wf, wt as Tf, wu as Ef, x as Df, xa as Of, xc as kf, xd as Af, xf as jf, xi as Mf, xl as Nf, xn as Pf, xo as Ff, xp as If, xr as Lf, xs as Rf, xt as zf, xu as Bf, y as Vf, ya as Hf, yc as Uf, yd as Wf, yf as Gf, yi as Kf, yl as qf, yn as Jf, yo as Yf, yp as Xf, yr as Zf, ys as Qf, yt as $f, yu as ep, z as tp, za as np, zc as rp, zd as ip, zf as ap, zi as op, zl as sp, zn as cp, zo as lp, zp as up, zr as dp, zs as fp, zt as pp, zu as mp } from "./components-
|
|
2
|
+
import { $ as te, $a as ne, $c as re, $d as e, $f as t, $i as n, $l as r, $n as i, $o as a, $p as o, $r as s, $s as c, $t as l, $u as u, A as d, Aa as f, Ac as p, Ad as m, Af as h, Ai as g, Al as _, An as v, Ao as y, Ap as b, Ar as x, As as S, At as C, Au as w, B as T, Ba as E, Bc as D, Bd as O, Bf as k, Bi as A, Bl as j, Bn as M, Bo as N, Bp as P, Br as F, Bs as I, Bt as L, Bu as R, C as z, Ca as B, Cc as V, Cd as H, Cf as U, Ci as W, Cl as G, Cn as K, Co as q, Cp as J, Cr as Y, Cs as X, Ct as ie, Cu as ae, D as oe, Da as se, Dc as ce, Dd as le, Df as ue, Di as de, Dl as fe, Dn as pe, Do as me, Dp as he, Dr as ge, Ds as _e, Dt as ve, Du as ye, E as be, Ea as xe, Ec as Se, Ed as Ce, Ef as we, Ei as Te, El as Ee, En as De, Eo as Oe, Ep as ke, Er as Ae, Es as je, Et as Me, Eu as Ne, F as Pe, Fa as Fe, Fc as Ie, Fd as Le, Ff as Re, Fi as ze, Fl as Be, Fn as Ve, Fo as He, Fp as Ue, Fr as We, Fs as Ge, Ft as Ke, Fu as qe, G as Je, Ga as Ye, Gc as Xe, Gd as Ze, Gf as Qe, Gi as $e, Gl as et, Gn as tt, Go as nt, Gp as rt, Gr as it, Gs as at, Gt as ot, Gu as st, H as ct, Ha as lt, Hc as ut, Hd as dt, Hf as ft, Hi as pt, Hl as mt, Hn as ht, Ho as gt, Hp as _t, Hr as vt, Hs as yt, Ht as Z, Hu as bt, I as xt, Ia as St, Ic as Ct, Id as wt, If as Tt, Ii as Et, Il as Dt, In as Ot, Io as kt, Ip as At, Ir as jt, Is as Mt, It as Nt, Iu as Pt, J as Ft, Ja as It, Jc as Lt, Jd as Rt, Jf as zt, Ji as Bt, Jl as Vt, Jn as Ht, Jo as Ut, Jp as Wt, Jr as Gt, Js as Kt, Jt as qt, Ju as Jt, K as Yt, Ka as Xt, Kc as Zt, Kd as Qt, Kf as $t, Ki as en, Kl as tn, Kn as nn, Ko as rn, Kp as an, Kr as on, Ks as sn, Kt as cn, Ku as ln, L as un, La as dn, Lc as fn, Ld as pn, Lf as mn, Li as hn, Ll as gn, Ln as _n, Lo as vn, Lp as yn, Lr as bn, Ls as xn, Lt as Sn, Lu as Cn, M as wn, Ma as Tn, Mc as En, Md as Dn, Mf as On, Mi as kn, Ml as An, Mn as jn, Mo as Mn, Mp as Nn, Mr as Pn, Ms as Fn, Mt as In, Mu as Ln, N as Rn, Na as zn, Nc as Bn, Nd as Vn, Nf as Hn, Ni as Un, Nl as Wn, Nn as Gn, No as Kn, Np as qn, Nr as Jn, Ns as Yn, Nt as Xn, Nu as Zn, O as Qn, Oa as $n, Oc as er, Od as tr, Of as nr, Oi as rr, Ol as ir, On as ar, Oo as or, Op as sr, Or as cr, Os as lr, Ot as ur, Ou as dr, P as fr, Pa as pr, Pc as mr, Pd as hr, Pf as gr, Pi as _r, Pl as vr, Pn as yr, Po as br, Pp as xr, Pr as Sr, Ps as Cr, Pt as wr, Pu as Tr, Q as Er, Qa as Dr, Qc as Or, Qd as kr, Qf as Ar, Qi as jr, Ql as Mr, Qn as Nr, Qo as Pr, Qp as Fr, Qr as Ir, Qs as Lr, Qt as Rr, Qu as zr, R as Br, Ra as Vr, Rc as Hr, Rd as Ur, Rf as Wr, Ri as Gr, Rl as Kr, Rn as qr, Ro as Jr, Rp as Yr, Rr as Xr, Rs as Zr, Rt as Qr, Ru as $r, S as ei, Sa as ti, Sc as ni, Sd as ri, Sf as ii, Si as ai, Sl as oi, Sn as si, So as ci, Sp as li, Sr as ui, Ss as di, St as fi, Su as pi, T as mi, Ta as hi, Tc as gi, Td as _i, Tf as vi, Ti as yi, Tl as bi, Tn as xi, To as Si, Tp as Ci, Tr as wi, Ts as Ti, Tt as Ei, Tu as Di, U as Oi, Ua as ki, Uc as Ai, Ud as ji, Uf as Mi, Ui as Ni, Ul as Pi, Un as Fi, Uo as Ii, Up as Li, Ur as Ri, Us as zi, Ut as Bi, Uu as Vi, V as Hi, Va as Ui, Vc as Wi, Vd as Gi, Vf as Ki, Vi as qi, Vl as Ji, Vn as Yi, Vo as Xi, Vp as Zi, Vr as Qi, Vs as $i, Vt as ea, Vu as ta, W as na, Wa as ra, Wc as ia, Wd as aa, Wf as oa, Wi as sa, Wl as ca, Wn as la, Wo as ua, Wp as da, Wr as fa, Ws as pa, Wt as ma, Wu as ha, X as ga, Xa as _a, Xc as va, Xd as ya, Xf as ba, Xi as xa, Xl as Sa, Xn as Ca, Xo as wa, Xp as Ta, Xr as Ea, Xs as Da, Xt as Oa, Xu as ka, Y as Aa, Ya as ja, Yc as Ma, Yd as Na, Yf as Pa, Yi as Fa, Yl as Ia, Yn as La, Yo as Ra, Yp as za, Yr as Ba, Ys as Va, Yt as Ha, Yu as Ua, Z as Wa, Za as Ga, Zc as Ka, Zd as qa, Zf as Ja, Zi as Ya, Zl as Xa, Zn as Za, Zo as Qa, Zp as $a, Zr as eo, Zs as to, Zt as no, Zu as ro, _ as io, _a as ao, _c as oo, _d as so, _f as co, _i as lo, _l as uo, _n as fo, _o as po, _p as mo, _r as ho, _s as go, _t as _o, _u as vo, a as yo, aa as bo, ac as xo, ad as So, af as Co, ai as wo, al as To, am as Eo, an as Do, ao as Oo, ap as ko, ar as Ao, as as jo, at as Mo, au as No, b as Po, ba as Fo, bc as Io, bd as Lo, bf as Ro, bi as zo, bl as Bo, bn as Vo, bo as Ho, bp as Uo, br as Wo, bs as Go, bt as Ko, bu as qo, c as Jo, ca as Yo, cc as Xo, cd as Zo, cf as Qo, ci as $o, cl as es, cm as ts, cn as ns, co as rs, cp as is, cr as as, cs as os, ct as ss, cu as cs, d as ls, da as us, dc as ds, dd as fs, df as ps, di as ms, dl as hs, dm as gs, dn as _s, do as vs, dp as ys, dr as bs, ds as xs, dt as Ss, du as Cs, ea as ws, ec as Ts, ed as Es, ef as Ds, ei as Os, el as ks, em as As, en as js, eo as Ms, ep as Ns, er as Ps, es as Fs, et as Is, eu as Ls, f as Rs, fa as zs, fc as Bs, fd as Vs, ff as Hs, fi as Us, fl as Ws, fn as Gs, fo as Ks, fp as qs, fr as Js, fs as Ys, ft as Xs, fu as Zs, g as Qs, ga as $s, gc as ec, gd as tc, gf as nc, gi as rc, gl as ic, gn as ac, go as oc, gp as sc, gr as cc, gs as lc, gt as uc, gu as dc, h as fc, ha as pc, hc as mc, hd as hc, hf as gc, hi as _c, hl as vc, hn as yc, ho as bc, hp as xc, hr as Sc, hs as Cc, ht as wc, hu as Tc, i as Q, ia as Ec, ic as Dc, id as Oc, if as kc, ii as Ac, il as jc, im as Mc, in as Nc, io as Pc, ip as Fc, ir as Ic, is as Lc, it as Rc, iu as zc, j as Bc, ja as Vc, jc as Hc, jd as Uc, jf as Wc, ji as Gc, jl as Kc, jn as qc, jo as Jc, jp as Yc, jr as Xc, js as Zc, jt as Qc, ju as $c, k as el, ka as tl, kc as nl, kd as rl, kf as il, ki as al, kl as ol, kn as sl, ko as cl, kp as ll, kr as ul, ks as dl, kt as fl, ku as pl, l as ml, la as hl, lc as gl, ld as _l, lf as vl, li as yl, ll as bl, lm as xl, ln as Sl, lo as Cl, lp as wl, lr as Tl, ls as El, lt as Dl, lu as Ol, m as kl, ma as Al, mc as jl, md as Ml, mf as Nl, mi as Pl, ml as Fl, mn as Il, mo as Ll, mp as Rl, mr as zl, ms as Bl, mt as Vl, mu as Hl, n as Ul, na as Wl, nc as Gl, nd as Kl, nf as ql, ni as Jl, nl as Yl, nm as Xl, nn as Zl, no as Ql, np as $l, nr as eu, ns as tu, nt as nu, nu as ru, o as iu, oa as au, oc as ou, od as su, of as cu, oi as lu, ol as uu, om as du, on as fu, oo as pu, op as mu, or as hu, os as gu, ot as _u, ou as vu, p as yu, pa as bu, pc as xu, pd as Su, pf as Cu, pi as wu, pl as Tu, pn as Eu, po as Du, pp as Ou, pr as ku, ps as Au, pt as ju, pu as Mu, q as Nu, qa as Pu, qc as Fu, qd as Iu, qf as Lu, qi as Ru, ql as zu, qn as Bu, qo as Vu, qp as Hu, qr as Uu, qs as Wu, qt as Gu, qu as Ku, r as qu, ra as Ju, rc as Yu, rd as Xu, rf as Zu, ri as Qu, rl as $u, rm as ed, rn as td, ro as nd, rp as rd, rs as id, rt as ad, ru as od, s as sd, sa as cd, sc as ld, sd as ud, sf as dd, si as fd, sl as pd, sm as md, sn as hd, so as gd, sp as _d, sr as vd, ss as yd, st as bd, su as xd, t as Sd, ta as Cd, tc as wd, td as Td, tf as Ed, ti as Dd, tl as Od, tm as kd, tn as Ad, to as jd, tp as Md, tr as Nd, ts as Pd, tt as Fd, tu as Id, u as Ld, ua as Rd, uc as zd, ud as Bd, uf as Vd, ui as Hd, ul as Ud, um as Wd, un as Gd, uo as Kd, up as qd, ur as Jd, us as Yd, ut as Xd, uu as Zd, v as Qd, va as $d, vc as ef, vd as tf, vf as nf, vi as rf, vl as af, vn as of, vo as sf, vp as cf, vr as lf, vs as uf, vt as df, vu as ff, w as pf, wa as mf, wc as hf, wd as gf, wf as _f, wi as vf, wl as yf, wn as bf, wo as xf, wp as Sf, wr as Cf, ws as wf, wt as Tf, wu as Ef, x as Df, xa as Of, xc as kf, xd as Af, xf as jf, xi as Mf, xl as Nf, xn as Pf, xo as Ff, xp as If, xr as Lf, xs as Rf, xt as zf, xu as Bf, y as Vf, ya as Hf, yc as Uf, yd as Wf, yf as Gf, yi as Kf, yl as qf, yn as Jf, yo as Yf, yp as Xf, yr as Zf, ys as Qf, yt as $f, yu as ep, z as tp, za as np, zc as rp, zd as ip, zf as ap, zi as op, zl as sp, zn as cp, zo as lp, zp as up, zr as dp, zs as fp, zt as pp, zu as mp } from "./components-D3nLHMxx.js";
|
|
3
3
|
import { a as hp, i as gp, n as _p, r as vp } from "./stored-language-D7FRT1hD.js";
|
|
4
4
|
import { a as yp, i as bp, n as xp, r as Sp, t as Cp } from "./i18n-provider-BTm3J_K9.js";
|
|
5
5
|
import { n as wp, r as Tp, t as Ep } from "./translator-BJPRdlc8.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
2
|
import { t } from "./utils-CykWQ0iJ.js";
|
|
3
|
-
import { af as n } from "./components-
|
|
3
|
+
import { af as n } from "./components-D3nLHMxx.js";
|
|
4
4
|
import { t as r } from "./use-material-translation-gr5V24w5.js";
|
|
5
5
|
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
|
|
6
6
|
//#region lib/components/ui/media/pdf-viewer/partials/pdf-outline-row.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./utils-CykWQ0iJ.js";
|
|
2
|
-
import { zc as t } from "./components-
|
|
2
|
+
import { zc as t } from "./components-D3nLHMxx.js";
|
|
3
3
|
import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, nextTick as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, openBlock as f, ref as p, shallowRef as m, unref as h, watch as g } from "vue";
|
|
4
4
|
import { DEFAULT_PAGE_SIZE as _, escapeHtml as v, findTextMatches as y, highlightItemHtml as b, placeholderSize as x, rotatedSize as S } from "@nxgt/material-core/pdf-viewer";
|
|
5
5
|
//#region lib/components/ui/media/pdf-viewer/pdf-note-icons.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
|
-
import { af as t } from "./components-
|
|
3
|
-
import { t as n } from "./pdf-page-
|
|
2
|
+
import { af as t } from "./components-D3nLHMxx.js";
|
|
3
|
+
import { t as n } from "./pdf-page-CHfDMJ_4.js";
|
|
4
4
|
import { Fragment as r, createBlock as i, createElementBlock as a, createElementVNode as o, defineComponent as s, openBlock as c, renderList as l, withCtx as u } from "vue";
|
|
5
5
|
//#region lib/components/ui/media/pdf-viewer/partials/pdf-page-list.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var d = { class: "flex flex-col items-center gap-4 px-4 py-4" }, f = /*@__PURE__*/ s({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as e } from "./utils-CykWQ0iJ.js";
|
|
2
|
-
import { wn as t } from "./components-
|
|
2
|
+
import { wn as t } from "./components-D3nLHMxx.js";
|
|
3
3
|
import { t as n } from "./use-material-translation-gr5V24w5.js";
|
|
4
4
|
import { t as r } from "./Button-DcFHQ3oH.js";
|
|
5
5
|
import { o as i } from "./HoverCardTrigger-D99aHKDX.js";
|
|
6
|
-
import { n as a } from "./pdf-page-
|
|
7
|
-
import { t as o } from "./pdf-page-list-
|
|
8
|
-
import { t as s } from "./pdf-sidebar-
|
|
6
|
+
import { n as a } from "./pdf-page-CHfDMJ_4.js";
|
|
7
|
+
import { t as o } from "./pdf-page-list-Cy3Qgm2N.js";
|
|
8
|
+
import { t as s } from "./pdf-sidebar-D4BpuyNy.js";
|
|
9
9
|
import { t as c } from "./pdf-toolbar-Cj_fCmo3.js";
|
|
10
10
|
import { computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, nextTick as _, normalizeClass as v, onBeforeUnmount as y, onMounted as b, openBlock as x, reactive as S, ref as C, shallowRef as w, toDisplayString as T, toRef as E, unref as D, useId as O, watch as k, withCtx as A } from "vue";
|
|
11
11
|
import { AlertCircle as j, FileX2 as M, KeyRound as N, Loader2 as P } from "@lucide/vue";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
2
|
import { t } from "./utils-CykWQ0iJ.js";
|
|
3
3
|
import { t as n } from "./use-material-translation-gr5V24w5.js";
|
|
4
|
-
import { t as r } from "./pdf-outline-sidebar-
|
|
5
|
-
import { t as i } from "./pdf-thumbnail-sidebar-
|
|
4
|
+
import { t as r } from "./pdf-outline-sidebar-DycVwjfJ.js";
|
|
5
|
+
import { t as i } from "./pdf-thumbnail-sidebar-Cl9o8zQp.js";
|
|
6
6
|
import { createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, toDisplayString as d, unref as f, useId as p, useTemplateRef as m } from "vue";
|
|
7
7
|
//#region lib/components/ui/media/pdf-viewer/partials/pdf-sidebar.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var h = ["aria-label"], g = ["aria-label"], _ = [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
2
|
import { t } from "./utils-CykWQ0iJ.js";
|
|
3
|
-
import { af as n } from "./components-
|
|
3
|
+
import { af as n } from "./components-D3nLHMxx.js";
|
|
4
4
|
import { t as r } from "./use-material-translation-gr5V24w5.js";
|
|
5
|
-
import { t as i } from "./pdf-page-
|
|
5
|
+
import { t as i } from "./pdf-page-CHfDMJ_4.js";
|
|
6
6
|
import { Fragment as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, renderList as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
|
|
7
7
|
//#region lib/components/ui/media/pdf-viewer/partials/pdf-thumbnail-sidebar.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var _ = ["aria-label"], v = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./utils-CykWQ0iJ.js";
|
|
2
|
-
import { Gt as t, Jt as n, Ut as r, Wt as i, Xt as a, Yt as o, lp as s, qt as c } from "./components-
|
|
2
|
+
import { Gt as t, Jt as n, Ut as r, Wt as i, Xt as a, Yt as o, lp as s, qt as c } from "./components-D3nLHMxx.js";
|
|
3
3
|
import { t as l } from "./use-material-translation-gr5V24w5.js";
|
|
4
4
|
import { createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, normalizeClass as _, openBlock as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
|
|
5
5
|
//#region lib/components/ui/media/stx-player/partials/stx-player-frame.vue?vue&type=script&setup=true&lang.ts
|
package/docs/getting-started.md
CHANGED
|
@@ -187,7 +187,10 @@ The module also:
|
|
|
187
187
|
- adds the package to `build.transpile`, so it is bundled into the server
|
|
188
188
|
build ([SSR](guides/ssr.md#nuxt));
|
|
189
189
|
- installs Pinia when the app has none;
|
|
190
|
-
- pre-bundles the CommonJS dependency `jsbarcode` for Vite
|
|
190
|
+
- pre-bundles the CommonJS dependency `jsbarcode` for Vite;
|
|
191
|
+
- adds pdfkit's standard-font files to `nitro.externals.traceInclude`, so a
|
|
192
|
+
production server renders PDFs from `.output` alone
|
|
193
|
+
([troubleshooting](troubleshooting.md#cannot-find-module-pdfkitjsstandard-fontshelveticacjs)).
|
|
191
194
|
|
|
192
195
|
It does **not** add the stylesheet: import it yourself as in [Styles](#styles).
|
|
193
196
|
It does **not** register what is outside `/components`: `I18nProvider`, the
|
package/docs/guides/pdf.md
CHANGED
|
@@ -271,8 +271,11 @@ as `invoicePdf(invoice, language)` does above.
|
|
|
271
271
|
|
|
272
272
|
The PDFs use the fourteen standard PDF fonts, loaded by pdfkit at runtime from
|
|
273
273
|
a specifier no bundler resolves. Nitro keeps `@react-pdf/renderer` external by
|
|
274
|
-
default, where that works
|
|
275
|
-
|
|
274
|
+
default, where that works: the Nuxt module adds pdfkit's font files to what
|
|
275
|
+
Nitro copies into `.output/server/node_modules`, which its tracer would miss
|
|
276
|
+
([troubleshooting](../troubleshooting.md#cannot-find-module-pdfkitjsstandard-fontshelveticacjs)).
|
|
277
|
+
When the runtime image has **no `node_modules`** (the server inlined into one
|
|
278
|
+
artifact, `nitro: { noExternals: true }`), bundle the fonts in:
|
|
276
279
|
|
|
277
280
|
```ts
|
|
278
281
|
// nuxt.config.ts
|
package/docs/roadmap.md
CHANGED
|
@@ -88,6 +88,15 @@ Nothing in progress right now; see Next.
|
|
|
88
88
|
|
|
89
89
|
## Shipped
|
|
90
90
|
|
|
91
|
+
- **One copy of the framework-free code, shared with `@nxgt/material`** —
|
|
92
|
+
the PDF document model and renderer, the print formatters, the PDF file
|
|
93
|
+
helpers, `PdfReader`'s page geometry, scroll spy and search, the
|
|
94
|
+
`CurrencyField` decimals, the fields' blur rule and `pdfkitStandardFonts()`
|
|
95
|
+
now come from `@nxgt/material-core`, which your install adds on its own.
|
|
96
|
+
Every entry exports the same names with the same types, so nothing changes
|
|
97
|
+
in your imports or your Nuxt config; a server bundled without
|
|
98
|
+
`node_modules` bundles `@nxgt/material-core` too. 0.23.0.
|
|
99
|
+
([troubleshooting](troubleshooting.md#cannot-find-package-nxgtmaterial-core))
|
|
91
100
|
- **PdfReader, turned pages and a steady zoom** — a page the PDF turns
|
|
92
101
|
(`/Rotate`) shows the right way up, the fit zoom settles once when the
|
|
93
102
|
document opens instead of moving while you read, `@page-change` also reports
|
package/docs/troubleshooting.md
CHANGED
|
@@ -59,6 +59,7 @@ words in your error.
|
|
|
59
59
|
**PDF documents**
|
|
60
60
|
|
|
61
61
|
- [`Cannot find module '#standard-fonts/Helvetica'`](#cannot-find-module-standard-fontshelvetica)
|
|
62
|
+
- [`Cannot find module '…/pdfkit/js/standard-fonts/Helvetica.cjs'`](#cannot-find-module-pdfkitjsstandard-fontshelveticacjs)
|
|
62
63
|
- [`still references '#standard-fonts/' after the transform`](#still-references-standard-fonts-after-the-transform)
|
|
63
64
|
- [`renderToStream is a Node specific API` / `renderToBuffer is a Node specific API`](#rendertostream-is-a-node-specific-api--rendertobuffer-is-a-node-specific-api)
|
|
64
65
|
- [PDF rendering fails on an edge runtime](#pdf-rendering-fails-on-an-edge-runtime)
|
|
@@ -751,6 +752,11 @@ or leave both external, with a `node_modules` that keeps
|
|
|
751
752
|
`@nxgt/material-vue`'s dependencies:
|
|
752
753
|
`--external @nxgt/material-vue --external @nxgt/material-core`.
|
|
753
754
|
|
|
755
|
+
In Nuxt there is nothing to do: the module transpiles `@nxgt/material-vue`,
|
|
756
|
+
and Nitro traces `@nxgt/material-core` into `.output/server/node_modules`
|
|
757
|
+
like any dependency — or inlines it with everything else under
|
|
758
|
+
`nitro: { noExternals: true }`.
|
|
759
|
+
|
|
754
760
|
## Pinia, router & forms
|
|
755
761
|
|
|
756
762
|
### `"getActivePinia()" was called but there was no active Pinia`
|
|
@@ -1003,8 +1009,9 @@ single artifact that runs without `node_modules`.
|
|
|
1003
1009
|
**Why:** pdfkit, under `@react-pdf/renderer`, loads its standard fonts with a
|
|
1004
1010
|
runtime `require('#standard-fonts/<name>')`, a specifier private to pdfkit
|
|
1005
1011
|
that no bundler resolves. Inlined into your server, the call looks for it next
|
|
1006
|
-
to your build output. Nitro keeps the renderer external by default,
|
|
1007
|
-
|
|
1012
|
+
to your build output. Nitro keeps the renderer external by default, and the
|
|
1013
|
+
Nuxt module has it copy the fonts into `.output/server/node_modules`; this
|
|
1014
|
+
appears when the renderer is inlined.
|
|
1008
1015
|
**Fix:** bundle the fonts in. In Nuxt:
|
|
1009
1016
|
|
|
1010
1017
|
```ts
|
|
@@ -1036,6 +1043,48 @@ works too, and keeps pdfkit out of the artifact. A `resolve.alias` for
|
|
|
1036
1043
|
`require` at runtime, never seen by the resolver. See
|
|
1037
1044
|
[PDF documents](guides/pdf.md#fonts-on-a-fully-inlined-server).
|
|
1038
1045
|
|
|
1046
|
+
### `Cannot find module '…/pdfkit/js/standard-fonts/Helvetica.cjs'`
|
|
1047
|
+
|
|
1048
|
+
**When:** on every PDF a Nuxt or Nitro production server renders
|
|
1049
|
+
(`node .output/server/index.mjs`), while `nuxi dev` renders fine. The path
|
|
1050
|
+
points into `.output/server/node_modules/pdfkit/`.
|
|
1051
|
+
**Why:** Nitro copies the server's external dependencies into
|
|
1052
|
+
`.output/server/node_modules`, keeping only the files its tracer finds.
|
|
1053
|
+
pdfkit loads its fonts with a runtime `require('#standard-fonts/<name>')`,
|
|
1054
|
+
which resolves to a `.cjs` file the tracer never sees, so pdfkit is copied
|
|
1055
|
+
without them.
|
|
1056
|
+
**Fix:** use the Nuxt module (`modules: ['@nxgt/material-vue/nuxt']`), which
|
|
1057
|
+
adds pdfkit's font files to Nitro's trace. A Nitro server without Nuxt adds
|
|
1058
|
+
them itself:
|
|
1059
|
+
|
|
1060
|
+
```ts
|
|
1061
|
+
// nitro.config.ts
|
|
1062
|
+
import { createRequire } from 'node:module';
|
|
1063
|
+
|
|
1064
|
+
const require = createRequire(import.meta.url);
|
|
1065
|
+
const fromRenderer = createRequire(require.resolve('@react-pdf/renderer'));
|
|
1066
|
+
const fonts = ['Courier', 'CourierBold', 'CourierBoldOblique', 'CourierOblique',
|
|
1067
|
+
'Helvetica', 'HelveticaBold', 'HelveticaBoldOblique', 'HelveticaOblique',
|
|
1068
|
+
'Symbol', 'TimesBold', 'TimesBoldItalic', 'TimesItalic', 'TimesRoman',
|
|
1069
|
+
'ZapfDingbats'];
|
|
1070
|
+
|
|
1071
|
+
export default defineNitroConfig({
|
|
1072
|
+
externals: {
|
|
1073
|
+
// require.resolve picks pdfkit's `require` export: the .cjs it loads.
|
|
1074
|
+
traceInclude: fonts.map((font) =>
|
|
1075
|
+
fromRenderer.resolve(`pdfkit/standard-fonts/${font}`)),
|
|
1076
|
+
},
|
|
1077
|
+
});
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
With `nitro.externals` set to a boolean, the module leaves Nitro's trace
|
|
1081
|
+
alone: add the `traceInclude` above yourself (as an `externals` object), or
|
|
1082
|
+
inline the server and use `bundleStandardFonts`. A server built with
|
|
1083
|
+
`noExternals` has no `node_modules` to trace into: use
|
|
1084
|
+
`bundleStandardFonts` instead ([above](#cannot-find-module-standard-fontshelvetica)).
|
|
1085
|
+
When the module cannot resolve pdfkit's fonts although `@react-pdf/renderer`
|
|
1086
|
+
is installed, `nuxi build` prints a `pdf fonts:` warning naming what failed.
|
|
1087
|
+
|
|
1039
1088
|
### `still references '#standard-fonts/' after the transform`
|
|
1040
1089
|
|
|
1041
1090
|
**When:** at build, from the `nxgt-material:pdfkit-standard-fonts` plugin
|
package/lib/nuxt/module.ts
CHANGED
|
@@ -5,10 +5,15 @@ import {
|
|
|
5
5
|
createResolver,
|
|
6
6
|
defineNuxtModule,
|
|
7
7
|
extendViteConfig,
|
|
8
|
+
useLogger,
|
|
8
9
|
} from '@nuxt/kit';
|
|
9
10
|
import { COMPOSABLE_IMPORTS, I18N_IMPORTS } from './auto-imports';
|
|
10
11
|
import { COMPONENT_NAMES } from './component-names';
|
|
11
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
addPdfFontsPlugin,
|
|
14
|
+
addPdfFontsTrace,
|
|
15
|
+
pdfkitStandardFontFiles,
|
|
16
|
+
} from './pdf-fonts';
|
|
12
17
|
|
|
13
18
|
export type ModuleOptions = {
|
|
14
19
|
/** Prepended to auto-imported component names. Empty by default. */
|
|
@@ -21,7 +26,9 @@ export type ModuleOptions = {
|
|
|
21
26
|
/**
|
|
22
27
|
* Bundle pdfkit's standard fonts into the Nitro server, for
|
|
23
28
|
* `@nxgt/material-vue/pdf` in a server whose runtime image has no
|
|
24
|
-
* `node_modules
|
|
29
|
+
* `node_modules` (`nitro.noExternals`). Default false: Nitro keeps the
|
|
30
|
+
* renderer external, and the module adds pdfkit's font files to what
|
|
31
|
+
* Nitro traces into `.output/server/node_modules`.
|
|
25
32
|
*/
|
|
26
33
|
bundleStandardFonts?: boolean;
|
|
27
34
|
};
|
|
@@ -48,7 +55,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
48
55
|
setup(
|
|
49
56
|
options: ModuleOptions,
|
|
50
57
|
nuxt: {
|
|
51
|
-
options: { build: { transpile: string[] } };
|
|
58
|
+
options: { rootDir: string; build: { transpile: string[] } };
|
|
52
59
|
hook: (name: 'nitro:config', fn: (config: object) => void) => void;
|
|
53
60
|
},
|
|
54
61
|
) {
|
|
@@ -91,9 +98,19 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
// @nxgt/material-core is not transpiled: Nitro traces it into
|
|
102
|
+
// .output/server/node_modules like any external, and inlines it with
|
|
103
|
+
// everything else under noExternals.
|
|
104
|
+
nuxt.hook('nitro:config', (config) => {
|
|
105
|
+
const logger = useLogger('@nxgt/material-vue');
|
|
106
|
+
addPdfFontsTrace(
|
|
107
|
+
config,
|
|
108
|
+
pdfkitStandardFontFiles(nuxt.options.rootDir, (message) =>
|
|
109
|
+
logger.warn(`pdf fonts: ${message}`),
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
if (options.pdf?.bundleStandardFonts) addPdfFontsPlugin(config);
|
|
113
|
+
});
|
|
97
114
|
|
|
98
115
|
addPlugin(resolver.resolve('./runtime/plugin'));
|
|
99
116
|
},
|
package/lib/nuxt/pdf-fonts.ts
CHANGED
|
@@ -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,
|
|
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.
|
|
3
|
+
"version": "0.23.1",
|
|
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.
|
|
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",
|