@embedpdf-editor/chapter-snippet 0.3.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.pdfium ADDED
@@ -0,0 +1,196 @@
1
+ // Copyright 2014 PDFium Authors. All rights reserved.
2
+ //
3
+ // Redistribution and use in source and binary forms, with or without
4
+ // modification, are permitted provided that the following conditions are
5
+ // met:
6
+ //
7
+ // * Redistributions of source code must retain the above copyright
8
+ // notice, this list of conditions and the following disclaimer.
9
+ // * Redistributions in binary form must reproduce the above
10
+ // copyright notice, this list of conditions and the following disclaimer
11
+ // in the documentation and/or other materials provided with the
12
+ // distribution.
13
+ // * Neither the name of Google Inc. nor the names of its
14
+ // contributors may be used to endorse or promote products derived from
15
+ // this software without specific prior written permission.
16
+ //
17
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ Apache License
29
+ Version 2.0, January 2004
30
+ https://www.apache.org/licenses/
31
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
32
+ 1. Definitions.
33
+ "License" shall mean the terms and conditions for use, reproduction,
34
+ and distribution as defined by Sections 1 through 9 of this document.
35
+ "Licensor" shall mean the copyright owner or entity authorized by
36
+ the copyright owner that is granting the License.
37
+ "Legal Entity" shall mean the union of the acting entity and all
38
+ other entities that control, are controlled by, or are under common
39
+ control with that entity. For the purposes of this definition,
40
+ "control" means (i) the power, direct or indirect, to cause the
41
+ direction or management of such entity, whether by contract or
42
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
43
+ outstanding shares, or (iii) beneficial ownership of such entity.
44
+ "You" (or "Your") shall mean an individual or Legal Entity
45
+ exercising permissions granted by this License.
46
+ "Source" form shall mean the preferred form for making modifications,
47
+ including but not limited to software source code, documentation
48
+ source, and configuration files.
49
+ "Object" form shall mean any form resulting from mechanical
50
+ transformation or translation of a Source form, including but
51
+ not limited to compiled object code, generated documentation,
52
+ and conversions to other media types.
53
+ "Work" shall mean the work of authorship, whether in Source or
54
+ Object form, made available under the License, as indicated by a
55
+ copyright notice that is included in or attached to the work
56
+ (an example is provided in the Appendix below).
57
+ "Derivative Works" shall mean any work, whether in Source or Object
58
+ form, that is based on (or derived from) the Work and for which the
59
+ editorial revisions, annotations, elaborations, or other modifications
60
+ represent, as a whole, an original work of authorship. For the purposes
61
+ of this License, Derivative Works shall not include works that remain
62
+ separable from, or merely link (or bind by name) to the interfaces of,
63
+ the Work and Derivative Works thereof.
64
+ "Contribution" shall mean any work of authorship, including
65
+ the original version of the Work and any modifications or additions
66
+ to that Work or Derivative Works thereof, that is intentionally
67
+ submitted to Licensor for inclusion in the Work by the copyright owner
68
+ or by an individual or Legal Entity authorized to submit on behalf of
69
+ the copyright owner. For the purposes of this definition, "submitted"
70
+ means any form of electronic, verbal, or written communication sent
71
+ to the Licensor or its representatives, including but not limited to
72
+ communication on electronic mailing lists, source code control systems,
73
+ and issue tracking systems that are managed by, or on behalf of, the
74
+ Licensor for the purpose of discussing and improving the Work, but
75
+ excluding communication that is conspicuously marked or otherwise
76
+ designated in writing by the copyright owner as "Not a Contribution."
77
+ "Contributor" shall mean Licensor and any individual or Legal Entity
78
+ on behalf of whom a Contribution has been received by Licensor and
79
+ subsequently incorporated within the Work.
80
+ 2. Grant of Copyright License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ copyright license to reproduce, prepare Derivative Works of,
84
+ publicly display, publicly perform, sublicense, and distribute the
85
+ Work and such Derivative Works in Source or Object form.
86
+ 3. Grant of Patent License. Subject to the terms and conditions of
87
+ this License, each Contributor hereby grants to You a perpetual,
88
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89
+ (except as stated in this section) patent license to make, have made,
90
+ use, offer to sell, sell, import, and otherwise transfer the Work,
91
+ where such license applies only to those patent claims licensable
92
+ by such Contributor that are necessarily infringed by their
93
+ Contribution(s) alone or by combination of their Contribution(s)
94
+ with the Work to which such Contribution(s) was submitted. If You
95
+ institute patent litigation against any entity (including a
96
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
97
+ or a Contribution incorporated within the Work constitutes direct
98
+ or contributory patent infringement, then any patent licenses
99
+ granted to You under this License for that Work shall terminate
100
+ as of the date such litigation is filed.
101
+ 4. Redistribution. You may reproduce and distribute copies of the
102
+ Work or Derivative Works thereof in any medium, with or without
103
+ modifications, and in Source or Object form, provided that You
104
+ meet the following conditions:
105
+ (a) You must give any other recipients of the Work or
106
+ Derivative Works a copy of this License; and
107
+ (b) You must cause any modified files to carry prominent notices
108
+ stating that You changed the files; and
109
+ (c) You must retain, in the Source form of any Derivative Works
110
+ that You distribute, all copyright, patent, trademark, and
111
+ attribution notices from the Source form of the Work,
112
+ excluding those notices that do not pertain to any part of
113
+ the Derivative Works; and
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+ END OF TERMS AND CONDITIONS
178
+ APPENDIX: How to apply the Apache License to your work.
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+ Copyright [yyyy] [name of copyright owner]
188
+ Licensed under the Apache License, Version 2.0 (the "License");
189
+ you may not use this file except in compliance with the License.
190
+ You may obtain a copy of the License at
191
+ https://www.apache.org/licenses/LICENSE-2.0
192
+ Unless required by applicable law or agreed to in writing, software
193
+ distributed under the License is distributed on an "AS IS" BASIS,
194
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
195
+ See the License for the specific language governing permissions and
196
+ limitations under the License.
package/NOTICE CHANGED
@@ -5,3 +5,9 @@ Copyright (c) 2025 CloudPDF
5
5
  Copyright (c) 2026 xiaoliuing
6
6
 
7
7
  See LICENSE for the full MIT License text.
8
+
9
+ ---
10
+
11
+ This package redistributes pdfium.wasm. PDFium is licensed under the
12
+ Apache License 2.0. See NOTICE.pdfium, LICENSE.pdfium (also under dist/),
13
+ and THIRD-PARTY-NOTICES.md.
package/NOTICE.pdfium ADDED
@@ -0,0 +1,13 @@
1
+ PDFium (WebAssembly binary: pdfium.wasm)
2
+ =====================================
3
+
4
+ This product includes PDFium, an open-source PDF rendering library:
5
+ https://pdfium.googlesource.com/pdfium/
6
+
7
+ Copyright (c) PDFium Authors. Portions copyright Google LLC.
8
+
9
+ Licensed under the Apache License, Version 2.0 and additional BSD-style
10
+ terms as stated in LICENSE.pdfium in this directory (or package root).
11
+
12
+ You must retain LICENSE.pdfium when redistributing pdfium.wasm or
13
+ products that bundle it. See THIRD-PARTY-NOTICES.md for an overview.
package/README.md CHANGED
@@ -127,10 +127,10 @@ viewer?.addEventListener(CHAPTER_SNIPPET_EVENTS.ready, (event) => {
127
127
  | `worker` | `true` | 是否启用 PDFium worker |
128
128
  | `fallbackToDirectEngine` | `true` | 首章 worker 加载超时后自动降级到 direct engine |
129
129
  | `workerOpenTimeoutMs` | `8000` | 首章加载超时时间 |
130
- | `features` | - | 兼容旧写法;会覆盖 `options.features` 中同名项 |
130
+ | `features` | - | `options.features` **深度合并**;顶层同名字段优先。勿放进 `createChapterViewerEditorOptions()` |
131
131
  | `className` / `viewportClassName` | - | 传给内部阅读器容器 |
132
132
 
133
- 旧版本的 `editorInput` 仍可使用,但新代码应改为 `options`。`options.features` 会参与合并,顶层 `features` 仅作为兼容覆盖保留。
133
+ 旧版本的 `editorInput` 仍可使用,但新代码应改为 `options`,并把 `features` 写在 `options.features` 或顶层 `features`。
134
134
 
135
135
  ### `ChapterViewerOptions`(与 React / Vue3 一致)
136
136
 
@@ -153,7 +153,8 @@ viewer?.addEventListener(CHAPTER_SNIPPET_EVENTS.ready, (event) => {
153
153
  | `markup` | `styles` 四类划线;`annotationMenu` 默认选中后在下方显示「删除」;`squiggly.offsetY` 默认 **4** |
154
154
  | `bookmarks` | `marker` / `hover` 自定义图标 |
155
155
  | `notes` | `marker.renderIcon`、`renderMenuActions`、`highlightColor` |
156
- | `zoom` | `pageWidth`、`min` / `max` / `enabled` |
156
+ | `zoom` | `pageWidth`、`min` / `max` / `enabled`;实际上限不超过 `[data-chapter-scroll-viewport]` 宽度,resize 时自动 clamp |
157
+ | `scrollViewport` | `background`(默认 `#f1f5f9`),`[data-chapter-scroll-viewport]` 背景 |
157
158
  | `selectionToolbar` | `hiddenBuiltinActions`、`extraActions`;扩展动作监听 `selectionExtraAction` 事件 |
158
159
 
159
160
  ```js
@@ -261,6 +262,12 @@ import {
261
262
  | Registry | hook / ref | `chapter-viewer-ready` → `detail.registry` |
262
263
  | Vite | `chapterViewerViteResolve()` | `chapterSnippetViteResolve()` |
263
264
 
265
+ ## 许可
266
+
267
+ - 本包 JavaScript / 类型定义:**MIT**(见 `LICENSE`、`NOTICE`)
268
+ - **`dist/pdfium.wasm`**:来自 **PDFium**,适用 **Apache License 2.0**(见 `LICENSE.pdfium`、`NOTICE.pdfium`、`THIRD-PARTY-NOTICES.md`)
269
+ - 再分发本包或随产品打包 wasm 时,须保留上述许可文件
270
+
264
271
  ## 常见问题
265
272
 
266
273
  | 现象 | 处理 |
@@ -0,0 +1,102 @@
1
+ # Third-Party Notices
2
+
3
+ 本文件说明本仓库及对外发布的 `@embedpdf-editor/*` 包所涉及的主要第三方软件及其许可义务。
4
+ **本文不构成法律意见**;若用于商业产品,请由法务根据实际分发形态审阅。
5
+
6
+ ---
7
+
8
+ ## 1. 本仓库自有与二开代码(MIT)
9
+
10
+ 章节阅读器扩展(`engine-packages/` 下 `@embedpdf-editor/*` 中你们编写的部分,以及对外发布的 3 个 npm 包中的 **JavaScript/TypeScript 封装与 bundle**)在以下版权下发布:
11
+
12
+ - Copyright (c) 2025 CloudPDF(上游 EmbedPDF,须保留)
13
+ - Copyright (c) 2026 xiaoliuing(本仓库修改与扩展,追加)
14
+
15
+ 完整条文见根目录 [LICENSE](LICENSE) 与 [NOTICE](NOTICE)。
16
+
17
+ 再分发这些部分时,须保留上述版权行及 MIT 许可全文。
18
+
19
+ ---
20
+
21
+ ## 2. 上游 EmbedPDF(MIT)
22
+
23
+ 本仓库基于 [embedpdf/embed-pdf-viewer](https://github.com/embedpdf/embed-pdf-viewer) 二次开发。
24
+ `packages/`、`viewers/` 下的 `@embedpdf/*` 包多为 **MIT**(以各包内 `package.json` 与 `LICENSE` 为准)。
25
+
26
+ 运行时依赖示例:`@embedpdf/core`、`@embedpdf/engines`、`@embedpdf/plugin-*` 等。
27
+
28
+ ---
29
+
30
+ ## 3. PDFium(Apache License 2.0 — 重要)
31
+
32
+ ### 3.1 是什么
33
+
34
+ **PDFium** 是 Google 维护的开源 PDF 渲染引擎(C++),浏览器端通过 **WebAssembly**(`pdfium.wasm`)加载。
35
+ 本仓库通过 `@embedpdf/pdfium` 使用 PDFium;章节 snippet 等包会 **直接分发** `pdfium.wasm`。
36
+
37
+ ### 3.2 许可(非 MIT)
38
+
39
+ PDFium 许可全文见:
40
+
41
+ - 仓库路径:[packages/pdfium/LICENSE.pdfium](packages/pdfium/LICENSE.pdfium)
42
+ - 对外 npm 包内:`LICENSE.pdfium`(由 `pnpm sync:pdfium-licenses` 同步)
43
+
44
+ 该文件包含 **PDFium Authors 的 BSD 风格条款** 与 **Apache License Version 2.0** 全文。
45
+ **不得以「整个项目仅 MIT」为由忽略 PDFium 义务。**
46
+
47
+ `@embedpdf/pdfium` 包根目录的 `LICENSE`(MIT)一般仅指 **JavaScript 胶水层**;**WASM 二进制仍适用 PDFium / Apache 2.0**。
48
+
49
+ ### 3.3 再分发时建议做到(最安全实践)
50
+
51
+ | 做法 | 说明 |
52
+ | ---- | ---- |
53
+ | 附带 `LICENSE.pdfium` | 随应用安装包、静态资源目录或 npm tarball **一并提供** 完整许可文本 |
54
+ | 附带 `NOTICE.pdfium` | 简短说明使用了 PDFium 及版权归属 |
55
+ | 保留版权声明 | 不得删除 `LICENSE.pdfium` 中的版权与 Apache 2.0 正文 |
56
+ | 产品「开源许可」页 | App / SaaS 建议在「关于 → 开源许可」中列出 PDFium 与 Apache 2.0 |
57
+ | 勿暗示官方背书 | 不得声称产品获 Google / PDFium / Chrome 官方认证 |
58
+
59
+ 若 **未修改** PDFium 源码、仅使用预编译 `pdfium.wasm`,通常 **无需** 在源码中标注「修改说明」;若自行编译并改动了 PDFium,须按 Apache 2.0 标注变更文件。
60
+
61
+ ### 3.4 各发布形态
62
+
63
+ | 包 | PDFium 如何到达终端用户 | 建议 |
64
+ | --- | ------------------------ | ---- |
65
+ | `@embedpdf-editor/chapter-snippet` | **tarball 内含 `dist/pdfium.wasm`** | 必须随包提供 `LICENSE.pdfium`(已纳入 `files`);`dist/` 构建后也会同步一份 |
66
+ | `@embedpdf-editor/react-chapter-viewer` | 依赖 `@embedpdf/pdfium`,由用户安装依赖获得 wasm | 包内仍附带 `LICENSE.pdfium` / 本文件,并在文档中说明依赖链 |
67
+ | `@embedpdf-editor/vue3-chapter-viewer` | 同上 | 同上 |
68
+
69
+ ### 3.5 Apache 2.0 与 MIT 的关系
70
+
71
+ - 二者 **可并存**:你们的章节编辑器可用 MIT,PDFium 部分适用 Apache 2.0。
72
+ - Apache 2.0 提供明确的 **专利授权** 条款(使用 PDFium 时的常见关注项之一)。
73
+ - **闭源商业产品** 一般可使用 PDFium,但仍须履行上述声明与许可附带义务。
74
+
75
+ ---
76
+
77
+ ## 4. 其他常见依赖
78
+
79
+ 通过 `@embedpdf/*` 与构建工具链可能间接引入的其他开源组件(如 Preact、Babel 等),其许可以 **各依赖包在 npm 上的声明** 为准。
80
+ 发版前可对生产 bundle 运行许可扫描(如 `license-checker`、`pnpm licenses list`)作为补充。
81
+
82
+ ---
83
+
84
+ ## 5. 维护说明
85
+
86
+ - PDFium 许可 **唯一源文件**:`packages/pdfium/LICENSE.pdfium`(随上游更新)
87
+ - 同步命令:`pnpm sync:pdfium-licenses`(在 `build:chapter-viewers` 前会自动执行)
88
+ - 模板:`engine-packages/shared/NOTICE.pdfium`、`engine-packages/shared/NOTICE`
89
+
90
+ ---
91
+
92
+ ## 6. 对外 npm 包内应包含的文件(检查清单)
93
+
94
+ 发布 `@embedpdf-editor/react-chapter-viewer` / `vue3-chapter-viewer` / `chapter-snippet` 时,tarball 中建议包含:
95
+
96
+ - [ ] `LICENSE`(MIT,含双版权行)
97
+ - [ ] `NOTICE`(衍生说明 + 指向 PDFium)
98
+ - [ ] `LICENSE.pdfium`(PDFium / Apache 2.0 全文)
99
+ - [ ] `NOTICE.pdfium`(PDFium 摘要)
100
+ - [ ] `THIRD-PARTY-NOTICES.md`(本文件副本)
101
+
102
+ `chapter-snippet` 另含 `dist/pdfium.wasm` 时,**尤其** 须保证 `dist/LICENSE.pdfium` 在构建后存在(由同步脚本写入)。
@@ -0,0 +1,196 @@
1
+ // Copyright 2014 PDFium Authors. All rights reserved.
2
+ //
3
+ // Redistribution and use in source and binary forms, with or without
4
+ // modification, are permitted provided that the following conditions are
5
+ // met:
6
+ //
7
+ // * Redistributions of source code must retain the above copyright
8
+ // notice, this list of conditions and the following disclaimer.
9
+ // * Redistributions in binary form must reproduce the above
10
+ // copyright notice, this list of conditions and the following disclaimer
11
+ // in the documentation and/or other materials provided with the
12
+ // distribution.
13
+ // * Neither the name of Google Inc. nor the names of its
14
+ // contributors may be used to endorse or promote products derived from
15
+ // this software without specific prior written permission.
16
+ //
17
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ Apache License
29
+ Version 2.0, January 2004
30
+ https://www.apache.org/licenses/
31
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
32
+ 1. Definitions.
33
+ "License" shall mean the terms and conditions for use, reproduction,
34
+ and distribution as defined by Sections 1 through 9 of this document.
35
+ "Licensor" shall mean the copyright owner or entity authorized by
36
+ the copyright owner that is granting the License.
37
+ "Legal Entity" shall mean the union of the acting entity and all
38
+ other entities that control, are controlled by, or are under common
39
+ control with that entity. For the purposes of this definition,
40
+ "control" means (i) the power, direct or indirect, to cause the
41
+ direction or management of such entity, whether by contract or
42
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
43
+ outstanding shares, or (iii) beneficial ownership of such entity.
44
+ "You" (or "Your") shall mean an individual or Legal Entity
45
+ exercising permissions granted by this License.
46
+ "Source" form shall mean the preferred form for making modifications,
47
+ including but not limited to software source code, documentation
48
+ source, and configuration files.
49
+ "Object" form shall mean any form resulting from mechanical
50
+ transformation or translation of a Source form, including but
51
+ not limited to compiled object code, generated documentation,
52
+ and conversions to other media types.
53
+ "Work" shall mean the work of authorship, whether in Source or
54
+ Object form, made available under the License, as indicated by a
55
+ copyright notice that is included in or attached to the work
56
+ (an example is provided in the Appendix below).
57
+ "Derivative Works" shall mean any work, whether in Source or Object
58
+ form, that is based on (or derived from) the Work and for which the
59
+ editorial revisions, annotations, elaborations, or other modifications
60
+ represent, as a whole, an original work of authorship. For the purposes
61
+ of this License, Derivative Works shall not include works that remain
62
+ separable from, or merely link (or bind by name) to the interfaces of,
63
+ the Work and Derivative Works thereof.
64
+ "Contribution" shall mean any work of authorship, including
65
+ the original version of the Work and any modifications or additions
66
+ to that Work or Derivative Works thereof, that is intentionally
67
+ submitted to Licensor for inclusion in the Work by the copyright owner
68
+ or by an individual or Legal Entity authorized to submit on behalf of
69
+ the copyright owner. For the purposes of this definition, "submitted"
70
+ means any form of electronic, verbal, or written communication sent
71
+ to the Licensor or its representatives, including but not limited to
72
+ communication on electronic mailing lists, source code control systems,
73
+ and issue tracking systems that are managed by, or on behalf of, the
74
+ Licensor for the purpose of discussing and improving the Work, but
75
+ excluding communication that is conspicuously marked or otherwise
76
+ designated in writing by the copyright owner as "Not a Contribution."
77
+ "Contributor" shall mean Licensor and any individual or Legal Entity
78
+ on behalf of whom a Contribution has been received by Licensor and
79
+ subsequently incorporated within the Work.
80
+ 2. Grant of Copyright License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ copyright license to reproduce, prepare Derivative Works of,
84
+ publicly display, publicly perform, sublicense, and distribute the
85
+ Work and such Derivative Works in Source or Object form.
86
+ 3. Grant of Patent License. Subject to the terms and conditions of
87
+ this License, each Contributor hereby grants to You a perpetual,
88
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89
+ (except as stated in this section) patent license to make, have made,
90
+ use, offer to sell, sell, import, and otherwise transfer the Work,
91
+ where such license applies only to those patent claims licensable
92
+ by such Contributor that are necessarily infringed by their
93
+ Contribution(s) alone or by combination of their Contribution(s)
94
+ with the Work to which such Contribution(s) was submitted. If You
95
+ institute patent litigation against any entity (including a
96
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
97
+ or a Contribution incorporated within the Work constitutes direct
98
+ or contributory patent infringement, then any patent licenses
99
+ granted to You under this License for that Work shall terminate
100
+ as of the date such litigation is filed.
101
+ 4. Redistribution. You may reproduce and distribute copies of the
102
+ Work or Derivative Works thereof in any medium, with or without
103
+ modifications, and in Source or Object form, provided that You
104
+ meet the following conditions:
105
+ (a) You must give any other recipients of the Work or
106
+ Derivative Works a copy of this License; and
107
+ (b) You must cause any modified files to carry prominent notices
108
+ stating that You changed the files; and
109
+ (c) You must retain, in the Source form of any Derivative Works
110
+ that You distribute, all copyright, patent, trademark, and
111
+ attribution notices from the Source form of the Work,
112
+ excluding those notices that do not pertain to any part of
113
+ the Derivative Works; and
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+ END OF TERMS AND CONDITIONS
178
+ APPENDIX: How to apply the Apache License to your work.
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+ Copyright [yyyy] [name of copyright owner]
188
+ Licensed under the Apache License, Version 2.0 (the "License");
189
+ you may not use this file except in compliance with the License.
190
+ You may obtain a copy of the License at
191
+ https://www.apache.org/licenses/LICENSE-2.0
192
+ Unless required by applicable law or agreed to in writing, software
193
+ distributed under the License is distributed on an "AS IS" BASIS,
194
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
195
+ See the License for the specific language governing permissions and
196
+ limitations under the License.
@@ -0,0 +1,13 @@
1
+ PDFium (WebAssembly binary: pdfium.wasm)
2
+ =====================================
3
+
4
+ This product includes PDFium, an open-source PDF rendering library:
5
+ https://pdfium.googlesource.com/pdfium/
6
+
7
+ Copyright (c) PDFium Authors. Portions copyright Google LLC.
8
+
9
+ Licensed under the Apache License, Version 2.0 and additional BSD-style
10
+ terms as stated in LICENSE.pdfium in this directory (or package root).
11
+
12
+ You must retain LICENSE.pdfium when redistributing pdfium.wasm or
13
+ products that bundle it. See THIRD-PARTY-NOTICES.md for an overview.
@@ -43,7 +43,7 @@ export declare function buildParagraphBookmarkAnchor(chapterId: string, localPag
43
43
  }): ParagraphBookmark['anchor'];
44
44
 
45
45
  /** 选区浮窗 card 内置操作 */
46
- declare type BuiltinSelectionToolbarAction = 'highlight' | 'underline' | 'squiggly' | 'strikeout' | 'note';
46
+ declare type BuiltinSelectionToolbarAction = 'copy' | 'highlight' | 'underline' | 'squiggly' | 'strikeout' | 'note';
47
47
 
48
48
  /**
49
49
  * 回调型:把决策交给业务侧异步函数(最常用)。
@@ -330,6 +330,8 @@ export declare type ChapterViewerConfig = {
330
330
  marker?: NoteMarkerUiConfig;
331
331
  };
332
332
  zoom?: boolean | ChapterViewerZoomConfig;
333
+ /** 滚动视口(`[data-chapter-scroll-viewport]`)样式 */
334
+ scrollViewport?: ChapterViewerScrollViewportConfig;
333
335
  /** 默认随划线/笔记开启;仅在有扩展按钮或需隐藏内置按钮时配置 */
334
336
  selectionToolbar?: boolean | SelectionToolbarConfig;
335
337
  };
@@ -359,6 +361,8 @@ export declare interface ChapterViewerFeaturesConfig {
359
361
  selectionToolbar?: SelectionToolbarConfig;
360
362
  /** 缩放 */
361
363
  zoom?: ChapterViewerZoomConfig;
364
+ /** 滚动视口(`[data-chapter-scroll-viewport]`) */
365
+ scrollViewport?: ChapterViewerScrollViewportConfig;
362
366
  }
363
367
 
364
368
  /** 章节阅读器统一配置(推荐入口) */
@@ -380,6 +384,12 @@ export declare interface ChapterViewerOptions {
380
384
  features?: ChapterViewerConfig;
381
385
  }
382
386
 
387
+ /** `[data-chapter-scroll-viewport]` 滚动容器样式 */
388
+ declare interface ChapterViewerScrollViewportConfig {
389
+ /** 背景色,默认 {@link DEFAULT_CHAPTER_SCROLL_VIEWPORT_BACKGROUND} */
390
+ background?: string;
391
+ }
392
+
383
393
  export declare type ChapterViewerSnippetConfig = {
384
394
  /** PDFium wasm 地址;默认使用 chapter-snippet/dist/pdfium.wasm */
385
395
  wasmUrl?: string;
@@ -393,8 +403,8 @@ export declare type ChapterViewerSnippetConfig = {
393
403
  options?: ChapterViewerOptions;
394
404
  /** @deprecated 请改用 options */
395
405
  editorInput?: CreateChapterViewerEditorOptionsInput;
396
- /** 阅读器功能开关,默认与 DEFAULT_CHAPTER_VIEWER_FEATURES 合并 */
397
- features?: ChapterViewerFeaturesConfig;
406
+ /** 阅读器功能开关;与 `options.features` 深度合并,顶层字段优先 */
407
+ features?: ChapterViewerConfig;
398
408
  className?: string;
399
409
  viewportClassName?: string;
400
410
  };
@@ -403,6 +413,7 @@ declare interface ChapterViewerZoomConfig {
403
413
  /** 是否启用 Ctrl+滚轮 / 双指捏合等交互缩放,默认 true;为 false 时仍可用 pageWidth / initial 设置版面宽度 */
404
414
  enabled?: boolean;
405
415
  min?: number;
416
+ /** 配置上限;实际不会超过视口宽度(fit-width scale) */
406
417
  max?: number;
407
418
  /** 文档 scale 初始值;未设置且配置了 pageWidth 时由 pageWidth 按首页宽度推导 */
408
419
  initial?: number;
@@ -425,7 +436,7 @@ export declare function createChapterViewerBundle(input: ChapterViewerOptions |
425
436
  editorOptions: CreatePdfChapterEditorOptions;
426
437
  };
427
438
 
428
- /** 进阶用法:仅生成 editor 配置(不含 features,需自行传给 PdfChapterViewport) */
439
+ /** 进阶用法:仅生成 editor 配置(不含 features,需通过 snippet `features` 或 `options.features` 传入) */
429
440
  export declare function createChapterViewerEditorOptions(input: ChapterViewerOptions | CreateChapterViewerEditorOptionsInput): Omit<CreatePdfChapterEditorOptions, 'features'>;
430
441
 
431
442
  /** @deprecated 旧版嵌套 `callbacks` 写法,仍兼容 */
@@ -820,6 +831,8 @@ declare interface SelectionToolbarConfig {
820
831
  enabled?: boolean;
821
832
  /** 隐藏部分内置按钮 */
822
833
  hiddenBuiltinActions?: BuiltinSelectionToolbarAction[];
834
+ /** 自定义复制按钮图标;不提供则使用默认图标 */
835
+ renderCopyIcon?: () => unknown;
823
836
  /** 扩展操作(由宿主在 buildSelectionMenu 或 onExtraAction 中处理) */
824
837
  extraActions?: SelectionToolbarExtraAction[];
825
838
  }