@inkbar/vue 0.5.0 → 0.7.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/README.md +24 -2
- package/dist/components/InkCommand.js +7 -0
- package/dist/components/InkCommand.js.map +1 -0
- package/dist/components/InkCommand.vue.d.ts +23 -0
- package/dist/components/InkCommand.vue.d.ts.map +1 -0
- package/dist/components/InkCommand.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/components/InkCommand.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkFindBar.js +7 -0
- package/dist/components/InkFindBar.js.map +1 -0
- package/dist/components/InkFindBar.vue.d.ts +4 -0
- package/dist/components/InkFindBar.vue.d.ts.map +1 -0
- package/dist/components/InkFindBar.vue_vue_type_script_setup_true_lang.js +133 -0
- package/dist/components/InkFindBar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkPageInput.js.map +1 -1
- package/dist/components/InkPageInput.vue.d.ts.map +1 -1
- package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkRoot.js.map +1 -1
- package/dist/components/InkRoot.vue.d.ts +8 -1
- package/dist/components/InkRoot.vue.d.ts.map +1 -1
- package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +154 -106
- package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkSearchButton.js +7 -0
- package/dist/components/InkSearchButton.js.map +1 -0
- package/dist/components/InkSearchButton.vue.d.ts +19 -0
- package/dist/components/InkSearchButton.vue.d.ts.map +1 -0
- package/dist/components/InkSearchButton.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/components/InkSearchButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkToolButton.js.map +1 -1
- package/dist/components/InkToolButton.vue.d.ts.map +1 -1
- package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +36 -35
- package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkViewport.js.map +1 -1
- package/dist/components/InkViewport.vue.d.ts.map +1 -1
- package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/SignatureForm.vue.d.ts +2 -2
- package/dist/composables/useCommand.d.ts +23 -0
- package/dist/composables/useCommand.d.ts.map +1 -0
- package/dist/composables/useCommand.js +22 -0
- package/dist/composables/useCommand.js.map +1 -0
- package/dist/composables/useSearch.d.ts +12 -0
- package/dist/composables/useSearch.d.ts.map +1 -0
- package/dist/composables/useSearch.js +27 -0
- package/dist/composables/useSearch.js.map +1 -0
- package/dist/context.d.ts +21 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -25
- package/dist/ref-history.d.ts +12 -3
- package/dist/ref-history.d.ts.map +1 -1
- package/dist/ref-history.js +27 -16
- package/dist/ref-history.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { useTool as t } from "../composables/useTool.js";
|
|
3
|
+
import n from "./InkIcon.js";
|
|
4
|
+
import { computed as r, createBlock as i, createCommentVNode as a, defineComponent as o, mergeProps as s, openBlock as c, renderSlot as l, unref as u, withCtx as d } from "vue";
|
|
5
|
+
import { TOOL_LABELS as f } from "@inkbar/core/dom";
|
|
6
|
+
import { ToolbarButton as p } from "reka-ui";
|
|
7
|
+
import { Highlighter as m, MessageSquare as h, PenLine as g, PenTool as _, Signature as v, Square as y, SquareDashedMousePointer as b, TextCursor as x, Type as S } from "@inkbar/icons";
|
|
7
8
|
//#region src/components/InkToolButton.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var
|
|
9
|
+
var C = /*@__PURE__*/ o({
|
|
9
10
|
__name: "InkToolButton",
|
|
10
11
|
props: {
|
|
11
12
|
tool: {},
|
|
@@ -15,37 +16,37 @@ var S = /*@__PURE__*/ a({
|
|
|
15
16
|
default: !1
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
|
-
setup(
|
|
19
|
-
let
|
|
20
|
-
"select-text":
|
|
21
|
-
select:
|
|
22
|
-
highlight:
|
|
23
|
-
"redact-area":
|
|
24
|
-
sketch:
|
|
25
|
-
draw:
|
|
26
|
-
note:
|
|
27
|
-
freetext:
|
|
28
|
-
signature:
|
|
29
|
-
},
|
|
30
|
-
"aria-pressed": String(
|
|
31
|
-
"aria-label":
|
|
32
|
-
title:
|
|
33
|
-
onClick: () =>
|
|
19
|
+
setup(o) {
|
|
20
|
+
let C = {
|
|
21
|
+
"select-text": x,
|
|
22
|
+
select: b,
|
|
23
|
+
highlight: m,
|
|
24
|
+
"redact-area": y,
|
|
25
|
+
sketch: _,
|
|
26
|
+
draw: g,
|
|
27
|
+
note: h,
|
|
28
|
+
freetext: S,
|
|
29
|
+
signature: v
|
|
30
|
+
}, w = o, T = e("InkToolButton"), { tool: E, setTool: D } = t(), O = r(() => E.value === w.tool), k = r(() => [...T.hostTools.value ?? [], ...T.pluginHost.value?.tools ?? []].find((e) => e.id === w.tool)), A = r(() => w.label ?? f[w.tool] ?? k.value?.label ?? w.tool), j = r(() => C[w.tool] ?? k.value?.icon), M = r(() => ({
|
|
31
|
+
"aria-pressed": String(O.value),
|
|
32
|
+
"aria-label": A.value,
|
|
33
|
+
title: A.value,
|
|
34
|
+
onClick: () => D(w.tool)
|
|
34
35
|
}));
|
|
35
|
-
return (e,
|
|
36
|
-
"as-child":
|
|
36
|
+
return (e, t) => (c(), i(u(p), s({
|
|
37
|
+
"as-child": o.asChild,
|
|
37
38
|
class: "ink-tool-button",
|
|
38
39
|
"data-ink-tool-button": "",
|
|
39
|
-
"data-tool":
|
|
40
|
-
"data-state":
|
|
41
|
-
},
|
|
42
|
-
default:
|
|
43
|
-
active:
|
|
44
|
-
label:
|
|
45
|
-
}, () => [
|
|
40
|
+
"data-tool": o.tool,
|
|
41
|
+
"data-state": O.value ? "on" : "off"
|
|
42
|
+
}, M.value), {
|
|
43
|
+
default: d(() => [l(e.$slots, "default", {
|
|
44
|
+
active: O.value,
|
|
45
|
+
label: A.value
|
|
46
|
+
}, () => [j.value ? (c(), i(n, {
|
|
46
47
|
key: 0,
|
|
47
|
-
icon:
|
|
48
|
-
}, null, 8, ["icon"])) :
|
|
48
|
+
icon: j.value
|
|
49
|
+
}, null, 8, ["icon"])) : a("", !0)])]),
|
|
49
50
|
_: 3
|
|
50
51
|
}, 16, [
|
|
51
52
|
"as-child",
|
|
@@ -55,6 +56,6 @@ var S = /*@__PURE__*/ a({
|
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
58
|
//#endregion
|
|
58
|
-
export {
|
|
59
|
+
export { C as default };
|
|
59
60
|
|
|
60
61
|
//# sourceMappingURL=InkToolButton.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkToolButton.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","InkIcon","_createCommentVNode","InkIcon_default","InkToolButton_vue_vue_type_script_setup_true_lang_default","ICONS","TextCursor","SquareDashedMousePointer","Highlighter","Square","PenTool","PenLine","MessageSquare","Type","Signature","props","__props","current","useTool","active","computed","name","TOOL_LABELS","icon","attrs","setTool","openBlock","createBlock","unref","ToolbarButton","mergeProps","withCtx","renderSlot","_ctx","createCommentVNode"],"sources":["../../src/components/InkToolButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { TOOL_LABELS } from '@inkbar/core/dom'\nimport {\n Highlighter,\n MessageSquare,\n PenLine,\n PenTool,\n Signature,\n Square,\n SquareDashedMousePointer,\n TextCursor,\n Type,\n} from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useTool } from '../composables/useTool'\n\nimport InkIcon from './InkIcon.vue'\n\nimport type { ToolId } from '@inkbar/core/dom'\nimport type { IconNode } from '@inkbar/icons'\n\nconst ICONS: Readonly<Partial<Record<ToolId, IconNode>>> = {\n 'select-text': TextCursor,\n select: SquareDashedMousePointer,\n highlight: Highlighter,\n 'redact-area': Square,\n sketch: PenTool,\n draw: PenLine,\n note: MessageSquare,\n freetext: Type,\n signature: Signature,\n}\n\nconst props = withDefaults(\n defineProps<{ tool: ToolId; label?: string | undefined; asChild?: boolean }>(),\n { label: undefined, asChild: false }\n)\n\nconst { tool: current, setTool } = useTool()\nconst active = computed(() => current.value === props.tool)\n
|
|
1
|
+
{"version":3,"file":"InkToolButton.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","InkIcon","_createCommentVNode","InkIcon_default","InkToolButton_vue_vue_type_script_setup_true_lang_default","ICONS","TextCursor","SquareDashedMousePointer","Highlighter","Square","PenTool","PenLine","MessageSquare","Type","Signature","props","__props","ctx","useInkContext","current","useTool","active","computed","own","t","name","TOOL_LABELS","icon","attrs","setTool","openBlock","createBlock","unref","ToolbarButton","mergeProps","withCtx","renderSlot","_ctx","createCommentVNode"],"sources":["../../src/components/InkToolButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { TOOL_LABELS } from '@inkbar/core/dom'\nimport {\n Highlighter,\n MessageSquare,\n PenLine,\n PenTool,\n Signature,\n Square,\n SquareDashedMousePointer,\n TextCursor,\n Type,\n} from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useTool } from '../composables/useTool'\nimport { useInkContext } from '../context'\n\nimport InkIcon from './InkIcon.vue'\n\nimport type { ToolId } from '@inkbar/core/dom'\nimport type { IconNode } from '@inkbar/icons'\n\nconst ICONS: Readonly<Partial<Record<ToolId, IconNode>>> = {\n 'select-text': TextCursor,\n select: SquareDashedMousePointer,\n highlight: Highlighter,\n 'redact-area': Square,\n sketch: PenTool,\n draw: PenLine,\n note: MessageSquare,\n freetext: Type,\n signature: Signature,\n}\n\nconst props = withDefaults(\n defineProps<{ tool: ToolId; label?: string | undefined; asChild?: boolean }>(),\n { label: undefined, asChild: false }\n)\n\nconst ctx = useInkContext('InkToolButton')\nconst { tool: current, setTool } = useTool()\nconst active = computed(() => current.value === props.tool)\n/** A host or plugin tool by this id, for the name and icon core has none for. */\nconst own = computed(() =>\n [...(ctx.hostTools.value ?? []), ...(ctx.pluginHost.value?.tools ?? [])].find(\n (t) => t.id === props.tool\n )\n)\n// `label` and the slot win; then core's name and icon; then the tool's own.\nconst name = computed(\n () => props.label ?? TOOL_LABELS[props.tool] ?? own.value?.label ?? props.tool\n)\nconst icon = computed(() => ICONS[props.tool] ?? own.value?.icon)\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = computed(() => ({\n 'aria-pressed': String(active.value),\n 'aria-label': name.value,\n title: name.value,\n onClick: () => setTool(props.tool),\n}))\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-tool-button\"\n data-ink-tool-button\n :data-tool=\"tool\"\n :data-state=\"active ? 'on' : 'off'\"\n v-bind=\"attrs\"\n >\n <slot :active=\"active\" :label=\"name\"><InkIcon v-if=\"icon\" :icon=\"icon\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAwBA,IAAMU,IAAqD;GACzD,eAAeC;GACf,QAAQC;GACR,WAAWC;GACX,eAAeC;GACf,QAAQC;GACR,MAAMC;GACN,MAAMC;GACN,UAAUC;GACV,WAAWC;EACb,GAEMC,IAAQC,GAKRC,IAAMC,EAAc,eAAe,GACnC,EAAE,MAAMC,GAAS,eAAYC,EAAQ,GACrCC,IAASC,QAAeH,EAAQ,UAAUJ,EAAM,IAAI,GAEpDQ,IAAMD,QACV,CAAC,GAAIL,EAAI,UAAU,SAAS,CAAC,GAAI,GAAIA,EAAI,WAAW,OAAO,SAAS,CAAC,CAAE,CAAC,CAAC,MACtE,MAAMO,EAAE,OAAOT,EAAM,IACxB,CACF,GAEMU,IAAOH,QACLP,EAAM,SAASW,EAAYX,EAAM,SAASQ,EAAI,OAAO,SAASR,EAAM,IAC5E,GACMY,IAAOL,QAAejB,EAAMU,EAAM,SAASQ,EAAI,OAAO,IAAI,GAE1DK,IAAQN,SAAgB;GAC5B,gBAAgB,OAAOD,EAAO,KAAK;GACnC,cAAcI,EAAK;GACnB,OAAOA,EAAK;GACZ,eAAeI,EAAQd,EAAM,IAAI;EACnC,EAAE;oBAIApB,EAAA,GAAAC,EASgBC,EAAAoC,CAAA,GAThBnC,EASgB;GARb,YAAUkB,EAAA;GACX,OAAM;GACN,wBAAA;GACC,aAAWA,EAAA;GACX,cAAYK,EAAA,QAAM,OAAA;EACX,GAAAO,EAAA,KAAK,GAAA;GAEb,SAAA7B,QAAgF,CAAhFC,EAAgFqC,EAAA,QAAA,WAAA;IAAzE,QAAQhB,EAAA;IAAS,OAAOI,EAAA;GAA/B,SAAgF,CAA5BE,EAAA,SAAfhC,EAAA,GAAAC,EAAoCK,GAAA;;IAAd,MAAM0B,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkViewport.js","names":["_sfc_main","InkViewport_vue_vue_type_script_setup_true_lang_default","InkViewport_default"],"sources":["../../src/components/InkViewport.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The scroll element is handed to core's `mountViewer`, which builds the viewport, the page\n * layers, the tool controller and the keyboard shortcuts in it; Vue never renders children\n * into it. The engine reports each page host it mounts, and InkPage components rendered here\n * (they render nothing in place) teleport the page-error and custom-annotation slots into them.\n *\n * Two-way zoom and page: the viewport's own changes are reported through the context, and\n * the host's v-model values are applied only when they differ from the viewport's state, so\n * the echo of a reported value does nothing.\n */\nimport { mountViewer } from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onBeforeUpdate,\n onMounted,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { injectInkContext } from '../context'\n\nimport InkPage from './InkPage.vue'\n\nimport type { AnnotationSlotProps } from './annotation-slot'\nimport type { InkError } from '@inkbar/core'\nimport type {\n LayoutMode,\n PageMount,\n ToolId,\n ViewerEngine,\n ViewRotation,\n ZoomValue,\n} from '@inkbar/core/dom'\n\nconst props = withDefaults(\n defineProps<{\n mode?: LayoutMode\n rotation?: ViewRotation\n /** Gap between pages, CSS px. */\n gap?: number\n /** Pages kept mounted either side of the visible ones. */\n buffer?: number\n }>(),\n { mode: 'continuous', rotation: 0, gap: 16, buffer: 2 }\n)\n\nconst slots = defineSlots<{\n loading?(): unknown\n error?(props: { error: InkError }): unknown\n empty?(): unknown\n annotation?(props: AnnotationSlotProps): unknown\n /** Shown inside a page that failed to render. The rest of the document stays usable. */\n 'page-error'?(props: { error: InkError; page: number }): unknown\n}>()\n\nconst ctx = injectInkContext()\nconst scroll = useTemplateRef<HTMLElement>('scroll')\n\ninterface MountedPage {\n /** The engine build the host belongs to; part of the InkPage key. */\n build: number\n page: number\n host: HTMLElement\n mount: PageMount\n error: InkError | null\n /** Whether the build that mounted the page renders the annotation slot. */\n custom: boolean\n}\n/** Page hosts, mounts and errors the engine reported; InkPage renders Teleports for them. */\nconst pages = shallowRef<MountedPage[]>([])\n\nconst state = computed(() => ctx.status.value.state)\nconst error = computed<InkError | null>(() =>\n ctx.status.value.state === 'error' ? ctx.status.value.error : null\n)\n\nconst engine = shallowRef<ViewerEngine | null>(null)\n/**\n * Numbered before each build starts, so the pages a build mounts carry its own number. A\n * rebuild gives each page a new host and mount, so pages from an earlier build must remount,\n * not be reused.\n */\nlet build = 0\n/** Whether the current build renders the annotation slot. */\nlet custom = false\nlet stops: (() => void)[] = []\n/** The zoom and page last reported to the host. */\nlet lastReportedZoom: ZoomValue | undefined\nlet lastReportedPage: number | undefined\n\nfunction teardown(): void {\n for (const stop of stops) stop()\n stops = []\n // Unmounts every page, which empties `pages` through `onPageUnmount`.\n engine.value?.destroy()\n engine.value = null\n if (ctx.viewport.value) ctx.viewport.value = null\n if (ctx.tools.value) ctx.tools.value = null\n pages.value = []\n}\n\nfunction rebuild(opts: Parameters<ViewerEngine['rebuild']>[0]): void {\n const e = engine.value\n if (!e) return\n build += 1\n if (opts.customAnnotations !== undefined) custom = opts.customAnnotations\n e.rebuild(opts)\n}\n\n// Build for a new document or status; the previous engine is torn down first.\nfunction setup(): void {\n teardown()\n lastReportedZoom = undefined\n lastReportedPage = undefined\n const doc = ctx.document.value\n const el = scroll.value\n if (!doc || !el || ctx.status.value.state !== 'ready') return\n let first = true\n build += 1\n custom = !!slots.annotation\n engine.value = mountViewer({\n container: el,\n document: doc,\n zoom: ctx.zoomModel.value ?? 'fit-width',\n ...(ctx.pageModel.value === undefined ? {} : { page: ctx.pageModel.value }),\n mode: props.mode,\n rotation: props.rotation,\n gap: props.gap,\n buffer: props.buffer,\n tool: ctx.tool.value,\n ...(ctx.hostTools.value ? { tools: ctx.hostTools.value } : {}),\n // Read through, so the watch below can re-apply a new function without a rebuild.\n decorateAnnotation: (a) => ctx.decorateAnnotation.value?.(a),\n ...(ctx.toolStyle.value ? { toolStyle: ctx.toolStyle.value } : {}),\n toolHistory: { batch: (fn) => ctx.history.batch(fn) },\n toolOptions: ctx.toolOptions,\n fonts: [...ctx.fonts.value],\n // Read through, so a new `signatures` store reaches the tool as well as the menus.\n signatureLibrary: () => ctx.signatures.value,\n customAnnotations: custom,\n onActivate: (id) => ctx.setActivated(id),\n onBuild: (vp, tc) => {\n ctx.viewport.value = vp\n ctx.tools.value = tc\n if (first) {\n // A new document starts from where the viewport opens (its zoom, on the first page:\n // `createViewport` always starts at page 0); only later changes are reported, the\n // restored page among them, since the engine has already scrolled to it.\n first = false\n lastReportedZoom = vp.zoom.get()\n lastReportedPage = 0\n }\n for (const stop of stops) stop()\n const reportZoom = (z: ZoomValue): void => {\n if (z === lastReportedZoom) return\n lastReportedZoom = z\n ctx.reportZoom(z)\n }\n const reportPage = (p: number): void => {\n if (p === lastReportedPage) return\n lastReportedPage = p\n ctx.reportPage(p)\n }\n // A tool that switches itself (a one-shot tool once used) is reported as a pick.\n const followTool = (id: ToolId): void => {\n if (id !== ctx.tool.value) ctx.setTool(id)\n }\n stops = [\n vp.zoom.subscribe(reportZoom),\n vp.currentPage.subscribe(reportPage),\n tc.active.subscribe(followTool),\n ]\n // Whatever the build restored is reported once; nothing is when it matched.\n reportZoom(vp.zoom.get())\n reportPage(vp.currentPage.get())\n },\n onPageMount: (page, mount, host) => {\n pages.value = [...pages.value, { build, page, host, mount, error: null, custom }]\n },\n onPageUnmount: (page) => {\n pages.value = pages.value.filter((p) => p.page !== page)\n },\n onPageError: (page, err) => {\n pages.value = pages.value.map((p) => (p.page === page ? { ...p, error: err } : p))\n },\n })\n}\n\nonMounted(() => {\n watch([() => ctx.document.value, () => ctx.status.value.state], setup, {\n immediate: true,\n })\n})\n\n// A new decorateAnnotation re-applies to the mounted annotation elements at once.\nwatch(\n () => ctx.decorateAnnotation.value,\n () => engine.value?.redecorate()\n)\nwatch(\n () => ctx.zoomModel.value,\n (z: ZoomValue | undefined) => {\n const vp = engine.value?.viewport\n if (vp && z !== undefined && z !== vp.zoom.get()) vp.setZoom(z)\n }\n)\nwatch(\n () => ctx.pageModel.value,\n (p) => {\n const vp = engine.value?.viewport\n if (!vp || p === undefined || p === lastReportedPage) return\n if (p !== vp.currentPage.get()) vp.scrollToPage(p)\n }\n)\nwatch(\n () => ctx.tool.value,\n (t) => {\n const tc = engine.value?.tools\n if (tc && tc.active.get() !== t) tc.set(t)\n }\n)\nwatch(\n () => props.mode,\n (m) => engine.value?.viewport.setMode(m)\n)\nwatch(\n () => props.rotation,\n (r) => engine.value?.viewport.setRotation(r)\n)\n// Gap and buffer are construction options: rebuild for the same document, keeping zoom and page.\n// The slots are already updated when this runs, so it carries the annotation slot too: a slot\n// toggle in the same tick is then recorded here and `onBeforeUpdate` finds nothing left to do.\nwatch([() => props.gap, () => props.buffer], ([gap, buffer]) =>\n rebuild({ gap, buffer, customAnnotations: !!slots.annotation })\n)\n\n// Slots are not reactive, so a change to whether the annotation slot is given is caught here.\n// `onBeforeUpdate` runs after the new slots are in place and before this render: the rebuild\n// swaps `pages` for the new build's pages synchronously, so the render that follows never pairs\n// the annotation slot with an overlay built without it (or the reverse). The rebuild keeps the\n// scroll position.\nonBeforeUpdate(() => {\n const next = !!slots.annotation\n if (engine.value && next !== custom) rebuild({ customAnnotations: next })\n})\n\nonBeforeUnmount(teardown)\n</script>\n\n<template>\n <div class=\"ink-viewport-root\" data-ink-viewport-root :data-state=\"state\">\n <div v-if=\"state === 'loading'\" class=\"ink-status\" role=\"status\" aria-live=\"polite\">\n <slot name=\"loading\">Loading document…</slot>\n </div>\n <div v-else-if=\"error\" class=\"ink-status ink-error\" role=\"alert\">\n <slot name=\"error\" :error=\"error\">\n <p class=\"ink-error-title\">This document could not be opened.</p>\n <!-- The message comes from the PDF engine and is not written for readers: it stays\n off the page, on the code's tooltip. -->\n <p>\n <code class=\"ink-error-code\" :title=\"error.message\">{{ error.code }}</code>\n </p>\n </slot>\n </div>\n <div v-else-if=\"state === 'idle'\" class=\"ink-status ink-empty\">\n <slot name=\"empty\" />\n </div>\n <div\n ref=\"scroll\"\n class=\"ink-scroll\"\n data-ink-scroll\n tabindex=\"0\"\n role=\"document\"\n aria-label=\"Document\"\n />\n <InkPage\n v-for=\"p in pages\"\n :key=\"`${p.build}:${p.page}`\"\n :page=\"p.page\"\n :host=\"p.host\"\n :mount=\"p.mount\"\n :error=\"p.error\"\n :custom-annotations=\"p.custom\"\n >\n <template v-if=\"slots.annotation\" #annotation=\"slotProps\">\n <slot name=\"annotation\" v-bind=\"slotProps\" />\n </template>\n <template v-if=\"slots['page-error']\" #page-error=\"slotProps\">\n <slot name=\"page-error\" v-bind=\"slotProps\" />\n </template>\n </InkPage>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"InkViewport.js","names":["_sfc_main","InkViewport_vue_vue_type_script_setup_true_lang_default","InkViewport_default"],"sources":["../../src/components/InkViewport.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The scroll element is handed to core's `mountViewer`, which builds the viewport, the page\n * layers, the tool controller and the keyboard shortcuts in it; Vue never renders children\n * into it. The engine reports each page host it mounts, and InkPage components rendered here\n * (they render nothing in place) teleport the page-error and custom-annotation slots into them.\n *\n * Two-way zoom and page: the viewport's own changes are reported through the context, and\n * the host's v-model values are applied only when they differ from the viewport's state, so\n * the echo of a reported value does nothing.\n */\nimport { mountViewer } from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onBeforeUpdate,\n onMounted,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { injectInkContext } from '../context'\n\nimport InkPage from './InkPage.vue'\n\nimport type { AnnotationSlotProps } from './annotation-slot'\nimport type { InkError } from '@inkbar/core'\nimport type {\n LayoutMode,\n PageMount,\n ToolId,\n ViewerEngine,\n ViewRotation,\n ZoomValue,\n} from '@inkbar/core/dom'\n\nconst props = withDefaults(\n defineProps<{\n mode?: LayoutMode\n rotation?: ViewRotation\n /** Gap between pages, CSS px. */\n gap?: number\n /** Pages kept mounted either side of the visible ones. */\n buffer?: number\n }>(),\n { mode: 'continuous', rotation: 0, gap: 16, buffer: 2 }\n)\n\nconst slots = defineSlots<{\n loading?(): unknown\n error?(props: { error: InkError }): unknown\n empty?(): unknown\n annotation?(props: AnnotationSlotProps): unknown\n /** Shown inside a page that failed to render. The rest of the document stays usable. */\n 'page-error'?(props: { error: InkError; page: number }): unknown\n}>()\n\nconst ctx = injectInkContext()\nconst scroll = useTemplateRef<HTMLElement>('scroll')\n\ninterface MountedPage {\n /** The engine build the host belongs to; part of the InkPage key. */\n build: number\n page: number\n host: HTMLElement\n mount: PageMount\n error: InkError | null\n /** Whether the build that mounted the page renders the annotation slot. */\n custom: boolean\n}\n/** Page hosts, mounts and errors the engine reported; InkPage renders Teleports for them. */\nconst pages = shallowRef<MountedPage[]>([])\n\nconst state = computed(() => ctx.status.value.state)\nconst error = computed<InkError | null>(() =>\n ctx.status.value.state === 'error' ? ctx.status.value.error : null\n)\n\nconst engine = shallowRef<ViewerEngine | null>(null)\n/**\n * Numbered before each build starts, so the pages a build mounts carry its own number. A\n * rebuild gives each page a new host and mount, so pages from an earlier build must remount,\n * not be reused.\n */\nlet build = 0\n/** Whether the current build renders the annotation slot. */\nlet custom = false\nlet stops: (() => void)[] = []\n/** The zoom and page last reported to the host. */\nlet lastReportedZoom: ZoomValue | undefined\nlet lastReportedPage: number | undefined\n\nfunction teardown(): void {\n for (const stop of stops) stop()\n stops = []\n // Unmounts every page, which empties `pages` through `onPageUnmount`.\n engine.value?.destroy()\n engine.value = null\n if (ctx.viewport.value) ctx.viewport.value = null\n if (ctx.tools.value) ctx.tools.value = null\n pages.value = []\n}\n\nfunction rebuild(opts: Parameters<ViewerEngine['rebuild']>[0]): void {\n const e = engine.value\n if (!e) return\n build += 1\n if (opts.customAnnotations !== undefined) custom = opts.customAnnotations\n e.rebuild(opts)\n}\n\n// Build for a new document or status; the previous engine is torn down first.\nfunction setup(): void {\n teardown()\n lastReportedZoom = undefined\n lastReportedPage = undefined\n const doc = ctx.document.value\n const el = scroll.value\n if (!doc || !el || ctx.status.value.state !== 'ready') return\n let first = true\n build += 1\n custom = !!slots.annotation\n engine.value = mountViewer({\n container: el,\n document: doc,\n zoom: ctx.zoomModel.value ?? 'fit-width',\n ...(ctx.pageModel.value === undefined ? {} : { page: ctx.pageModel.value }),\n mode: props.mode,\n rotation: props.rotation,\n gap: props.gap,\n buffer: props.buffer,\n tool: ctx.tool.value,\n ...(ctx.hostTools.value ? { tools: ctx.hostTools.value } : {}),\n // The engine adds the plugins' tools and layers, and decorates through the host, which\n // reads `decorateAnnotation` first.\n ...(ctx.pluginHost.value ? { plugins: ctx.pluginHost.value } : {}),\n // The engine draws the search matches on the pages.\n ...(ctx.search.value ? { search: ctx.search.value } : {}),\n // Read through, so the watch below can re-apply a new function without a rebuild.\n decorateAnnotation: (a) => ctx.decorateAnnotation.value?.(a),\n ...(ctx.toolStyle.value ? { toolStyle: ctx.toolStyle.value } : {}),\n toolHistory: { batch: (fn) => ctx.history.batch(fn) },\n toolOptions: ctx.toolOptions,\n fonts: [...ctx.fonts.value],\n // Read through, so a new `signatures` store reaches the tool as well as the menus.\n signatureLibrary: () => ctx.signatures.value,\n customAnnotations: custom,\n onActivate: (id) => ctx.setActivated(id),\n onBuild: (vp, tc) => {\n ctx.viewport.value = vp\n ctx.tools.value = tc\n if (first) {\n // A new document starts from where the viewport opens (its zoom, on the first page:\n // `createViewport` always starts at page 0); only later changes are reported, the\n // restored page among them, since the engine has already scrolled to it.\n first = false\n lastReportedZoom = vp.zoom.get()\n lastReportedPage = 0\n }\n for (const stop of stops) stop()\n const reportZoom = (z: ZoomValue): void => {\n if (z === lastReportedZoom) return\n lastReportedZoom = z\n ctx.reportZoom(z)\n }\n const reportPage = (p: number): void => {\n if (p === lastReportedPage) return\n lastReportedPage = p\n ctx.reportPage(p)\n }\n // A tool that switches itself (a one-shot tool once used) is reported as a pick.\n const followTool = (id: ToolId): void => {\n if (id !== ctx.tool.value) ctx.setTool(id)\n }\n stops = [\n vp.zoom.subscribe(reportZoom),\n vp.currentPage.subscribe(reportPage),\n tc.active.subscribe(followTool),\n ]\n // Whatever the build restored is reported once; nothing is when it matched.\n reportZoom(vp.zoom.get())\n reportPage(vp.currentPage.get())\n },\n onPageMount: (page, mount, host) => {\n pages.value = [...pages.value, { build, page, host, mount, error: null, custom }]\n },\n onPageUnmount: (page) => {\n pages.value = pages.value.filter((p) => p.page !== page)\n },\n onPageError: (page, err) => {\n pages.value = pages.value.map((p) => (p.page === page ? { ...p, error: err } : p))\n },\n })\n}\n\nonMounted(() => {\n ctx.viewportEl.value = scroll.value\n watch([() => ctx.document.value, () => ctx.status.value.state], setup, {\n immediate: true,\n })\n})\n\n// A new decorateAnnotation re-applies to the mounted annotation elements at once.\nwatch(\n () => ctx.decorateAnnotation.value,\n () => engine.value?.redecorate()\n)\nwatch(\n () => ctx.zoomModel.value,\n (z: ZoomValue | undefined) => {\n const vp = engine.value?.viewport\n if (vp && z !== undefined && z !== vp.zoom.get()) vp.setZoom(z)\n }\n)\nwatch(\n () => ctx.pageModel.value,\n (p) => {\n const vp = engine.value?.viewport\n if (!vp || p === undefined || p === lastReportedPage) return\n if (p !== vp.currentPage.get()) vp.scrollToPage(p)\n }\n)\nwatch(\n () => ctx.tool.value,\n (t) => {\n const tc = engine.value?.tools\n if (tc && tc.active.get() !== t) tc.set(t)\n }\n)\nwatch(\n () => props.mode,\n (m) => engine.value?.viewport.setMode(m)\n)\nwatch(\n () => props.rotation,\n (r) => engine.value?.viewport.setRotation(r)\n)\n// Gap and buffer are construction options: rebuild for the same document, keeping zoom and page.\n// The slots are already updated when this runs, so it carries the annotation slot too: a slot\n// toggle in the same tick is then recorded here and `onBeforeUpdate` finds nothing left to do.\nwatch([() => props.gap, () => props.buffer], ([gap, buffer]) =>\n rebuild({ gap, buffer, customAnnotations: !!slots.annotation })\n)\n\n// Slots are not reactive, so a change to whether the annotation slot is given is caught here.\n// `onBeforeUpdate` runs after the new slots are in place and before this render: the rebuild\n// swaps `pages` for the new build's pages synchronously, so the render that follows never pairs\n// the annotation slot with an overlay built without it (or the reverse). The rebuild keeps the\n// scroll position.\nonBeforeUpdate(() => {\n const next = !!slots.annotation\n if (engine.value && next !== custom) rebuild({ customAnnotations: next })\n})\n\nonBeforeUnmount(() => {\n teardown()\n if (ctx.viewportEl.value === scroll.value) ctx.viewportEl.value = null\n})\n</script>\n\n<template>\n <div class=\"ink-viewport-root\" data-ink-viewport-root :data-state=\"state\">\n <div v-if=\"state === 'loading'\" class=\"ink-status\" role=\"status\" aria-live=\"polite\">\n <slot name=\"loading\">Loading document…</slot>\n </div>\n <div v-else-if=\"error\" class=\"ink-status ink-error\" role=\"alert\">\n <slot name=\"error\" :error=\"error\">\n <p class=\"ink-error-title\">This document could not be opened.</p>\n <!-- The message comes from the PDF engine and is not written for readers: it stays\n off the page, on the code's tooltip. -->\n <p>\n <code class=\"ink-error-code\" :title=\"error.message\">{{ error.code }}</code>\n </p>\n </slot>\n </div>\n <div v-else-if=\"state === 'idle'\" class=\"ink-status ink-empty\">\n <slot name=\"empty\" />\n </div>\n <div\n ref=\"scroll\"\n class=\"ink-scroll\"\n data-ink-scroll\n tabindex=\"0\"\n role=\"document\"\n aria-label=\"Document\"\n />\n <InkPage\n v-for=\"p in pages\"\n :key=\"`${p.build}:${p.page}`\"\n :page=\"p.page\"\n :host=\"p.host\"\n :mount=\"p.mount\"\n :error=\"p.error\"\n :custom-annotations=\"p.custom\"\n >\n <template v-if=\"slots.annotation\" #annotation=\"slotProps\">\n <slot name=\"annotation\" v-bind=\"slotProps\" />\n </template>\n <template v-if=\"slots['page-error']\" #page-error=\"slotProps\">\n <slot name=\"page-error\" v-bind=\"slotProps\" />\n </template>\n </InkPage>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkViewport.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkViewport.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InkViewport.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkViewport.vue"],"names":[],"mappings":"AA4UA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EACV,UAAU,EAIV,YAAY,EAEb,MAAM,kBAAkB,CAAA;AAGzB,KAAK,WAAW,GAAG;IACf,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC;AAMJ,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,IAAI,OAAO,CAAA;IACnB,KAAK,CAAC,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAA;IAC3C,KAAK,CAAC,IAAI,OAAO,CAAA;IACjB,UAAU,CAAC,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAA;IAChD,wFAAwF;IACxF,YAAY,CAAC,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAA;CACjE,CAAC;AAsUF,QAAA,MAAM,UAAU;;;;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -49,6 +49,8 @@ var T = ["data-state"], E = {
|
|
|
49
49
|
buffer: A.buffer,
|
|
50
50
|
tool: M.tool.value,
|
|
51
51
|
...M.hostTools.value ? { tools: M.hostTools.value } : {},
|
|
52
|
+
...M.pluginHost.value ? { plugins: M.pluginHost.value } : {},
|
|
53
|
+
...M.search.value ? { search: M.search.value } : {},
|
|
52
54
|
decorateAnnotation: (e) => M.decorateAnnotation.value?.(e),
|
|
53
55
|
...M.toolStyle.value ? { toolStyle: M.toolStyle.value } : {},
|
|
54
56
|
toolHistory: { batch: (e) => M.history.batch(e) },
|
|
@@ -95,7 +97,7 @@ var T = ["data-state"], E = {
|
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
99
|
return m(() => {
|
|
98
|
-
S([() => M.document.value, () => M.status.value.state], G, { immediate: !0 });
|
|
100
|
+
M.viewportEl.value = N.value, S([() => M.document.value, () => M.status.value.state], G, { immediate: !0 });
|
|
99
101
|
}), S(() => M.decorateAnnotation.value, () => L.value?.redecorate()), S(() => M.zoomModel.value, (e) => {
|
|
100
102
|
let t = L.value?.viewport;
|
|
101
103
|
t && e !== void 0 && e !== t.zoom.get() && t.setZoom(e);
|
|
@@ -112,7 +114,9 @@ var T = ["data-state"], E = {
|
|
|
112
114
|
})), p(() => {
|
|
113
115
|
let e = !!j.annotation;
|
|
114
116
|
L.value && e !== z && W({ customAnnotations: e });
|
|
115
|
-
}), f(
|
|
117
|
+
}), f(() => {
|
|
118
|
+
U(), M.viewportEl.value === N.value && (M.viewportEl.value = null);
|
|
119
|
+
}), (e, r) => (h(), o("div", {
|
|
116
120
|
class: "ink-viewport-root",
|
|
117
121
|
"data-ink-viewport-root": "",
|
|
118
122
|
"data-state": F.value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkViewport.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_renderSlot","_createTextVNode","_createElementVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","_createBlock","InkPage","_createSlots","_withCtx","_mergeProps","InkPage_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","InkViewport_vue_vue_type_script_setup_true_lang_default","props","__props","slots","useSlots","ctx","injectInkContext","scroll","useTemplateRef","pages","shallowRef","state","computed","error","engine","build","custom","stops","lastReportedZoom","lastReportedPage","teardown","stop","rebuild","e","opts","setup","doc","el","first","mountViewer","a","fn","id","vp","tc","reportZoom","z","reportPage","p","page","err","onMounted","watch","t","m","r","gap","buffer","onBeforeUpdate","next","onBeforeUnmount","openBlock","createElementBlock","renderSlot","_ctx","_cache","createTextVNode","createElementVNode","toDisplayString","createCommentVNode","Fragment","renderList","createBlock","createSlots","withCtx","mergeProps","slotProps"],"sources":["../../src/components/InkViewport.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The scroll element is handed to core's `mountViewer`, which builds the viewport, the page\n * layers, the tool controller and the keyboard shortcuts in it; Vue never renders children\n * into it. The engine reports each page host it mounts, and InkPage components rendered here\n * (they render nothing in place) teleport the page-error and custom-annotation slots into them.\n *\n * Two-way zoom and page: the viewport's own changes are reported through the context, and\n * the host's v-model values are applied only when they differ from the viewport's state, so\n * the echo of a reported value does nothing.\n */\nimport { mountViewer } from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onBeforeUpdate,\n onMounted,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { injectInkContext } from '../context'\n\nimport InkPage from './InkPage.vue'\n\nimport type { AnnotationSlotProps } from './annotation-slot'\nimport type { InkError } from '@inkbar/core'\nimport type {\n LayoutMode,\n PageMount,\n ToolId,\n ViewerEngine,\n ViewRotation,\n ZoomValue,\n} from '@inkbar/core/dom'\n\nconst props = withDefaults(\n defineProps<{\n mode?: LayoutMode\n rotation?: ViewRotation\n /** Gap between pages, CSS px. */\n gap?: number\n /** Pages kept mounted either side of the visible ones. */\n buffer?: number\n }>(),\n { mode: 'continuous', rotation: 0, gap: 16, buffer: 2 }\n)\n\nconst slots = defineSlots<{\n loading?(): unknown\n error?(props: { error: InkError }): unknown\n empty?(): unknown\n annotation?(props: AnnotationSlotProps): unknown\n /** Shown inside a page that failed to render. The rest of the document stays usable. */\n 'page-error'?(props: { error: InkError; page: number }): unknown\n}>()\n\nconst ctx = injectInkContext()\nconst scroll = useTemplateRef<HTMLElement>('scroll')\n\ninterface MountedPage {\n /** The engine build the host belongs to; part of the InkPage key. */\n build: number\n page: number\n host: HTMLElement\n mount: PageMount\n error: InkError | null\n /** Whether the build that mounted the page renders the annotation slot. */\n custom: boolean\n}\n/** Page hosts, mounts and errors the engine reported; InkPage renders Teleports for them. */\nconst pages = shallowRef<MountedPage[]>([])\n\nconst state = computed(() => ctx.status.value.state)\nconst error = computed<InkError | null>(() =>\n ctx.status.value.state === 'error' ? ctx.status.value.error : null\n)\n\nconst engine = shallowRef<ViewerEngine | null>(null)\n/**\n * Numbered before each build starts, so the pages a build mounts carry its own number. A\n * rebuild gives each page a new host and mount, so pages from an earlier build must remount,\n * not be reused.\n */\nlet build = 0\n/** Whether the current build renders the annotation slot. */\nlet custom = false\nlet stops: (() => void)[] = []\n/** The zoom and page last reported to the host. */\nlet lastReportedZoom: ZoomValue | undefined\nlet lastReportedPage: number | undefined\n\nfunction teardown(): void {\n for (const stop of stops) stop()\n stops = []\n // Unmounts every page, which empties `pages` through `onPageUnmount`.\n engine.value?.destroy()\n engine.value = null\n if (ctx.viewport.value) ctx.viewport.value = null\n if (ctx.tools.value) ctx.tools.value = null\n pages.value = []\n}\n\nfunction rebuild(opts: Parameters<ViewerEngine['rebuild']>[0]): void {\n const e = engine.value\n if (!e) return\n build += 1\n if (opts.customAnnotations !== undefined) custom = opts.customAnnotations\n e.rebuild(opts)\n}\n\n// Build for a new document or status; the previous engine is torn down first.\nfunction setup(): void {\n teardown()\n lastReportedZoom = undefined\n lastReportedPage = undefined\n const doc = ctx.document.value\n const el = scroll.value\n if (!doc || !el || ctx.status.value.state !== 'ready') return\n let first = true\n build += 1\n custom = !!slots.annotation\n engine.value = mountViewer({\n container: el,\n document: doc,\n zoom: ctx.zoomModel.value ?? 'fit-width',\n ...(ctx.pageModel.value === undefined ? {} : { page: ctx.pageModel.value }),\n mode: props.mode,\n rotation: props.rotation,\n gap: props.gap,\n buffer: props.buffer,\n tool: ctx.tool.value,\n ...(ctx.hostTools.value ? { tools: ctx.hostTools.value } : {}),\n // Read through, so the watch below can re-apply a new function without a rebuild.\n decorateAnnotation: (a) => ctx.decorateAnnotation.value?.(a),\n ...(ctx.toolStyle.value ? { toolStyle: ctx.toolStyle.value } : {}),\n toolHistory: { batch: (fn) => ctx.history.batch(fn) },\n toolOptions: ctx.toolOptions,\n fonts: [...ctx.fonts.value],\n // Read through, so a new `signatures` store reaches the tool as well as the menus.\n signatureLibrary: () => ctx.signatures.value,\n customAnnotations: custom,\n onActivate: (id) => ctx.setActivated(id),\n onBuild: (vp, tc) => {\n ctx.viewport.value = vp\n ctx.tools.value = tc\n if (first) {\n // A new document starts from where the viewport opens (its zoom, on the first page:\n // `createViewport` always starts at page 0); only later changes are reported, the\n // restored page among them, since the engine has already scrolled to it.\n first = false\n lastReportedZoom = vp.zoom.get()\n lastReportedPage = 0\n }\n for (const stop of stops) stop()\n const reportZoom = (z: ZoomValue): void => {\n if (z === lastReportedZoom) return\n lastReportedZoom = z\n ctx.reportZoom(z)\n }\n const reportPage = (p: number): void => {\n if (p === lastReportedPage) return\n lastReportedPage = p\n ctx.reportPage(p)\n }\n // A tool that switches itself (a one-shot tool once used) is reported as a pick.\n const followTool = (id: ToolId): void => {\n if (id !== ctx.tool.value) ctx.setTool(id)\n }\n stops = [\n vp.zoom.subscribe(reportZoom),\n vp.currentPage.subscribe(reportPage),\n tc.active.subscribe(followTool),\n ]\n // Whatever the build restored is reported once; nothing is when it matched.\n reportZoom(vp.zoom.get())\n reportPage(vp.currentPage.get())\n },\n onPageMount: (page, mount, host) => {\n pages.value = [...pages.value, { build, page, host, mount, error: null, custom }]\n },\n onPageUnmount: (page) => {\n pages.value = pages.value.filter((p) => p.page !== page)\n },\n onPageError: (page, err) => {\n pages.value = pages.value.map((p) => (p.page === page ? { ...p, error: err } : p))\n },\n })\n}\n\nonMounted(() => {\n watch([() => ctx.document.value, () => ctx.status.value.state], setup, {\n immediate: true,\n })\n})\n\n// A new decorateAnnotation re-applies to the mounted annotation elements at once.\nwatch(\n () => ctx.decorateAnnotation.value,\n () => engine.value?.redecorate()\n)\nwatch(\n () => ctx.zoomModel.value,\n (z: ZoomValue | undefined) => {\n const vp = engine.value?.viewport\n if (vp && z !== undefined && z !== vp.zoom.get()) vp.setZoom(z)\n }\n)\nwatch(\n () => ctx.pageModel.value,\n (p) => {\n const vp = engine.value?.viewport\n if (!vp || p === undefined || p === lastReportedPage) return\n if (p !== vp.currentPage.get()) vp.scrollToPage(p)\n }\n)\nwatch(\n () => ctx.tool.value,\n (t) => {\n const tc = engine.value?.tools\n if (tc && tc.active.get() !== t) tc.set(t)\n }\n)\nwatch(\n () => props.mode,\n (m) => engine.value?.viewport.setMode(m)\n)\nwatch(\n () => props.rotation,\n (r) => engine.value?.viewport.setRotation(r)\n)\n// Gap and buffer are construction options: rebuild for the same document, keeping zoom and page.\n// The slots are already updated when this runs, so it carries the annotation slot too: a slot\n// toggle in the same tick is then recorded here and `onBeforeUpdate` finds nothing left to do.\nwatch([() => props.gap, () => props.buffer], ([gap, buffer]) =>\n rebuild({ gap, buffer, customAnnotations: !!slots.annotation })\n)\n\n// Slots are not reactive, so a change to whether the annotation slot is given is caught here.\n// `onBeforeUpdate` runs after the new slots are in place and before this render: the rebuild\n// swaps `pages` for the new build's pages synchronously, so the render that follows never pairs\n// the annotation slot with an overlay built without it (or the reverse). The rebuild keeps the\n// scroll position.\nonBeforeUpdate(() => {\n const next = !!slots.annotation\n if (engine.value && next !== custom) rebuild({ customAnnotations: next })\n})\n\nonBeforeUnmount(teardown)\n</script>\n\n<template>\n <div class=\"ink-viewport-root\" data-ink-viewport-root :data-state=\"state\">\n <div v-if=\"state === 'loading'\" class=\"ink-status\" role=\"status\" aria-live=\"polite\">\n <slot name=\"loading\">Loading document…</slot>\n </div>\n <div v-else-if=\"error\" class=\"ink-status ink-error\" role=\"alert\">\n <slot name=\"error\" :error=\"error\">\n <p class=\"ink-error-title\">This document could not be opened.</p>\n <!-- The message comes from the PDF engine and is not written for readers: it stays\n off the page, on the code's tooltip. -->\n <p>\n <code class=\"ink-error-code\" :title=\"error.message\">{{ error.code }}</code>\n </p>\n </slot>\n </div>\n <div v-else-if=\"state === 'idle'\" class=\"ink-status ink-empty\">\n <slot name=\"empty\" />\n </div>\n <div\n ref=\"scroll\"\n class=\"ink-scroll\"\n data-ink-scroll\n tabindex=\"0\"\n role=\"document\"\n aria-label=\"Document\"\n />\n <InkPage\n v-for=\"p in pages\"\n :key=\"`${p.build}:${p.page}`\"\n :page=\"p.page\"\n :host=\"p.host\"\n :mount=\"p.mount\"\n :error=\"p.error\"\n :custom-annotations=\"p.custom\"\n >\n <template v-if=\"slots.annotation\" #annotation=\"slotProps\">\n <slot name=\"annotation\" v-bind=\"slotProps\" />\n </template>\n <template v-if=\"slots['page-error']\" #page-error=\"slotProps\">\n <slot name=\"page-error\" v-bind=\"slotProps\" />\n </template>\n </InkPage>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,IAAMsB,IAAQC,GAYRC,IAAQxB,EAAA,GASR0B,IAAMC,EAAiB,GACvBC,IAASC,EAA4B,QAAQ,GAa7CC,IAAQC,EAA0B,CAAC,CAAC,GAEpCC,IAAQC,QAAeP,EAAI,OAAO,MAAM,KAAK,GAC7CQ,IAAQD,QACZP,EAAI,OAAO,MAAM,UAAU,UAAUA,EAAI,OAAO,MAAM,QAAQ,IAChE,GAEMS,IAASJ,EAAgC,IAAI,GAM/CK,IAAQ,GAERC,IAAS,IACTC,IAAwB,CAAC,GAEzBC,GACAC;EAEJ,SAASC,IAAiB;GACxB,KAAK,IAAMC,KAAQJ,GAAO,EAAK;GAO/B,AANA,IAAQ,CAAC,GAETH,EAAO,OAAO,QAAQ,GACtB,EAAO,QAAQ,MACXT,EAAI,SAAS,UAAO,EAAI,SAAS,QAAQ,OACzCA,EAAI,MAAM,UAAO,EAAI,MAAM,QAAQ,OACvC,EAAM,QAAQ,CAAC;EACjB;EAEA,SAASiB,EAAQ,GAAoD;GACnE,IAAMC,IAAIT,EAAO;GACjB,AAAKS,MACL,KAAS,GACLC,EAAK,sBAAsB,KAAA,MAAW,IAASA,EAAK,oBACxDD,EAAE,QAAQC,CAAI;EAChB;EAGA,SAASC,IAAc;GAGrB,AAFAL,EAAS,GACT,IAAmB,KAAA,GACnB,IAAmB,KAAA;GACnB,IAAMM,IAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAIvDa,EAAA,UAAK,UAArB/B,EAAA,GAAAC,EAEM,OAFNkB,GAEM,CADJjB,EAAqBwE,EAAA,QAAA,OAAA,CAAA,CAAA,KAAAK,EAAA,IAAA,EAAA;GAEvB3E,EAOE,OAAA;IANI,SAAA;IAAJ,KAAIuB;IACJ,OAAM;IACN,mBAAA;IACA,UAAS;IACT,MAAK;IACL,cAAW;;IAEb3B,EAAA,EAAA,GAAAC,EAeUM,GAAA,MAAAC,EAdIqB,EAAA,QAAL,OADT7B,EAAA,GAAAS,EAeUC,GAAA;IAbP,KAAG,GAAKgD,EAAE,MAAK,GAAIA,EAAE;IACrB,MAAMA,EAAE;IACR,MAAMA,EAAE;IACR,OAAOA,EAAE;IACT,OAAOA,EAAE;IACT,sBAAoBA,EAAE;GAEP,GAAAyB,EAAA,EAAA,GAAA,EAAA,GAAA,CAAA5D,EAAM,aAAA;IAAa,MAAA;IACjC,IAAAX,GAD6C,MAAS,CACtDV,EAA6CwE,EAAA,QAAA,cAA7C7D,EAA6C,EAAA,SAAA,GAAA,GAAbyE,CAAS,CAAA,CAAA,CAAA;;GAE3B,IAAA,KAAA,GAAA/D,EAAK,gBAAA;IAAiB,MAAA;IACpC,IAAAX,GADgD,MAAS,CACzDV,EAA6CwE,EAAA,QAAA,cAA7C7D,EAA6C,EAAA,SAAA,GAAA,GAAbyE,CAAS,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"InkViewport.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_renderSlot","_createTextVNode","_createElementVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","_createBlock","InkPage","_createSlots","_withCtx","_mergeProps","InkPage_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","InkViewport_vue_vue_type_script_setup_true_lang_default","props","__props","slots","useSlots","ctx","injectInkContext","scroll","useTemplateRef","pages","shallowRef","state","computed","error","engine","build","custom","stops","lastReportedZoom","lastReportedPage","teardown","stop","rebuild","e","opts","setup","doc","el","first","mountViewer","a","fn","id","vp","tc","reportZoom","z","reportPage","p","page","err","onMounted","watch","t","m","r","gap","buffer","onBeforeUpdate","next","onBeforeUnmount","openBlock","createElementBlock","renderSlot","_ctx","_cache","createTextVNode","createElementVNode","toDisplayString","createCommentVNode","Fragment","renderList","createBlock","createSlots","withCtx","mergeProps","slotProps"],"sources":["../../src/components/InkViewport.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The scroll element is handed to core's `mountViewer`, which builds the viewport, the page\n * layers, the tool controller and the keyboard shortcuts in it; Vue never renders children\n * into it. The engine reports each page host it mounts, and InkPage components rendered here\n * (they render nothing in place) teleport the page-error and custom-annotation slots into them.\n *\n * Two-way zoom and page: the viewport's own changes are reported through the context, and\n * the host's v-model values are applied only when they differ from the viewport's state, so\n * the echo of a reported value does nothing.\n */\nimport { mountViewer } from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onBeforeUpdate,\n onMounted,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { injectInkContext } from '../context'\n\nimport InkPage from './InkPage.vue'\n\nimport type { AnnotationSlotProps } from './annotation-slot'\nimport type { InkError } from '@inkbar/core'\nimport type {\n LayoutMode,\n PageMount,\n ToolId,\n ViewerEngine,\n ViewRotation,\n ZoomValue,\n} from '@inkbar/core/dom'\n\nconst props = withDefaults(\n defineProps<{\n mode?: LayoutMode\n rotation?: ViewRotation\n /** Gap between pages, CSS px. */\n gap?: number\n /** Pages kept mounted either side of the visible ones. */\n buffer?: number\n }>(),\n { mode: 'continuous', rotation: 0, gap: 16, buffer: 2 }\n)\n\nconst slots = defineSlots<{\n loading?(): unknown\n error?(props: { error: InkError }): unknown\n empty?(): unknown\n annotation?(props: AnnotationSlotProps): unknown\n /** Shown inside a page that failed to render. The rest of the document stays usable. */\n 'page-error'?(props: { error: InkError; page: number }): unknown\n}>()\n\nconst ctx = injectInkContext()\nconst scroll = useTemplateRef<HTMLElement>('scroll')\n\ninterface MountedPage {\n /** The engine build the host belongs to; part of the InkPage key. */\n build: number\n page: number\n host: HTMLElement\n mount: PageMount\n error: InkError | null\n /** Whether the build that mounted the page renders the annotation slot. */\n custom: boolean\n}\n/** Page hosts, mounts and errors the engine reported; InkPage renders Teleports for them. */\nconst pages = shallowRef<MountedPage[]>([])\n\nconst state = computed(() => ctx.status.value.state)\nconst error = computed<InkError | null>(() =>\n ctx.status.value.state === 'error' ? ctx.status.value.error : null\n)\n\nconst engine = shallowRef<ViewerEngine | null>(null)\n/**\n * Numbered before each build starts, so the pages a build mounts carry its own number. A\n * rebuild gives each page a new host and mount, so pages from an earlier build must remount,\n * not be reused.\n */\nlet build = 0\n/** Whether the current build renders the annotation slot. */\nlet custom = false\nlet stops: (() => void)[] = []\n/** The zoom and page last reported to the host. */\nlet lastReportedZoom: ZoomValue | undefined\nlet lastReportedPage: number | undefined\n\nfunction teardown(): void {\n for (const stop of stops) stop()\n stops = []\n // Unmounts every page, which empties `pages` through `onPageUnmount`.\n engine.value?.destroy()\n engine.value = null\n if (ctx.viewport.value) ctx.viewport.value = null\n if (ctx.tools.value) ctx.tools.value = null\n pages.value = []\n}\n\nfunction rebuild(opts: Parameters<ViewerEngine['rebuild']>[0]): void {\n const e = engine.value\n if (!e) return\n build += 1\n if (opts.customAnnotations !== undefined) custom = opts.customAnnotations\n e.rebuild(opts)\n}\n\n// Build for a new document or status; the previous engine is torn down first.\nfunction setup(): void {\n teardown()\n lastReportedZoom = undefined\n lastReportedPage = undefined\n const doc = ctx.document.value\n const el = scroll.value\n if (!doc || !el || ctx.status.value.state !== 'ready') return\n let first = true\n build += 1\n custom = !!slots.annotation\n engine.value = mountViewer({\n container: el,\n document: doc,\n zoom: ctx.zoomModel.value ?? 'fit-width',\n ...(ctx.pageModel.value === undefined ? {} : { page: ctx.pageModel.value }),\n mode: props.mode,\n rotation: props.rotation,\n gap: props.gap,\n buffer: props.buffer,\n tool: ctx.tool.value,\n ...(ctx.hostTools.value ? { tools: ctx.hostTools.value } : {}),\n // The engine adds the plugins' tools and layers, and decorates through the host, which\n // reads `decorateAnnotation` first.\n ...(ctx.pluginHost.value ? { plugins: ctx.pluginHost.value } : {}),\n // The engine draws the search matches on the pages.\n ...(ctx.search.value ? { search: ctx.search.value } : {}),\n // Read through, so the watch below can re-apply a new function without a rebuild.\n decorateAnnotation: (a) => ctx.decorateAnnotation.value?.(a),\n ...(ctx.toolStyle.value ? { toolStyle: ctx.toolStyle.value } : {}),\n toolHistory: { batch: (fn) => ctx.history.batch(fn) },\n toolOptions: ctx.toolOptions,\n fonts: [...ctx.fonts.value],\n // Read through, so a new `signatures` store reaches the tool as well as the menus.\n signatureLibrary: () => ctx.signatures.value,\n customAnnotations: custom,\n onActivate: (id) => ctx.setActivated(id),\n onBuild: (vp, tc) => {\n ctx.viewport.value = vp\n ctx.tools.value = tc\n if (first) {\n // A new document starts from where the viewport opens (its zoom, on the first page:\n // `createViewport` always starts at page 0); only later changes are reported, the\n // restored page among them, since the engine has already scrolled to it.\n first = false\n lastReportedZoom = vp.zoom.get()\n lastReportedPage = 0\n }\n for (const stop of stops) stop()\n const reportZoom = (z: ZoomValue): void => {\n if (z === lastReportedZoom) return\n lastReportedZoom = z\n ctx.reportZoom(z)\n }\n const reportPage = (p: number): void => {\n if (p === lastReportedPage) return\n lastReportedPage = p\n ctx.reportPage(p)\n }\n // A tool that switches itself (a one-shot tool once used) is reported as a pick.\n const followTool = (id: ToolId): void => {\n if (id !== ctx.tool.value) ctx.setTool(id)\n }\n stops = [\n vp.zoom.subscribe(reportZoom),\n vp.currentPage.subscribe(reportPage),\n tc.active.subscribe(followTool),\n ]\n // Whatever the build restored is reported once; nothing is when it matched.\n reportZoom(vp.zoom.get())\n reportPage(vp.currentPage.get())\n },\n onPageMount: (page, mount, host) => {\n pages.value = [...pages.value, { build, page, host, mount, error: null, custom }]\n },\n onPageUnmount: (page) => {\n pages.value = pages.value.filter((p) => p.page !== page)\n },\n onPageError: (page, err) => {\n pages.value = pages.value.map((p) => (p.page === page ? { ...p, error: err } : p))\n },\n })\n}\n\nonMounted(() => {\n ctx.viewportEl.value = scroll.value\n watch([() => ctx.document.value, () => ctx.status.value.state], setup, {\n immediate: true,\n })\n})\n\n// A new decorateAnnotation re-applies to the mounted annotation elements at once.\nwatch(\n () => ctx.decorateAnnotation.value,\n () => engine.value?.redecorate()\n)\nwatch(\n () => ctx.zoomModel.value,\n (z: ZoomValue | undefined) => {\n const vp = engine.value?.viewport\n if (vp && z !== undefined && z !== vp.zoom.get()) vp.setZoom(z)\n }\n)\nwatch(\n () => ctx.pageModel.value,\n (p) => {\n const vp = engine.value?.viewport\n if (!vp || p === undefined || p === lastReportedPage) return\n if (p !== vp.currentPage.get()) vp.scrollToPage(p)\n }\n)\nwatch(\n () => ctx.tool.value,\n (t) => {\n const tc = engine.value?.tools\n if (tc && tc.active.get() !== t) tc.set(t)\n }\n)\nwatch(\n () => props.mode,\n (m) => engine.value?.viewport.setMode(m)\n)\nwatch(\n () => props.rotation,\n (r) => engine.value?.viewport.setRotation(r)\n)\n// Gap and buffer are construction options: rebuild for the same document, keeping zoom and page.\n// The slots are already updated when this runs, so it carries the annotation slot too: a slot\n// toggle in the same tick is then recorded here and `onBeforeUpdate` finds nothing left to do.\nwatch([() => props.gap, () => props.buffer], ([gap, buffer]) =>\n rebuild({ gap, buffer, customAnnotations: !!slots.annotation })\n)\n\n// Slots are not reactive, so a change to whether the annotation slot is given is caught here.\n// `onBeforeUpdate` runs after the new slots are in place and before this render: the rebuild\n// swaps `pages` for the new build's pages synchronously, so the render that follows never pairs\n// the annotation slot with an overlay built without it (or the reverse). The rebuild keeps the\n// scroll position.\nonBeforeUpdate(() => {\n const next = !!slots.annotation\n if (engine.value && next !== custom) rebuild({ customAnnotations: next })\n})\n\nonBeforeUnmount(() => {\n teardown()\n if (ctx.viewportEl.value === scroll.value) ctx.viewportEl.value = null\n})\n</script>\n\n<template>\n <div class=\"ink-viewport-root\" data-ink-viewport-root :data-state=\"state\">\n <div v-if=\"state === 'loading'\" class=\"ink-status\" role=\"status\" aria-live=\"polite\">\n <slot name=\"loading\">Loading document…</slot>\n </div>\n <div v-else-if=\"error\" class=\"ink-status ink-error\" role=\"alert\">\n <slot name=\"error\" :error=\"error\">\n <p class=\"ink-error-title\">This document could not be opened.</p>\n <!-- The message comes from the PDF engine and is not written for readers: it stays\n off the page, on the code's tooltip. -->\n <p>\n <code class=\"ink-error-code\" :title=\"error.message\">{{ error.code }}</code>\n </p>\n </slot>\n </div>\n <div v-else-if=\"state === 'idle'\" class=\"ink-status ink-empty\">\n <slot name=\"empty\" />\n </div>\n <div\n ref=\"scroll\"\n class=\"ink-scroll\"\n data-ink-scroll\n tabindex=\"0\"\n role=\"document\"\n aria-label=\"Document\"\n />\n <InkPage\n v-for=\"p in pages\"\n :key=\"`${p.build}:${p.page}`\"\n :page=\"p.page\"\n :host=\"p.host\"\n :mount=\"p.mount\"\n :error=\"p.error\"\n :custom-annotations=\"p.custom\"\n >\n <template v-if=\"slots.annotation\" #annotation=\"slotProps\">\n <slot name=\"annotation\" v-bind=\"slotProps\" />\n </template>\n <template v-if=\"slots['page-error']\" #page-error=\"slotProps\">\n <slot name=\"page-error\" v-bind=\"slotProps\" />\n </template>\n </InkPage>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,IAAMsB,IAAQC,GAYRC,IAAQxB,EAAA,GASR0B,IAAMC,EAAiB,GACvBC,IAASC,EAA4B,QAAQ,GAa7CC,IAAQC,EAA0B,CAAC,CAAC,GAEpCC,IAAQC,QAAeP,EAAI,OAAO,MAAM,KAAK,GAC7CQ,IAAQD,QACZP,EAAI,OAAO,MAAM,UAAU,UAAUA,EAAI,OAAO,MAAM,QAAQ,IAChE,GAEMS,IAASJ,EAAgC,IAAI,GAM/CK,IAAQ,GAERC,IAAS,IACTC,IAAwB,CAAC,GAEzBC,GACAC;EAE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EAAE;IACR,OAAOA,EAAE;IACT,OAAOA,EAAE;IACT,sBAAoBA,EAAE;GAEP,GAAAyB,EAAA,EAAA,GAAA,EAAA,GAAA,CAAA5D,EAAM,aAAA;IAAa,MAAA;IACjC,IAAAX,GAD6C,MAAS,CACtDV,EAA6CwE,EAAA,QAAA,cAA7C7D,EAA6C,EAAA,SAAA,GAAA,GAAbyE,CAAS,CAAA,CAAA,CAAA;;GAE3B,IAAA,KAAA,GAAA/D,EAAK,gBAAA;IAAiB,MAAA;IACpC,IAAAX,GADgD,MAAS,CACzDV,EAA6CwE,EAAA,QAAA,cAA7C7D,EAA6C,EAAA,SAAA,GAAA,GAAbyE,CAAS,CAAA,CAAA,CAAA"}
|
|
@@ -3,11 +3,11 @@ type __VLS_Props = {
|
|
|
3
3
|
fonts?: readonly string[] | undefined;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
-
saved: (template: SignatureTemplate) => any;
|
|
7
6
|
close: () => any;
|
|
7
|
+
saved: (template: SignatureTemplate) => any;
|
|
8
8
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
-
onSaved?: (template: SignatureTemplate) => any;
|
|
10
9
|
onClose?: () => any;
|
|
10
|
+
onSaved?: (template: SignatureTemplate) => any;
|
|
11
11
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
|
13
13
|
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IconNode } from '@inkbar/icons';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
export interface CommandHandle {
|
|
4
|
+
/** Runs the command; does nothing while it is busy or disabled. Never rejects. */
|
|
5
|
+
run(): Promise<void>;
|
|
6
|
+
/** A ready document (or the plugin's own condition), and not busy. */
|
|
7
|
+
enabled: Readonly<Ref<boolean>>;
|
|
8
|
+
busy: Readonly<Ref<boolean>>;
|
|
9
|
+
/** The command's progress or result message, `''` without one. */
|
|
10
|
+
status: Readonly<Ref<string>>;
|
|
11
|
+
/** `''` until the plugins are set up. */
|
|
12
|
+
label: Readonly<Ref<string>>;
|
|
13
|
+
icon: Readonly<Ref<IconNode | undefined>>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A plugin command by its namespaced id (`sandbox.suggest`), for hosts building their own
|
|
17
|
+
* control. Plugins are set up once InkRoot has mounted, so until then (and on the server) the
|
|
18
|
+
* command is disabled with no label; it fills in then. Once they are set up, an id no plugin
|
|
19
|
+
* passed to InkRoot registered stays that way, and logs `InkError('UnknownCommand')` to the
|
|
20
|
+
* console once.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCommand(id: string): CommandHandle;
|
|
23
|
+
//# sourceMappingURL=useCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommand.d.ts","sourceRoot":"","sources":["../../src/composables/useCommand.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACpB,sEAAsE;IACtE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5B,kEAAkE;IAClE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7B,yCAAyC;IACzC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAA;CAC1C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAmBpD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { useReadable as t } from "../use-readable.js";
|
|
3
|
+
import { computed as n, watch as r } from "vue";
|
|
4
|
+
import { unknownCommand as i } from "@inkbar/core/dom";
|
|
5
|
+
//#region src/composables/useCommand.ts
|
|
6
|
+
function a(a) {
|
|
7
|
+
let o = e("useCommand()").pluginHost, s = n(() => o.value?.command(a));
|
|
8
|
+
return r(o, (e) => {
|
|
9
|
+
e && !e.command(a) && console.error(i(a, [...e.commands.keys()]));
|
|
10
|
+
}, { immediate: !0 }), {
|
|
11
|
+
run: async () => s.value?.run(),
|
|
12
|
+
enabled: t(() => s.value?.enabled, !1),
|
|
13
|
+
busy: t(() => s.value?.busy, !1),
|
|
14
|
+
status: t(() => s.value?.status, ""),
|
|
15
|
+
label: n(() => s.value?.label ?? ""),
|
|
16
|
+
icon: n(() => s.value?.icon)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as useCommand };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=useCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommand.js","names":["useCommand","host","useInkContext","command","computed","id","watch","set","unknownCommand","useReadable"],"sources":["../../src/composables/useCommand.ts"],"sourcesContent":["import { unknownCommand } from '@inkbar/core/dom'\nimport { computed, watch } from 'vue'\n\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport type { IconNode } from '@inkbar/icons'\nimport type { Ref } from 'vue'\n\nexport interface CommandHandle {\n /** Runs the command; does nothing while it is busy or disabled. Never rejects. */\n run(): Promise<void>\n /** A ready document (or the plugin's own condition), and not busy. */\n enabled: Readonly<Ref<boolean>>\n busy: Readonly<Ref<boolean>>\n /** The command's progress or result message, `''` without one. */\n status: Readonly<Ref<string>>\n /** `''` until the plugins are set up. */\n label: Readonly<Ref<string>>\n icon: Readonly<Ref<IconNode | undefined>>\n}\n\n/**\n * A plugin command by its namespaced id (`sandbox.suggest`), for hosts building their own\n * control. Plugins are set up once InkRoot has mounted, so until then (and on the server) the\n * command is disabled with no label; it fills in then. Once they are set up, an id no plugin\n * passed to InkRoot registered stays that way, and logs `InkError('UnknownCommand')` to the\n * console once.\n */\nexport function useCommand(id: string): CommandHandle {\n const host = useInkContext('useCommand()').pluginHost\n const command = computed(() => host.value?.command(id))\n watch(\n host,\n (set) => {\n if (set && !set.command(id))\n console.error(unknownCommand(id, [...set.commands.keys()]))\n },\n { immediate: true }\n )\n return {\n run: async () => command.value?.run(),\n enabled: useReadable(() => command.value?.enabled, false),\n busy: useReadable(() => command.value?.busy, false),\n status: useReadable(() => command.value?.status, ''),\n label: computed(() => command.value?.label ?? ''),\n icon: computed(() => command.value?.icon),\n }\n}\n"],"mappings":";;;;;AA6BA,SAAgBA,EAAW,GAA2B;CACpD,IAAMC,IAAOC,EAAc,cAAc,CAAC,CAAC,YACrCC,IAAUC,QAAeH,EAAK,OAAO,QAAQI,CAAE,CAAC;CAStD,OARAC,EACEL,IACC,MAAQ;EACP,AAAIM,KAAO,CAACA,EAAI,QAAQF,CAAE,KACxB,QAAQ,MAAMG,EAAeH,GAAI,CAAC,GAAGE,EAAI,SAAS,KAAK,CAAC,CAAC,CAAC;CAC9D,GACA,EAAE,WAAW,GAAK,CACpB,GACO;EACL,KAAK,YAAYJ,EAAQ,OAAO,IAAI;EACpC,SAASM,QAAkBN,EAAQ,OAAO,SAAS,EAAK;EACxD,MAAMM,QAAkBN,EAAQ,OAAO,MAAM,EAAK;EAClD,QAAQM,QAAkBN,EAAQ,OAAO,QAAQ,EAAE;EACnD,OAAOC,QAAeD,EAAQ,OAAO,SAAS,EAAE;EAChD,MAAMC,QAAeD,EAAQ,OAAO,IAAI;CAC1C;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SearchState, ViewerSearch } from '@inkbar/core/dom';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* The document search for hosts building their own control: the state, and the actions the
|
|
5
|
+
* find bar uses. Search is set up once InkRoot has mounted, so until then (and on the server)
|
|
6
|
+
* the state is closed and the actions do nothing. `open()` runs the search and draws the
|
|
7
|
+
* highlights even when no find bar is mounted.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSearch(): {
|
|
10
|
+
state: Readonly<Ref<SearchState>>;
|
|
11
|
+
} & Omit<ViewerSearch, 'state'>;
|
|
12
|
+
//# sourceMappingURL=useSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearch.d.ts","sourceRoot":"","sources":["../../src/composables/useSearch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAW9B;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI;IAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAA;CAAE,GAAG,IAAI,CACvE,YAAY,EACZ,OAAO,CACR,CAWA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { useReadable as t } from "../use-readable.js";
|
|
3
|
+
//#region src/composables/useSearch.ts
|
|
4
|
+
var n = {
|
|
5
|
+
open: !1,
|
|
6
|
+
query: "",
|
|
7
|
+
matchCase: !1,
|
|
8
|
+
hits: [],
|
|
9
|
+
current: -1,
|
|
10
|
+
scanning: !1
|
|
11
|
+
};
|
|
12
|
+
function r() {
|
|
13
|
+
let r = e("useSearch()").search;
|
|
14
|
+
return {
|
|
15
|
+
state: t(() => r.value?.state, n),
|
|
16
|
+
open: (e) => r.value?.open(e),
|
|
17
|
+
setQuery: (e) => r.value?.setQuery(e),
|
|
18
|
+
setMatchCase: (e) => r.value?.setMatchCase(e),
|
|
19
|
+
next: () => r.value?.next(),
|
|
20
|
+
previous: () => r.value?.previous(),
|
|
21
|
+
close: () => r.value?.close()
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { r as useSearch };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=useSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearch.js","names":["CLOSED","useSearch","search","useInkContext","useReadable","query","on"],"sources":["../../src/composables/useSearch.ts"],"sourcesContent":["import { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport type { SearchState, ViewerSearch } from '@inkbar/core/dom'\nimport type { Ref } from 'vue'\n\nconst CLOSED: SearchState = {\n open: false,\n query: '',\n matchCase: false,\n hits: [],\n current: -1,\n scanning: false,\n}\n\n/**\n * The document search for hosts building their own control: the state, and the actions the\n * find bar uses. Search is set up once InkRoot has mounted, so until then (and on the server)\n * the state is closed and the actions do nothing. `open()` runs the search and draws the\n * highlights even when no find bar is mounted.\n */\nexport function useSearch(): { state: Readonly<Ref<SearchState>> } & Omit<\n ViewerSearch,\n 'state'\n> {\n const search = useInkContext('useSearch()').search\n return {\n state: useReadable(() => search.value?.state, CLOSED),\n open: (query) => search.value?.open(query),\n setQuery: (query) => search.value?.setQuery(query),\n setMatchCase: (on) => search.value?.setMatchCase(on),\n next: () => search.value?.next(),\n previous: () => search.value?.previous(),\n close: () => search.value?.close(),\n }\n}\n"],"mappings":";;;AAMA,IAAMA,IAAsB;CAC1B,MAAM;CACN,OAAO;CACP,WAAW;CACX,MAAM,CAAC;CACP,SAAS;CACT,UAAU;AACZ;AAQA,SAAgBC,IAGd;CACA,IAAMC,IAASC,EAAc,aAAa,CAAC,CAAC;CAC5C,OAAO;EACL,OAAOC,QAAkBF,EAAO,OAAO,OAAOF,CAAM;EACpD,OAAO,MAAUE,EAAO,OAAO,KAAKG,CAAK;EACzC,WAAW,MAAUH,EAAO,OAAO,SAASG,CAAK;EACjD,eAAe,MAAOH,EAAO,OAAO,aAAaI,CAAE;EACnD,YAAYJ,EAAO,OAAO,KAAK;EAC/B,gBAAgBA,EAAO,OAAO,SAAS;EACvC,aAAaA,EAAO,OAAO,MAAM;CACnC;AACF"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { Annotation, InkDocument, InkStatus, PdfAssets, SignatureLibrary } from '@inkbar/core';
|
|
2
|
-
import { DecorateAnnotation, Tool, ToolController, ToolId, ToolOptions, ToolStyle, Viewport, ZoomValue } from '@inkbar/core/dom';
|
|
1
|
+
import { Annotation, InkDocument, InkStatus, PdfAssets, PluginHistory, SignatureLibrary } from '@inkbar/core';
|
|
2
|
+
import { DecorateAnnotation, PluginHost, SearchController, Tool, ToolController, ToolId, ToolOptions, ToolStyle, Viewport, ZoomValue } from '@inkbar/core/dom';
|
|
3
3
|
import { Ref, ShallowRef } from 'vue';
|
|
4
4
|
export type { InkStatus };
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Undo and redo for the current document, whichever mode its annotations are in. `track` and
|
|
7
|
+
* `react` (from `PluginHistory`) reach the same history, so plugin stores undo with the edits.
|
|
8
|
+
*/
|
|
9
|
+
export interface InkHistory extends PluginHistory {
|
|
7
10
|
canUndo: Readonly<Ref<boolean>>;
|
|
8
11
|
canRedo: Readonly<Ref<boolean>>;
|
|
9
12
|
undo: () => void;
|
|
@@ -24,6 +27,20 @@ export interface InkContext {
|
|
|
24
27
|
status: Readonly<Ref<InkStatus>>;
|
|
25
28
|
annotations: Readonly<Ref<readonly Annotation[]>>;
|
|
26
29
|
selection: Readonly<Ref<readonly string[]>>;
|
|
30
|
+
/**
|
|
31
|
+
* The plugins from InkRoot's `plugins` prop, set up once the root has mounted and kept for
|
|
32
|
+
* its life; `null` before that (and on the server) and once it unmounts. InkViewport hands it
|
|
33
|
+
* to the engine; InkCommand places its commands.
|
|
34
|
+
*/
|
|
35
|
+
pluginHost: Readonly<ShallowRef<PluginHost | null>>;
|
|
36
|
+
/**
|
|
37
|
+
* The search controller from the same set-up as `pluginHost`: shared by the find bar, the
|
|
38
|
+
* search button, the engine's highlights and the plugins. `null` until the root has mounted
|
|
39
|
+
* (and on the server) and once it unmounts.
|
|
40
|
+
*/
|
|
41
|
+
search: Readonly<ShallowRef<SearchController | null>>;
|
|
42
|
+
/** InkViewport's scroll element while it is mounted: the plugins' `root`. */
|
|
43
|
+
viewportEl: ShallowRef<HTMLElement | null>;
|
|
27
44
|
/** Set by InkViewport once it has mounted its viewport and tool controller. */
|
|
28
45
|
viewport: ShallowRef<Viewport | null>;
|
|
29
46
|
tools: ShallowRef<ToolController | null>;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,gBAAgB,EACjB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EACV,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAE1C,YAAY,EAAE,SAAS,EAAE,CAAA;AAEzB
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,EACb,gBAAgB,EACjB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EACV,kBAA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GAAG,IAAI,CAAA;IAC3B,gGAAgG;IAChG,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAA;IACvC;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IACrC,OAAO,EAAE,UAAU,CAAA;IACnB,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAA;CAC1C;AAED,eAAO,MAAO,gBAAgB,uIAAE,iBAAiB,0CAAwC,CAAA;AAEzF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAO1D"}
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":["injectInkContext","provideInkContext","createContext","useInkContext","ctx","getCurrentInstance","consumer"],"sources":["../src/context.ts"],"sourcesContent":["import { createContext } from 'reka-ui'\nimport { getCurrentInstance } from 'vue'\n\nimport type {\n Annotation,\n InkDocument,\n InkStatus,\n PdfAssets,\n SignatureLibrary,\n} from '@inkbar/core'\nimport type {\n DecorateAnnotation,\n Tool,\n ToolController,\n ToolId,\n ToolOptions,\n ToolStyle,\n Viewport,\n ZoomValue,\n} from '@inkbar/core/dom'\nimport type { Ref, ShallowRef } from 'vue'\n\nexport type { InkStatus }\n\n
|
|
1
|
+
{"version":3,"file":"context.js","names":["injectInkContext","provideInkContext","createContext","useInkContext","ctx","getCurrentInstance","consumer"],"sources":["../src/context.ts"],"sourcesContent":["import { createContext } from 'reka-ui'\nimport { getCurrentInstance } from 'vue'\n\nimport type {\n Annotation,\n InkDocument,\n InkStatus,\n PdfAssets,\n PluginHistory,\n SignatureLibrary,\n} from '@inkbar/core'\nimport type {\n DecorateAnnotation,\n PluginHost,\n SearchController,\n Tool,\n ToolController,\n ToolId,\n ToolOptions,\n ToolStyle,\n Viewport,\n ZoomValue,\n} from '@inkbar/core/dom'\nimport type { Ref, ShallowRef } from 'vue'\n\nexport type { InkStatus }\n\n/**\n * Undo and redo for the current document, whichever mode its annotations are in. `track` and\n * `react` (from `PluginHistory`) reach the same history, so plugin stores undo with the edits.\n */\nexport interface InkHistory extends PluginHistory {\n canUndo: Readonly<Ref<boolean>>\n canRedo: Readonly<Ref<boolean>>\n undo: () => void\n redo: () => void\n clear: () => void\n /**\n * Runs `fn` and records what it changes as one undo step. The host still receives one change\n * per add. Controlled, the history groups the resulting list changes into one step, and\n * `canUndo` updates once the current task ends. Any other change the host applies in that\n * same window joins the step.\n */\n batch: (fn: () => void) => void\n}\n\nexport interface InkContext {\n assets: Readonly<Ref<PdfAssets>>\n document: Readonly<ShallowRef<InkDocument | null>>\n /** `loading` from the moment a document starts opening, then the document's own status. */\n status: Readonly<Ref<InkStatus>>\n annotations: Readonly<Ref<readonly Annotation[]>>\n selection: Readonly<Ref<readonly string[]>>\n /**\n * The plugins from InkRoot's `plugins` prop, set up once the root has mounted and kept for\n * its life; `null` before that (and on the server) and once it unmounts. InkViewport hands it\n * to the engine; InkCommand places its commands.\n */\n pluginHost: Readonly<ShallowRef<PluginHost | null>>\n /**\n * The search controller from the same set-up as `pluginHost`: shared by the find bar, the\n * search button, the engine's highlights and the plugins. `null` until the root has mounted\n * (and on the server) and once it unmounts.\n */\n search: Readonly<ShallowRef<SearchController | null>>\n /** InkViewport's scroll element while it is mounted: the plugins' `root`. */\n viewportEl: ShallowRef<HTMLElement | null>\n /** Set by InkViewport once it has mounted its viewport and tool controller. */\n viewport: ShallowRef<Viewport | null>\n tools: ShallowRef<ToolController | null>\n /** Desired tool; InkViewport applies it to the controller. */\n tool: Readonly<Ref<ToolId>>\n setTool(id: ToolId): void\n /** Host tools from InkRoot's `tools` prop; InkViewport registers them. */\n hostTools: Readonly<Ref<Tool[] | undefined>>\n /** InkRoot's `decorateAnnotation` prop. InkViewport re-applies decorations when it changes. */\n decorateAnnotation: Readonly<Ref<DecorateAnnotation | undefined>>\n /** The font families text boxes offer: InkRoot's `fonts`, else `FONT_FAMILIES`. */\n fonts: Readonly<Ref<readonly string[]>>\n /** The tools' options for InkRoot's life, so they persist across documents. */\n toolOptions: ToolOptions\n /** The saved signatures, from InkRoot's `signatures` store (memory by default). */\n signatures: Readonly<ShallowRef<SignatureLibrary>>\n /** The fonts a typed signature offers: InkRoot's `signatureFonts`, else `SIGNATURE_FONTS`. */\n signatureFonts: Readonly<Ref<readonly string[]>>\n /** The open document's tool style; `null` while no document is open. */\n toolStyle: Readonly<ShallowRef<ToolStyle | null>>\n /** Desired zoom and page from the host's v-models; InkViewport applies and reports back. */\n zoomModel: Readonly<Ref<ZoomValue | undefined>>\n pageModel: Readonly<Ref<number | undefined>>\n reportZoom(z: ZoomValue): void\n reportPage(p: number): void\n /** Last activated annotation (Enter, click with the note tool, etc.). Popovers key off this. */\n activated: Readonly<Ref<string | null>>\n /**\n * Activates annotation `id`, or clears the activation with `null`. This is the context's\n * own: unlike core's `Viewer.setActivated`, it emits InkRoot's `activate` for an id, and it\n * does not check that the id is in the document.\n */\n setActivated(id: string | null): void\n history: InkHistory\n rootEl: Readonly<Ref<HTMLElement | null>>\n}\n\nexport const [injectInkContext, provideInkContext] = createContext<InkContext>('InkRoot')\n\n/**\n * The context for composables: throws a readable error when called outside a component\n * rendered inside `InkRoot`, instead of Vue's injection warning.\n */\nexport function useInkContext(consumer: string): InkContext {\n const ctx = getCurrentInstance() ? injectInkContext(null) : null\n if (!ctx)\n throw new Error(\n `[inkbar] ${consumer} must be called in a component inside <InkRoot>.`\n )\n return ctx\n}\n"],"mappings":";;;AAwGA,IAAa,CAACA,GAAkBC,KAAqBC,EAA0B,SAAS;AAMxF,SAAgBC,EAAc,GAA8B;CAC1D,IAAMC,IAAMC,EAAmB,IAAIL,EAAiB,IAAI,IAAI;CAC5D,IAAI,CAACI,GACH,MAAU,MACR,YAAYE,EAAS,iDACvB;CACF,OAAOF;AACT"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as InkRoot } from './components/InkRoot.vue';
|
|
2
2
|
export { injectInkContext } from './context';
|
|
3
3
|
export type { InkContext, InkHistory, InkStatus } from './context';
|
|
4
|
-
export type { AnnotationDecoration, DecorateAnnotation } from '@inkbar/core/dom';
|
|
4
|
+
export type { AnnotationDecoration, DecorateAnnotation, InkPlugin, } from '@inkbar/core/dom';
|
|
5
5
|
export { useReadable } from './use-readable';
|
|
6
6
|
export { useDocument } from './composables/useDocument';
|
|
7
7
|
export { useAnnotations } from './composables/useAnnotations';
|
|
@@ -14,6 +14,9 @@ export { useZoom } from './composables/useZoom';
|
|
|
14
14
|
export { usePage } from './composables/usePage';
|
|
15
15
|
export { useHistory } from './composables/useHistory';
|
|
16
16
|
export { useEmbedded } from './composables/useEmbedded';
|
|
17
|
+
export { useSearch } from './composables/useSearch';
|
|
18
|
+
export { useCommand } from './composables/useCommand';
|
|
19
|
+
export type { CommandHandle } from './composables/useCommand';
|
|
17
20
|
export { default as InkViewport } from './components/InkViewport.vue';
|
|
18
21
|
export { default as InkPage } from './components/InkPage.vue';
|
|
19
22
|
export { default as InkAnnotation } from './components/InkAnnotation.vue';
|
|
@@ -21,6 +24,7 @@ export type { AnnotationSlotProps, AnnotationState } from './components/annotati
|
|
|
21
24
|
export { default as InkToolbar } from './components/InkToolbar.vue';
|
|
22
25
|
export { default as InkIcon } from './components/InkIcon.vue';
|
|
23
26
|
export { default as InkToolButton } from './components/InkToolButton.vue';
|
|
27
|
+
export { default as InkCommand } from './components/InkCommand.vue';
|
|
24
28
|
export { default as InkToolbarSeparator } from './components/InkToolbarSeparator.vue';
|
|
25
29
|
export { default as InkUndo } from './components/InkUndo.vue';
|
|
26
30
|
export { default as InkRedo } from './components/InkRedo.vue';
|
|
@@ -40,4 +44,6 @@ export { default as InkPrevPage } from './components/InkPrevPage.vue';
|
|
|
40
44
|
export { default as InkNextPage } from './components/InkNextPage.vue';
|
|
41
45
|
export { default as InkThreadPopover } from './components/InkThreadPopover.vue';
|
|
42
46
|
export type { ThreadPopoverSlotProps } from './components/InkThreadPopover.vue';
|
|
47
|
+
export { default as InkSearchButton } from './components/InkSearchButton.vue';
|
|
48
|
+
export { default as InkFindBar } from './components/InkFindBar.vue';
|
|
43
49
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAClE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAClE,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,GACV,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,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