@jc-times/business-ui 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -321,3 +321,9 @@
321
321
 
322
322
  ## 0.2.52
323
323
  - AutoComplete and Combobox accept grouped options with non-selectable, muted headings and preserve filtering and keyboard selection.
324
+ # 0.3.2 — 2026-09-22 (patch)
325
+
326
+ - Render existing signature Widget appearances in Headless pages and thumbnails (`withForms: true`); rendering does not enable form editing or alter signed bytes. Add failed-before/passed-after Widget regression coverage.
327
+
328
+ - Fix missing Chinese and substituted Latin text in PDFs with unembedded fonts. Both PDFium viewers use stable same-origin Noto fallback configuration; assets and OFL licenses ship with the package, with no external CDN requests.
329
+ - Add desktop/mobile real PDF rendering coverage. Restoring `fontFallback: null` makes the same Chinese test fail with zero text pixels; explicit caller overrides remain supported.
@@ -29,3 +29,8 @@
29
29
  MIT, Copyright (c) 2019-present react-component. Source: https://github.com/react-component/cascader. Used as the external Cascader interaction dependency; license reproduced in licenses/rc-cascader-MIT.txt. Transitive dependencies retain their own notices in their installed packages.
30
30
 
31
31
  0.2.46 additionally bundles the React gesture entry of @embedpdf/plugin-zoom@2.15.0 with a pinned bounds/precision patch. Original MIT license: licenses/embedpdf-MIT.txt; patch: patches/@embedpdf__plugin-zoom@2.15.0.patch. Engine and core plugin implementations remain external.
32
+ # PDF fallback fonts
33
+
34
+ `assets/pdf-fonts` contains unmodified Noto Sans Hans and Noto Sans fonts from
35
+ `@embedpdf/fonts-sc@1.0.0` and `@embedpdf/fonts-latin@1.0.0`, under SIL OFL 1.1.
36
+ See the accompanying `OFL-CJK.txt`, `OFL-Latin.txt`, and source README.
@@ -0,0 +1,92 @@
1
+ This Font Software is licensed under the SIL Open Font License,
2
+ Version 1.1.
3
+
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+ -----------------------------------------------------------
8
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9
+ -----------------------------------------------------------
10
+
11
+ PREAMBLE
12
+ The goals of the Open Font License (OFL) are to stimulate worldwide
13
+ development of collaborative font projects, to support the font
14
+ creation efforts of academic and linguistic communities, and to
15
+ provide a free and open framework in which fonts may be shared and
16
+ improved in partnership with others.
17
+
18
+ The OFL allows the licensed fonts to be used, studied, modified and
19
+ redistributed freely as long as they are not sold by themselves. The
20
+ fonts, including any derivative works, can be bundled, embedded,
21
+ redistributed and/or sold with any software provided that any reserved
22
+ names are not used by derivative works. The fonts and derivatives,
23
+ however, cannot be released under any other type of license. The
24
+ requirement for fonts to remain under this license does not apply to
25
+ any document created using the fonts or their derivatives.
26
+
27
+ DEFINITIONS
28
+ "Font Software" refers to the set of files released by the Copyright
29
+ Holder(s) under this license and clearly marked as such. This may
30
+ include source files, build scripts and documentation.
31
+
32
+ "Reserved Font Name" refers to any names specified as such after the
33
+ copyright statement(s).
34
+
35
+ "Original Version" refers to the collection of Font Software
36
+ components as distributed by the Copyright Holder(s).
37
+
38
+ "Modified Version" refers to any derivative made by adding to,
39
+ deleting, or substituting -- in part or in whole -- any of the
40
+ components of the Original Version, by changing formats or by porting
41
+ the Font Software to a new environment.
42
+
43
+ "Author" refers to any designer, engineer, programmer, technical
44
+ writer or other person who contributed to the Font Software.
45
+
46
+ PERMISSION & CONDITIONS
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of the Font Software, to use, study, copy, merge, embed,
49
+ modify, redistribute, and sell modified and unmodified copies of the
50
+ Font Software, subject to the following conditions:
51
+
52
+ 1) Neither the Font Software nor any of its individual components, in
53
+ Original or Modified Versions, may be sold by itself.
54
+
55
+ 2) Original or Modified Versions of the Font Software may be bundled,
56
+ redistributed and/or sold with any software, provided that each copy
57
+ contains the above copyright notice and this license. These can be
58
+ included either as stand-alone text files, human-readable headers or
59
+ in the appropriate machine-readable metadata fields within text or
60
+ binary files as long as those fields can be easily viewed by the user.
61
+
62
+ 3) No Modified Version of the Font Software may use the Reserved Font
63
+ Name(s) unless explicit written permission is granted by the
64
+ corresponding Copyright Holder. This restriction only applies to the
65
+ primary font name as presented to the users.
66
+
67
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68
+ Software shall not be used to promote, endorse or advertise any
69
+ Modified Version, except to acknowledge the contribution(s) of the
70
+ Copyright Holder(s) and the Author(s) or with their explicit written
71
+ permission.
72
+
73
+ 5) The Font Software, modified or unmodified, in part or in whole,
74
+ must be distributed entirely under this license, and must not be
75
+ distributed under any other license. The requirement for fonts to
76
+ remain under this license does not apply to any document created using
77
+ the Font Software.
78
+
79
+ TERMINATION
80
+ This license becomes null and void if any of the above conditions are
81
+ not met.
82
+
83
+ DISCLAIMER
84
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,94 @@
1
+ Copyright 2018 The Noto Project Authors (github.com/googlei18n/noto-fonts)
2
+
3
+ This Font Software is licensed under the SIL Open Font License,
4
+ Version 1.1.
5
+
6
+ This license is copied below, and is also available with a FAQ at:
7
+ http://scripts.sil.org/OFL
8
+
9
+ -----------------------------------------------------------
10
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
+ -----------------------------------------------------------
12
+
13
+ PREAMBLE
14
+ The goals of the Open Font License (OFL) are to stimulate worldwide
15
+ development of collaborative font projects, to support the font
16
+ creation efforts of academic and linguistic communities, and to
17
+ provide a free and open framework in which fonts may be shared and
18
+ improved in partnership with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves. The
22
+ fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply to
27
+ any document created using the fonts or their derivatives.
28
+
29
+ DEFINITIONS
30
+ "Font Software" refers to the set of files released by the Copyright
31
+ Holder(s) under this license and clearly marked as such. This may
32
+ include source files, build scripts and documentation.
33
+
34
+ "Reserved Font Name" refers to any names specified as such after the
35
+ copyright statement(s).
36
+
37
+ "Original Version" refers to the collection of Font Software
38
+ components as distributed by the Copyright Holder(s).
39
+
40
+ "Modified Version" refers to any derivative made by adding to,
41
+ deleting, or substituting -- in part or in whole -- any of the
42
+ components of the Original Version, by changing formats or by porting
43
+ the Font Software to a new environment.
44
+
45
+ "Author" refers to any designer, engineer, programmer, technical
46
+ writer or other person who contributed to the Font Software.
47
+
48
+ PERMISSION & CONDITIONS
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of the Font Software, to use, study, copy, merge, embed,
51
+ modify, redistribute, and sell modified and unmodified copies of the
52
+ Font Software, subject to the following conditions:
53
+
54
+ 1) Neither the Font Software nor any of its individual components, in
55
+ Original or Modified Versions, may be sold by itself.
56
+
57
+ 2) Original or Modified Versions of the Font Software may be bundled,
58
+ redistributed and/or sold with any software, provided that each copy
59
+ contains the above copyright notice and this license. These can be
60
+ included either as stand-alone text files, human-readable headers or
61
+ in the appropriate machine-readable metadata fields within text or
62
+ binary files as long as those fields can be easily viewed by the user.
63
+
64
+ 3) No Modified Version of the Font Software may use the Reserved Font
65
+ Name(s) unless explicit written permission is granted by the
66
+ corresponding Copyright Holder. This restriction only applies to the
67
+ primary font name as presented to the users.
68
+
69
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
+ Software shall not be used to promote, endorse or advertise any
71
+ Modified Version, except to acknowledge the contribution(s) of the
72
+ Copyright Holder(s) and the Author(s) or with their explicit written
73
+ permission.
74
+
75
+ 5) The Font Software, modified or unmodified, in part or in whole,
76
+ must be distributed entirely under this license, and must not be
77
+ distributed under any other license. The requirement for fonts to
78
+ remain under this license does not apply to any document created using
79
+ the Font Software.
80
+
81
+ TERMINATION
82
+ This license becomes null and void if any of the above conditions are
83
+ not met.
84
+
85
+ DISCLAIMER
86
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # PDFium fallback fonts
2
+
3
+ Unmodified assets copied from exact npm packages `@embedpdf/fonts-sc@1.0.0`
4
+ and `@embedpdf/fonts-latin@1.0.0` (their `fonts/` directories). Noto Sans Hans
5
+ Regular provides Chinese glyphs; Noto Sans Regular/Bold/Italic/BoldItalic
6
+ provides Latin variants. Licenses accompany the font files.
7
+
8
+ The public viewer imports these through `@jc-times/business-ui/pdf-fonts/*?url`.
9
+ Consumer bundlers emit static same-origin assets. The renderer requests the
10
+ required font only when a PDF lacks its own font. These files must not be
11
+ inlined into the main JavaScript entry or loaded from a public CDN.
@@ -1,20 +1,21 @@
1
1
  import { DocumentViewer as e } from "../document-viewer/DocumentViewer.js";
