superdoc 2.29.0-next.3 → 2.29.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/dist/chunks/{FindReplaceSurface-BKVHzhQ4.es.js → FindReplaceSurface-B_5ggdWg.es.js} +1 -1
- package/dist/chunks/{FindReplaceSurface-BNDrJ6VS.cjs → FindReplaceSurface-fVHxPXtn.cjs} +1 -1
- package/dist/chunks/{PasswordPromptSurface-6mF6Azda.es.js → PasswordPromptSurface-CZqhDQQ1.es.js} +1 -1
- package/dist/chunks/{PasswordPromptSurface-BNkaztaP.cjs → PasswordPromptSurface-x8GNmMJT.cjs} +1 -1
- package/dist/chunks/{PdfViewer-D4lVeOJu.es.js → PdfViewer-CW09MNrB.es.js} +70 -105
- package/dist/chunks/{PdfViewer-boENOZdF.cjs → PdfViewer-CkrAHpC-.cjs} +74 -109
- package/dist/chunks/{_plugin-vue_export-helper-6MBoygIY.cjs → _plugin-vue_export-helper-BkbCxNeT.cjs} +31 -7
- package/dist/chunks/{_plugin-vue_export-helper-CsJQtMvr.es.js → _plugin-vue_export-helper-DRPRMkeA.es.js} +20 -8
- package/dist/chunks/{constants-DpXuDx_g.cjs → constants-BeeNZoQp.cjs} +1 -1
- package/dist/chunks/{constants-B6VBlmKp.es.js → constants-BvNs_ybI.es.js} +1 -1
- package/dist/chunks/{create-super-doc-ui-BFt8agAI.es.js → create-super-doc-ui-Dc8dQAMc.es.js} +89 -137
- package/dist/chunks/{create-super-doc-ui-BAGOnYGM.cjs → create-super-doc-ui-L60GhVAX.cjs} +211 -259
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/capabilities/html-markdown-support.d.ts +4 -6
- package/dist/document-api/src/comments/comments.d.ts +2 -0
- package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
- package/dist/document-api/src/contract/operation-definitions.d.ts +2 -2
- package/dist/document-api/src/contract/operation-registry.d.ts +10 -9
- package/dist/document-api/src/index.d.ts +8 -7
- package/dist/document-api/src/insert/insert.d.ts +2 -2
- package/dist/document-api/src/replace/replace.d.ts +3 -2
- package/dist/document-api/src/types/address.d.ts +3 -0
- package/dist/document-api/src/types/temporary-mutation.d.ts +5 -1
- package/dist/document-api/src/write/write.d.ts +12 -6
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layered.css +1 -1
- package/dist/superdoc/src/SuperDoc.vue.d.ts +132 -58
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +28 -13
- package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +11 -1
- package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +19 -2
- package/dist/superdoc/src/components/CommentsLayer/comment-urls.d.ts +1 -1
- package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +23 -20
- package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +24 -23
- package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +1 -4
- package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +16 -2
- package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +28 -13
- package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +132 -45
- package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +62 -16
- package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +77 -17
- package/dist/superdoc/src/components/PdfViewer/pdf-viewer-types.d.ts +45 -0
- package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +80 -16
- package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +48 -13
- package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +30 -15
- package/dist/superdoc/src/components/Whiteboard/whiteboard-types.d.ts +13 -0
- package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +1 -5
- package/dist/superdoc/src/components/surfaces/watermark-surface-runtime.d.ts +7 -7
- package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +16 -9
- package/dist/superdoc/src/composables/replace-continuation.d.ts +11 -15
- package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +11 -7
- package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +44 -18
- package/dist/superdoc/src/composables/use-document.d.ts +1210 -30
- package/dist/superdoc/src/composables/use-field.d.ts +88 -25
- package/dist/superdoc/src/composables/use-find-replace.d.ts +13 -3
- package/dist/superdoc/src/composables/use-password-prompt.d.ts +23 -24
- package/dist/superdoc/src/composables/use-viewport-fit.d.ts +62 -26
- package/dist/superdoc/src/composables/useUiFontFamily.d.ts +3 -11
- package/dist/superdoc/src/core/SuperDoc.d.ts +4 -4
- package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +9 -4
- package/dist/superdoc/src/core/collaboration/helpers.d.ts +20 -3
- package/dist/superdoc/src/core/collaboration/permissions.d.ts +15 -10
- package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +4 -3
- package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +2 -1
- package/dist/superdoc/src/core/config/merge-comments-config.d.ts +1 -5
- package/dist/superdoc/src/core/config/merge-defined.d.ts +3 -8
- package/dist/superdoc/src/core/config/normalize-hyperlinks-config.d.ts +7 -12
- package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +9 -12
- package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +1 -12
- package/dist/superdoc/src/core/create-app.d.ts +13 -24
- package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +2 -1
- package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +2 -1
- package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -1
- package/dist/superdoc/src/core/editor-runtime/types.d.ts +2 -1
- package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +1 -1
- package/dist/superdoc/src/core/helpers/export.d.ts +3 -2
- package/dist/superdoc/src/core/helpers/file.d.ts +8 -45
- package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +6 -60
- package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -2
- package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -1
- package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -1
- package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -1
- package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +28 -61
- package/dist/superdoc/src/core/superdoc-ui-owner.d.ts +1 -1
- package/dist/superdoc/src/core/surface-manager.d.ts +21 -83
- package/dist/superdoc/src/core/types/index.d.ts +41 -23
- package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +5 -3
- package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +3 -13
- package/dist/superdoc/src/core/v2-integration/internal-vue-runtime.d.ts +64 -59
- package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +10 -10
- package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +22 -208
- package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +163 -189
- package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +14 -1
- package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -1
- package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -1
- package/dist/superdoc/src/helpers/comment-focus.d.ts +21 -4
- package/dist/superdoc/src/helpers/deprecation.d.ts +5 -11
- package/dist/superdoc/src/helpers/interaction-trace.d.ts +7 -24
- package/dist/superdoc/src/helpers/mark-raw-component.d.ts +1 -0
- package/dist/superdoc/src/helpers/object-guards.d.ts +2 -5
- package/dist/superdoc/src/helpers/selection-source.d.ts +1 -1
- package/dist/superdoc/src/helpers/use-selection.d.ts +35 -15
- package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +8 -11
- package/dist/superdoc/src/helpers/v2-bulk-decision-event.d.ts +9 -7
- package/dist/superdoc/src/helpers/v2-keyboard-edit-rejection.d.ts +8 -7
- package/dist/superdoc/src/helpers/v2-mutation-exception.d.ts +12 -8
- package/dist/superdoc/src/helpers/v2-review-target.d.ts +11 -1
- package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +40 -14
- package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +14 -5
- package/dist/superdoc/src/icons.d.ts +11 -19
- package/dist/superdoc/src/internal/diagnostics/diagnostic-dedupe.d.ts +6 -15
- package/dist/superdoc/src/internal/diagnostics/translate-diagnostic.d.ts +6 -4
- package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +2 -2
- package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +4 -24
- package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +34 -0
- package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +34 -0
- package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +1 -1
- package/dist/superdoc/src/internal/toolbar/built-in/PageNumberMenu.vue.d.ts +25 -15
- package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +9 -3
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +12 -14
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +1 -11
- package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +9 -19
- package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +14 -45
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +34 -17
- package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +15 -1
- package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +37 -7
- package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +10 -4
- package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +12 -1
- package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +9 -4
- package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
- package/dist/superdoc/src/internal/toolbar/built-in/page-number-feedback.d.ts +4 -5
- package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +3 -4
- package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +10 -2
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +78 -145
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +61 -61
- package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +11 -3
- package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +110 -48
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +11 -30
- package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +4 -3
- package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +29 -39
- package/dist/superdoc/src/internal/toolbar/toolbar-item-aliases.d.ts +1 -1
- package/dist/superdoc/src/public/browser-document-api.d.ts +5 -4
- package/dist/superdoc/src/public/index.d.cts +26 -0
- package/dist/superdoc/src/public/index.d.ts +13 -0
- package/dist/superdoc/src/public/ui/commands.d.ts +14 -13
- package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +1 -1
- package/dist/superdoc/src/public/ui/entity-at.d.ts +2 -1
- package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +2 -8
- package/dist/superdoc/src/public/ui/style-match-patch.d.ts +2 -2
- package/dist/superdoc/src/public/ui/types.d.ts +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +231 -105
- package/dist/superdoc/src/stores/helpers/comment-document-scope.d.ts +22 -0
- package/dist/superdoc/src/stores/helpers/comment-grouping.d.ts +30 -0
- package/dist/superdoc/src/stores/helpers/comment-identity.d.ts +40 -0
- package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +48 -13
- package/dist/superdoc/src/stores/helpers/pending-selection-snapshot.d.ts +17 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-compaction.d.ts +16 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-decision.d.ts +45 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-identity.d.ts +19 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-row-values.d.ts +0 -4
- package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +21 -24
- package/dist/superdoc/src/stores/superdoc-store.d.ts +694 -316
- package/dist/superdoc.cjs +1804 -2782
- package/dist/superdoc.es.js +1720 -2699
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +42 -42
- package/package.json +3 -2
- package/dist/superdoc/src/internal/toolbar/index.d.ts +0 -10
- package/dist/superdoc/src/main.d.ts +0 -1
|
@@ -1,141 +1,89 @@
|
|
|
1
|
-
const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-
|
|
1
|
+
const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BkbCxNeT.cjs");
|
|
2
2
|
const require_is_finite_number = require("./is-finite-number-BEXgTRgc.cjs");
|
|
3
|
-
const require_constants = require("./constants-
|
|
4
|
-
//#region src/core/pdf/helpers/floor.
|
|
3
|
+
const require_constants = require("./constants-BeeNZoQp.cjs");
|
|
4
|
+
//#region src/core/pdf/helpers/floor.ts
|
|
5
5
|
var floor = (val, precision) => {
|
|
6
6
|
const multiplier = 10 ** (precision || 0);
|
|
7
7
|
return Math.floor(val * multiplier) / multiplier;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
10
|
-
//#region src/core/pdf/helpers/read-file.
|
|
10
|
+
//#region src/core/pdf/helpers/read-file.ts
|
|
11
11
|
var readFileAsArrayBuffer = (blob) => {
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
13
|
const reader = new FileReader();
|
|
14
|
-
reader.onload = (
|
|
14
|
+
reader.onload = () => {
|
|
15
|
+
if (reader.result instanceof ArrayBuffer) resolve(reader.result);
|
|
16
|
+
else reject(/* @__PURE__ */ new TypeError("FileReader did not produce an ArrayBuffer"));
|
|
17
|
+
};
|
|
15
18
|
reader.onerror = reject;
|
|
16
|
-
reader.
|
|
19
|
+
reader.readAsArrayBuffer(blob);
|
|
17
20
|
});
|
|
18
21
|
};
|
|
19
22
|
//#endregion
|
|
20
|
-
//#region src/core/pdf/helpers/range.
|
|
23
|
+
//#region src/core/pdf/helpers/range.ts
|
|
21
24
|
var range = (start, end) => {
|
|
22
25
|
const length = end - start;
|
|
23
26
|
return Array.from({ length }, (_, i) => start + i);
|
|
24
27
|
};
|
|
25
28
|
//#endregion
|
|
26
|
-
//#region src/core/pdf/pdf-adapter.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @property {string} [workerSrc]
|
|
39
|
-
* @property {boolean} [setWorker]
|
|
40
|
-
*/
|
|
41
|
-
/**
|
|
42
|
-
* @typedef {Object} PDFJSConfig
|
|
43
|
-
* @property {any} pdfLib
|
|
44
|
-
* @property {string} [workerSrc]
|
|
45
|
-
* @property {boolean} [setWorker]
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* @typedef {Object} RenderPagesOptions
|
|
49
|
-
* @property {string} documentId
|
|
50
|
-
* @property {PDFDocumentProxy} pdfDocument
|
|
51
|
-
* @property {HTMLElement} viewerContainer
|
|
52
|
-
* @property {function(string, ...any): void} [emit]
|
|
53
|
-
*/
|
|
54
|
-
/**
|
|
55
|
-
* @typedef {Object} PageSize
|
|
56
|
-
* @property {number} width
|
|
57
|
-
* @property {number} height
|
|
58
|
-
*/
|
|
59
|
-
/**
|
|
60
|
-
* @param {Partial<PDFConfig>} [config]
|
|
61
|
-
* @returns {PDFConfig}
|
|
62
|
-
*/
|
|
29
|
+
//#region src/core/pdf/pdf-adapter.ts
|
|
30
|
+
var isObjectLike = (value) => (typeof value === "object" || typeof value === "function") && value !== null;
|
|
31
|
+
var REQUIRES_PDFJS = "PDFJSAdapter requires a pdf.js module as pdfLib";
|
|
32
|
+
var hasDocumentLoader = (value) => isObjectLike(value) && "getDocument" in value && typeof value.getDocument === "function";
|
|
33
|
+
var requireWorkerOptions = (value) => {
|
|
34
|
+
if (isObjectLike(value) && "GlobalWorkerOptions" in value && isObjectLike(value.GlobalWorkerOptions)) return value.GlobalWorkerOptions;
|
|
35
|
+
throw new TypeError(REQUIRES_PDFJS);
|
|
36
|
+
};
|
|
37
|
+
var requireVersion = (value) => {
|
|
38
|
+
if (isObjectLike(value) && "version" in value && typeof value.version === "string") return value.version;
|
|
39
|
+
throw new TypeError(REQUIRES_PDFJS);
|
|
40
|
+
};
|
|
63
41
|
var createPDFConfig = (config) => {
|
|
64
42
|
return {
|
|
65
43
|
adapter: "pdfjs",
|
|
66
44
|
...config
|
|
67
45
|
};
|
|
68
46
|
};
|
|
69
|
-
/**
|
|
70
|
-
* @abstract
|
|
71
|
-
*/
|
|
72
47
|
var PDFAdapter = class PDFAdapter {
|
|
73
|
-
/**
|
|
74
|
-
* @throws {Error}
|
|
75
|
-
*/
|
|
76
48
|
constructor() {
|
|
77
49
|
if (Object.getPrototypeOf(this).constructor === PDFAdapter) throw new Error("Abstract class should not be instantiated");
|
|
78
50
|
}
|
|
79
51
|
};
|
|
80
52
|
var PDFJSAdapter = class extends PDFAdapter {
|
|
81
|
-
/**
|
|
82
|
-
* @param {PDFJSConfig} config
|
|
83
|
-
*/
|
|
84
53
|
constructor(config) {
|
|
85
54
|
super();
|
|
86
55
|
this.pdfLib = config.pdfLib;
|
|
87
56
|
this.workerSrc = config.workerSrc;
|
|
88
|
-
if (config.setWorker)
|
|
89
|
-
|
|
57
|
+
if (config.setWorker) {
|
|
58
|
+
const workerOptions = requireWorkerOptions(this.pdfLib);
|
|
59
|
+
workerOptions.workerSrc = this.workerSrc || getWorkerSrcFromCDN(requireVersion(this.pdfLib));
|
|
60
|
+
}
|
|
90
61
|
}
|
|
91
|
-
/**
|
|
92
|
-
* @param {string | ArrayBuffer | Uint8Array} file
|
|
93
|
-
* @returns {Promise<PDFDocumentProxy>}
|
|
94
|
-
*/
|
|
95
62
|
async getDocument(file) {
|
|
96
|
-
|
|
63
|
+
const pdfLib = this.pdfLib;
|
|
64
|
+
if (!hasDocumentLoader(pdfLib)) throw new TypeError(REQUIRES_PDFJS);
|
|
65
|
+
return pdfLib.getDocument(file).promise;
|
|
97
66
|
}
|
|
98
|
-
/**
|
|
99
|
-
* @param {PDFDocumentProxy} pdf
|
|
100
|
-
* @param {number} firstPage
|
|
101
|
-
* @param {number} lastPage
|
|
102
|
-
* @returns {Promise<PDFPageProxy[]>}
|
|
103
|
-
*/
|
|
104
67
|
async getPages(pdf, firstPage, lastPage) {
|
|
105
68
|
const pagesPromises = range(firstPage, lastPage + 1).map((num) => pdf.getPage(num));
|
|
106
69
|
return await Promise.all(pagesPromises);
|
|
107
70
|
}
|
|
108
71
|
};
|
|
109
72
|
var PDFAdapterFactory = class {
|
|
110
|
-
/**
|
|
111
|
-
* @param {PDFJSConfig & {adapter: AdapterType}} config
|
|
112
|
-
* @returns {PDFAdapter}
|
|
113
|
-
* @throws {Error}
|
|
114
|
-
*/
|
|
115
73
|
static create(config) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
default: () => {
|
|
121
|
-
throw new Error("Unsupported adapter");
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
return (adapters[config.adapter] ?? adapters.default)();
|
|
74
|
+
const adapter = (/* @__PURE__ */ new Map([["pdfjs", () => new PDFJSAdapter(config)]])).get(config.adapter);
|
|
75
|
+
if (!adapter) throw new Error("Unsupported adapter");
|
|
76
|
+
return adapter();
|
|
125
77
|
}
|
|
126
78
|
};
|
|
127
|
-
/**
|
|
128
|
-
* @param {number} version
|
|
129
|
-
* @returns {string}
|
|
130
|
-
*/
|
|
131
79
|
function getWorkerSrcFromCDN(version) {
|
|
132
80
|
return `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${version}/pdf.worker.min.mjs`;
|
|
133
81
|
}
|
|
134
82
|
//#endregion
|
|
135
|
-
//#region src/components/PdfViewer/PdfViewerPage.vue
|
|
83
|
+
//#region src/components/PdfViewer/PdfViewerPage.vue?vue&type=script&setup=true&lang.ts
|
|
136
84
|
var _hoisted_1$1 = ["data-page-id", "data-page-number"];
|
|
137
85
|
var _hoisted_2 = { class: "sd-pdf-viewer-page__canvas-wrapper" };
|
|
138
|
-
var
|
|
86
|
+
var PdfViewerPage_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ require__plugin_vue_export_helper.defineComponent({
|
|
139
87
|
__name: "PdfViewerPage",
|
|
140
88
|
props: {
|
|
141
89
|
config: {
|
|
@@ -163,7 +111,7 @@ var _sfc_main$2 = {
|
|
|
163
111
|
default: 2
|
|
164
112
|
},
|
|
165
113
|
documentEl: {
|
|
166
|
-
type:
|
|
114
|
+
type: Object,
|
|
167
115
|
default: null
|
|
168
116
|
}
|
|
169
117
|
},
|
|
@@ -178,11 +126,11 @@ var _sfc_main$2 = {
|
|
|
178
126
|
setup(__props, { emit: __emit }) {
|
|
179
127
|
const emit = __emit;
|
|
180
128
|
const props = __props;
|
|
181
|
-
const viewport = require__plugin_vue_export_helper.shallowRef(
|
|
129
|
+
const viewport = require__plugin_vue_export_helper.shallowRef(createInitialViewport());
|
|
182
130
|
const pageRef = require__plugin_vue_export_helper.ref(null);
|
|
183
131
|
const canvasRef = require__plugin_vue_export_helper.ref(null);
|
|
184
132
|
const textLayerRef = require__plugin_vue_export_helper.ref(null);
|
|
185
|
-
let renderTask;
|
|
133
|
+
let renderTask = null;
|
|
186
134
|
const pageIdx = require__plugin_vue_export_helper.computed(() => props.pages.findIndex((page) => page.pageId === props.page.pageId));
|
|
187
135
|
const pageNumber = require__plugin_vue_export_helper.computed(() => {
|
|
188
136
|
if (pageIdx.value === -1) return 0;
|
|
@@ -243,7 +191,9 @@ var _sfc_main$2 = {
|
|
|
243
191
|
function onMouseUp() {
|
|
244
192
|
const selection = window.getSelection();
|
|
245
193
|
if (!selection || selection.toString().length === 0) return;
|
|
246
|
-
const
|
|
194
|
+
const container = props.documentEl ?? pageRef.value;
|
|
195
|
+
if (!container) return;
|
|
196
|
+
const bounds = getSelectedTextBoundingBox(container);
|
|
247
197
|
if (!bounds) return;
|
|
248
198
|
emit("selection-raw", {
|
|
249
199
|
selectionBounds: bounds,
|
|
@@ -254,7 +204,7 @@ var _sfc_main$2 = {
|
|
|
254
204
|
}
|
|
255
205
|
function onMouseDown(event) {
|
|
256
206
|
if (!event?.target) return;
|
|
257
|
-
if (event.target.tagName !== "SPAN") emit("bypass-selection", event);
|
|
207
|
+
if (!(event.target instanceof Element) || event.target.tagName !== "SPAN") emit("bypass-selection", event);
|
|
258
208
|
}
|
|
259
209
|
function getPagePtSize() {
|
|
260
210
|
const factor = require_constants.PDF_TO_CSS_UNITS * props.outputScale;
|
|
@@ -278,16 +228,16 @@ var _sfc_main$2 = {
|
|
|
278
228
|
function getScaleFactor() {
|
|
279
229
|
return (props.scale ?? 1) * require_constants.PDF_TO_CSS_UNITS;
|
|
280
230
|
}
|
|
281
|
-
function
|
|
231
|
+
function createInitialViewport() {
|
|
282
232
|
const { pdfjsPage } = props.page;
|
|
283
|
-
|
|
233
|
+
return pdfjsPage.getViewport({ scale: require_constants.PDF_TO_CSS_UNITS * props.outputScale });
|
|
284
234
|
}
|
|
285
235
|
async function renderPage() {
|
|
286
236
|
if (renderTask) return;
|
|
287
237
|
const canvasElem = canvasRef.value;
|
|
288
238
|
if (!canvasElem || !viewport.value) return;
|
|
289
239
|
const renderContext = {
|
|
290
|
-
|
|
240
|
+
canvas: canvasElem,
|
|
291
241
|
viewport: viewport.value
|
|
292
242
|
};
|
|
293
243
|
try {
|
|
@@ -349,7 +299,6 @@ var _sfc_main$2 = {
|
|
|
349
299
|
require__plugin_vue_export_helper.watch(() => props.scale, () => {
|
|
350
300
|
renderTextLayer();
|
|
351
301
|
});
|
|
352
|
-
setInitialViewport();
|
|
353
302
|
require__plugin_vue_export_helper.onMounted(() => {
|
|
354
303
|
render();
|
|
355
304
|
});
|
|
@@ -378,11 +327,13 @@ var _sfc_main$2 = {
|
|
|
378
327
|
}, null, 512)) : require__plugin_vue_export_helper.createCommentVNode("", true)], 44, _hoisted_1$1);
|
|
379
328
|
};
|
|
380
329
|
}
|
|
381
|
-
};
|
|
382
|
-
var PdfViewerPage_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$2, [["__scopeId", "data-v-d7a9857d"]]);
|
|
330
|
+
});
|
|
383
331
|
//#endregion
|
|
384
|
-
//#region src/components/PdfViewer/
|
|
385
|
-
var
|
|
332
|
+
//#region src/components/PdfViewer/PdfViewerPage.vue
|
|
333
|
+
var PdfViewerPage_default = /* @__PURE__ */ require__plugin_vue_export_helper._plugin_vue_export_helper_default(PdfViewerPage_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-ba5c44f5"]]);
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/components/PdfViewer/PdfViewerDocument.vue?vue&type=script&setup=true&lang.ts
|
|
336
|
+
var PdfViewerDocument_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ require__plugin_vue_export_helper.defineComponent({
|
|
386
337
|
__name: "PdfViewerDocument",
|
|
387
338
|
props: {
|
|
388
339
|
config: {
|
|
@@ -394,7 +345,10 @@ var _sfc_main$1 = {
|
|
|
394
345
|
type: Array,
|
|
395
346
|
required: true
|
|
396
347
|
},
|
|
397
|
-
scale: {
|
|
348
|
+
scale: {
|
|
349
|
+
type: Number,
|
|
350
|
+
required: true
|
|
351
|
+
},
|
|
398
352
|
hasTextLayer: {
|
|
399
353
|
type: Boolean,
|
|
400
354
|
default: false
|
|
@@ -451,12 +405,14 @@ var _sfc_main$1 = {
|
|
|
451
405
|
}), 128))], 512)], 512);
|
|
452
406
|
};
|
|
453
407
|
}
|
|
454
|
-
};
|
|
455
|
-
var PdfViewerDocument_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$1, [["__scopeId", "data-v-2152178b"]]);
|
|
408
|
+
});
|
|
456
409
|
//#endregion
|
|
457
|
-
//#region src/components/PdfViewer/
|
|
410
|
+
//#region src/components/PdfViewer/PdfViewerDocument.vue
|
|
411
|
+
var PdfViewerDocument_default = /* @__PURE__ */ require__plugin_vue_export_helper._plugin_vue_export_helper_default(PdfViewerDocument_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-92044cae"]]);
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/components/PdfViewer/PdfViewer.vue?vue&type=script&setup=true&lang.ts
|
|
458
414
|
var _hoisted_1 = { class: "sd-pdf-viewer__main" };
|
|
459
|
-
var
|
|
415
|
+
var PdfViewer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ require__plugin_vue_export_helper.defineComponent({
|
|
460
416
|
__name: "PdfViewer",
|
|
461
417
|
props: {
|
|
462
418
|
config: {
|
|
@@ -490,8 +446,13 @@ var _sfc_main = {
|
|
|
490
446
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
491
447
|
const emit = __emit;
|
|
492
448
|
const props = __props;
|
|
449
|
+
function requirePdfLib(config) {
|
|
450
|
+
const { pdfLib } = config;
|
|
451
|
+
if (!pdfLib) throw new TypeError("PdfViewer requires modules.pdf.pdfLib");
|
|
452
|
+
return require__plugin_vue_export_helper.markRaw(pdfLib);
|
|
453
|
+
}
|
|
493
454
|
const pdfConfig = createPDFConfig({
|
|
494
|
-
pdfLib:
|
|
455
|
+
pdfLib: requirePdfLib(props.config),
|
|
495
456
|
workerSrc: props.config.workerSrc,
|
|
496
457
|
setWorker: props.config.setWorker
|
|
497
458
|
});
|
|
@@ -559,9 +520,11 @@ var _sfc_main = {
|
|
|
559
520
|
try {
|
|
560
521
|
const pdfjsPages = await pdfAdapter.getPages(pdfjsDocument, firstPageNum, lastPageNum);
|
|
561
522
|
const mapPages = (pdfjsPage) => {
|
|
523
|
+
const currentPdf = pdf.value;
|
|
524
|
+
if (!currentPdf) throw new TypeError("PdfViewer has no document to map pages for");
|
|
562
525
|
return {
|
|
563
|
-
documentId:
|
|
564
|
-
pageId: generatePageId(
|
|
526
|
+
documentId: currentPdf.documentId,
|
|
527
|
+
pageId: generatePageId(currentPdf.documentId, pdfjsPage.pageNumber),
|
|
565
528
|
pageNumber: pdfjsPage.pageNumber,
|
|
566
529
|
pageIsRendered: false,
|
|
567
530
|
pdfjsPage: require__plugin_vue_export_helper.markRaw(pdfjsPage)
|
|
@@ -614,7 +577,9 @@ var _sfc_main = {
|
|
|
614
577
|
}), null, 16)])], 512);
|
|
615
578
|
};
|
|
616
579
|
}
|
|
617
|
-
};
|
|
618
|
-
|
|
580
|
+
});
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/components/PdfViewer/PdfViewer.vue
|
|
583
|
+
var PdfViewer_default = /* @__PURE__ */ require__plugin_vue_export_helper._plugin_vue_export_helper_default(PdfViewer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-469cc3d8"]]);
|
|
619
584
|
//#endregion
|
|
620
585
|
exports.default = PdfViewer_default;
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/helpers/object-guards.ts
|
|
2
|
+
function isPlainObject(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function isThenable(value) {
|
|
6
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/core/v2-integration/internal-vue-runtime.ts
|
|
2
10
|
var runtimeKey = "__SUPERDOC_V2_BROWSER_RUNTIME__";
|
|
11
|
+
function isVueRuntime(value) {
|
|
12
|
+
return isPlainObject(value) && typeof value.createApp === "function";
|
|
13
|
+
}
|
|
3
14
|
function runtime() {
|
|
4
|
-
const
|
|
5
|
-
|
|
15
|
+
const installed = Reflect.get(globalThis, runtimeKey);
|
|
16
|
+
const vue = isPlainObject(installed) ? installed.vue : void 0;
|
|
17
|
+
if (!isVueRuntime(vue)) throw new Error("SuperDoc rendering runtime is unavailable; initialize SuperDoc before rendering built-in surfaces.");
|
|
6
18
|
return vue;
|
|
7
19
|
}
|
|
8
20
|
function component(name) {
|
|
9
21
|
return new Proxy({}, {
|
|
10
22
|
get(_target, key) {
|
|
11
|
-
return runtime()[name]
|
|
23
|
+
return Reflect.get(runtime()[name], key);
|
|
12
24
|
},
|
|
13
25
|
set(_target, key, value) {
|
|
14
|
-
runtime()[name]
|
|
26
|
+
Reflect.set(runtime()[name], key, value);
|
|
15
27
|
return true;
|
|
16
28
|
},
|
|
17
29
|
has(_target, key) {
|
|
@@ -38,10 +50,10 @@ function defineComponent(options, extraOptions) {
|
|
|
38
50
|
}
|
|
39
51
|
var Transition = new Proxy((props, context) => runtime().Transition(props, context), {
|
|
40
52
|
get(_target, key) {
|
|
41
|
-
return runtime().Transition
|
|
53
|
+
return Reflect.get(runtime().Transition, key);
|
|
42
54
|
},
|
|
43
55
|
set(_target, key, value) {
|
|
44
|
-
runtime().Transition
|
|
56
|
+
Reflect.set(runtime().Transition, key, value);
|
|
45
57
|
return true;
|
|
46
58
|
},
|
|
47
59
|
has(_target, key) {
|
|
@@ -340,6 +352,12 @@ Object.defineProperty(exports, "inject", {
|
|
|
340
352
|
return inject;
|
|
341
353
|
}
|
|
342
354
|
});
|
|
355
|
+
Object.defineProperty(exports, "isPlainObject", {
|
|
356
|
+
enumerable: true,
|
|
357
|
+
get: function() {
|
|
358
|
+
return isPlainObject;
|
|
359
|
+
}
|
|
360
|
+
});
|
|
343
361
|
Object.defineProperty(exports, "isReactive", {
|
|
344
362
|
enumerable: true,
|
|
345
363
|
get: function() {
|
|
@@ -352,6 +370,12 @@ Object.defineProperty(exports, "isRef", {
|
|
|
352
370
|
return isRef;
|
|
353
371
|
}
|
|
354
372
|
});
|
|
373
|
+
Object.defineProperty(exports, "isThenable", {
|
|
374
|
+
enumerable: true,
|
|
375
|
+
get: function() {
|
|
376
|
+
return isThenable;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
355
379
|
Object.defineProperty(exports, "markRaw", {
|
|
356
380
|
enumerable: true,
|
|
357
381
|
get: function() {
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/helpers/object-guards.ts
|
|
2
|
+
function isPlainObject(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function isThenable(value) {
|
|
6
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/core/v2-integration/internal-vue-runtime.ts
|
|
2
10
|
var runtimeKey = "__SUPERDOC_V2_BROWSER_RUNTIME__";
|
|
11
|
+
function isVueRuntime(value) {
|
|
12
|
+
return isPlainObject(value) && typeof value.createApp === "function";
|
|
13
|
+
}
|
|
3
14
|
function runtime() {
|
|
4
|
-
const
|
|
5
|
-
|
|
15
|
+
const installed = Reflect.get(globalThis, runtimeKey);
|
|
16
|
+
const vue = isPlainObject(installed) ? installed.vue : void 0;
|
|
17
|
+
if (!isVueRuntime(vue)) throw new Error("SuperDoc rendering runtime is unavailable; initialize SuperDoc before rendering built-in surfaces.");
|
|
6
18
|
return vue;
|
|
7
19
|
}
|
|
8
20
|
function component(name) {
|
|
9
21
|
return new Proxy({}, {
|
|
10
22
|
get(_target, key) {
|
|
11
|
-
return runtime()[name]
|
|
23
|
+
return Reflect.get(runtime()[name], key);
|
|
12
24
|
},
|
|
13
25
|
set(_target, key, value) {
|
|
14
|
-
runtime()[name]
|
|
26
|
+
Reflect.set(runtime()[name], key, value);
|
|
15
27
|
return true;
|
|
16
28
|
},
|
|
17
29
|
has(_target, key) {
|
|
@@ -38,10 +50,10 @@ function defineComponent(options, extraOptions) {
|
|
|
38
50
|
}
|
|
39
51
|
var Transition = new Proxy((props, context) => runtime().Transition(props, context), {
|
|
40
52
|
get(_target, key) {
|
|
41
|
-
return runtime().Transition
|
|
53
|
+
return Reflect.get(runtime().Transition, key);
|
|
42
54
|
},
|
|
43
55
|
set(_target, key, value) {
|
|
44
|
-
runtime().Transition
|
|
56
|
+
Reflect.set(runtime().Transition, key, value);
|
|
45
57
|
return true;
|
|
46
58
|
},
|
|
47
59
|
has(_target, key) {
|
|
@@ -214,4 +226,4 @@ var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
|
214
226
|
return target;
|
|
215
227
|
};
|
|
216
228
|
//#endregion
|
|
217
|
-
export { vModelSelect as $, onActivated as A, renderList as B, isRef as C, normalizeClass as D, nextTick as E, openBlock as F, toDisplayString as G, resolveDirective as H, provide as I, toRefs as J, toRaw as K, reactive as L, onDeactivated as M, onMounted as N, normalizeProps as O, onScopeDispose as P, vModelCheckbox as Q, readonly as R, isReactive as S, mergeProps as T, resolveDynamicComponent as U, renderSlot as V, shallowRef as W, useAttrs as X, unref as Y, useSlots as Z, getCurrentInstance as _, computed as a, withModifiers as at, hasInjectionContext as b, createCommentVNode as c, createStaticVNode as d, vModelText as et, createTextVNode as f, effectScope as g, defineComponent as h, Transition as i, withKeys as it, onBeforeUnmount as j, normalizeStyle as k, createElementBlock as l, defineAsyncComponent as m, Fragment as n, withCtx as nt, createApp as o, createVNode as p, toRef as q, Teleport as r, withDirectives as rt, createBlock as s, _plugin_vue_export_helper_default as t, watch as tt, createElementVNode as u, getCurrentScope as v, markRaw as w, inject as x, h as y, ref as z };
|
|
229
|
+
export { vModelSelect as $, onActivated as A, renderList as B, isRef as C, normalizeClass as D, nextTick as E, openBlock as F, toDisplayString as G, resolveDirective as H, provide as I, toRefs as J, toRaw as K, reactive as L, onDeactivated as M, onMounted as N, normalizeProps as O, onScopeDispose as P, vModelCheckbox as Q, readonly as R, isReactive as S, mergeProps as T, resolveDynamicComponent as U, renderSlot as V, shallowRef as W, useAttrs as X, unref as Y, useSlots as Z, getCurrentInstance as _, computed as a, withModifiers as at, hasInjectionContext as b, createCommentVNode as c, createStaticVNode as d, vModelText as et, createTextVNode as f, effectScope as g, defineComponent as h, Transition as i, withKeys as it, onBeforeUnmount as j, normalizeStyle as k, createElementBlock as l, defineAsyncComponent as m, Fragment as n, withCtx as nt, createApp as o, isPlainObject as ot, createVNode as p, toRef as q, Teleport as r, withDirectives as rt, createBlock as s, isThenable as st, _plugin_vue_export_helper_default as t, watch as tt, createElementVNode as u, getCurrentScope as v, markRaw as w, inject as x, h as y, ref as z };
|