@embedpdf/vue 3.0.0-next.15 → 3.0.0-next.16
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/{DocumentScope.vue_vue_type_script_setup_true_lang-CtTu1FGX.js → DocumentScope.vue_vue_type_script_setup_true_lang-C-7yeEGh.js} +4 -3
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-C-7yeEGh.js.map +1 -0
- package/dist/{DocumentScope.vue_vue_type_script_setup_true_lang-loLSm4lV.cjs → DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.cjs} +3 -2
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.cjs.map +1 -0
- package/dist/annotation/text-box.d.cts +2 -1
- package/dist/annotation/text-box.d.ts +2 -1
- package/dist/annotation.cjs +1 -1
- package/dist/annotation.js +1 -1
- package/dist/attachment.cjs +22 -0
- package/dist/attachment.cjs.map +1 -0
- package/dist/attachment.d.cts +34 -0
- package/dist/attachment.d.ts +34 -0
- package/dist/attachment.js +17 -0
- package/dist/attachment.js.map +1 -0
- package/dist/{composables-BuHvnUlo.cjs → composables-Bi6QvJpj.cjs} +18 -43
- package/dist/{composables-BuHvnUlo.cjs.map → composables-Bi6QvJpj.cjs.map} +1 -1
- package/dist/{composables-CIkhKwAg.js → composables-DK3lwh38.js} +19 -44
- package/dist/{composables-CIkhKwAg.js.map → composables-DK3lwh38.js.map} +1 -1
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/outline.cjs +22 -0
- package/dist/outline.cjs.map +1 -0
- package/dist/outline.d.cts +36 -0
- package/dist/outline.d.ts +36 -0
- package/dist/outline.js +17 -0
- package/dist/outline.js.map +1 -0
- package/dist/page-edit.cjs +3 -0
- package/dist/page-edit.cjs.map +1 -1
- package/dist/page-edit.d.cts +14 -2
- package/dist/page-edit.d.ts +14 -2
- package/dist/page-edit.js +5 -2
- package/dist/page-edit.js.map +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/package.json +40 -30
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-CtTu1FGX.js.map +0 -1
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-loLSm4lV.cjs.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @embedpdf/vue/outline: the Vue view of `@embedpdf/plugin-outline`. Reading
|
|
3
|
+
* the state reads the outline; the plugin keeps it live off the document's
|
|
4
|
+
* event stream, and shows your own edits at once.
|
|
5
|
+
*
|
|
6
|
+
* const outline = useOutline();
|
|
7
|
+
* const { rows, current, canEdit } = useOutlineState();
|
|
8
|
+
* outline.activate(row.item.ref); // goes where the item goes, as a click does
|
|
9
|
+
*/
|
|
10
|
+
export * from '@embedpdf/plugin-outline';
|
|
11
|
+
import type { OutlineCapability } from '@embedpdf/plugin-outline';
|
|
12
|
+
import type { EventHook } from '@embedpdf/core';
|
|
13
|
+
/**
|
|
14
|
+
* The outline API (expand, select, activate, create, update, move, delete) of
|
|
15
|
+
* the nearest `<DocumentScope>`'s document, else the active one. The object
|
|
16
|
+
* never changes; outside a document every method throws `not-ready`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useOutline(): OutlineCapability;
|
|
19
|
+
/**
|
|
20
|
+
* The outline's state as refs: its items, the rows a tree view shows, the item
|
|
21
|
+
* for where the view is reading, the selection, the load state and whether you
|
|
22
|
+
* may edit it (the page's State table, declared once in `outlineState`). With
|
|
23
|
+
* a selector, one ref for the value it picks, which updates only when that
|
|
24
|
+
* value changes.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useOutlineState: import("./state.cjs").StateComposable<{
|
|
27
|
+
items: readonly import("@embedpdf/plugin-outline").OutlineItem<import("@embedpdf/core").PageDestination>[];
|
|
28
|
+
rows: readonly import("@embedpdf/plugin-outline").OutlineRow[];
|
|
29
|
+
current: import("@embedpdf/plugin-outline").OutlineItemRef | null;
|
|
30
|
+
selected: readonly import("@embedpdf/plugin-outline").OutlineItemRef[];
|
|
31
|
+
status: import("@embedpdf/core").ResourceStatus;
|
|
32
|
+
incomplete: boolean;
|
|
33
|
+
canEdit: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
/** Subscribe to one outline event while the component lives: `useOutlineEvent((outline) => outline.onChanged, handler)`. */
|
|
36
|
+
export declare function useOutlineEvent<Event>(select: (outline: OutlineCapability) => EventHook<Event>, handler: (event: Event) => void): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @embedpdf/vue/outline: the Vue view of `@embedpdf/plugin-outline`. Reading
|
|
3
|
+
* the state reads the outline; the plugin keeps it live off the document's
|
|
4
|
+
* event stream, and shows your own edits at once.
|
|
5
|
+
*
|
|
6
|
+
* const outline = useOutline();
|
|
7
|
+
* const { rows, current, canEdit } = useOutlineState();
|
|
8
|
+
* outline.activate(row.item.ref); // goes where the item goes, as a click does
|
|
9
|
+
*/
|
|
10
|
+
export * from '@embedpdf/plugin-outline';
|
|
11
|
+
import type { OutlineCapability } from '@embedpdf/plugin-outline';
|
|
12
|
+
import type { EventHook } from '@embedpdf/core';
|
|
13
|
+
/**
|
|
14
|
+
* The outline API (expand, select, activate, create, update, move, delete) of
|
|
15
|
+
* the nearest `<DocumentScope>`'s document, else the active one. The object
|
|
16
|
+
* never changes; outside a document every method throws `not-ready`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useOutline(): OutlineCapability;
|
|
19
|
+
/**
|
|
20
|
+
* The outline's state as refs: its items, the rows a tree view shows, the item
|
|
21
|
+
* for where the view is reading, the selection, the load state and whether you
|
|
22
|
+
* may edit it (the page's State table, declared once in `outlineState`). With
|
|
23
|
+
* a selector, one ref for the value it picks, which updates only when that
|
|
24
|
+
* value changes.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useOutlineState: import("./state.js").StateComposable<{
|
|
27
|
+
items: readonly import("@embedpdf/plugin-outline").OutlineItem<import("@embedpdf/core").PageDestination>[];
|
|
28
|
+
rows: readonly import("@embedpdf/plugin-outline").OutlineRow[];
|
|
29
|
+
current: import("@embedpdf/plugin-outline").OutlineItemRef | null;
|
|
30
|
+
selected: readonly import("@embedpdf/plugin-outline").OutlineItemRef[];
|
|
31
|
+
status: import("@embedpdf/core").ResourceStatus;
|
|
32
|
+
incomplete: boolean;
|
|
33
|
+
canEdit: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
/** Subscribe to one outline event while the component lives: `useOutlineEvent((outline) => outline.onChanged, handler)`. */
|
|
36
|
+
export declare function useOutlineEvent<Event>(select: (outline: OutlineCapability) => EventHook<Event>, handler: (event: Event) => void): void;
|
package/dist/outline.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OutlineToken, outlineState } from "@embedpdf/plugin-outline";
|
|
2
|
+
export * from "@embedpdf/plugin-outline";
|
|
3
|
+
import { a as useCapability, b as useCapabilityEvent } from "./capabilities-C7YzgPCX.js";
|
|
4
|
+
import { a as stateComposable } from "./state-DZg8q3v6.js";
|
|
5
|
+
function useOutline() {
|
|
6
|
+
return useCapability(OutlineToken);
|
|
7
|
+
}
|
|
8
|
+
const useOutlineState = stateComposable(outlineState);
|
|
9
|
+
function useOutlineEvent(select, handler) {
|
|
10
|
+
useCapabilityEvent(OutlineToken, select, handler);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
useOutline,
|
|
14
|
+
useOutlineEvent,
|
|
15
|
+
useOutlineState
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.js","sources":["../src/outline.ts"],"sourcesContent":["/**\n * @embedpdf/vue/outline: the Vue view of `@embedpdf/plugin-outline`. Reading\n * the state reads the outline; the plugin keeps it live off the document's\n * event stream, and shows your own edits at once.\n *\n * const outline = useOutline();\n * const { rows, current, canEdit } = useOutlineState();\n * outline.activate(row.item.ref); // goes where the item goes, as a click does\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-outline';\nimport { OutlineToken, outlineState } from '@embedpdf/plugin-outline';\nimport type { OutlineCapability } from '@embedpdf/plugin-outline';\nimport type { EventHook } from '@embedpdf/core';\nimport { useCapability, useCapabilityEvent } from './runtime/capabilities';\nimport { stateComposable } from './state';\n\n/**\n * The outline API (expand, select, activate, create, update, move, delete) of\n * the nearest `<DocumentScope>`'s document, else the active one. The object\n * never changes; outside a document every method throws `not-ready`.\n */\nexport function useOutline(): OutlineCapability {\n return useCapability(OutlineToken);\n}\n\n/**\n * The outline's state as refs: its items, the rows a tree view shows, the item\n * for where the view is reading, the selection, the load state and whether you\n * may edit it (the page's State table, declared once in `outlineState`). With\n * a selector, one ref for the value it picks, which updates only when that\n * value changes.\n */\nexport const useOutlineState = stateComposable(outlineState);\n\n/** Subscribe to one outline event while the component lives: `useOutlineEvent((outline) => outline.onChanged, handler)`. */\nexport function useOutlineEvent<Event>(\n select: (outline: OutlineCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(OutlineToken, select, handler);\n}\n"],"names":[],"mappings":";;;;AAuBO,SAAS,aAAgC;AAC9C,SAAO,cAAc,YAAY;AACnC;AASO,MAAM,kBAAkB,gBAAgB,YAAY;AAGpD,SAAS,gBACd,QACA,SACM;AACN,qBAAmB,cAAc,QAAQ,OAAO;AAClD;"}
|
package/dist/page-edit.cjs
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const pluginPageEdit = require("@embedpdf/plugin-page-edit");
|
|
4
4
|
const capabilities = require("./capabilities-DVNJmgy7.cjs");
|
|
5
|
+
const state = require("./state-M22NDJQo.cjs");
|
|
5
6
|
function usePageEdit() {
|
|
6
7
|
return capabilities.useCapability(pluginPageEdit.PageEditToken);
|
|
7
8
|
}
|
|
9
|
+
const usePageEditState = state.stateComposable(pluginPageEdit.pageEditState);
|
|
8
10
|
exports.usePageEdit = usePageEdit;
|
|
11
|
+
exports.usePageEditState = usePageEditState;
|
|
9
12
|
Object.keys(pluginPageEdit).forEach((k) => {
|
|
10
13
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
11
14
|
enumerable: true,
|
package/dist/page-edit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-edit.cjs","sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * @embedpdf/vue/page-edit: the Vue view of `@embedpdf/plugin-page-edit`. The\n * plugin turns a page relative to its rotation and resolves
|
|
1
|
+
{"version":3,"file":"page-edit.cjs","sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * @embedpdf/vue/page-edit: the Vue view of `@embedpdf/plugin-page-edit`. The\n * plugin turns a page relative to its rotation and resolves positions, so\n * this entry is the binding only:\n *\n * const pageEdit = usePageEdit();\n * const { selected, canEdit } = usePageEditState();\n * await pageEdit.rotateBy(selected.value, 90);\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nimport { PageEditToken, pageEditState } from '@embedpdf/plugin-page-edit';\nimport type { PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime/capabilities';\nimport { stateComposable } from './state';\n\n/**\n * The page edits of the nearest `<DocumentScope>`'s document, else the active\n * one. The object never changes; outside a document every method throws\n * `not-ready`. The pages themselves come from `usePageList()`.\n */\nexport function usePageEdit(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n\n/**\n * The page edits' state as refs: the selected pages and whether you may edit\n * and copy pages (the page's State table, declared once in `pageEditState`).\n * With a selector, one ref for the value it picks, which updates only when\n * that value changes.\n */\nexport const usePageEditState = stateComposable(pageEditState);\n"],"names":["useCapability","PageEditToken","stateComposable","pageEditState"],"mappings":";;;;;AAsBO,SAAS,cAAkC;AAChD,SAAOA,aAAAA,cAAcC,eAAAA,aAAa;AACpC;AAQO,MAAM,mBAAmBC,MAAAA,gBAAgBC,eAAAA,aAAa;;;;;;;;;"}
|
package/dist/page-edit.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @embedpdf/vue/page-edit: the Vue view of `@embedpdf/plugin-page-edit`. The
|
|
3
|
-
* plugin turns a page relative to its rotation and resolves
|
|
3
|
+
* plugin turns a page relative to its rotation and resolves positions, so
|
|
4
4
|
* this entry is the binding only:
|
|
5
5
|
*
|
|
6
6
|
* const pageEdit = usePageEdit();
|
|
7
|
-
*
|
|
7
|
+
* const { selected, canEdit } = usePageEditState();
|
|
8
|
+
* await pageEdit.rotateBy(selected.value, 90);
|
|
8
9
|
*/
|
|
9
10
|
export * from '@embedpdf/plugin-page-edit';
|
|
10
11
|
import type { PageEditCapability } from '@embedpdf/plugin-page-edit';
|
|
@@ -14,3 +15,14 @@ import type { PageEditCapability } from '@embedpdf/plugin-page-edit';
|
|
|
14
15
|
* `not-ready`. The pages themselves come from `usePageList()`.
|
|
15
16
|
*/
|
|
16
17
|
export declare function usePageEdit(): PageEditCapability;
|
|
18
|
+
/**
|
|
19
|
+
* The page edits' state as refs: the selected pages and whether you may edit
|
|
20
|
+
* and copy pages (the page's State table, declared once in `pageEditState`).
|
|
21
|
+
* With a selector, one ref for the value it picks, which updates only when
|
|
22
|
+
* that value changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare const usePageEditState: import("./state.cjs").StateComposable<{
|
|
25
|
+
selected: readonly import("@embedpdf/core").PageRef[];
|
|
26
|
+
canEdit: boolean;
|
|
27
|
+
canExtract: boolean;
|
|
28
|
+
}>;
|
package/dist/page-edit.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @embedpdf/vue/page-edit: the Vue view of `@embedpdf/plugin-page-edit`. The
|
|
3
|
-
* plugin turns a page relative to its rotation and resolves
|
|
3
|
+
* plugin turns a page relative to its rotation and resolves positions, so
|
|
4
4
|
* this entry is the binding only:
|
|
5
5
|
*
|
|
6
6
|
* const pageEdit = usePageEdit();
|
|
7
|
-
*
|
|
7
|
+
* const { selected, canEdit } = usePageEditState();
|
|
8
|
+
* await pageEdit.rotateBy(selected.value, 90);
|
|
8
9
|
*/
|
|
9
10
|
export * from '@embedpdf/plugin-page-edit';
|
|
10
11
|
import type { PageEditCapability } from '@embedpdf/plugin-page-edit';
|
|
@@ -14,3 +15,14 @@ import type { PageEditCapability } from '@embedpdf/plugin-page-edit';
|
|
|
14
15
|
* `not-ready`. The pages themselves come from `usePageList()`.
|
|
15
16
|
*/
|
|
16
17
|
export declare function usePageEdit(): PageEditCapability;
|
|
18
|
+
/**
|
|
19
|
+
* The page edits' state as refs: the selected pages and whether you may edit
|
|
20
|
+
* and copy pages (the page's State table, declared once in `pageEditState`).
|
|
21
|
+
* With a selector, one ref for the value it picks, which updates only when
|
|
22
|
+
* that value changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare const usePageEditState: import("./state.js").StateComposable<{
|
|
25
|
+
selected: readonly import("@embedpdf/core").PageRef[];
|
|
26
|
+
canEdit: boolean;
|
|
27
|
+
canExtract: boolean;
|
|
28
|
+
}>;
|
package/dist/page-edit.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { PageEditToken } from "@embedpdf/plugin-page-edit";
|
|
1
|
+
import { PageEditToken, pageEditState } from "@embedpdf/plugin-page-edit";
|
|
2
2
|
export * from "@embedpdf/plugin-page-edit";
|
|
3
3
|
import { a as useCapability } from "./capabilities-C7YzgPCX.js";
|
|
4
|
+
import { a as stateComposable } from "./state-DZg8q3v6.js";
|
|
4
5
|
function usePageEdit() {
|
|
5
6
|
return useCapability(PageEditToken);
|
|
6
7
|
}
|
|
8
|
+
const usePageEditState = stateComposable(pageEditState);
|
|
7
9
|
export {
|
|
8
|
-
usePageEdit
|
|
10
|
+
usePageEdit,
|
|
11
|
+
usePageEditState
|
|
9
12
|
};
|
|
10
13
|
//# sourceMappingURL=page-edit.js.map
|
package/dist/page-edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-edit.js","sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * @embedpdf/vue/page-edit: the Vue view of `@embedpdf/plugin-page-edit`. The\n * plugin turns a page relative to its rotation and resolves
|
|
1
|
+
{"version":3,"file":"page-edit.js","sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * @embedpdf/vue/page-edit: the Vue view of `@embedpdf/plugin-page-edit`. The\n * plugin turns a page relative to its rotation and resolves positions, so\n * this entry is the binding only:\n *\n * const pageEdit = usePageEdit();\n * const { selected, canEdit } = usePageEditState();\n * await pageEdit.rotateBy(selected.value, 90);\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nimport { PageEditToken, pageEditState } from '@embedpdf/plugin-page-edit';\nimport type { PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime/capabilities';\nimport { stateComposable } from './state';\n\n/**\n * The page edits of the nearest `<DocumentScope>`'s document, else the active\n * one. The object never changes; outside a document every method throws\n * `not-ready`. The pages themselves come from `usePageList()`.\n */\nexport function usePageEdit(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n\n/**\n * The page edits' state as refs: the selected pages and whether you may edit\n * and copy pages (the page's State table, declared once in `pageEditState`).\n * With a selector, one ref for the value it picks, which updates only when\n * that value changes.\n */\nexport const usePageEditState = stateComposable(pageEditState);\n"],"names":[],"mappings":";;;;AAsBO,SAAS,cAAkC;AAChD,SAAO,cAAc,aAAa;AACpC;AAQO,MAAM,mBAAmB,gBAAgB,aAAa;"}
|
package/dist/runtime.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const core = require("@embedpdf/core");
|
|
4
4
|
const web = require("@embedpdf/web");
|
|
5
|
-
const DocumentScope_vue_vue_type_script_setup_true_lang = require("./DocumentScope.vue_vue_type_script_setup_true_lang-
|
|
5
|
+
const DocumentScope_vue_vue_type_script_setup_true_lang = require("./DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.cjs");
|
|
6
6
|
const capabilities = require("./capabilities-DVNJmgy7.cjs");
|
|
7
7
|
const documents = require("./documents-TQ1fMdWI.cjs");
|
|
8
8
|
const page = require("./page-Doy4_Sdz.cjs");
|
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "@embedpdf/core";
|
|
2
2
|
import { makePageContext, mountWebFont, saveFile } from "@embedpdf/web";
|
|
3
|
-
import { _, a, b, c, e } from "./DocumentScope.vue_vue_type_script_setup_true_lang-
|
|
3
|
+
import { _, a, b, c, e } from "./DocumentScope.vue_vue_type_script_setup_true_lang-C-7yeEGh.js";
|
|
4
4
|
import { u, a as a2, b as b2, c as c2, d, e as e2, f, g, h, i, j } from "./capabilities-C7YzgPCX.js";
|
|
5
5
|
import { u as u2, a as a3, b as b3, c as c3, d as d2, e as e3 } from "./documents-DUu5H4yH.js";
|
|
6
6
|
import { p, u as u3 } from "./page-D9XIuLSj.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/vue",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Vue adapter for EmbedPDF v3: composables, components with v-model and scoped slots, headless layers. The whole framework surface, one entry point per feature.",
|
|
6
6
|
"type": "module",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"import": "./dist/annotation.js",
|
|
35
35
|
"require": "./dist/annotation.cjs"
|
|
36
36
|
},
|
|
37
|
+
"./attachment": {
|
|
38
|
+
"import": "./dist/attachment.js",
|
|
39
|
+
"require": "./dist/attachment.cjs"
|
|
40
|
+
},
|
|
37
41
|
"./commands": {
|
|
38
42
|
"import": "./dist/commands.js",
|
|
39
43
|
"require": "./dist/commands.cjs"
|
|
@@ -62,6 +66,10 @@
|
|
|
62
66
|
"import": "./dist/metadata.js",
|
|
63
67
|
"require": "./dist/metadata.cjs"
|
|
64
68
|
},
|
|
69
|
+
"./outline": {
|
|
70
|
+
"import": "./dist/outline.js",
|
|
71
|
+
"require": "./dist/outline.cjs"
|
|
72
|
+
},
|
|
65
73
|
"./history": {
|
|
66
74
|
"import": "./dist/history.js",
|
|
67
75
|
"require": "./dist/history.cjs"
|
|
@@ -121,33 +129,35 @@
|
|
|
121
129
|
"./package.json": "./package.json"
|
|
122
130
|
},
|
|
123
131
|
"dependencies": {
|
|
124
|
-
"@embedpdf/core-annotation": "3.0.0-next.
|
|
125
|
-
"@embedpdf/core-geometry": "3.0.0-next.
|
|
126
|
-
"@embedpdf/
|
|
127
|
-
"@embedpdf/plugin-
|
|
128
|
-
"@embedpdf/plugin-
|
|
129
|
-
"@embedpdf/
|
|
130
|
-
"@embedpdf/plugin-
|
|
131
|
-
"@embedpdf/plugin-
|
|
132
|
-
"@embedpdf/plugin-
|
|
133
|
-
"@embedpdf/plugin-metadata": "3.0.0-next.
|
|
134
|
-
"@embedpdf/plugin-
|
|
135
|
-
"@embedpdf/plugin-
|
|
136
|
-
"@embedpdf/plugin-
|
|
137
|
-
"@embedpdf/plugin-
|
|
138
|
-
"@embedpdf/plugin-
|
|
139
|
-
"@embedpdf/plugin-
|
|
140
|
-
"@embedpdf/plugin-
|
|
141
|
-
"@embedpdf/plugin-
|
|
142
|
-
"@embedpdf/plugin-
|
|
143
|
-
"@embedpdf/plugin-shell": "3.0.0-next.
|
|
144
|
-
"@embedpdf/plugin-
|
|
145
|
-
"@embedpdf/
|
|
146
|
-
"@embedpdf/
|
|
147
|
-
"@embedpdf/core-
|
|
148
|
-
"@embedpdf/
|
|
149
|
-
"@embedpdf/
|
|
150
|
-
"@embedpdf/
|
|
132
|
+
"@embedpdf/core-annotation": "3.0.0-next.16",
|
|
133
|
+
"@embedpdf/core-geometry": "3.0.0-next.16",
|
|
134
|
+
"@embedpdf/core": "3.0.0-next.16",
|
|
135
|
+
"@embedpdf/plugin-annotation": "3.0.0-next.16",
|
|
136
|
+
"@embedpdf/plugin-commands": "3.0.0-next.16",
|
|
137
|
+
"@embedpdf/plugin-attachment": "3.0.0-next.16",
|
|
138
|
+
"@embedpdf/plugin-i18n": "3.0.0-next.16",
|
|
139
|
+
"@embedpdf/plugin-interaction": "3.0.0-next.16",
|
|
140
|
+
"@embedpdf/plugin-form": "3.0.0-next.16",
|
|
141
|
+
"@embedpdf/plugin-metadata": "3.0.0-next.16",
|
|
142
|
+
"@embedpdf/plugin-link": "3.0.0-next.16",
|
|
143
|
+
"@embedpdf/plugin-outline": "3.0.0-next.16",
|
|
144
|
+
"@embedpdf/plugin-history": "3.0.0-next.16",
|
|
145
|
+
"@embedpdf/plugin-redaction": "3.0.0-next.16",
|
|
146
|
+
"@embedpdf/plugin-page-edit": "3.0.0-next.16",
|
|
147
|
+
"@embedpdf/plugin-search": "3.0.0-next.16",
|
|
148
|
+
"@embedpdf/plugin-selection": "3.0.0-next.16",
|
|
149
|
+
"@embedpdf/plugin-render": "3.0.0-next.16",
|
|
150
|
+
"@embedpdf/plugin-signature": "3.0.0-next.16",
|
|
151
|
+
"@embedpdf/plugin-shell": "3.0.0-next.16",
|
|
152
|
+
"@embedpdf/plugin-stage": "3.0.0-next.16",
|
|
153
|
+
"@embedpdf/plugin-stamp": "3.0.0-next.16",
|
|
154
|
+
"@embedpdf/plugin-view-manager": "3.0.0-next.16",
|
|
155
|
+
"@embedpdf/core-signature": "3.0.0-next.16",
|
|
156
|
+
"@embedpdf/core-stage": "3.0.0-next.16",
|
|
157
|
+
"@embedpdf/core-ui": "3.0.0-next.16",
|
|
158
|
+
"@embedpdf/web": "3.0.0-next.16",
|
|
159
|
+
"@embedpdf/plugin-actions": "3.0.0-next.16",
|
|
160
|
+
"@embedpdf/plugin-measurement": "3.0.0-next.16"
|
|
151
161
|
},
|
|
152
162
|
"peerDependencies": {
|
|
153
163
|
"vue": ">=3.4"
|
|
@@ -161,8 +171,8 @@
|
|
|
161
171
|
"vitest": "^2.1.9",
|
|
162
172
|
"vue": "^3.5.13",
|
|
163
173
|
"vue-tsc": "^3.2.4",
|
|
164
|
-
"@embedpdf/
|
|
165
|
-
"@embedpdf/
|
|
174
|
+
"@embedpdf/tooling-build": "0.0.0",
|
|
175
|
+
"@embedpdf/engine": "3.0.0-next.16"
|
|
166
176
|
},
|
|
167
177
|
"scripts": {
|
|
168
178
|
"build": "vite build && vue-tsc -p tsconfig.build.json && node ../../../tooling/build/src/fully-specify-imports.mjs --cjs-types && node ../../../tooling/build/src/check-framework-package.mjs",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentScope.vue_vue_type_script_setup_true_lang-CtTu1FGX.js","sources":["../src/theme.ts","../src/runtime/Viewer.vue","../src/runtime/KernelProvider.vue","../src/runtime/DocumentGate.vue","../src/runtime/DocumentScope.vue"],"sourcesContent":["/**\n * `epdfTheme()`: a theme written with setting names, as a style for the\n * element around your viewer. The variables and their lookup are framework-free\n * (`@embedpdf/web`); this only types the result as Vue's style.\n */\nimport type { CSSProperties } from 'vue';\nimport { epdfThemeVariables, type EpdfTheme } from '@embedpdf/web';\n\nexport type { EpdfTheme } from '@embedpdf/web';\n\n/**\n * The CSS variables of a theme, for a `:style` binding: `<div :style=\"epdfTheme({ accent })\">`.\n * Everything inside the element follows them, and a CSS variable wins over any setting.\n */\nexport function epdfTheme(theme: EpdfTheme): CSSProperties {\n return epdfThemeVariables(theme) as CSSProperties;\n}\n","<!--\n <Viewer>: owns the kernel. It creates and starts the kernel when it mounts\n (never on the server) and destroys it when it unmounts; the components inside\n read it through composables. `engine`, `plugins` and `initialDocuments` are\n read once; `identity`, `scope`, `accent` and `page` are the viewer's settings\n and follow the props.\n-->\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted, shallowRef, toRaw, watch } from 'vue';\nimport { createKernel, isLocalEngine, viewerSettingsOf } from '@embedpdf/core';\nimport { browserClock } from '@embedpdf/web';\nimport type {\n AnyPlugin,\n Engine,\n EngineFactory,\n Identity,\n InitialDocument,\n Kernel,\n ViewerPageSettings,\n ViewerSettings,\n} from '@embedpdf/core';\nimport { devWarn } from '../dev';\nimport { provideViewer } from './kernel';\n\nconst props = defineProps<{\n /**\n * The engine, as an instance or a function. An instance is borrowed: the\n * viewer uses it and never destroys it (a module-level `localEngine()`\n * shared by every viewer). A function is the viewer's own: it calls it when\n * it mounts and destroys the engine when it unmounts. Read once.\n */\n engine: Engine | EngineFactory;\n /** The plugins, created once next to the engine. Read once. */\n plugins: AnyPlugin[];\n /** Documents to open when the viewer starts, with optional tab names. Read once. */\n initialDocuments?: InitialDocument[];\n /**\n * Who the user is, for every document opened without an `identity` of its\n * own (which replaces this one). Documents opened after a change use the new\n * value; open ones keep theirs. The local engine only: the cloud engine reads\n * it from the document's token.\n */\n identity?: Identity;\n /**\n * What the user may do, as permissions, in every document opened without a\n * `scope` of its own. Left out, they may do everything. Changes reach the\n * documents opened after them, as `identity`.\n */\n scope?: readonly string[];\n /** The color every part without a color of its own follows. CSS `--epdf-accent` wins over it. */\n accent?: string;\n /** How pages look: `background` before the picture arrives, and the `shadow` under each page. */\n page?: Partial<ViewerPageSettings>;\n}>();\n\nconst emit = defineEmits<{\n /**\n * The kernel has started: before the default slot mounts and before\n * `initialDocuments` open. The door for code outside Vue components\n * (register commands, subscribe to events).\n */\n ready: [kernel: Kernel];\n}>();\n\ndefineSlots<{\n /** The viewer's content, mounted once the kernel has started. */\n default?(): unknown;\n /** Shown while the kernel starts; the composables already work in it. */\n fallback?(): unknown;\n /** Shown when the kernel couldn't be created or started. Without it, a failed start shows nothing. */\n error?(props: { error: unknown }): unknown;\n}>();\n\n/**\n * The viewer's settings as the props give them: a prop left out is its\n * default. Values reach the kernel raw: a reactive copy would be another object\n * to it, and can't be sent to a worker.\n */\nconst settingsOf = (): ViewerSettings =>\n viewerSettingsOf({\n identity: toRaw(props.identity),\n scope: toRaw(props.scope),\n accent: props.accent,\n page: toRaw(props.page),\n });\n\nconst kernel = shallowRef<Kernel | null>(null);\nconst phase = shallowRef<'booting' | 'ready' | 'error'>('booting');\nconst bootError = shallowRef<unknown>(null);\n// Goes up on every kernel change; every reader's computed depends on it.\nconst revision = shallowRef(0);\n\nprovideViewer({\n get kernel() {\n return kernel.value;\n },\n track: () => {\n void revision.value;\n },\n});\n\n// Read once: a changed engine or plugin list can't mean \"rebuild the\n// workspace\", which would drop every open document. Raw, because the kernel\n// knows a plugin's token by identity, and a reactive copy is another object.\nconst initial = {\n engine: toRaw(props.engine),\n plugins: toRaw(props.plugins),\n initialDocuments: toRaw(props.initialDocuments),\n};\nwatch(\n () => props.plugins,\n () =>\n devWarn(\n 'viewer-plugins-init-only',\n '<Viewer> plugins are read once, when it mounts; a new list is ignored. ' +\n 'Create the list once, next to the engine, not inline in the template.',\n ),\n);\nwatch(\n () => props.engine,\n (engine) => {\n // An inline `:engine=\"() => localEngine()\"` is a new function on every\n // render; only another engine instance is worth a warning.\n if (typeof engine === 'function') return;\n devWarn(\n 'viewer-engine-init-only',\n '<Viewer> engine is read once, when it mounts; another engine is ignored. ' +\n 'To use another engine, mount a new <Viewer>, for example with a new `key`.',\n );\n },\n);\n\nlet teardown: (() => void) | null = null;\n\nonMounted(() => {\n // A function is the viewer's own engine: called now, destroyed on unmount.\n // An instance is borrowed. Construction is synchronous and inert either way,\n // so warming up a local engine overlaps its boot with the plugins' start.\n const ownsEngine = typeof initial.engine === 'function';\n const engine: Engine = ownsEngine\n ? (initial.engine as EngineFactory)()\n : (initial.engine as Engine);\n if (isLocalEngine(engine)) engine.warmup();\n let created: Kernel;\n try {\n created = createKernel({\n engine,\n plugins: initial.plugins,\n settings: settingsOf(),\n clock: browserClock(),\n });\n } catch (error) {\n // A plan or dependency error shows in the `error` slot.\n bootError.value = error;\n phase.value = 'error';\n if (ownsEngine) void engine.destroy();\n return;\n }\n const stopTracking = created.subscribe(() => {\n revision.value += 1;\n });\n // The kernel is on the binding from now on, so the fallback can use it.\n kernel.value = created;\n let alive = true;\n created.start().then(\n () => {\n if (!alive) return;\n emit('ready', created);\n phase.value = 'ready';\n // Every tab appears at once, in order; the `active` entry (else the\n // first) is selected; a failure shows as that document's status.\n created.documents.openAll(initial.initialDocuments ?? []);\n },\n (error: unknown) => {\n if (!alive) return;\n bootError.value = error;\n phase.value = 'error';\n },\n );\n teardown = () => {\n alive = false;\n stopTracking();\n // The kernel first (it closes every document's handle), then the engine\n // the viewer owns.\n void created.destroy().then(() => {\n if (ownsEngine) void engine.destroy();\n });\n };\n});\n\n// After the content has unmounted, so its own cleanups still reach a live kernel.\nonUnmounted(() => teardown?.());\n\n// Props compare by value: an inline `:page=\"{ shadow: 'none' }\"` is a new\n// object on every render, and settings that didn't change change nothing.\nwatch(settingsOf, (settings) => kernel.value?.updateSettings(settings));\n\ndefineExpose({\n /** The started kernel; null before it starts and after a failed start. */\n kernel: computed(() => (phase.value === 'ready' ? kernel.value : null)),\n});\n</script>\n\n<template>\n <slot v-if=\"phase === 'error'\" name=\"error\" :error=\"bootError\" />\n <template v-else-if=\"kernel\">\n <slot v-if=\"phase === 'ready'\" />\n <slot v-else name=\"fallback\" />\n </template>\n</template>\n","<!--\n <KernelProvider :kernel>: gives its content a kernel someone else created and\n owns, so every composable inside works against that kernel. The full viewer's\n Vue wrapper puts the components it shows in the viewer inside one. It never\n starts or destroys the kernel; <Viewer> is the component that owns one. The\n kernel is read once: for another one, mount a new provider (a new `key`).\n-->\n<script setup lang=\"ts\">\nimport { onScopeDispose, shallowRef, toRaw, watch } from 'vue';\nimport type { Kernel } from '@embedpdf/core';\nimport { devWarn } from '../dev';\nimport { provideViewer } from './kernel';\n\nconst props = defineProps<{\n /** The kernel, created and started by its owner. Read once. */\n kernel: Kernel;\n}>();\n\ndefineSlots<{ default?(): unknown }>();\n\n// Read once, as `<Viewer>` reads its engine: the composables inside took this kernel when they\n// were set up, and a new one under them would leave them reading the old one. Raw, because a\n// reactive copy of the kernel is another object.\nconst kernel = toRaw(props.kernel);\nwatch(\n () => props.kernel,\n () =>\n devWarn(\n 'kernel-provider-kernel-init-only',\n '<KernelProvider> kernel is read once, when it mounts; another kernel is ignored. ' +\n 'To give its content another kernel, mount a new <KernelProvider>, for example with a new `key`.',\n ),\n);\n\n// Goes up on every change the kernel announces; every reader's computed depends on it.\nconst revision = shallowRef(0);\nonScopeDispose(\n kernel.subscribe(() => {\n revision.value += 1;\n }),\n);\n\nprovideViewer({\n kernel,\n track: () => {\n void revision.value;\n },\n});\n</script>\n\n<template>\n <slot />\n</template>\n","<!--\n <DocumentGate>: renders its content only while this subtree has a ready\n document, the structural way to say \"this UI is defined over a document\".\n Workspace UI (toolbars, commands) lives outside it; document UI (the Stage,\n panels) inside. A document that waits for its password, or failed, renders\n the `#locked` or `#error` slot with it, or else `#fallback`. It decides\n whether; <DocumentScope> decides which document.\n-->\n<script setup lang=\"ts\">\nimport type { DocumentInfo, FailedDocumentInfo, LockedDocumentInfo } from '@embedpdf/core';\nimport { useDocument } from './documents';\n\ndefineSlots<{\n /** Rendered while the document is ready. */\n default?(): unknown;\n /** Shown while this subtree has no document: none is open, or it's still opening. */\n fallback?(): unknown;\n /** Shown while the document waits for its password; `#fallback` without it. */\n locked?(props: { document: LockedDocumentInfo }): unknown;\n /** Shown when the document couldn't be opened, with why; `#fallback` without it. */\n error?(props: { document: FailedDocumentInfo }): unknown;\n}>();\n\nconst current = useDocument((document: DocumentInfo) => document);\n</script>\n\n<template>\n <slot v-if=\"current.status === 'ready'\" />\n <slot\n v-else-if=\"current.status === 'locked' && $slots.locked\"\n name=\"locked\"\n :document=\"current as LockedDocumentInfo\"\n />\n <slot\n v-else-if=\"current.status === 'error' && $slots.error\"\n name=\"error\"\n :document=\"current as FailedDocumentInfo\"\n />\n <slot v-else name=\"fallback\" />\n</template>\n","<!--\n <DocumentScope :id>: binds its content to one document, for panes and\n comparisons. The composables inside talk to that document instead of the\n active one, and `useDocuments()` calls without an id use it.\n-->\n<script setup lang=\"ts\">\nimport { provideDocumentScope } from './kernel';\n\nconst props = defineProps<{\n /** The document's id. */\n id: string;\n}>();\n\ndefineSlots<{ default?(): unknown }>();\n\nprovideDocumentScope(() => props.id);\n</script>\n\n<template>\n <slot />\n</template>\n"],"names":["_renderSlot","_createElementBlock","_Fragment","_unref","$slots"],"mappings":";;;;;;AAcO,SAAS,UAAU,OAAiC;AACzD,SAAO,mBAAmB,KAAK;AACjC;;;;;;;;;;;;;;ACQA,UAAM,QAAQ;AA+Bd,UAAM,OAAO;AAuBb,UAAM,aAAa,MACjB,iBAAiB;AAAA,MACf,UAAU,MAAM,MAAM,QAAQ;AAAA,MAC9B,OAAO,MAAM,MAAM,KAAK;AAAA,MACxB,QAAQ,MAAM;AAAA,MACd,MAAM,MAAM,MAAM,IAAI;AAAA,IAAA,CACvB;AAEH,UAAM,SAAS,WAA0B,IAAI;AAC7C,UAAM,QAAQ,WAA0C,SAAS;AACjE,UAAM,YAAY,WAAoB,IAAI;AAE1C,UAAM,WAAW,WAAW,CAAC;AAE7B,kBAAc;AAAA,MACZ,IAAI,SAAS;AACX,eAAO,OAAO;AAAA,MAChB;AAAA,MACA,OAAO,MAAM;AACX,aAAK,SAAS;AAAA,MAChB;AAAA,IAAA,CACD;AAKD,UAAM,UAAU;AAAA,MACd,QAAQ,MAAM,MAAM,MAAM;AAAA,MAC1B,SAAS,MAAM,MAAM,OAAO;AAAA,MAC5B,kBAAkB,MAAM,MAAM,gBAAgB;AAAA,IAAA;AAEhD;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,MACE;AAAA,QACE;AAAA,QACA;AAAA,MAAA;AAAA,IAEF;AAEJ;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,WAAW;AAGV,YAAI,OAAO,WAAW,WAAY;AAClC;AAAA,UACE;AAAA,UACA;AAAA,QAAA;AAAA,M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AAOd,yBAAqB,MAAM,MAAM,EAAE;;aAIjCA,WAAQ,KAAA,QAAA,SAAA;AAAA;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentScope.vue_vue_type_script_setup_true_lang-loLSm4lV.cjs","sources":["../src/theme.ts","../src/runtime/Viewer.vue","../src/runtime/KernelProvider.vue","../src/runtime/DocumentGate.vue","../src/runtime/DocumentScope.vue"],"sourcesContent":["/**\n * `epdfTheme()`: a theme written with setting names, as a style for the\n * element around your viewer. The variables and their lookup are framework-free\n * (`@embedpdf/web`); this only types the result as Vue's style.\n */\nimport type { CSSProperties } from 'vue';\nimport { epdfThemeVariables, type EpdfTheme } from '@embedpdf/web';\n\nexport type { EpdfTheme } from '@embedpdf/web';\n\n/**\n * The CSS variables of a theme, for a `:style` binding: `<div :style=\"epdfTheme({ accent })\">`.\n * Everything inside the element follows them, and a CSS variable wins over any setting.\n */\nexport function epdfTheme(theme: EpdfTheme): CSSProperties {\n return epdfThemeVariables(theme) as CSSProperties;\n}\n","<!--\n <Viewer>: owns the kernel. It creates and starts the kernel when it mounts\n (never on the server) and destroys it when it unmounts; the components inside\n read it through composables. `engine`, `plugins` and `initialDocuments` are\n read once; `identity`, `scope`, `accent` and `page` are the viewer's settings\n and follow the props.\n-->\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted, shallowRef, toRaw, watch } from 'vue';\nimport { createKernel, isLocalEngine, viewerSettingsOf } from '@embedpdf/core';\nimport { browserClock } from '@embedpdf/web';\nimport type {\n AnyPlugin,\n Engine,\n EngineFactory,\n Identity,\n InitialDocument,\n Kernel,\n ViewerPageSettings,\n ViewerSettings,\n} from '@embedpdf/core';\nimport { devWarn } from '../dev';\nimport { provideViewer } from './kernel';\n\nconst props = defineProps<{\n /**\n * The engine, as an instance or a function. An instance is borrowed: the\n * viewer uses it and never destroys it (a module-level `localEngine()`\n * shared by every viewer). A function is the viewer's own: it calls it when\n * it mounts and destroys the engine when it unmounts. Read once.\n */\n engine: Engine | EngineFactory;\n /** The plugins, created once next to the engine. Read once. */\n plugins: AnyPlugin[];\n /** Documents to open when the viewer starts, with optional tab names. Read once. */\n initialDocuments?: InitialDocument[];\n /**\n * Who the user is, for every document opened without an `identity` of its\n * own (which replaces this one). Documents opened after a change use the new\n * value; open ones keep theirs. The local engine only: the cloud engine reads\n * it from the document's token.\n */\n identity?: Identity;\n /**\n * What the user may do, as permissions, in every document opened without a\n * `scope` of its own. Left out, they may do everything. Changes reach the\n * documents opened after them, as `identity`.\n */\n scope?: readonly string[];\n /** The color every part without a color of its own follows. CSS `--epdf-accent` wins over it. */\n accent?: string;\n /** How pages look: `background` before the picture arrives, and the `shadow` under each page. */\n page?: Partial<ViewerPageSettings>;\n}>();\n\nconst emit = defineEmits<{\n /**\n * The kernel has started: before the default slot mounts and before\n * `initialDocuments` open. The door for code outside Vue components\n * (register commands, subscribe to events).\n */\n ready: [kernel: Kernel];\n}>();\n\ndefineSlots<{\n /** The viewer's content, mounted once the kernel has started. */\n default?(): unknown;\n /** Shown while the kernel starts; the composables already work in it. */\n fallback?(): unknown;\n /** Shown when the kernel couldn't be created or started. Without it, a failed start shows nothing. */\n error?(props: { error: unknown }): unknown;\n}>();\n\n/**\n * The viewer's settings as the props give them: a prop left out is its\n * default. Values reach the kernel raw: a reactive copy would be another object\n * to it, and can't be sent to a worker.\n */\nconst settingsOf = (): ViewerSettings =>\n viewerSettingsOf({\n identity: toRaw(props.identity),\n scope: toRaw(props.scope),\n accent: props.accent,\n page: toRaw(props.page),\n });\n\nconst kernel = shallowRef<Kernel | null>(null);\nconst phase = shallowRef<'booting' | 'ready' | 'error'>('booting');\nconst bootError = shallowRef<unknown>(null);\n// Goes up on every kernel change; every reader's computed depends on it.\nconst revision = shallowRef(0);\n\nprovideViewer({\n get kernel() {\n return kernel.value;\n },\n track: () => {\n void revision.value;\n },\n});\n\n// Read once: a changed engine or plugin list can't mean \"rebuild the\n// workspace\", which would drop every open document. Raw, because the kernel\n// knows a plugin's token by identity, and a reactive copy is another object.\nconst initial = {\n engine: toRaw(props.engine),\n plugins: toRaw(props.plugins),\n initialDocuments: toRaw(props.initialDocuments),\n};\nwatch(\n () => props.plugins,\n () =>\n devWarn(\n 'viewer-plugins-init-only',\n '<Viewer> plugins are read once, when it mounts; a new list is ignored. ' +\n 'Create the list once, next to the engine, not inline in the template.',\n ),\n);\nwatch(\n () => props.engine,\n (engine) => {\n // An inline `:engine=\"() => localEngine()\"` is a new function on every\n // render; only another engine instance is worth a warning.\n if (typeof engine === 'function') return;\n devWarn(\n 'viewer-engine-init-only',\n '<Viewer> engine is read once, when it mounts; another engine is ignored. ' +\n 'To use another engine, mount a new <Viewer>, for example with a new `key`.',\n );\n },\n);\n\nlet teardown: (() => void) | null = null;\n\nonMounted(() => {\n // A function is the viewer's own engine: called now, destroyed on unmount.\n // An instance is borrowed. Construction is synchronous and inert either way,\n // so warming up a local engine overlaps its boot with the plugins' start.\n const ownsEngine = typeof initial.engine === 'function';\n const engine: Engine = ownsEngine\n ? (initial.engine as EngineFactory)()\n : (initial.engine as Engine);\n if (isLocalEngine(engine)) engine.warmup();\n let created: Kernel;\n try {\n created = createKernel({\n engine,\n plugins: initial.plugins,\n settings: settingsOf(),\n clock: browserClock(),\n });\n } catch (error) {\n // A plan or dependency error shows in the `error` slot.\n bootError.value = error;\n phase.value = 'error';\n if (ownsEngine) void engine.destroy();\n return;\n }\n const stopTracking = created.subscribe(() => {\n revision.value += 1;\n });\n // The kernel is on the binding from now on, so the fallback can use it.\n kernel.value = created;\n let alive = true;\n created.start().then(\n () => {\n if (!alive) return;\n emit('ready', created);\n phase.value = 'ready';\n // Every tab appears at once, in order; the `active` entry (else the\n // first) is selected; a failure shows as that document's status.\n created.documents.openAll(initial.initialDocuments ?? []);\n },\n (error: unknown) => {\n if (!alive) return;\n bootError.value = error;\n phase.value = 'error';\n },\n );\n teardown = () => {\n alive = false;\n stopTracking();\n // The kernel first (it closes every document's handle), then the engine\n // the viewer owns.\n void created.destroy().then(() => {\n if (ownsEngine) void engine.destroy();\n });\n };\n});\n\n// After the content has unmounted, so its own cleanups still reach a live kernel.\nonUnmounted(() => teardown?.());\n\n// Props compare by value: an inline `:page=\"{ shadow: 'none' }\"` is a new\n// object on every render, and settings that didn't change change nothing.\nwatch(settingsOf, (settings) => kernel.value?.updateSettings(settings));\n\ndefineExpose({\n /** The started kernel; null before it starts and after a failed start. */\n kernel: computed(() => (phase.value === 'ready' ? kernel.value : null)),\n});\n</script>\n\n<template>\n <slot v-if=\"phase === 'error'\" name=\"error\" :error=\"bootError\" />\n <template v-else-if=\"kernel\">\n <slot v-if=\"phase === 'ready'\" />\n <slot v-else name=\"fallback\" />\n </template>\n</template>\n","<!--\n <KernelProvider :kernel>: gives its content a kernel someone else created and\n owns, so every composable inside works against that kernel. The full viewer's\n Vue wrapper puts the components it shows in the viewer inside one. It never\n starts or destroys the kernel; <Viewer> is the component that owns one. The\n kernel is read once: for another one, mount a new provider (a new `key`).\n-->\n<script setup lang=\"ts\">\nimport { onScopeDispose, shallowRef, toRaw, watch } from 'vue';\nimport type { Kernel } from '@embedpdf/core';\nimport { devWarn } from '../dev';\nimport { provideViewer } from './kernel';\n\nconst props = defineProps<{\n /** The kernel, created and started by its owner. Read once. */\n kernel: Kernel;\n}>();\n\ndefineSlots<{ default?(): unknown }>();\n\n// Read once, as `<Viewer>` reads its engine: the composables inside took this kernel when they\n// were set up, and a new one under them would leave them reading the old one. Raw, because a\n// reactive copy of the kernel is another object.\nconst kernel = toRaw(props.kernel);\nwatch(\n () => props.kernel,\n () =>\n devWarn(\n 'kernel-provider-kernel-init-only',\n '<KernelProvider> kernel is read once, when it mounts; another kernel is ignored. ' +\n 'To give its content another kernel, mount a new <KernelProvider>, for example with a new `key`.',\n ),\n);\n\n// Goes up on every change the kernel announces; every reader's computed depends on it.\nconst revision = shallowRef(0);\nonScopeDispose(\n kernel.subscribe(() => {\n revision.value += 1;\n }),\n);\n\nprovideViewer({\n kernel,\n track: () => {\n void revision.value;\n },\n});\n</script>\n\n<template>\n <slot />\n</template>\n","<!--\n <DocumentGate>: renders its content only while this subtree has a ready\n document, the structural way to say \"this UI is defined over a document\".\n Workspace UI (toolbars, commands) lives outside it; document UI (the Stage,\n panels) inside. A document that waits for its password, or failed, renders\n the `#locked` or `#error` slot with it, or else `#fallback`. It decides\n whether; <DocumentScope> decides which document.\n-->\n<script setup lang=\"ts\">\nimport type { DocumentInfo, FailedDocumentInfo, LockedDocumentInfo } from '@embedpdf/core';\nimport { useDocument } from './documents';\n\ndefineSlots<{\n /** Rendered while the document is ready. */\n default?(): unknown;\n /** Shown while this subtree has no document: none is open, or it's still opening. */\n fallback?(): unknown;\n /** Shown while the document waits for its password; `#fallback` without it. */\n locked?(props: { document: LockedDocumentInfo }): unknown;\n /** Shown when the document couldn't be opened, with why; `#fallback` without it. */\n error?(props: { document: FailedDocumentInfo }): unknown;\n}>();\n\nconst current = useDocument((document: DocumentInfo) => document);\n</script>\n\n<template>\n <slot v-if=\"current.status === 'ready'\" />\n <slot\n v-else-if=\"current.status === 'locked' && $slots.locked\"\n name=\"locked\"\n :document=\"current as LockedDocumentInfo\"\n />\n <slot\n v-else-if=\"current.status === 'error' && $slots.error\"\n name=\"error\"\n :document=\"current as FailedDocumentInfo\"\n />\n <slot v-else name=\"fallback\" />\n</template>\n","<!--\n <DocumentScope :id>: binds its content to one document, for panes and\n comparisons. The composables inside talk to that document instead of the\n active one, and `useDocuments()` calls without an id use it.\n-->\n<script setup lang=\"ts\">\nimport { provideDocumentScope } from './kernel';\n\nconst props = defineProps<{\n /** The document's id. */\n id: string;\n}>();\n\ndefineSlots<{ default?(): unknown }>();\n\nprovideDocumentScope(() => props.id);\n</script>\n\n<template>\n <slot />\n</template>\n"],"names":["epdfThemeVariables","viewerSettingsOf","toRaw","shallowRef","provideViewer","watch","devWarn","onMounted","isLocalEngine","createKernel","browserClock","onUnmounted","computed","_renderSlot","_createElementBlock","_Fragment","onScopeDispose","useDocument","_unref","$slots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