2
- import { Suspense as t, lazy as n, useCallback as r, useMemo as i } from "react";
3
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
+ import { pdfFontFallback as t } from "./pdf-font-fallback.js";
3
+ import { Suspense as n, lazy as r, useCallback as i, useMemo as a } from "react";
4
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
5
  //#region src/document-viewer-v2/DocumentViewerV2.tsx
5
- var s = n(() => import("@embedpdf/react-pdf-viewer").then((e) => ({ default: e.PDFViewer }))), c = n(() => import("./HeadlessPdfViewer.js")), l = [
6
+ var c = r(() => import("@embedpdf/react-pdf-viewer").then((e) => ({ default: e.PDFViewer }))), l = r(() => import("./HeadlessPdfViewer.js")), u = [
6
7
  "annotation",
7
8
  "redaction",
8
9
  "insert",
9
10
  "form"
10
- ], u = "data-business-ui-document-viewer-v2-toolbar", d = "\n[data-epdf-i=\"main-toolbar\"] {\n min-height: 52px;\n gap: 8px;\n padding: 7px 12px;\n border-bottom-color: var(--ui-border, #dde0eb);\n background: var(--ui-surface, #fff);\n box-shadow: 0 1px 0 color-mix(in srgb, var(--ui-text, #242837) 3%, transparent);\n}\n\n[data-epdf-i=\"main-toolbar\"] [data-epdf-i$=\"-group\"] {\n gap: 4px;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) {\n width: 36px;\n min-width: 36px;\n height: 36px;\n padding: 7px;\n border: 1px solid transparent;\n border-radius: var(--ui-radius, 8px);\n color: var(--ui-muted, #70778b);\n background: transparent;\n box-shadow: none;\n transition:\n color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n background-color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n border-color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n box-shadow var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease);\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]):hover:not(:disabled) {\n border-color: color-mix(in srgb, var(--ui-primary, #5965a8) 22%, var(--ui-border, #dde0eb));\n color: var(--ui-primary-hover, #414a78);\n background: var(--ui-primary-soft, #eef0fb);\n box-shadow: none;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]):focus-visible {\n border-color: var(--ui-primary, #5965a8);\n outline: 3px solid var(--ui-focus, rgb(89 101 168 / 28%));\n outline-offset: 1px;\n}\n\n[data-epdf-i=\"main-toolbar\"] button.bg-interactive-selected {\n border-color: color-mix(in srgb, var(--ui-primary, #5965a8) 42%, var(--ui-border, #dde0eb));\n color: var(--ui-primary-hover, #414a78);\n background: var(--ui-primary-soft, #eef0fb);\n box-shadow: 0 1px 3px color-mix(in srgb, var(--ui-primary, #5965a8) 16%, transparent);\n}\n\n[data-epdf-i=\"main-toolbar\"] button:disabled {\n opacity: .48;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) > svg {\n width: 20px;\n height: 20px;\n}\n\n[data-epdf-i=\"zoom-toolbar\"] > .relative > .flex {\n height: 36px;\n padding-left: 8px;\n overflow: hidden;\n border: 1px solid var(--ui-border, #dde0eb);\n border-radius: var(--ui-radius, 8px);\n color: var(--ui-text, #242837);\n background: var(--ui-surface, #fff);\n}\n\n[data-epdf-i=\"zoom-toolbar\"] input[name=\"zoom\"] {\n width: 36px;\n color: var(--ui-text, #242837);\n font-weight: 700;\n}\n\n[data-epdf-i=\"zoom-toolbar\"] > .relative > .flex > button {\n width: 34px;\n min-width: 34px;\n height: 34px;\n padding: 7px;\n border: 0;\n border-radius: 6px;\n}\n\n[data-epdf-i=\"main-toolbar\"] [aria-hidden=\"true\"] > div {\n background: var(--ui-border, #dde0eb);\n}\n\n@container (max-width: 640px) {\n [data-epdf-i=\"main-toolbar\"] {\n min-height: 56px;\n padding: 7px 8px;\n }\n\n [data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) {\n width: 40px;\n min-width: 40px;\n height: 40px;\n }\n}\n";
11
- function f(e) {
11
+ ], d = "data-business-ui-document-viewer-v2-toolbar", f = "\n[data-epdf-i=\"main-toolbar\"] {\n min-height: 52px;\n gap: 8px;\n padding: 7px 12px;\n border-bottom-color: var(--ui-border, #dde0eb);\n background: var(--ui-surface, #fff);\n box-shadow: 0 1px 0 color-mix(in srgb, var(--ui-text, #242837) 3%, transparent);\n}\n\n[data-epdf-i=\"main-toolbar\"] [data-epdf-i$=\"-group\"] {\n gap: 4px;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) {\n width: 36px;\n min-width: 36px;\n height: 36px;\n padding: 7px;\n border: 1px solid transparent;\n border-radius: var(--ui-radius, 8px);\n color: var(--ui-muted, #70778b);\n background: transparent;\n box-shadow: none;\n transition:\n color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n background-color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n border-color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n box-shadow var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease);\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]):hover:not(:disabled) {\n border-color: color-mix(in srgb, var(--ui-primary, #5965a8) 22%, var(--ui-border, #dde0eb));\n color: var(--ui-primary-hover, #414a78);\n background: var(--ui-primary-soft, #eef0fb);\n box-shadow: none;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]):focus-visible {\n border-color: var(--ui-primary, #5965a8);\n outline: 3px solid var(--ui-focus, rgb(89 101 168 / 28%));\n outline-offset: 1px;\n}\n\n[data-epdf-i=\"main-toolbar\"] button.bg-interactive-selected {\n border-color: color-mix(in srgb, var(--ui-primary, #5965a8) 42%, var(--ui-border, #dde0eb));\n color: var(--ui-primary-hover, #414a78);\n background: var(--ui-primary-soft, #eef0fb);\n box-shadow: 0 1px 3px color-mix(in srgb, var(--ui-primary, #5965a8) 16%, transparent);\n}\n\n[data-epdf-i=\"main-toolbar\"] button:disabled {\n opacity: .48;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) > svg {\n width: 20px;\n height: 20px;\n}\n\n[data-epdf-i=\"zoom-toolbar\"] > .relative > .flex {\n height: 36px;\n padding-left: 8px;\n overflow: hidden;\n border: 1px solid var(--ui-border, #dde0eb);\n border-radius: var(--ui-radius, 8px);\n color: var(--ui-text, #242837);\n background: var(--ui-surface, #fff);\n}\n\n[data-epdf-i=\"zoom-toolbar\"] input[name=\"zoom\"] {\n width: 36px;\n color: var(--ui-text, #242837);\n font-weight: 700;\n}\n\n[data-epdf-i=\"zoom-toolbar\"] > .relative > .flex > button {\n width: 34px;\n min-width: 34px;\n height: 34px;\n padding: 7px;\n border: 0;\n border-radius: 6px;\n}\n\n[data-epdf-i=\"main-toolbar\"] [aria-hidden=\"true\"] > div {\n background: var(--ui-border, #dde0eb);\n}\n\n@container (max-width: 640px) {\n [data-epdf-i=\"main-toolbar\"] {\n min-height: 56px;\n padding: 7px 8px;\n }\n\n [data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) {\n width: 40px;\n min-width: 40px;\n height: 40px;\n }\n}\n";
12
+ function p(e) {
12
13
  let { shadowRoot: t } = e;
13
14
  if (!t || t.querySelector("[data-business-ui-document-viewer-v2-toolbar]")) return;
14
15
  let n = t.ownerDocument.createElement("style");
15
- n.setAttribute(u, ""), n.textContent = d, t.append(n);
16
+ n.setAttribute(d, ""), n.textContent = f, t.append(n);
16
17
  }
17
- var p = {
18
+ var m = {
18
19
  preference: "system",
19
20
  light: {
20
21
  background: {
@@ -58,113 +59,113 @@ var p = {
58
59
  }
59
60
  }
60
61
  };
61
- function m(e) {
62
+ function h(e) {
62
63
  return {
63
- ...p,
64
+ ...m,
64
65
  ...e,
65
66
  light: {
66
- ...p.light,
67
+ ...m.light,
67
68
  ...e?.light,
68
69
  background: {
69
- ...p.light?.background,
70
+ ...m.light?.background,
70
71
  ...e?.light?.background
71
72
  },
72
73
  foreground: {
73
- ...p.light?.foreground,
74
+ ...m.light?.foreground,
74
75
  ...e?.light?.foreground
75
76
  },
76
77
  border: {
77
- ...p.light?.border,
78
+ ...m.light?.border,
78
79
  ...e?.light?.border
79
80
  },
80
81
  accent: {
81
- ...p.light?.accent,
82
+ ...m.light?.accent,
82
83
  ...e?.light?.accent
83
84
  },
84
85
  interactive: {
85
- ...p.light?.interactive,
86
+ ...m.light?.interactive,
86
87
  ...e?.light?.interactive
87
88
  }
88
89
  }
89
90
  };
90
91
  }
91
- function h(e, t = {}) {
92
- let { documentManager: n, disabledCategories: r, fonts: i, i18n: a, theme: o, ...s } = t, { id: c, kind: u, ...d } = e;
92
+ function g(e, n = {}) {
93
+ let { documentManager: r, disabledCategories: i, fonts: a, i18n: o, theme: s, ...c } = n, { id: l, kind: d, ...f } = e;
93
94
  return {
94
95
  worker: !0,
95
96
  tabBar: "never",
96
- fontFallback: null,
97
- ...s,
98
- disabledCategories: r ?? [...l],
97
+ fontFallback: t,
98
+ ...c,
99
+ disabledCategories: i ?? [...u],
99
100
  fonts: {
100
101
  ui: null,
101
102
  signature: null,
102
- ...i
103
+ ...a
103
104
  },
104
105
  i18n: {
105
106
  defaultLocale: "zh-CN",
106
- ...a
107
+ ...o
107
108
  },
108
- theme: m(o),
109
+ theme: h(s),
109
110
  documentManager: {
110
111
  maxDocuments: 1,
111
- ...n,
112
+ ...r,
112
113
  initialDocuments: [{
113
- ...d,
114
- documentId: c,
114
+ ...f,
115
+ documentId: l,
115
116
  autoActivate: !0
116
117
  }]
117
118
  }
118
119
  };
119
120
  }
120
- function g(n) {
121
- return n.renderer === "headless" ? /* @__PURE__ */ a(t, {
122
- fallback: /* @__PURE__ */ a("div", {
121
+ function _(t) {
122
+ return t.renderer === "headless" ? /* @__PURE__ */ o(n, {
123
+ fallback: /* @__PURE__ */ o("div", {
123
124
  role: "status",
124
125
  children: "正在加载 PDF 查看器…"
125
126
  }),
126
- children: /* @__PURE__ */ a(c, { ...n }, `${n.source.kind}:${n.source.id}`)
127
- }) : _(n) ? /* @__PURE__ */ a(v, { ...n }) : /* @__PURE__ */ a(e, {
128
- ...n,
129
- className: ["ui-document-viewer-v2-compat", n.className].filter(Boolean).join(" ")
127
+ children: /* @__PURE__ */ o(l, { ...t }, `${t.source.kind}:${t.source.id}`)
128
+ }) : v(t) ? /* @__PURE__ */ o(y, { ...t }) : /* @__PURE__ */ o(e, {
129
+ ...t,
130
+ className: ["ui-document-viewer-v2-compat", t.className].filter(Boolean).join(" ")
130
131
  });
131
132
  }
132
- function _(e) {
133
+ function v(e) {
133
134
  return e.source.kind === "url" || e.source.kind === "buffer";
134
135
  }
135
- function v({ source: e, config: n, className: c, style: l, layoutMode: u = "standalone", ariaLabel: d = "PDF 文档查看器", onInit: p, onReady: m, title: g, toolbar: _, footer: v }) {
136
- let y = i(() => h(e, n), [e, n]), b = r((e) => {
137
- f(e), p?.(e);
138
- }, [p]);
139
- return /* @__PURE__ */ o("section", {
136
+ function y({ source: e, config: t, className: r, style: l, layoutMode: u = "standalone", ariaLabel: d = "PDF 文档查看器", onInit: f, onReady: m, title: h, toolbar: _, footer: v }) {
137
+ let y = a(() => g(e, t), [e, t]), b = i((e) => {
138
+ p(e), f?.(e);
139
+ }, [f]);
140
+ return /* @__PURE__ */ s("section", {
140
141
  className: [
141
142
  "ui-document-viewer-v2",
142
143
  u === "fill" && "ui-viewer-fill",
143
- c
144
+ r
144
145
  ].filter(Boolean).join(" "),
145
146
  style: l,
146
147
  "aria-label": d,
147
148
  children: [
148
- (g !== void 0 || _ !== void 0) && /* @__PURE__ */ o("div", {
149
+ (h !== void 0 || _ !== void 0) && /* @__PURE__ */ s("div", {
149
150
  className: "ui-viewer-toolbar",
150
- children: [g !== void 0 && /* @__PURE__ */ a("div", {
151
+ children: [h !== void 0 && /* @__PURE__ */ o("div", {
151
152
  className: "ui-viewer-title",
152
- children: g
153
+ children: h
153
154
  }), _]
154
155
  }),
155
- /* @__PURE__ */ a(t, {
156
- fallback: /* @__PURE__ */ a("div", {
156
+ /* @__PURE__ */ o(n, {
157
+ fallback: /* @__PURE__ */ o("div", {
157
158
  role: "status",
158
159
  children: "正在加载 PDF 查看器…"
159
160
  }),
160
- children: /* @__PURE__ */ a(s, {
161
+ children: /* @__PURE__ */ o(c, {
161
162
  className: "ui-document-viewer-v2-engine",
162
163
  config: y,
163
164
  onInit: b,
164
165
  onReady: m
165
166
  }, e.id)
166
167
  }),
167
- v !== void 0 && /* @__PURE__ */ a("div", {
168
+ v !== void 0 && /* @__PURE__ */ o("div", {
168
169
  className: "ui-viewer-footer",
169
170
  children: v
170
171
  })
@@ -172,4 +173,4 @@ function v({ source: e, config: n, className: c, style: l, layoutMode: u = "stan
172
173
  });
173
174
  }
174
175
  //#endregion
175
- export { l as DOCUMENT_VIEWER_V2_DISABLED_CATEGORIES, u as DOCUMENT_VIEWER_V2_TOOLBAR_STYLE_ATTRIBUTE, g as DocumentViewerV2, f as applyDocumentViewerV2ToolbarStyles, h as createDocumentViewerV2Config };
176
+ export { u as DOCUMENT_VIEWER_V2_DISABLED_CATEGORIES, d as DOCUMENT_VIEWER_V2_TOOLBAR_STYLE_ATTRIBUTE, _ as DocumentViewerV2, p as applyDocumentViewerV2ToolbarStyles, g as createDocumentViewerV2Config };
@@ -2,42 +2,43 @@ import { Button as e } from "../Button.js";
2
2
  import { PdfWorkspace as t } from "../document-viewer/PdfWorkspace.js";
3
3
  import { PdfToolbar as n } from "../document-viewer/PdfToolbar.js";
4
4
  import { usePdfViewport as r } from "../document-viewer/usePdfViewport.js";
5
- import { ZoomGestureWrapper as i, react_exports as a, useZoom as o } from "../vendor/embedpdf-zoom-react19.js";
6
- import { HeadlessSearch as s } from "./HeadlessSearch.js";
7
- import { useEffect as c, useLayoutEffect as ee, useMemo as te, useRef as l, useState as u } from "react";
5
+ import { pdfFontFallback as i } from "./pdf-font-fallback.js";
6
+ import { ZoomGestureWrapper as a, react_exports as o, useZoom as s } from "../vendor/embedpdf-zoom-react19.js";
7
+ import { HeadlessSearch as ee } from "./HeadlessSearch.js";
8
+ import { useEffect as c, useLayoutEffect as te, useMemo as ne, useRef as l, useState as u } from "react";
8
9
  import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
- import { Search as ne, X as re } from "lucide-react";
10
+ import { Search as re, X as ie } from "lucide-react";
10
11
  import { createPluginRegistration as p } from "@embedpdf/core";
11
- import { EmbedPDF as m, useDocumentState as ie } from "@embedpdf/core/react";
12
+ import { EmbedPDF as m, useDocumentState as ae } from "@embedpdf/core/react";
12
13
  import { usePdfiumEngine as h } from "@embedpdf/engines/react";
13
14
  import { DocumentManagerPluginPackage as g } from "@embedpdf/plugin-document-manager/react";
14
- import { Viewport as ae, ViewportPluginPackage as _, useViewportCapability as oe } from "@embedpdf/plugin-viewport/react";
15
- import { ScrollPluginPackage as v, Scroller as se, useScrollCapability as ce } from "@embedpdf/plugin-scroll/react";
16
- import { RenderLayer as le, RenderPluginPackage as y } from "@embedpdf/plugin-render/react";
17
- import { Rotate as ue, RotatePluginPackage as b, useRotate as de } from "@embedpdf/plugin-rotate/react";
18
- import { ThumbImg as fe, ThumbnailPluginPackage as x, ThumbnailsPane as pe } from "@embedpdf/plugin-thumbnail/react";
19
- import { SearchLayer as me, SearchPluginPackage as S, useSearch as he } from "@embedpdf/plugin-search/react";
20
- import { SelectionLayer as ge, SelectionPluginPackage as _e, useSelectionCapability as ve } from "@embedpdf/plugin-selection/react";
21
- import { InteractionManagerPluginPackage as C, PagePointerProvider as ye } from "@embedpdf/plugin-interaction-manager/react";
15
+ import { Viewport as oe, ViewportPluginPackage as _, useViewportCapability as se } from "@embedpdf/plugin-viewport/react";
16
+ import { ScrollPluginPackage as v, Scroller as ce, useScrollCapability as le } from "@embedpdf/plugin-scroll/react";
17
+ import { RenderLayer as ue, RenderPluginPackage as y } from "@embedpdf/plugin-render/react";
18
+ import { Rotate as de, RotatePluginPackage as b, useRotate as fe } from "@embedpdf/plugin-rotate/react";
19
+ import { ThumbImg as pe, ThumbnailPluginPackage as x, ThumbnailsPane as me } from "@embedpdf/plugin-thumbnail/react";
20
+ import { SearchLayer as he, SearchPluginPackage as S, useSearch as ge } from "@embedpdf/plugin-search/react";
21
+ import { SelectionLayer as _e, SelectionPluginPackage as C, useSelectionCapability as ve } from "@embedpdf/plugin-selection/react";
22
+ import { InteractionManagerPluginPackage as w, PagePointerProvider as ye } from "@embedpdf/plugin-interaction-manager/react";
22
23
  //#region src/document-viewer-v2/HeadlessPdfViewer.tsx
23
- var w = "(max-width: 900px), (hover: none) and (pointer: coarse)";
24
+ var T = "(max-width: 900px), (hover: none) and (pointer: coarse)";
24
25
  function be(e) {
25
- let [t, n] = u(() => e && typeof window < "u" && window.matchMedia(w).matches);
26
+ let [t, n] = u(() => e && typeof window < "u" && window.matchMedia(T).matches);
26
27
  return c(() => {
27
28
  if (!e) {
28
29
  n(!1);
29
30
  return;
30
31
  }
31
- let t = window.matchMedia(w), r = () => n(t.matches);
32
+ let t = window.matchMedia(T), r = () => n(t.matches);
32
33
  return r(), t.addEventListener("change", r), () => t.removeEventListener("change", r);
33
34
  }, [e]), t;
34
35
  }
35
- function T(e) {
36
+ function E(e) {
36
37
  let { engine: t, isLoading: n, error: r } = h({
37
38
  worker: !0,
38
- fontFallback: null,
39
+ fontFallback: i,
39
40
  ...e.engineOptions
40
- }), [i] = u(() => {
41
+ }), [a] = u(() => {
41
42
  let { id: t, kind: n, ...r } = e.source;
42
43
  return [
43
44
  p(g, { initialDocuments: [{
@@ -47,16 +48,19 @@ function T(e) {
47
48
  }] }),
48
49
  p(_),
49
50
  p(v, { defaultPageGap: 20 }),
50
- p(y, { withAnnotations: !0 }),
51
- p(a.ZoomPluginPackage, {
51
+ p(y, {
52
+ withAnnotations: !0,
53
+ withForms: !0
54
+ }),
55
+ p(o.ZoomPluginPackage, {
52
56
  defaultZoomLevel: 1,
53
57
  minZoom: e.initialZoom === "fit-width" ? .1 : .5,
54
58
  maxZoom: 3
55
59
  }),
56
60
  p(b),
57
- p(C, { exclusionRules: { dataAttributes: ["data-pdf-business-control"] } }),
61
+ p(w, { exclusionRules: { dataAttributes: ["data-pdf-business-control"] } }),
58
62
  p(S),
59
- p(_e, { marquee: { enabled: !1 } }),
63
+ p(C, { marquee: { enabled: !1 } }),
60
64
  p(x, { width: 100 })
61
65
  ];
62
66
  });
@@ -68,44 +72,44 @@ function T(e) {
68
72
  children: "正在加载 PDF 引擎…"
69
73
  }) : /* @__PURE__ */ d(m, {
70
74
  engine: t,
71
- plugins: i,
75
+ plugins: a,
72
76
  onInitialized: async (t) => {
73
77
  e.onReady?.(t);
74
78
  },
75
- children: /* @__PURE__ */ d(E, { ...e })
79
+ children: /* @__PURE__ */ d(D, { ...e })
76
80
  });
77
81
  }
78
- function E(p) {
79
- let m = p.source.id, h = ie(m), g = h?.document, { provides: _ } = ce(), v = te(() => _?.forDocument(m), [_, m]), { provides: y, state: b } = o(m), { provides: x } = oe(), { provides: S } = ve(), { provides: _e } = he(m), { provides: C, rotation: w } = de(m), T = r(m), [E, D] = u(1), [O, k] = u(null), A = be(p.mobileMode === "continuous-reader"), j = p.searchMode === "collapsible", M = p.features?.search !== !1, [N, P] = u(!j), F = g?.pages.length ?? 0, I = Math.max(1, Math.min(F || 1, p.currentPage ?? E)), L = p.pageMode === "single" && !A, R = p.features?.textSelection !== !1 && !A, z = l(p);
80
- z.current = p, c(() => {
82
+ function D(i) {
83
+ let p = i.source.id, m = ae(p), h = m?.document, { provides: g } = le(), _ = ne(() => g?.forDocument(p), [g, p]), { provides: v, state: y } = s(p), { provides: b } = se(), { provides: x } = ve(), { provides: S } = ge(p), { provides: C, rotation: w } = fe(p), T = r(p), [E, D] = u(1), [O, k] = u(null), A = be(i.mobileMode === "continuous-reader"), j = i.searchMode === "collapsible", M = i.features?.search !== !1, [N, P] = u(!j), F = h?.pages.length ?? 0, I = Math.max(1, Math.min(F || 1, i.currentPage ?? E)), L = i.pageMode === "single" && !A, R = i.features?.textSelection !== !1 && !A, z = l(i);
84
+ z.current = i, c(() => {
81
85
  P(!j), k(null);
82
- }, [m, j]);
83
- let B = h?.scale ?? 1, V = l(!1), H = l(p.currentPage ?? 1), U = l(!0), W = l(I), G = l(L), K = l(null);
84
- ee(() => {
86
+ }, [p, j]);
87
+ let B = m?.scale ?? 1, V = l(!1), H = l(i.currentPage ?? 1), U = l(!0), W = l(I), G = l(L), K = l(null);
88
+ te(() => {
85
89
  (W.current !== I || G.current !== L) && ((G.current !== L || I !== K.current) && (H.current = I), G.current !== L && (U.current = !0), W.current = I, G.current = L, K.current = null);
86
90
  }, [I, L]);
87
- let q = l(y);
88
- q.current = y, c(() => {
89
- if (!x || !F) return;
91
+ let q = l(v);
92
+ q.current = v, c(() => {
93
+ if (!b || !F) return;
90
94
  let e = () => {
91
- let e = x.forDocument(m).getMetrics();
92
- !V.current && e.clientWidth && e.clientHeight && q.current && (V.current = !0, q.current.requestZoom(z.current.zoom ?? (z.current.initialZoom === "fit-width" ? a.ZoomMode.FitWidth : z.current.initialZoom ?? 1)));
93
- }, t = x.onViewportResize((t) => {
94
- t.documentId === m && e();
95
+ let e = b.forDocument(p).getMetrics();
96
+ !V.current && e.clientWidth && e.clientHeight && q.current && (V.current = !0, q.current.requestZoom(z.current.zoom ?? (z.current.initialZoom === "fit-width" ? o.ZoomMode.FitWidth : z.current.initialZoom ?? 1)));
97
+ }, t = b.onViewportResize((t) => {
98
+ t.documentId === p && e();
95
99
  });
96
100
  return e(), t;
97
101
  }, [
98
- x,
99
- m,
102
+ b,
103
+ p,
100
104
  F
101
105
  ]), c(() => {
102
- if (v && !L) return v.onPageChange((e) => {
106
+ if (_ && !L) return _.onPageChange((e) => {
103
107
  V.current && !U.current && (z.current.currentPage === void 0 && D(e.pageNumber), e.pageNumber !== z.current.currentPage && (K.current = e.pageNumber, z.current.onCurrentPageChange?.(e.pageNumber)));
104
108
  });
105
- }, [v, L]), c(() => {
106
- if (!v || L || !F) return;
109
+ }, [_, L]), c(() => {
110
+ if (!_ || L || !F) return;
107
111
  let e = () => {
108
- H.current !== null && (U.current = !0, v.scrollToPage({
112
+ H.current !== null && (U.current = !0, _.scrollToPage({
109
113
  pageNumber: H.current,
110
114
  behavior: "instant",
111
115
  ...O?.page === H.current ? {
@@ -114,19 +118,19 @@ function E(p) {
114
118
  alignY: 40
115
119
  } : {}
116
120
  }));
117
- }, t = _?.onLayoutReady((t) => {
118
- t.documentId === m && e();
119
- }), n = x?.onViewportResize((t) => {
120
- t.documentId === m && e();
121
+ }, t = g?.onLayoutReady((t) => {
122
+ t.documentId === p && e();
123
+ }), n = b?.onViewportResize((t) => {
124
+ t.documentId === p && e();
121
125
  }), r = requestAnimationFrame(e);
122
126
  return () => {
123
127
  cancelAnimationFrame(r), t?.(), n?.();
124
128
  };
125
129
  }, [
126
- v,
127
130
  _,
128
- x,
129
- m,
131
+ g,
132
+ b,
133
+ p,
130
134
  L,
131
135
  F,
132
136
  I,
@@ -134,9 +138,9 @@ function E(p) {
134
138
  w,
135
139
  O
136
140
  ]), c(() => {
137
- if (!L || !O || !x) return;
138
- let e = () => xe(T.containerRef.current, O, x.forDocument(m)), t = x.onViewportResize((t) => {
139
- t.documentId === m && e();
141
+ if (!L || !O || !b) return;
142
+ let e = () => xe(T.containerRef.current, O, b.forDocument(p)), t = b.onViewportResize((t) => {
143
+ t.documentId === p && e();
140
144
  }), n = requestAnimationFrame(e);
141
145
  return () => {
142
146
  cancelAnimationFrame(n), t();
@@ -144,23 +148,23 @@ function E(p) {
144
148
  }, [
145
149
  L,
146
150
  O,
147
- x,
148
- m,
151
+ b,
152
+ p,
149
153
  I,
150
154
  B,
151
155
  w
152
156
  ]);
153
- let J = l(p.zoom ?? null), Y = l(p.rotation ?? null), X = l(B), Se = l(w);
157
+ let J = l(i.zoom ?? null), Y = l(i.rotation ?? null), X = l(B), Se = l(w);
154
158
  c(() => {
155
- p.zoom !== void 0 && y && F && Math.abs(p.zoom - B) > .001 && (J.current = p.zoom, y.requestZoom(p.zoom));
159
+ i.zoom !== void 0 && v && F && Math.abs(i.zoom - B) > .001 && (J.current = i.zoom, v.requestZoom(i.zoom));
156
160
  }, [
157
- p.zoom,
158
- !!y,
161
+ i.zoom,
162
+ !!v,
159
163
  F
160
164
  ]), c(() => {
161
- p.rotation !== void 0 && C && F && p.rotation !== w * 90 && (Y.current = p.rotation, C.setRotation((p.rotation / 90 % 4 + 4) % 4));
165
+ i.rotation !== void 0 && C && F && i.rotation !== w * 90 && (Y.current = i.rotation, C.setRotation((i.rotation / 90 % 4 + 4) % 4));
162
166
  }, [
163
- p.rotation,
167
+ i.rotation,
164
168
  !!C,
165
169
  F
166
170
  ]), c(() => {
@@ -176,8 +180,8 @@ function E(p) {
176
180
  }
177
181
  Se.current !== w && z.current.onRotationChange?.(w * 90), Se.current = w;
178
182
  }, [w]), c(() => {
179
- let e = p.focusTarget, t = e && g?.pages[e.page - 1];
180
- e && t && v && !L && (U.current = !0, v.scrollToPage({
183
+ let e = i.focusTarget, t = e && h?.pages[e.page - 1];
184
+ e && t && _ && !L && (U.current = !0, _.scrollToPage({
181
185
  pageNumber: e.page,
182
186
  pageCoordinates: {
183
187
  x: t.size.width / 2,
@@ -187,8 +191,8 @@ function E(p) {
187
191
  behavior: "instant"
188
192
  }));
189
193
  }, [
190
- p.focusTarget?.token,
191
- v,
194
+ i.focusTarget?.token,
195
+ _,
192
196
  F,
193
197
  L
194
198
  ]);
@@ -197,54 +201,54 @@ function E(p) {
197
201
  }, Q = (e) => {
198
202
  K.current = null;
199
203
  let t = Math.max(1, Math.min(F, e));
200
- p.currentPage === void 0 && D(t), p.onCurrentPageChange?.(t);
204
+ i.currentPage === void 0 && D(t), i.onCurrentPageChange?.(t);
201
205
  }, Ce = (e) => {
202
- let t = g?.pages[e];
206
+ let t = h?.pages[e];
203
207
  if (!t) return null;
204
- let n = (t.rotation + w) % 4, { width: r, height: i } = t.size, a = {
205
- documentId: m,
208
+ let n = (t.rotation + w) % 4, { width: r, height: a } = t.size, o = {
209
+ documentId: p,
206
210
  page: e + 1,
207
211
  pageIndex: e,
208
212
  width: r,
209
- height: i,
213
+ height: a,
210
214
  zoom: B,
211
215
  rotation: n * 90
212
- }, o = n % 2 == 1;
216
+ }, s = n % 2 == 1;
213
217
  return /* @__PURE__ */ d("div", {
214
218
  className: "ui-v2-native-page",
215
219
  "data-page": e + 1,
216
220
  style: {
217
221
  position: "relative",
218
- width: (o ? i : r) * B,
219
- height: (o ? r : i) * B
222
+ width: (s ? a : r) * B,
223
+ height: (s ? r : a) * B
220
224
  },
221
225
  children: /* @__PURE__ */ d(ye, {
222
- documentId: m,
226
+ documentId: p,
223
227
  pageIndex: e,
224
228
  rotation: n,
225
229
  scale: B,
226
- children: /* @__PURE__ */ f(ue, {
227
- documentId: m,
230
+ children: /* @__PURE__ */ f(de, {
231
+ documentId: p,
228
232
  pageIndex: e,
229
233
  rotation: n,
230
234
  style: {
231
235
  width: r * B,
232
- height: i * B
236
+ height: a * B
233
237
  },
234
238
  children: [
235
- p.renderPage ? p.renderPage({
239
+ i.renderPage ? i.renderPage({
236
240
  page: e + 1,
237
241
  zoom: B,
238
242
  rotation: n * 90
239
- }) : /* @__PURE__ */ d(le, {
243
+ }) : /* @__PURE__ */ d(ue, {
240
244
  draggable: !1,
241
- documentId: m,
245
+ documentId: p,
242
246
  pageIndex: e,
243
247
  "aria-label": `第 ${e + 1} 页`
244
248
  }),
245
- M && N && /* @__PURE__ */ d(me, {
249
+ M && N && /* @__PURE__ */ d(he, {
246
250
  "data-ui-search-layer": !0,
247
- documentId: m,
251
+ documentId: p,
248
252
  pageIndex: e,
249
253
  scale: B
250
254
  }),
@@ -259,24 +263,24 @@ function E(p) {
259
263
  pointerEvents: "none"
260
264
  }
261
265
  }),
262
- R && /* @__PURE__ */ d(ge, {
263
- documentId: m,
266
+ R && /* @__PURE__ */ d(_e, {
267
+ documentId: p,
264
268
  pageIndex: e,
265
269
  scale: B,
266
270
  rotation: 0
267
271
  }),
268
- p.renderPageOverlay && /* @__PURE__ */ d("div", {
272
+ i.renderPageOverlay && /* @__PURE__ */ d("div", {
269
273
  className: "ui-v2-page-overlay",
270
274
  style: {
271
275
  position: "absolute",
272
276
  inset: 0,
273
277
  width: r,
274
- height: i,
278
+ height: a,
275
279
  transform: `scale(${B})`,
276
280
  transformOrigin: "0 0",
277
281
  pointerEvents: "none"
278
282
  },
279
- children: p.renderPageOverlay(a)
283
+ children: i.renderPageOverlay(o)
280
284
  })
281
285
  ]
282
286
  })
@@ -288,61 +292,61 @@ function E(p) {
288
292
  "aria-expanded": N,
289
293
  "aria-label": N ? "收起文档搜索" : "搜索文档",
290
294
  onClick: () => {
291
- N && (_e?.stopSearch(), k(null)), P(!N);
295
+ N && (S?.stopSearch(), k(null)), P(!N);
292
296
  },
293
- children: [d(N ? re : ne, { size: 15 }), /* @__PURE__ */ d("span", {
297
+ children: [d(N ? ie : re, { size: 15 }), /* @__PURE__ */ d("span", {
294
298
  className: "ui-mobile-reader-search-label",
295
299
  children: N ? "收起搜索" : "搜索文档"
296
300
  })]
297
301
  });
298
302
  return /* @__PURE__ */ f("section", {
299
303
  ref: T.containerRef,
300
- style: p.style,
304
+ style: i.style,
301
305
  onKeyDown: (e) => {
302
306
  if (!R || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "c" || e.target.closest("input, textarea, [contenteditable=\"true\"]")) return;
303
- let t = S?.forDocument(m);
307
+ let t = x?.forDocument(p);
304
308
  t?.getState().selection && (e.preventDefault(), t.copyToClipboard());
305
309
  },
306
- "aria-label": p.ariaLabel ?? "PDF 文档查看器",
310
+ "aria-label": i.ariaLabel ?? "PDF 文档查看器",
307
311
  className: [
308
312
  "ui-document-viewer",
309
313
  "ui-document-viewer-v2-headless",
310
- p.layoutMode === "fill" && "ui-viewer-fill",
314
+ i.layoutMode === "fill" && "ui-viewer-fill",
311
315
  A && "ui-mobile-continuous-reader",
312
316
  T.fullscreen && "ui-viewer-fullscreen",
313
- p.className
317
+ i.className
314
318
  ].filter(Boolean).join(" "),
315
319
  children: [
316
- p.showToolbar !== !1 && /* @__PURE__ */ f("div", {
320
+ i.showToolbar !== !1 && /* @__PURE__ */ f("div", {
317
321
  className: "ui-viewer-toolbar",
318
322
  children: [
319
- p.title !== void 0 && /* @__PURE__ */ d("div", {
323
+ i.title !== void 0 && /* @__PURE__ */ d("div", {
320
324
  className: "ui-viewer-title",
321
- children: p.title
325
+ children: i.title
322
326
  }),
323
- p.toolbar,
327
+ i.toolbar,
324
328
  $,
325
329
  /* @__PURE__ */ d(n, {
326
- zoom: b.currentZoomLevel,
330
+ zoom: y.currentZoomLevel,
327
331
  disabled: !F,
328
332
  fullscreen: T.fullscreen,
329
333
  canZoomIn: B < 3,
330
- canZoomOut: B > (p.initialZoom === "fit-width" ? .1 : .5),
331
- onZoomIn: () => y?.zoomIn(),
332
- onZoomOut: () => y?.zoomOut(),
334
+ canZoomOut: B > (i.initialZoom === "fit-width" ? .1 : .5),
335
+ onZoomIn: () => v?.zoomIn(),
336
+ onZoomOut: () => v?.zoomOut(),
333
337
  onRotate: () => C?.rotateForward(),
334
338
  onToggleFullscreen: T.toggleFullscreen
335
339
  })
336
340
  ]
337
341
  }),
338
- p.showToolbar === !1 && $ && /* @__PURE__ */ d("div", {
342
+ i.showToolbar === !1 && $ && /* @__PURE__ */ d("div", {
339
343
  className: "ui-v2-search-disclosure",
340
344
  children: $
341
345
  }),
342
- M && N && /* @__PURE__ */ d(s, {
346
+ M && N && /* @__PURE__ */ d(ee, {
343
347
  onClear: () => k(null),
344
348
  enabled: !!F,
345
- documentId: m,
349
+ documentId: p,
346
350
  onPageChange: (e, t) => {
347
351
  H.current = e, k(t ? {
348
352
  page: e,
@@ -350,13 +354,13 @@ function E(p) {
350
354
  } : null), Q(e);
351
355
  }
352
356
  }),
353
- h?.status === "error" ? /* @__PURE__ */ f("div", {
357
+ m?.status === "error" ? /* @__PURE__ */ f("div", {
354
358
  role: "alert",
355
- children: ["PDF 加载失败:", h.error]
356
- }) : g ? /* @__PURE__ */ d(t, {
357
- defaultRailCollapsed: p.defaultRailCollapsed,
358
- rail: /* @__PURE__ */ d(pe, {
359
- documentId: m,
359
+ children: ["PDF 加载失败:", m.error]
360
+ }) : h ? /* @__PURE__ */ d(t, {
361
+ defaultRailCollapsed: i.defaultRailCollapsed,
362
+ rail: /* @__PURE__ */ d(me, {
363
+ documentId: p,
360
364
  children: (t) => /* @__PURE__ */ f(e, {
361
365
  variant: "ghost",
362
366
  className: "ui-v2-thumbnail",
@@ -370,8 +374,8 @@ function E(p) {
370
374
  height: t.wrapperHeight,
371
375
  display: "grid"
372
376
  },
373
- children: [/* @__PURE__ */ d(fe, {
374
- documentId: m,
377
+ children: [/* @__PURE__ */ d(pe, {
378
+ documentId: p,
375
379
  meta: t,
376
380
  className: "ui-v2-thumbnail-image",
377
381
  style: {
@@ -381,8 +385,8 @@ function E(p) {
381
385
  }), /* @__PURE__ */ d("span", { children: t.pageIndex + 1 })]
382
386
  }, t.pageIndex)
383
387
  }),
384
- children: /* @__PURE__ */ d(ae, {
385
- documentId: m,
388
+ children: /* @__PURE__ */ d(oe, {
389
+ documentId: p,
386
390
  className: "ui-v2-native-viewport",
387
391
  tabIndex: 0,
388
392
  "aria-label": "PDF 页面滚动区域",
@@ -395,16 +399,16 @@ function E(p) {
395
399
  onTouchMoveCapture: Z,
396
400
  onPointerDownCapture: Z,
397
401
  onKeyDownCapture: Z,
398
- children: /* @__PURE__ */ d(i, {
399
- documentId: m,
400
- enablePinch: p.features?.pinchZoom !== !1,
401
- minZoom: p.initialZoom === "fit-width" ? .1 : .5,
402
+ children: /* @__PURE__ */ d(a, {
403
+ documentId: p,
404
+ enablePinch: i.features?.pinchZoom !== !1,
405
+ minZoom: i.initialZoom === "fit-width" ? .1 : .5,
402
406
  maxZoom: 3,
403
407
  children: L ? /* @__PURE__ */ d("div", {
404
408
  className: "ui-v2-native-single",
405
409
  children: Ce(I - 1)
406
- }) : /* @__PURE__ */ d(se, {
407
- documentId: m,
410
+ }) : /* @__PURE__ */ d(ce, {
411
+ documentId: p,
408
412
  renderPage: ({ pageIndex: e }) => Ce(e)
409
413
  })
410
414
  })
@@ -438,7 +442,7 @@ function E(p) {
438
442
  onClick: () => Q(I + 1),
439
443
  children: "下一页"
440
444
  }),
441
- p.footer
445
+ i.footer
442
446
  ]
443
447
  })
444
448
  ]
@@ -456,4 +460,4 @@ function xe(e, t, n) {
456
460
  });
457
461
  }
458
462
  //#endregion
459
- export { T as default };
463
+ export { E as default };
@@ -0,0 +1,35 @@
1
+ import e from "@jc-times/business-ui/pdf-fonts/NotoSansHans-Regular.otf?url";
2
+ import t from "@jc-times/business-ui/pdf-fonts/NotoSans-Regular.ttf?url";
3
+ import n from "@jc-times/business-ui/pdf-fonts/NotoSans-Bold.ttf?url";
4
+ import r from "@jc-times/business-ui/pdf-fonts/NotoSans-Italic.ttf?url";
5
+ import i from "@jc-times/business-ui/pdf-fonts/NotoSans-BoldItalic.ttf?url";
6
+ //#region src/document-viewer-v2/pdf-font-fallback.ts
7
+ var a = (e) => typeof window > "u" ? e : new URL(e, window.location.href).href, o = {
8
+ fonts: {
9
+ 0: [
10
+ {
11
+ url: a(t),
12
+ weight: 400
13
+ },
14
+ {
15
+ url: a(n),
16
+ weight: 700
17
+ },
18
+ {
19
+ url: a(r),
20
+ weight: 400,
21
+ italic: !0
22
+ },
23
+ {
24
+ url: a(i),
25
+ weight: 700,
26
+ italic: !0
27
+ }
28
+ ],
29
+ 1: a(e),
30
+ 134: a(e)
31
+ },
32
+ defaultFont: a(e)
33
+ };
34
+ //#endregion
35
+ export { o as pdfFontFallback };
@@ -0,0 +1,2 @@
1
+ import type { FontFallbackConfig } from '@embedpdf/engines/pdfium';
2
+ export declare const pdfFontFallback: FontFallbackConfig;
@@ -1,5 +1,7 @@
1
1
  # Agent 公共组件使用指南
2
2
 
3
+ PDFium 自 0.3.2 默认按需使用同源中文/拉丁备用字体;构建器需支持包内 `?url` 静态资源导入(Vite)。不依赖外部字体 CDN;不要为禁外网而关闭整个字体回退。显式 `fontFallback: null` 仍可覆盖默认值。
4
+
3
5
  级联选择用于右侧窄栏时使用 0.2.48 或以上版本:浮层按可见视口避让,不需要消费方重写定位样式。
4
6
 
5
7
  本指南面向在业务应用中使用 `@jc-times/business-ui` 的 agent,也适用于维护本库的 agent。先按场景选型,再按需阅读 API 和专题文档,不需要通读历史审计记录。
@@ -94,7 +94,7 @@ export function ContractPreview({ fileVersion, pdfUrl, token }: Props) {
94
94
  成品 UI 默认配置:
95
95
 
96
96
  - 使用 Web Worker,单文档会话,隐藏多文档标签栏。
97
- - 默认语言为简体中文,UI 字体使用系统字体,禁用外部字体回退请求。
97
+ - 默认语言为简体中文,UI 字体使用系统字体。PDF 正文缺失字体时按需加载随包发布的 Noto 中文/拉丁备用字体,由消费方构建为同源资源,不请求外部字体 CDN。
98
98
  - 默认关闭批注、插入、表单编辑和涂黑分类。
99
99
  - 打印、导出及 PDF 自身权限仍由消费项目决定,隐藏按钮不能代替服务端授权。
100
100
  - 消费方配置与公共默认主题进行合并;显式传入的配置优先。
@@ -158,7 +158,7 @@ export function ContractPreview({ fileVersion, pdfUrl, token }: Props) {
158
158
  | `searchMode` | 默认 `expanded`;`collapsible` 将搜索面板改为公共搜索开关,文档切换或收起时清理旧搜索。`showToolbar=false` 时仍显示紧凑的公共搜索入口;配合移动连续阅读模式时仅显示搜索图标 |
159
159
  | `renderPageOverlay(context)` | 追加 React 内容;context 包含 `documentId`、从 1 开始的 `page`、从 0 开始的 `pageIndex`、原始 `width/height`、`zoom`、角度制 `rotation` |
160
160
  | `renderPage({ page, zoom, rotation })` | 与 V1 一样替换整个正文页。只添加印章或标记时应使用 `renderPageOverlay`,避免替换 PDF 位图 |
161
- | `engineOptions` | `usePdfiumEngine` 的选项,例如 `wasmUrl`;默认 Worker 开启、外部字体回退关闭。改变初始化选项时更新 `source.id` |
161
+ | `engineOptions` | `usePdfiumEngine` 的选项,例如 `wasmUrl`;默认 Worker 开启、同源字体回退开启。可显式传 `fontFallback: null` 关闭,或传自定义配置。改变初始化选项时更新 `source.id` |
162
162
  | `onReady(registry)` | 插件初始化回调;不保证文档已加载,不传成品 UI 的 `config/onInit` |
163
163
 
164
164
  叠层坐标以**未缩放、未旋转页面的左上角**为原点;`width/height` 是页面尺寸,不是视口 CSS 尺寸。组件统一应用缩放和 PDF 内置旋转加用户旋转,业务不要再次乘 `zoom` 或旋转整个叠层。业务若使用 PDF 底部原点坐标,应先转换成左上原点。叠层容器不拦截页面事件;可交互元素自行设置 `pointerEvents: 'auto'` 并提供键盘可访问控件。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jc-times/business-ui",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Shared accessible business UI components for JC Times applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,8 @@
36
36
  "docs/dependencies.md",
37
37
  "patches",
38
38
  "licenses/embedpdf-MIT.txt",
39
- "docs/sortable-list.md"
39
+ "docs/sortable-list.md",
40
+ "assets/pdf-fonts"
40
41
  ],
41
42
  "main": "./dist/business-ui.js",
42
43
  "module": "./dist/business-ui.js",
@@ -78,7 +79,8 @@
78
79
  "./pdfium-viewer": {
79
80
  "types": "./dist/types/PdfiumViewer.d.ts",
80
81
  "import": "./dist/pdfium-viewer.js"
81
- }
82
+ },
83
+ "./pdf-fonts/*": "./assets/pdf-fonts/*"
82
84
  },
83
85
  "bin": {
84
86
  "business-ui-gate": "./bin/business-ui-gate.mjs"
@@ -93,6 +95,8 @@
93
95
  "dependencies": {
94
96
  "@embedpdf/core": "2.15.0",
95
97
  "@embedpdf/engines": "2.15.0",
98
+ "@embedpdf/fonts-latin": "1.0.0",
99
+ "@embedpdf/fonts-sc": "1.0.0",
96
100
  "@embedpdf/plugin-document-manager": "2.15.0",
97
101
  "@embedpdf/plugin-interaction-manager": "2.15.0",
98
102
  "@embedpdf/plugin-render": "2.15.0",