jit-pdf 0.1.1 → 0.1.3

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 CHANGED
@@ -4,7 +4,7 @@ Enterprise-ready PDF viewing and editing SDK for business systems.
4
4
 
5
5
  `jit-pdf` provides a polished Chinese UI, annotation tools, redaction workflow, local IndexedDB storage, HTTP file-service integration, and multiple integration styles for modern apps and plain HTML pages.
6
6
 
7
- [中文文档 / Chinese Documentation](https://github.com/jitOffice/jit-pdf-sdk/blob/main/packages/pdf-sdk/README.zh-CN.md)
7
+ [中文文档 / Chinese Documentation](https://github.com/jitOffice/jit-pdf-sdk/blob/main/README.zh-CN.md)
8
8
 
9
9
  ## Why jit-pdf
10
10
 
@@ -61,8 +61,8 @@ Latest:
61
61
  Pinned version:
62
62
 
63
63
  ```html
64
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jit-pdf@0.1.1/dist/style.css" />
65
- <script src="https://cdn.jsdelivr.net/npm/jit-pdf@0.1.1/dist/jit-pdf.umd.js"></script>
64
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jit-pdf@0.1.3/dist/style.css" />
65
+ <script src="https://cdn.jsdelivr.net/npm/jit-pdf@0.1.3/dist/jit-pdf.umd.js"></script>
66
66
  ```
67
67
 
68
68
  ### UNPKG
@@ -77,8 +77,8 @@ Latest:
77
77
  Pinned version:
78
78
 
79
79
  ```html
80
- <link rel="stylesheet" href="https://unpkg.com/jit-pdf@0.1.1/dist/style.css" />
81
- <script src="https://unpkg.com/jit-pdf@0.1.1/dist/jit-pdf.umd.js"></script>
80
+ <link rel="stylesheet" href="https://unpkg.com/jit-pdf@0.1.3/dist/style.css" />
81
+ <script src="https://unpkg.com/jit-pdf@0.1.3/dist/jit-pdf.umd.js"></script>
82
82
  ```
83
83
 
84
84
  Global browser variable:
@@ -342,9 +342,17 @@ mountJitPdfEditor({
342
342
  });
343
343
  ```
344
344
 
345
+ ## Copyright Notice
346
+
347
+ `jit-pdf` renders a built-in copyright badge inside the editor. In browser mount mode and UMD mode, the SDK will also show an integrity reminder if that badge is removed or hidden.
348
+
349
+ Copyright link:
350
+
351
+ - https://jitword.com/jit-pdf.html
352
+
345
353
  ## GitHub and Examples
346
354
 
347
355
  - Repository: https://github.com/jitOffice/jit-pdf-sdk
348
356
  - Vue example: `packages/pdf-sdk/examples/vue-demo`
349
357
  - HTML example: `packages/pdf-sdk/examples/html-demo`
350
- - Chinese docs: https://github.com/jitOffice/jit-pdf-sdk/blob/main/packages/pdf-sdk/README.zh-CN.md
358
+ - Chinese docs: https://github.com/jitOffice/jit-pdf-sdk/blob/main/README.zh-CN.md
package/dist/browser.cjs CHANGED
@@ -1 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),e=require("./http-service-DqmwdbGE.cjs");function v(r){if(typeof r=="string"){const t=document.querySelector(r);if(!t)throw new Error(`未找到挂载容器:${r}`);return t}return r}function i(r){const{target:t,onReady:c,onDirtyChange:u,onSaveStart:f,onSaveSuccess:s,onSaveError:a,onLoadError:S,...E}=r,n=v(t),o=d.createApp({render(){return d.h(e._sfc_main,{...E,onReady:c,onDirtyChange:u,onSaveStart:f,onSaveSuccess:s,onSaveError:a,onLoadError:S})}});return o.mount(n),{app:o,element:n,unmount(){o.unmount()}}}const P={mountJitPdfEditor:i,createHttpPdfEditorService:e.createHttpPdfEditorService,createIndexedDbPdfEditorService:e.createIndexedDbPdfEditorService};exports.JitPdfEditor=e._sfc_main;exports.createHttpPdfEditorService=e.createHttpPdfEditorService;exports.createIndexedDbPdfEditorService=e.createIndexedDbPdfEditorService;exports.usePdfEditorSdk=e.usePdfEditorSdk;exports.browser=P;exports.mountJitPdfEditor=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),i=require("./http-service-R05ATCDe.cjs"),b=".jit-copyright-badge",v="data-jit-pdf-copyright-notice",o="data-jit-pdf-copyright-target",w="https://jitword.com/jit-pdf.html";function E(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`jit-pdf-${crypto.randomUUID()}`:`jit-pdf-${Date.now()}-${Math.random().toString(16).slice(2)}`}function I(t){const r=t.getAttribute(o);if(r)return r;const e=E();return t.setAttribute(o,e),e}function g(t){return document.querySelector(`.jit-copyright-integrity-notice[${o}="${t}"]`)}function y(t){var r;(r=g(t))==null||r.remove()}function S(t){const r=g(t);if(r)return r;const e=document.createElement("a");return e.className="jit-copyright-integrity-notice",e.href=w,e.target="_blank",e.rel="noopener noreferrer",e.setAttribute(v,"true"),e.setAttribute(o,t),e.setAttribute("aria-label","Jit PDF 版权提示,点击查看"),e.innerHTML=`
2
+ <span class="jit-copyright-integrity-notice__mark">!</span>
3
+ <span class="jit-copyright-integrity-notice__content">
4
+ <strong>请保留 Jit PDF 版权信息</strong>
5
+ <span>检测到浏览器挂载模式下的版权标识被隐藏或移除,点击查看说明。</span>
6
+ </span>
7
+ `,document.body.appendChild(e),e}function P(t){const r=window.getComputedStyle(t),e=t.getBoundingClientRect(),n=Number.parseFloat(r.opacity||"1");return r.display!=="none"&&r.visibility!=="hidden"&&n>.05&&e.width>0&&e.height>0}function T(t){if(typeof window>"u"||typeof document>"u")return()=>{};const r=I(t);let e=!1;const n=()=>{const d=t.querySelector(b);if(!!d&&P(d)){e=!1,y(r);return}S(r),e||(e=!0,console.warn("[jit-pdf] Please keep the Jit PDF copyright badge visible in browser/UMD mode. See https://jitword.com/jit-pdf.html"))},c=new MutationObserver(()=>{window.requestAnimationFrame(n)});c.observe(t,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","hidden","aria-hidden"]});const s=window.setInterval(n,2e3),a=window.setTimeout(n,120);return window.addEventListener("resize",n),()=>{c.disconnect(),window.clearInterval(s),window.clearTimeout(a),window.removeEventListener("resize",n),y(r),t.removeAttribute(o)}}function _(t){if(typeof t=="string"){const r=document.querySelector(t);if(!r)throw new Error(`未找到挂载容器:${t}`);return r}return t}function m(t){const{target:r,onReady:e,onDirtyChange:n,onSaveStart:c,onSaveSuccess:s,onSaveError:a,onLoadError:d,...f}=t,u=_(r),p=l.createApp({render(){return l.h(i._sfc_main,{...f,onReady:e,onDirtyChange:n,onSaveStart:c,onSaveSuccess:s,onSaveError:a,onLoadError:d})}});p.mount(u);const h=T(u);return{app:p,element:u,unmount(){h(),p.unmount()}}}const j={mountJitPdfEditor:m,createHttpPdfEditorService:i.createHttpPdfEditorService,createIndexedDbPdfEditorService:i.createIndexedDbPdfEditorService};exports.JitPdfEditor=i._sfc_main;exports.createHttpPdfEditorService=i.createHttpPdfEditorService;exports.createIndexedDbPdfEditorService=i.createIndexedDbPdfEditorService;exports.usePdfEditorSdk=i.usePdfEditorSdk;exports.browser=j;exports.mountJitPdfEditor=m;
package/dist/browser.js CHANGED
@@ -1,56 +1,124 @@
1
- import { createApp as f, h as m } from "vue";
2
- import { a as p, c as E, _ as S } from "./http-service-DBwg8kDH.js";
3
- import { u as _ } from "./http-service-DBwg8kDH.js";
4
- function v(r) {
5
- if (typeof r == "string") {
6
- const e = document.querySelector(r);
7
- if (!e)
8
- throw new Error(`未找到挂载容器:${r}`);
9
- return e;
1
+ import { createApp as m, h as g } from "vue";
2
+ import { a as h, c as w, _ as b } from "./http-service-DVJ0n9L_.js";
3
+ import { u as U } from "./http-service-DVJ0n9L_.js";
4
+ const v = ".jit-copyright-badge", I = "data-jit-pdf-copyright-notice", i = "data-jit-pdf-copyright-target", E = "https://jitword.com/jit-pdf.html";
5
+ function T() {
6
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `jit-pdf-${crypto.randomUUID()}` : `jit-pdf-${Date.now()}-${Math.random().toString(16).slice(2)}`;
7
+ }
8
+ function _(t) {
9
+ const n = t.getAttribute(i);
10
+ if (n)
11
+ return n;
12
+ const e = T();
13
+ return t.setAttribute(i, e), e;
14
+ }
15
+ function l(t) {
16
+ return document.querySelector(
17
+ `.jit-copyright-integrity-notice[${i}="${t}"]`
18
+ );
19
+ }
20
+ function f(t) {
21
+ var n;
22
+ (n = l(t)) == null || n.remove();
23
+ }
24
+ function S(t) {
25
+ const n = l(t);
26
+ if (n)
27
+ return n;
28
+ const e = document.createElement("a");
29
+ return e.className = "jit-copyright-integrity-notice", e.href = E, e.target = "_blank", e.rel = "noopener noreferrer", e.setAttribute(I, "true"), e.setAttribute(i, t), e.setAttribute("aria-label", "Jit PDF 版权提示,点击查看"), e.innerHTML = `
30
+ <span class="jit-copyright-integrity-notice__mark">!</span>
31
+ <span class="jit-copyright-integrity-notice__content">
32
+ <strong>请保留 Jit PDF 版权信息</strong>
33
+ <span>检测到浏览器挂载模式下的版权标识被隐藏或移除,点击查看说明。</span>
34
+ </span>
35
+ `, document.body.appendChild(e), e;
36
+ }
37
+ function j(t) {
38
+ const n = window.getComputedStyle(t), e = t.getBoundingClientRect(), r = Number.parseFloat(n.opacity || "1");
39
+ return n.display !== "none" && n.visibility !== "hidden" && r > 0.05 && e.width > 0 && e.height > 0;
40
+ }
41
+ function P(t) {
42
+ if (typeof window > "u" || typeof document > "u")
43
+ return () => {
44
+ };
45
+ const n = _(t);
46
+ let e = !1;
47
+ const r = () => {
48
+ const s = t.querySelector(v);
49
+ if (!!s && j(s)) {
50
+ e = !1, f(n);
51
+ return;
52
+ }
53
+ S(n), e || (e = !0, console.warn(
54
+ "[jit-pdf] Please keep the Jit PDF copyright badge visible in browser/UMD mode. See https://jitword.com/jit-pdf.html"
55
+ ));
56
+ }, o = new MutationObserver(() => {
57
+ window.requestAnimationFrame(r);
58
+ });
59
+ o.observe(t, {
60
+ subtree: !0,
61
+ childList: !0,
62
+ attributes: !0,
63
+ attributeFilter: ["style", "class", "hidden", "aria-hidden"]
64
+ });
65
+ const c = window.setInterval(r, 2e3), a = window.setTimeout(r, 120);
66
+ return window.addEventListener("resize", r), () => {
67
+ o.disconnect(), window.clearInterval(c), window.clearTimeout(a), window.removeEventListener("resize", r), f(n), t.removeAttribute(i);
68
+ };
69
+ }
70
+ function A(t) {
71
+ if (typeof t == "string") {
72
+ const n = document.querySelector(t);
73
+ if (!n)
74
+ throw new Error(`未找到挂载容器:${t}`);
75
+ return n;
10
76
  }
11
- return r;
77
+ return t;
12
78
  }
13
- function P(r) {
79
+ function C(t) {
14
80
  const {
15
- target: e,
16
- onReady: n,
17
- onDirtyChange: i,
18
- onSaveStart: c,
19
- onSaveSuccess: d,
20
- onSaveError: s,
21
- onLoadError: u,
22
- ...a
23
- } = r, t = v(e), o = f({
81
+ target: n,
82
+ onReady: e,
83
+ onDirtyChange: r,
84
+ onSaveStart: o,
85
+ onSaveSuccess: c,
86
+ onSaveError: a,
87
+ onLoadError: s,
88
+ ...p
89
+ } = t, d = A(n), u = m({
24
90
  render() {
25
- return m(S, {
26
- ...a,
27
- onReady: n,
28
- onDirtyChange: i,
29
- onSaveStart: c,
30
- onSaveSuccess: d,
31
- onSaveError: s,
32
- onLoadError: u
91
+ return g(b, {
92
+ ...p,
93
+ onReady: e,
94
+ onDirtyChange: r,
95
+ onSaveStart: o,
96
+ onSaveSuccess: c,
97
+ onSaveError: a,
98
+ onLoadError: s
33
99
  });
34
100
  }
35
101
  });
36
- return o.mount(t), {
37
- app: o,
38
- element: t,
102
+ u.mount(d);
103
+ const y = P(d);
104
+ return {
105
+ app: u,
106
+ element: d,
39
107
  unmount() {
40
- o.unmount();
108
+ y(), u.unmount();
41
109
  }
42
110
  };
43
111
  }
44
- const h = {
45
- mountJitPdfEditor: P,
46
- createHttpPdfEditorService: E,
47
- createIndexedDbPdfEditorService: p
112
+ const G = {
113
+ mountJitPdfEditor: C,
114
+ createHttpPdfEditorService: w,
115
+ createIndexedDbPdfEditorService: h
48
116
  };
49
117
  export {
50
- S as JitPdfEditor,
51
- h as browser,
52
- E as createHttpPdfEditorService,
53
- p as createIndexedDbPdfEditorService,
54
- P as mountJitPdfEditor,
55
- _ as usePdfEditorSdk
118
+ b as JitPdfEditor,
119
+ G as browser,
120
+ w as createHttpPdfEditorService,
121
+ h as createIndexedDbPdfEditorService,
122
+ C as mountJitPdfEditor,
123
+ U as usePdfEditorSdk
56
124
  };