@inkbar/vue 0.0.0-stage → 0.1.1

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.
Files changed (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -2
  3. package/dist/components/InkAnnotation.js +7 -0
  4. package/dist/components/InkAnnotation.js.map +1 -0
  5. package/dist/components/InkAnnotation.vue.d.ts +22 -0
  6. package/dist/components/InkAnnotation.vue.d.ts.map +1 -0
  7. package/dist/components/InkAnnotation.vue_vue_type_script_setup_true_lang.js +48 -0
  8. package/dist/components/InkAnnotation.vue_vue_type_script_setup_true_lang.js.map +1 -0
  9. package/dist/components/InkNotePopover.js +7 -0
  10. package/dist/components/InkNotePopover.js.map +1 -0
  11. package/dist/components/InkNotePopover.vue.d.ts +15 -0
  12. package/dist/components/InkNotePopover.vue.d.ts.map +1 -0
  13. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js +132 -0
  14. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
  15. package/dist/components/InkPage.js +7 -0
  16. package/dist/components/InkPage.js.map +1 -0
  17. package/dist/components/InkPage.vue.d.ts +32 -0
  18. package/dist/components/InkPage.vue.d.ts.map +1 -0
  19. package/dist/components/InkPage.vue_vue_type_script_setup_true_lang.js +68 -0
  20. package/dist/components/InkPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  21. package/dist/components/InkPageCount.js +7 -0
  22. package/dist/components/InkPageCount.js.map +1 -0
  23. package/dist/components/InkPageCount.vue.d.ts +4 -0
  24. package/dist/components/InkPageCount.vue.d.ts.map +1 -0
  25. package/dist/components/InkPageCount.vue_vue_type_script_setup_true_lang.js +18 -0
  26. package/dist/components/InkPageCount.vue_vue_type_script_setup_true_lang.js.map +1 -0
  27. package/dist/components/InkPageInput.js +7 -0
  28. package/dist/components/InkPageInput.js.map +1 -0
  29. package/dist/components/InkPageInput.vue.d.ts +4 -0
  30. package/dist/components/InkPageInput.vue.d.ts.map +1 -0
  31. package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js +30 -0
  32. package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  33. package/dist/components/InkRoot.js +7 -0
  34. package/dist/components/InkRoot.js.map +1 -0
  35. package/dist/components/InkRoot.vue.d.ts +784 -0
  36. package/dist/components/InkRoot.vue.d.ts.map +1 -0
  37. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +162 -0
  38. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -0
  39. package/dist/components/InkSuggestionCard.js +7 -0
  40. package/dist/components/InkSuggestionCard.js.map +1 -0
  41. package/dist/components/InkSuggestionCard.vue.d.ts +16 -0
  42. package/dist/components/InkSuggestionCard.vue.d.ts.map +1 -0
  43. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js +85 -0
  44. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  45. package/dist/components/InkToolButton.js +7 -0
  46. package/dist/components/InkToolButton.js.map +1 -0
  47. package/dist/components/InkToolButton.vue.d.ts +26 -0
  48. package/dist/components/InkToolButton.vue.d.ts.map +1 -0
  49. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +45 -0
  50. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  51. package/dist/components/InkToolbar.js +7 -0
  52. package/dist/components/InkToolbar.js.map +1 -0
  53. package/dist/components/InkToolbar.vue.d.ts +21 -0
  54. package/dist/components/InkToolbar.vue.d.ts.map +1 -0
  55. package/dist/components/InkToolbar.vue_vue_type_script_setup_true_lang.js +29 -0
  56. package/dist/components/InkToolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  57. package/dist/components/InkViewport.js +7 -0
  58. package/dist/components/InkViewport.js.map +1 -0
  59. package/dist/components/InkViewport.vue.d.ts +39 -0
  60. package/dist/components/InkViewport.vue.d.ts.map +1 -0
  61. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +148 -0
  62. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -0
  63. package/dist/components/InkZoomIn.js +7 -0
  64. package/dist/components/InkZoomIn.js.map +1 -0
  65. package/dist/components/InkZoomIn.vue.d.ts +19 -0
  66. package/dist/components/InkZoomIn.vue.d.ts.map +1 -0
  67. package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js +30 -0
  68. package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js.map +1 -0
  69. package/dist/components/InkZoomOut.js +7 -0
  70. package/dist/components/InkZoomOut.js.map +1 -0
  71. package/dist/components/InkZoomOut.vue.d.ts +19 -0
  72. package/dist/components/InkZoomOut.vue.d.ts.map +1 -0
  73. package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js +30 -0
  74. package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js.map +1 -0
  75. package/dist/components/InkZoomSelect.js +7 -0
  76. package/dist/components/InkZoomSelect.js.map +1 -0
  77. package/dist/components/InkZoomSelect.vue.d.ts +4 -0
  78. package/dist/components/InkZoomSelect.vue.d.ts.map +1 -0
  79. package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js +39 -0
  80. package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map +1 -0
  81. package/dist/components/annotation-element.d.ts +5 -0
  82. package/dist/components/annotation-element.d.ts.map +1 -0
  83. package/dist/components/annotation-element.js +18 -0
  84. package/dist/components/annotation-element.js.map +1 -0
  85. package/dist/components/annotation-slot.d.ts +2 -0
  86. package/dist/components/annotation-slot.d.ts.map +1 -0
  87. package/dist/components/popover-focus.d.ts +9 -0
  88. package/dist/components/popover-focus.d.ts.map +1 -0
  89. package/dist/components/popover-focus.js +15 -0
  90. package/dist/components/popover-focus.js.map +1 -0
  91. package/dist/composables/useAnnotations.d.ts +1921 -0
  92. package/dist/composables/useAnnotations.d.ts.map +1 -0
  93. package/dist/composables/useAnnotations.js +27 -0
  94. package/dist/composables/useAnnotations.js.map +1 -0
  95. package/dist/composables/useDocument.d.ts +12 -0
  96. package/dist/composables/useDocument.d.ts.map +1 -0
  97. package/dist/composables/useDocument.js +20 -0
  98. package/dist/composables/useDocument.js.map +1 -0
  99. package/dist/composables/useEmbedded.d.ts +6 -0
  100. package/dist/composables/useEmbedded.d.ts.map +1 -0
  101. package/dist/composables/useEmbedded.js +15 -0
  102. package/dist/composables/useEmbedded.js.map +1 -0
  103. package/dist/composables/useHistory.d.ts +7 -0
  104. package/dist/composables/useHistory.d.ts.map +1 -0
  105. package/dist/composables/useHistory.js +9 -0
  106. package/dist/composables/useHistory.js.map +1 -0
  107. package/dist/composables/usePage.d.ts +10 -0
  108. package/dist/composables/usePage.d.ts.map +1 -0
  109. package/dist/composables/usePage.js +22 -0
  110. package/dist/composables/usePage.js.map +1 -0
  111. package/dist/composables/useSelection.d.ts +6 -0
  112. package/dist/composables/useSelection.d.ts.map +1 -0
  113. package/dist/composables/useSelection.js +14 -0
  114. package/dist/composables/useSelection.js.map +1 -0
  115. package/dist/composables/useTool.d.ts +6 -0
  116. package/dist/composables/useTool.d.ts.map +1 -0
  117. package/dist/composables/useTool.js +13 -0
  118. package/dist/composables/useTool.js.map +1 -0
  119. package/dist/composables/useZoom.d.ts +9 -0
  120. package/dist/composables/useZoom.d.ts.map +1 -0
  121. package/dist/composables/useZoom.js +17 -0
  122. package/dist/composables/useZoom.js.map +1 -0
  123. package/dist/compositions/DefaultToolbar.js +7 -0
  124. package/dist/compositions/DefaultToolbar.js.map +1 -0
  125. package/dist/compositions/DefaultToolbar.vue.d.ts +19 -0
  126. package/dist/compositions/DefaultToolbar.vue.d.ts.map +1 -0
  127. package/dist/compositions/DefaultToolbar.vue_vue_type_script_setup_true_lang.js +100 -0
  128. package/dist/compositions/DefaultToolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  129. package/dist/context.d.ts +50 -0
  130. package/dist/context.d.ts.map +1 -0
  131. package/dist/context.js +13 -0
  132. package/dist/context.js.map +1 -0
  133. package/dist/index.d.ts +29 -0
  134. package/dist/index.d.ts.map +1 -0
  135. package/dist/index.js +25 -0
  136. package/dist/ref-history.d.ts +18 -0
  137. package/dist/ref-history.d.ts.map +1 -0
  138. package/dist/ref-history.js +25 -0
  139. package/dist/ref-history.js.map +1 -0
  140. package/dist/use-readable.d.ts +5 -0
  141. package/dist/use-readable.d.ts.map +1 -0
  142. package/dist/use-readable.js +16 -0
  143. package/dist/use-readable.js.map +1 -0
  144. package/package.json +52 -3
@@ -0,0 +1,148 @@
1
+ import { injectInkContext as e } from "../context.js";
2
+ import t from "./InkPage.js";
3
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createSlots as c, createTextVNode as l, defineComponent as u, mergeProps as d, onBeforeUnmount as f, onBeforeUpdate as p, onMounted as m, openBlock as h, renderList as g, renderSlot as _, shallowRef as v, toDisplayString as y, useSlots as b, useTemplateRef as x, watch as S, withCtx as C } from "vue";
4
+ import { mountViewer as w } from "@inkbar/core/dom";
5
+ //#region src/components/InkViewport.vue?vue&type=script&setup=true&lang.ts
6
+ var T = ["data-state"], E = {
7
+ key: 0,
8
+ class: "ink-status",
9
+ role: "status",
10
+ "aria-live": "polite"
11
+ }, D = {
12
+ key: 1,
13
+ class: "ink-status ink-error",
14
+ role: "alert"
15
+ }, O = ["title"], k = {
16
+ key: 2,
17
+ class: "ink-status ink-empty"
18
+ }, A = /*@__PURE__*/ u({
19
+ __name: "InkViewport",
20
+ props: {
21
+ mode: { default: "continuous" },
22
+ rotation: { default: 0 },
23
+ gap: { default: 16 },
24
+ buffer: { default: 2 }
25
+ },
26
+ setup(u) {
27
+ let A = u, j = b(), M = e(), N = x("scroll"), P = v([]), F = r(() => M.status.value.state), I = r(() => M.status.value.state === "error" ? M.status.value.error : null), L = v(null), R = 0, z = !1, B = [], V, H;
28
+ function U() {
29
+ for (let e of B) e();
30
+ B = [], L.value?.destroy(), L.value = null, M.viewport.value && (M.viewport.value = null), M.tools.value && (M.tools.value = null), P.value = [];
31
+ }
32
+ function W(e) {
33
+ let t = L.value;
34
+ t && (R += 1, e.customAnnotations !== void 0 && (z = e.customAnnotations), t.rebuild(e));
35
+ }
36
+ function G() {
37
+ U(), V = void 0, H = void 0;
38
+ let e = M.document.value, t = N.value;
39
+ if (!e || !t || M.status.value.state !== "ready") return;
40
+ let n = !0;
41
+ R += 1, z = !!j.annotation, L.value = w({
42
+ container: t,
43
+ document: e,
44
+ zoom: M.zoomModel.value ?? "fit-width",
45
+ ...M.pageModel.value === void 0 ? {} : { page: M.pageModel.value },
46
+ mode: A.mode,
47
+ rotation: A.rotation,
48
+ gap: A.gap,
49
+ buffer: A.buffer,
50
+ tool: M.tool.value,
51
+ customAnnotations: z,
52
+ onActivate: (e) => M.setActivated(e),
53
+ onBuild: (e, t) => {
54
+ M.viewport.value = e, M.tools.value = t, n && (n = !1, V = e.zoom.get(), H = 0);
55
+ for (let e of B) e();
56
+ let r = (e) => {
57
+ e !== V && (V = e, M.reportZoom(e));
58
+ }, i = (e) => {
59
+ e !== H && (H = e, M.reportPage(e));
60
+ };
61
+ B = [e.zoom.subscribe(r), e.currentPage.subscribe(i)], r(e.zoom.get()), i(e.currentPage.get());
62
+ },
63
+ onPageMount: (e, t, n) => {
64
+ P.value = [...P.value, {
65
+ build: R,
66
+ page: e,
67
+ host: n,
68
+ mount: t,
69
+ error: null,
70
+ custom: z
71
+ }];
72
+ },
73
+ onPageUnmount: (e) => {
74
+ P.value = P.value.filter((t) => t.page !== e);
75
+ },
76
+ onPageError: (e, t) => {
77
+ P.value = P.value.map((n) => n.page === e ? {
78
+ ...n,
79
+ error: t
80
+ } : n);
81
+ }
82
+ });
83
+ }
84
+ return m(() => {
85
+ S([() => M.document.value, () => M.status.value.state], G, { immediate: !0 });
86
+ }), S(() => M.zoomModel.value, (e) => {
87
+ let t = L.value?.viewport;
88
+ t && e !== void 0 && e !== t.zoom.get() && t.setZoom(e);
89
+ }), S(() => M.pageModel.value, (e) => {
90
+ let t = L.value?.viewport;
91
+ t && e !== void 0 && e !== H && e !== t.currentPage.get() && t.scrollToPage(e);
92
+ }), S(() => M.tool.value, (e) => {
93
+ let t = L.value?.tools;
94
+ t && t.active.get() !== e && t.set(e);
95
+ }), S(() => A.mode, (e) => L.value?.viewport.setMode(e)), S(() => A.rotation, (e) => L.value?.viewport.setRotation(e)), S([() => A.gap, () => A.buffer], ([e, t]) => W({
96
+ gap: e,
97
+ buffer: t,
98
+ customAnnotations: !!j.annotation
99
+ })), p(() => {
100
+ let e = !!j.annotation;
101
+ L.value && e !== z && W({ customAnnotations: e });
102
+ }), f(U), (e, r) => (h(), o("div", {
103
+ class: "ink-viewport-root",
104
+ "data-ink-viewport-root": "",
105
+ "data-state": F.value
106
+ }, [
107
+ F.value === "loading" ? (h(), o("div", E, [_(e.$slots, "loading", {}, () => [r[0] ||= l("Loading document…", -1)])])) : I.value ? (h(), o("div", D, [_(e.$slots, "error", { error: I.value }, () => [r[1] ||= s("p", { class: "ink-error-title" }, "This document could not be opened.", -1), s("p", null, [s("code", {
108
+ class: "ink-error-code",
109
+ title: I.value.message
110
+ }, y(I.value.code), 9, O)])])])) : F.value === "idle" ? (h(), o("div", k, [_(e.$slots, "empty")])) : a("", !0),
111
+ s("div", {
112
+ ref_key: "scroll",
113
+ ref: N,
114
+ class: "ink-scroll",
115
+ "data-ink-scroll": "",
116
+ tabindex: "0",
117
+ role: "document",
118
+ "aria-label": "Document"
119
+ }, null, 512),
120
+ (h(!0), o(n, null, g(P.value, (n) => (h(), i(t, {
121
+ key: `${n.build}:${n.page}`,
122
+ page: n.page,
123
+ host: n.host,
124
+ mount: n.mount,
125
+ error: n.error,
126
+ "custom-annotations": n.custom
127
+ }, c({ _: 2 }, [j.annotation ? {
128
+ name: "annotation",
129
+ fn: C((t) => [_(e.$slots, "annotation", d({ ref_for: !0 }, t))]),
130
+ key: "0"
131
+ } : void 0, j["page-error"] ? {
132
+ name: "page-error",
133
+ fn: C((t) => [_(e.$slots, "page-error", d({ ref_for: !0 }, t))]),
134
+ key: "1"
135
+ } : void 0]), 1032, [
136
+ "page",
137
+ "host",
138
+ "mount",
139
+ "error",
140
+ "custom-annotations"
141
+ ]))), 128))
142
+ ], 8, T));
143
+ }
144
+ });
145
+ //#endregion
146
+ export { A as default };
147
+
148
+ //# sourceMappingURL=InkViewport.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +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","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 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 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 stops = [vp.zoom.subscribe(reportZoom), vp.currentPage.subscribe(reportPage)]\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;EAoCA,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,E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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,GAAK8C,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,CAAA1D,EAAM,aAAA;IAAa,MAAA;IACjC,IAAAX,GAD6C,MAAS,CACtDV,EAA6CsE,EAAA,QAAA,cAA7C3D,EAA6C,EAAA,SAAA,GAAA,GAAbuE,CAAS,CAAA,CAAA,CAAA;;GAE3B,IAAA,KAAA,GAAA7D,EAAK,gBAAA;IAAiB,MAAA;IACpC,IAAAX,GADgD,MAAS,CACzDV,EAA6CsE,EAAA,QAAA,cAA7C3D,EAA6C,EAAA,SAAA,GAAA,GAAbuE,CAAS,CAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkZoomIn.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkZoomIn.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkZoomIn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomIn.js","names":["_sfc_main","InkZoomIn_vue_vue_type_script_setup_true_lang_default","InkZoomIn_default"],"sources":["../../src/components/InkZoomIn.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useZoom } from '../composables/useZoom'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { zoomIn } = useZoom()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Zoom in',\n title: 'Zoom in',\n onClick: () => zoomIn(),\n}\n</script>\n\n<template>\n <ToolbarButton :as-child=\"asChild\" class=\"ink-zoom-in\" data-ink-zoom-in v-bind=\"attrs\">\n <slot>+</slot>\n </ToolbarButton>\n</template>\n"],"mappings":""}
@@ -0,0 +1,19 @@
1
+ type __VLS_Props = {
2
+ asChild?: boolean;
3
+ };
4
+ declare var __VLS_7: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_7) => any;
7
+ };
8
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ asChild: boolean;
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
19
+ //# sourceMappingURL=InkZoomIn.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomIn.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkZoomIn.vue"],"names":[],"mappings":"AA2BA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA6CzC,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,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"}
@@ -0,0 +1,30 @@
1
+ import { useZoom as e } from "../composables/useZoom.js";
2
+ import { createBlock as t, createTextVNode as n, defineComponent as r, mergeProps as i, openBlock as a, renderSlot as o, unref as s, withCtx as c } from "vue";
3
+ import { ToolbarButton as l } from "reka-ui";
4
+ //#region src/components/InkZoomIn.vue?vue&type=script&setup=true&lang.ts
5
+ var u = /*@__PURE__*/ r({
6
+ __name: "InkZoomIn",
7
+ props: { asChild: {
8
+ type: Boolean,
9
+ default: !1
10
+ } },
11
+ setup(r) {
12
+ let { zoomIn: u } = e(), d = {
13
+ "aria-label": "Zoom in",
14
+ title: "Zoom in",
15
+ onClick: () => u()
16
+ };
17
+ return (e, u) => (a(), t(s(l), i({
18
+ "as-child": r.asChild,
19
+ class: "ink-zoom-in",
20
+ "data-ink-zoom-in": ""
21
+ }, d), {
22
+ default: c(() => [o(e.$slots, "default", {}, () => [u[0] ||= n("+", -1)])]),
23
+ _: 3
24
+ }, 16, ["as-child"]));
25
+ }
26
+ });
27
+ //#endregion
28
+ export { u as default };
29
+
30
+ //# sourceMappingURL=InkZoomIn.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomIn.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createTextVNode","InkZoomIn_vue_vue_type_script_setup_true_lang_default","useZoom","attrs","zoomIn","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","withCtx","renderSlot","_ctx","_cache","createTextVNode"],"sources":["../../src/components/InkZoomIn.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useZoom } from '../composables/useZoom'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { zoomIn } = useZoom()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Zoom in',\n title: 'Zoom in',\n onClick: () => zoomIn(),\n}\n</script>\n\n<template>\n <ToolbarButton :as-child=\"asChild\" class=\"ink-zoom-in\" data-ink-zoom-in v-bind=\"attrs\">\n <slot>+</slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;EAMA,IAAM,EAAE,cAAWQ,EAAQ,GAErBC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAO;EACxB;oBAIEV,EAAA,GAAAC,EAEgBC,EAAAY,CAAA,GAFhBX,EAEgB;GAFA,YAAUa,EAAA;GAAS,OAAM;GAAc,oBAAA;EAAyB,GAAAP,CAAK,GAAA;GACnF,SAAAL,QAAc,CAAdC,EAAcc,EAAA,QAAA,WAAA,CAAA,SAAA,CAAR,AAAAC,EAAA,OAAAd,EAAA,KAAC,EAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkZoomOut.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkZoomOut.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkZoomOut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomOut.js","names":["_sfc_main","InkZoomOut_vue_vue_type_script_setup_true_lang_default","InkZoomOut_default"],"sources":["../../src/components/InkZoomOut.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useZoom } from '../composables/useZoom'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { zoomOut } = useZoom()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Zoom out',\n title: 'Zoom out',\n onClick: () => zoomOut(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-zoom-out\"\n data-ink-zoom-out\n v-bind=\"attrs\"\n >\n <slot>−</slot>\n </ToolbarButton>\n</template>\n"],"mappings":""}
@@ -0,0 +1,19 @@
1
+ type __VLS_Props = {
2
+ asChild?: boolean;
3
+ };
4
+ declare var __VLS_7: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_7) => any;
7
+ };
8
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ asChild: boolean;
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
19
+ //# sourceMappingURL=InkZoomOut.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomOut.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkZoomOut.vue"],"names":[],"mappings":"AAgCA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA6CzC,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,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"}
@@ -0,0 +1,30 @@
1
+ import { useZoom as e } from "../composables/useZoom.js";
2
+ import { createBlock as t, createTextVNode as n, defineComponent as r, mergeProps as i, openBlock as a, renderSlot as o, unref as s, withCtx as c } from "vue";
3
+ import { ToolbarButton as l } from "reka-ui";
4
+ //#region src/components/InkZoomOut.vue?vue&type=script&setup=true&lang.ts
5
+ var u = /*@__PURE__*/ r({
6
+ __name: "InkZoomOut",
7
+ props: { asChild: {
8
+ type: Boolean,
9
+ default: !1
10
+ } },
11
+ setup(r) {
12
+ let { zoomOut: u } = e(), d = {
13
+ "aria-label": "Zoom out",
14
+ title: "Zoom out",
15
+ onClick: () => u()
16
+ };
17
+ return (e, u) => (a(), t(s(l), i({
18
+ "as-child": r.asChild,
19
+ class: "ink-zoom-out",
20
+ "data-ink-zoom-out": ""
21
+ }, d), {
22
+ default: c(() => [o(e.$slots, "default", {}, () => [u[0] ||= n("−", -1)])]),
23
+ _: 3
24
+ }, 16, ["as-child"]));
25
+ }
26
+ });
27
+ //#endregion
28
+ export { u as default };
29
+
30
+ //# sourceMappingURL=InkZoomOut.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomOut.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createTextVNode","InkZoomOut_vue_vue_type_script_setup_true_lang_default","useZoom","attrs","zoomOut","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","withCtx","renderSlot","_ctx","_cache","createTextVNode"],"sources":["../../src/components/InkZoomOut.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useZoom } from '../composables/useZoom'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { zoomOut } = useZoom()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Zoom out',\n title: 'Zoom out',\n onClick: () => zoomOut(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-zoom-out\"\n data-ink-zoom-out\n v-bind=\"attrs\"\n >\n <slot>−</slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;EAMA,IAAM,EAAE,eAAYQ,EAAQ,GAEtBC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAQ;EACzB;oBAIEV,EAAA,GAAAC,EAOgBC,EAAAY,CAAA,GAPhBX,EAOgB;GANb,YAAUa,EAAA;GACX,OAAM;GACN,qBAAA;EACQ,GAAAP,CAAK,GAAA;GAEb,SAAAL,QAAc,CAAdC,EAAcc,EAAA,QAAA,WAAA,CAAA,SAAA,CAAR,AAAAC,EAAA,OAAAd,EAAA,KAAC,EAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkZoomSelect.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkZoomSelect.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkZoomSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomSelect.js","names":["_sfc_main","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","InkZoomSelect_default"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nconst CUSTOM = 'custom:'\n\nconst { zoom, scale, setZoom } = useZoom()\n\nconst level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)\n/** A numeric zoom that is not one of the levels (zoom in and out multiply). */\nconst custom = computed(() =>\n typeof zoom.value === 'number' && level(zoom.value) === undefined ? zoom.value : null\n)\nconst value = computed(() => {\n const z = zoom.value\n if (typeof z !== 'number') return z\n return custom.value === null ? String(level(z)) : `${CUSTOM}${z}`\n})\n\nfunction onChange(e: Event): void {\n const v = (e.target as HTMLSelectElement).value\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n</script>\n\n<template>\n <select\n class=\"ink-zoom-select\"\n data-ink-zoom-select\n aria-label=\"Zoom\"\n :value=\"value\"\n @change=\"onChange\"\n >\n <option value=\"fit-width\">Fit width</option>\n <option value=\"fit-page\">Fit page</option>\n <option v-for=\"l in ZOOM_LEVELS\" :key=\"l\" :value=\"String(l)\">\n {{ Math.round(l * 100) }}%\n </option>\n <option v-if=\"custom !== null\" :value=\"`${CUSTOM}${custom}`\">\n {{ Math.round(scale * 100) }}%\n </option>\n </select>\n</template>\n"],"mappings":""}
@@ -0,0 +1,4 @@
1
+ declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
4
+ //# sourceMappingURL=InkZoomSelect.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomSelect.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkZoomSelect.vue"],"names":[],"mappings":"AAwHA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,39 @@
1
+ import { useZoom as e } from "../composables/useZoom.js";
2
+ import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, openBlock as s, renderList as c, toDisplayString as l, unref as u } from "vue";
3
+ import { ZOOM_LEVELS as d } from "@inkbar/core/dom";
4
+ //#region src/components/InkZoomSelect.vue?vue&type=script&setup=true&lang.ts
5
+ var f = ["value"], p = ["value"], m = ["value"], h = "custom:", g = /*@__PURE__*/ o({
6
+ __name: "InkZoomSelect",
7
+ setup(o) {
8
+ let { zoom: g, scale: _, setZoom: v } = e(), y = (e) => d.find((t) => Math.abs(t - e) < .001), b = n(() => typeof g.value == "number" && y(g.value) === void 0 ? g.value : null), x = n(() => {
9
+ let e = g.value;
10
+ return typeof e == "number" ? b.value === null ? String(y(e)) : `${h}${e}` : e;
11
+ });
12
+ function S(e) {
13
+ let t = e.target.value, n = t === "fit-width" || t === "fit-page" ? t : Number(t.replace(h, ""));
14
+ v(n);
15
+ }
16
+ return (e, n) => (s(), i("select", {
17
+ class: "ink-zoom-select",
18
+ "data-ink-zoom-select": "",
19
+ "aria-label": "Zoom",
20
+ value: x.value,
21
+ onChange: S
22
+ }, [
23
+ n[0] ||= a("option", { value: "fit-width" }, "Fit width", -1),
24
+ n[1] ||= a("option", { value: "fit-page" }, "Fit page", -1),
25
+ (s(!0), i(t, null, c(u(d), (e) => (s(), i("option", {
26
+ key: e,
27
+ value: String(e)
28
+ }, l(Math.round(e * 100)) + "% ", 9, p))), 128)),
29
+ b.value === null ? r("", !0) : (s(), i("option", {
30
+ key: 0,
31
+ value: `${h}${b.value}`
32
+ }, l(Math.round(u(_) * 100)) + "% ", 9, m))
33
+ ], 40, f));
34
+ }
35
+ });
36
+ //#endregion
37
+ export { g as default };
38
+
39
+ //# sourceMappingURL=InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkZoomSelect.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_Fragment","_renderList","_unref","_toDisplayString","_createCommentVNode","_hoisted_1","_hoisted_2","_hoisted_3","CUSTOM","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","useZoom","level","ZOOM_LEVELS","l","z","custom","computed","zoom","value","onChange","v","next","openBlock","createElementBlock","_cache","createElementVNode","Fragment","renderList","unref","toDisplayString","createCommentVNode","scale"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nconst CUSTOM = 'custom:'\n\nconst { zoom, scale, setZoom } = useZoom()\n\nconst level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)\n/** A numeric zoom that is not one of the levels (zoom in and out multiply). */\nconst custom = computed(() =>\n typeof zoom.value === 'number' && level(zoom.value) === undefined ? zoom.value : null\n)\nconst value = computed(() => {\n const z = zoom.value\n if (typeof z !== 'number') return z\n return custom.value === null ? String(level(z)) : `${CUSTOM}${z}`\n})\n\nfunction onChange(e: Event): void {\n const v = (e.target as HTMLSelectElement).value\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n</script>\n\n<template>\n <select\n class=\"ink-zoom-select\"\n data-ink-zoom-select\n aria-label=\"Zoom\"\n :value=\"value\"\n @change=\"onChange\"\n >\n <option value=\"fit-width\">Fit width</option>\n <option value=\"fit-page\">Fit page</option>\n <option v-for=\"l in ZOOM_LEVELS\" :key=\"l\" :value=\"String(l)\">\n {{ Math.round(l * 100) }}%\n </option>\n <option v-if=\"custom !== null\" :value=\"`${CUSTOM}${custom}`\">\n {{ Math.round(scale * 100) }}%\n </option>\n </select>\n</template>\n"],"mappings":";;;;iDAQMW,IAAS;;;EAEf,IAAM,EAAE,SAAM,UAAO,eAAYE,EAAQ,GAEnCC,KAAS,MAAcC,EAAY,MAAM,MAAM,KAAK,IAAIC,IAAIC,CAAC,IAAI,IAAK,GAEtEC,IAASC,QACb,OAAOC,EAAK,SAAU,YAAYN,EAAMM,EAAK,KAAK,MAAM,KAAA,IAAYA,EAAK,QAAQ,IACnF,GACMC,IAAQF,QAAe;GAC3B,IAAMF,IAAIG,EAAK;GAEf,OADI,OAAOH,KAAM,WACVC,EAAO,UAAU,OAAO,OAAOJ,EAAMG,CAAC,CAAC,IAAI,GAAGN,IAASM,MAD5BA;EAEpC,CAAC;EAED,SAASK,EAAS,GAAgB;GAChC,IAAMC,IAAK,EAAE,OAA6B,OACpCC,IACJD,MAAM,eAAeA,MAAM,aAAaA,IAAI,OAAOA,EAAE,QAAQZ,GAAQ,EAAE,CAAC;GAC1E,EAAQa,CAAI;EACd;oBAIExB,EAAA,GAAAC,EAeS,UAAA;GAdP,OAAM;GACN,wBAAA;GACA,cAAW;GACV,OAAOoB,EAAA;GACC;;GAET,AAAAM,EAAA,OAAAzB,EAA4C,UAAA,EAApC,OAAM,YAAW,GAAC,aAAS,EAAA;GACnC,AAAAyB,EAAA,OAAAzB,EAA0C,UAAA,EAAlC,OAAM,WAAU,GAAC,YAAQ,EAAA;IACjCF,EAAA,EAAA,GAAAC,EAESE,GAAA,MAAAC,EAFWC,EAAAU,CAAA,IAAL,OAAff,EAAA,GAAAC,EAES,UAAA;IAFyB,KAAKe;IAAI,OAAO,OAAOA,CAAC;GACrD,GAAAV,EAAA,KAAK,MAAMU,IAAC,GAAA,CAAA,IAAU,MAC3B,GAAAP,CAAA;GACcS,EAAA,UAAM,OAEpBe,EAAA,IAAA,EAAA,KAFAjC,EAAA,GAAAC,EAES,UAAA;;IAFuB,OAAK,GAAKU,IAASO,EAAA;GAC9C,GAAAZ,EAAA,KAAK,MAAMD,EAAA6B,CAAA,IAAK,GAAA,CAAA,IAAU,MAC/B,GAAAxB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { InkContext } from '../context';
2
+ import { Ref, ShallowRef } from 'vue';
3
+ /** The overlay element core draws for an annotation, for anchoring a popover to it. */
4
+ export declare function useAnnotationElement(ctx: InkContext, id: Readonly<Ref<string | null>>): Readonly<ShallowRef<HTMLElement | null>>;
5
+ //# sourceMappingURL=annotation-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-element.d.ts","sourceRoot":"","sources":["../../src/components/annotation-element.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAE1C,uFAAuF;AACvF,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,GAC/B,QAAQ,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAoB1C"}
@@ -0,0 +1,18 @@
1
+ import { onBeforeUnmount as e, shallowRef as t, watch as n } from "vue";
2
+ import { observeAnnotationElement as r } from "@inkbar/core/dom";
3
+ //#region src/components/annotation-element.ts
4
+ function i(i, a) {
5
+ let o = t(null), s;
6
+ return n([a, () => i.rootEl.value], ([e, t]) => {
7
+ s?.(), s = void 0, !e || !t ? o.value = null : s = r(t, e, (e) => {
8
+ o.value = e;
9
+ });
10
+ }, {
11
+ immediate: !0,
12
+ flush: "post"
13
+ }), e(() => s?.()), o;
14
+ }
15
+ //#endregion
16
+ export { i as useAnnotationElement };
17
+
18
+ //# sourceMappingURL=annotation-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-element.js","names":["useAnnotationElement","element","shallowRef","stop","watch","id","ctx","want","root","observeAnnotationElement","el","onBeforeUnmount"],"sources":["../../src/components/annotation-element.ts"],"sourcesContent":["import { observeAnnotationElement } from '@inkbar/core/dom'\nimport { onBeforeUnmount, shallowRef, watch } from 'vue'\n\nimport type { InkContext } from '../context'\nimport type { Ref, ShallowRef } from 'vue'\n\n/** The overlay element core draws for an annotation, for anchoring a popover to it. */\nexport function useAnnotationElement(\n ctx: InkContext,\n id: Readonly<Ref<string | null>>\n): Readonly<ShallowRef<HTMLElement | null>> {\n const element = shallowRef<HTMLElement | null>(null)\n let stop: (() => void) | undefined\n watch(\n [id, () => ctx.rootEl.value],\n ([want, root]) => {\n stop?.()\n stop = undefined\n if (!want || !root) {\n element.value = null\n return\n }\n stop = observeAnnotationElement(root, want, (el) => {\n element.value = el\n })\n },\n { immediate: true, flush: 'post' }\n )\n onBeforeUnmount(() => stop?.())\n return element\n}\n"],"mappings":";;;AAOA,SAAgBA,EACd,GACA,GAC0C;CAC1C,IAAMC,IAAUC,EAA+B,IAAI,GAC/CC;CAiBJ,OAhBAC,EACE,CAACC,SAAUC,EAAI,OAAO,KAAK,IAC1B,CAACC,GAAMC,OAAU;EAGhB,AAFAL,IAAO,GACP,IAAO,KAAA,GACH,CAACI,KAAQ,CAACC,IACZ,EAAQ,QAAQ,OAGlB,IAAOC,EAAyBD,GAAMD,IAAO,MAAO;GAClD,EAAQ,QAAQG;EAClB,CAAC;CACH,GACA;EAAE,WAAW;EAAM,OAAO;CAAO,CACnC,GACAC,QAAsBR,IAAO,CAAC,GACvBF;AACT"}
@@ -0,0 +1,2 @@
1
+ export type { AnnotationSlotProps, AnnotationState } from '@inkbar/core/dom';
2
+ //# sourceMappingURL=annotation-slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-slot.d.ts","sourceRoot":"","sources":["../../src/components/annotation-slot.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { FocusReturn } from '@inkbar/core/dom';
2
+ import { InkContext } from '../context';
3
+ export type { FocusReturn };
4
+ /** Reka's `interact-outside` handler: a press that will activate an annotation keeps the popover open. */
5
+ export declare function keepOpenOnAnnotation(event: CustomEvent<{
6
+ originalEvent: Event;
7
+ }>): void;
8
+ export declare function useFocusReturn(ctx: InkContext): FocusReturn;
9
+ //# sourceMappingURL=popover-focus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover-focus.d.ts","sourceRoot":"","sources":["../../src/components/popover-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,YAAY,EAAE,WAAW,EAAE,CAAA;AAE3B,0GAA0G;AAC1G,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC;IAAE,aAAa,EAAE,KAAK,CAAA;CAAE,CAAC,GAAG,IAAI,CAGvF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,WAAW,CAK3D"}
@@ -0,0 +1,15 @@
1
+ import { createFocusReturn as e, shouldKeepOpenOnAnnotation as t } from "@inkbar/core/dom";
2
+ //#region src/components/popover-focus.ts
3
+ function n(e) {
4
+ t(e.detail.originalEvent.target) && e.preventDefault();
5
+ }
6
+ function r(t) {
7
+ return e({
8
+ root: () => t.rootEl.value,
9
+ activated: () => t.activated.value
10
+ });
11
+ }
12
+ //#endregion
13
+ export { n as keepOpenOnAnnotation, r as useFocusReturn };
14
+
15
+ //# sourceMappingURL=popover-focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover-focus.js","names":["keepOpenOnAnnotation","shouldKeepOpenOnAnnotation","event","useFocusReturn","createFocusReturn","ctx"],"sources":["../../src/components/popover-focus.ts"],"sourcesContent":["import {\n createFocusReturn,\n shouldKeepOpenOnAnnotation,\n type FocusReturn,\n} from '@inkbar/core/dom'\n\nimport type { InkContext } from '../context'\n\nexport type { FocusReturn }\n\n/** Reka's `interact-outside` handler: a press that will activate an annotation keeps the popover open. */\nexport function keepOpenOnAnnotation(event: CustomEvent<{ originalEvent: Event }>): void {\n if (shouldKeepOpenOnAnnotation(event.detail.originalEvent.target))\n event.preventDefault()\n}\n\nexport function useFocusReturn(ctx: InkContext): FocusReturn {\n return createFocusReturn({\n root: () => ctx.rootEl.value,\n activated: () => ctx.activated.value,\n })\n}\n"],"mappings":";;AAWA,SAAgBA,EAAqB,GAAoD;CACvF,AAAIC,EAA2BC,EAAM,OAAO,cAAc,MAAM,KAC9DA,EAAM,eAAe;AACzB;AAEA,SAAgBC,EAAe,GAA8B;CAC3D,OAAOC,EAAkB;EACvB,YAAYC,EAAI,OAAO;EACvB,iBAAiBA,EAAI,UAAU;CACjC,CAAC;AACH"}