@inkbar/vue 0.0.0-stage → 0.2.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.
Files changed (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -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/InkIcon.js +7 -0
  10. package/dist/components/InkIcon.js.map +1 -0
  11. package/dist/components/InkIcon.vue.d.ts +11 -0
  12. package/dist/components/InkIcon.vue.d.ts.map +1 -0
  13. package/dist/components/InkIcon.vue_vue_type_script_setup_true_lang.js +22 -0
  14. package/dist/components/InkIcon.vue_vue_type_script_setup_true_lang.js.map +1 -0
  15. package/dist/components/InkNextPage.js +7 -0
  16. package/dist/components/InkNextPage.js.map +1 -0
  17. package/dist/components/InkNextPage.vue.d.ts +19 -0
  18. package/dist/components/InkNextPage.vue.d.ts.map +1 -0
  19. package/dist/components/InkNextPage.vue_vue_type_script_setup_true_lang.js +33 -0
  20. package/dist/components/InkNextPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  21. package/dist/components/InkNotePopover.js +7 -0
  22. package/dist/components/InkNotePopover.js.map +1 -0
  23. package/dist/components/InkNotePopover.vue.d.ts +15 -0
  24. package/dist/components/InkNotePopover.vue.d.ts.map +1 -0
  25. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js +132 -0
  26. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
  27. package/dist/components/InkPage.js +7 -0
  28. package/dist/components/InkPage.js.map +1 -0
  29. package/dist/components/InkPage.vue.d.ts +32 -0
  30. package/dist/components/InkPage.vue.d.ts.map +1 -0
  31. package/dist/components/InkPage.vue_vue_type_script_setup_true_lang.js +68 -0
  32. package/dist/components/InkPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  33. package/dist/components/InkPageCount.js +7 -0
  34. package/dist/components/InkPageCount.js.map +1 -0
  35. package/dist/components/InkPageCount.vue.d.ts +4 -0
  36. package/dist/components/InkPageCount.vue.d.ts.map +1 -0
  37. package/dist/components/InkPageCount.vue_vue_type_script_setup_true_lang.js +18 -0
  38. package/dist/components/InkPageCount.vue_vue_type_script_setup_true_lang.js.map +1 -0
  39. package/dist/components/InkPageInput.js +7 -0
  40. package/dist/components/InkPageInput.js.map +1 -0
  41. package/dist/components/InkPageInput.vue.d.ts +4 -0
  42. package/dist/components/InkPageInput.vue.d.ts.map +1 -0
  43. package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js +30 -0
  44. package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  45. package/dist/components/InkPrevPage.js +7 -0
  46. package/dist/components/InkPrevPage.js.map +1 -0
  47. package/dist/components/InkPrevPage.vue.d.ts +19 -0
  48. package/dist/components/InkPrevPage.vue.d.ts.map +1 -0
  49. package/dist/components/InkPrevPage.vue_vue_type_script_setup_true_lang.js +33 -0
  50. package/dist/components/InkPrevPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  51. package/dist/components/InkRedo.js +7 -0
  52. package/dist/components/InkRedo.js.map +1 -0
  53. package/dist/components/InkRedo.vue.d.ts +19 -0
  54. package/dist/components/InkRedo.vue.d.ts.map +1 -0
  55. package/dist/components/InkRedo.vue_vue_type_script_setup_true_lang.js +33 -0
  56. package/dist/components/InkRedo.vue_vue_type_script_setup_true_lang.js.map +1 -0
  57. package/dist/components/InkRoot.js +7 -0
  58. package/dist/components/InkRoot.js.map +1 -0
  59. package/dist/components/InkRoot.vue.d.ts +784 -0
  60. package/dist/components/InkRoot.vue.d.ts.map +1 -0
  61. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +162 -0
  62. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -0
  63. package/dist/components/InkSuggestionCard.js +7 -0
  64. package/dist/components/InkSuggestionCard.js.map +1 -0
  65. package/dist/components/InkSuggestionCard.vue.d.ts +16 -0
  66. package/dist/components/InkSuggestionCard.vue.d.ts.map +1 -0
  67. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js +85 -0
  68. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  69. package/dist/components/InkToolButton.js +7 -0
  70. package/dist/components/InkToolButton.js.map +1 -0
  71. package/dist/components/InkToolButton.vue.d.ts +26 -0
  72. package/dist/components/InkToolButton.vue.d.ts.map +1 -0
  73. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +53 -0
  74. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  75. package/dist/components/InkToolbar.js +7 -0
  76. package/dist/components/InkToolbar.js.map +1 -0
  77. package/dist/components/InkToolbar.vue.d.ts +21 -0
  78. package/dist/components/InkToolbar.vue.d.ts.map +1 -0
  79. package/dist/components/InkToolbar.vue_vue_type_script_setup_true_lang.js +29 -0
  80. package/dist/components/InkToolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  81. package/dist/components/InkToolbarSeparator.js +7 -0
  82. package/dist/components/InkToolbarSeparator.js.map +1 -0
  83. package/dist/components/InkToolbarSeparator.vue.d.ts +4 -0
  84. package/dist/components/InkToolbarSeparator.vue.d.ts.map +1 -0
  85. package/dist/components/InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js +17 -0
  86. package/dist/components/InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -0
  87. package/dist/components/InkUndo.js +7 -0
  88. package/dist/components/InkUndo.js.map +1 -0
  89. package/dist/components/InkUndo.vue.d.ts +19 -0
  90. package/dist/components/InkUndo.vue.d.ts.map +1 -0
  91. package/dist/components/InkUndo.vue_vue_type_script_setup_true_lang.js +33 -0
  92. package/dist/components/InkUndo.vue_vue_type_script_setup_true_lang.js.map +1 -0
  93. package/dist/components/InkViewport.js +7 -0
  94. package/dist/components/InkViewport.js.map +1 -0
  95. package/dist/components/InkViewport.vue.d.ts +39 -0
  96. package/dist/components/InkViewport.vue.d.ts.map +1 -0
  97. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +148 -0
  98. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -0
  99. package/dist/components/InkZoomIn.js +7 -0
  100. package/dist/components/InkZoomIn.js.map +1 -0
  101. package/dist/components/InkZoomIn.vue.d.ts +19 -0
  102. package/dist/components/InkZoomIn.vue.d.ts.map +1 -0
  103. package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js +32 -0
  104. package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js.map +1 -0
  105. package/dist/components/InkZoomOut.js +7 -0
  106. package/dist/components/InkZoomOut.js.map +1 -0
  107. package/dist/components/InkZoomOut.vue.d.ts +19 -0
  108. package/dist/components/InkZoomOut.vue.d.ts.map +1 -0
  109. package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js +32 -0
  110. package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js.map +1 -0
  111. package/dist/components/InkZoomSelect.js +7 -0
  112. package/dist/components/InkZoomSelect.js.map +1 -0
  113. package/dist/components/InkZoomSelect.vue.d.ts +4 -0
  114. package/dist/components/InkZoomSelect.vue.d.ts.map +1 -0
  115. package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js +115 -0
  116. package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map +1 -0
  117. package/dist/components/annotation-element.d.ts +5 -0
  118. package/dist/components/annotation-element.d.ts.map +1 -0
  119. package/dist/components/annotation-element.js +18 -0
  120. package/dist/components/annotation-element.js.map +1 -0
  121. package/dist/components/annotation-slot.d.ts +2 -0
  122. package/dist/components/annotation-slot.d.ts.map +1 -0
  123. package/dist/components/popover-focus.d.ts +9 -0
  124. package/dist/components/popover-focus.d.ts.map +1 -0
  125. package/dist/components/popover-focus.js +15 -0
  126. package/dist/components/popover-focus.js.map +1 -0
  127. package/dist/composables/useAnnotations.d.ts +1921 -0
  128. package/dist/composables/useAnnotations.d.ts.map +1 -0
  129. package/dist/composables/useAnnotations.js +27 -0
  130. package/dist/composables/useAnnotations.js.map +1 -0
  131. package/dist/composables/useDocument.d.ts +12 -0
  132. package/dist/composables/useDocument.d.ts.map +1 -0
  133. package/dist/composables/useDocument.js +20 -0
  134. package/dist/composables/useDocument.js.map +1 -0
  135. package/dist/composables/useEmbedded.d.ts +6 -0
  136. package/dist/composables/useEmbedded.d.ts.map +1 -0
  137. package/dist/composables/useEmbedded.js +15 -0
  138. package/dist/composables/useEmbedded.js.map +1 -0
  139. package/dist/composables/useHistory.d.ts +7 -0
  140. package/dist/composables/useHistory.d.ts.map +1 -0
  141. package/dist/composables/useHistory.js +9 -0
  142. package/dist/composables/useHistory.js.map +1 -0
  143. package/dist/composables/usePage.d.ts +10 -0
  144. package/dist/composables/usePage.d.ts.map +1 -0
  145. package/dist/composables/usePage.js +22 -0
  146. package/dist/composables/usePage.js.map +1 -0
  147. package/dist/composables/useSelection.d.ts +6 -0
  148. package/dist/composables/useSelection.d.ts.map +1 -0
  149. package/dist/composables/useSelection.js +14 -0
  150. package/dist/composables/useSelection.js.map +1 -0
  151. package/dist/composables/useTool.d.ts +6 -0
  152. package/dist/composables/useTool.d.ts.map +1 -0
  153. package/dist/composables/useTool.js +13 -0
  154. package/dist/composables/useTool.js.map +1 -0
  155. package/dist/composables/useZoom.d.ts +9 -0
  156. package/dist/composables/useZoom.d.ts.map +1 -0
  157. package/dist/composables/useZoom.js +17 -0
  158. package/dist/composables/useZoom.js.map +1 -0
  159. package/dist/context.d.ts +50 -0
  160. package/dist/context.d.ts.map +1 -0
  161. package/dist/context.js +13 -0
  162. package/dist/context.js.map +1 -0
  163. package/dist/index.d.ts +34 -0
  164. package/dist/index.d.ts.map +1 -0
  165. package/dist/index.js +30 -0
  166. package/dist/ref-history.d.ts +18 -0
  167. package/dist/ref-history.d.ts.map +1 -0
  168. package/dist/ref-history.js +25 -0
  169. package/dist/ref-history.js.map +1 -0
  170. package/dist/use-readable.d.ts +5 -0
  171. package/dist/use-readable.d.ts.map +1 -0
  172. package/dist/use-readable.js +16 -0
  173. package/dist/use-readable.js.map +1 -0
  174. package/package.json +52 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkRoot.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkRoot.vue"],"names":[],"mappings":"AA2RA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAA;AAcrD,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAI/E,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,SAAS,EACV,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAkB,MAAM,EAAY,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGnF,KAAK,WAAW,GAAG;IACf,GAAG,EAAE,cAAc,GAAG,IAAI,CAAA;IAC1B,MAAM,EAAE,SAAS,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,wFAAwF;IACxF,QAAQ,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAA;IACzC;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC5B,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;A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CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -0,0 +1,162 @@
1
+ import { provideInkContext as e } from "../context.js";
2
+ import { useReadable as t } from "../use-readable.js";
3
+ import { createRefHistory as n } from "../ref-history.js";
4
+ import { computed as r, createBlock as i, defineComponent as a, onBeforeUnmount as o, onMounted as s, onUpdated as c, openBlock as l, ref as u, renderSlot as d, shallowRef as f, unref as p, useTemplateRef as m, watch as h, withCtx as g } from "vue";
5
+ import { InkError as _, openDocument as v } from "@inkbar/core";
6
+ import { cssVariableDefaults as y } from "@inkbar/core/dom";
7
+ import { Primitive as b } from "reka-ui";
8
+ //#region src/components/InkRoot.vue?vue&type=script&setup=true&lang.ts
9
+ var x = /*@__PURE__*/ a({
10
+ __name: "InkRoot",
11
+ props: {
12
+ src: {},
13
+ assets: {},
14
+ password: { default: void 0 },
15
+ defaults: { default: void 0 },
16
+ annotations: { default: void 0 },
17
+ tool: { default: void 0 },
18
+ page: { default: void 0 },
19
+ zoom: { default: void 0 },
20
+ history: {
21
+ type: Boolean,
22
+ default: void 0
23
+ },
24
+ asChild: {
25
+ type: Boolean,
26
+ default: !1
27
+ }
28
+ },
29
+ emits: [
30
+ "update:annotations",
31
+ "change",
32
+ "update:tool",
33
+ "update:page",
34
+ "update:zoom",
35
+ "ready",
36
+ "error",
37
+ "activate"
38
+ ],
39
+ setup(a, { expose: x, emit: S }) {
40
+ let C = a, w = S, T = m("primitive"), E = f(null);
41
+ function D() {
42
+ let e = T.value?.$el;
43
+ E.value = e instanceof HTMLElement ? e : null;
44
+ }
45
+ let O = f(null), k = f(null), A = t(() => O.value?.status ?? null, { state: "idle" }), j = r(() => k.value ?? A.value), M = t(() => O.value?.annotations.list ?? null, []), N = t(() => O.value?.annotations.selection ?? null, []), P = f(null), F = f(null), I = u(C.tool ?? "view"), L = u(null), R = r(() => C.annotations !== void 0);
46
+ function z(e) {
47
+ return e === null ? null : typeof e == "string" ? e : "key" in e ? e.key : e;
48
+ }
49
+ let B = 0;
50
+ function V() {
51
+ O.value?.destroy(), O.value = null;
52
+ }
53
+ async function H() {
54
+ let e = ++B, t = C.src;
55
+ if (V(), U.clear(), t === null) {
56
+ k.value = null;
57
+ return;
58
+ }
59
+ k.value = { state: "loading" }, D();
60
+ let n;
61
+ try {
62
+ n = await v(t, {
63
+ assets: C.assets,
64
+ password: C.password,
65
+ defaults: C.defaults ?? (E.value ? y(E.value) : void 0),
66
+ history: R.value ? !1 : C.history ?? !0,
67
+ annotations: R.value ? {
68
+ mode: "controlled",
69
+ initial: C.annotations ?? [],
70
+ onChange: (e, t) => {
71
+ w("update:annotations", e), w("change", t);
72
+ }
73
+ } : { mode: "uncontrolled" }
74
+ });
75
+ } catch (t) {
76
+ if (e !== B) return;
77
+ let n = t instanceof _ ? t : new _("InvalidPdf", t instanceof Error ? t.message : String(t), {}, t);
78
+ k.value = {
79
+ state: "error",
80
+ error: n
81
+ }, w("error", n);
82
+ return;
83
+ }
84
+ if (e !== B) {
85
+ n.destroy();
86
+ return;
87
+ }
88
+ n.annotations.mode === "controlled" && C.annotations !== void 0 && n.annotations.setControlledValue(C.annotations), O.value = n, k.value = null;
89
+ let r = n.status.get();
90
+ r.state === "ready" ? w("ready", n) : r.state === "error" && w("error", r.error);
91
+ }
92
+ let U = n({
93
+ source: () => C.annotations,
94
+ apply: (e) => O.value?.annotations.replaceAll(e, "history"),
95
+ enabled: r(() => R.value && C.history === !0)
96
+ }), W = t(() => O.value?.history.canUndo ?? null, !1), G = t(() => O.value?.history.canRedo ?? null, !1), K = {
97
+ canUndo: r(() => R.value ? U.canUndo.value : W.value),
98
+ canRedo: r(() => R.value ? U.canRedo.value : G.value),
99
+ undo: () => R.value ? U.undo() : O.value?.history.undo(),
100
+ redo: () => R.value ? U.redo() : O.value?.history.redo(),
101
+ clear: () => R.value ? U.clear() : O.value?.history.clear(),
102
+ batch: (e) => {
103
+ R.value ? U.batch(e) : O.value ? O.value.history.batch(e) : e();
104
+ }
105
+ };
106
+ s(() => {
107
+ D(), H();
108
+ }), c(D), h([() => z(C.src), () => C.password], () => void H()), h(() => C.annotations, (e) => {
109
+ e && O.value?.annotations.mode === "controlled" && O.value.annotations.setControlledValue(e);
110
+ }), h(() => C.tool, (e) => {
111
+ e && (I.value = e);
112
+ });
113
+ function q(e) {
114
+ I.value = e, w("update:tool", e);
115
+ }
116
+ return o(() => {
117
+ B++, V();
118
+ }), e({
119
+ assets: r(() => C.assets),
120
+ document: O,
121
+ status: j,
122
+ annotations: M,
123
+ selection: N,
124
+ viewport: P,
125
+ tools: F,
126
+ tool: I,
127
+ setTool: q,
128
+ zoomModel: r(() => C.zoom),
129
+ pageModel: r(() => C.page),
130
+ reportZoom: (e) => w("update:zoom", e),
131
+ reportPage: (e) => w("update:page", e),
132
+ activated: L,
133
+ setActivated(e) {
134
+ L.value = e, e && w("activate", e);
135
+ },
136
+ history: K,
137
+ rootEl: E
138
+ }), x({
139
+ document: O,
140
+ status: j,
141
+ rootEl: E,
142
+ history: K
143
+ }), (e, t) => (l(), i(p(b), {
144
+ ref_key: "primitive",
145
+ ref: T,
146
+ "as-child": C.asChild,
147
+ as: "div",
148
+ "data-ink-root": "",
149
+ "data-state": j.value.state
150
+ }, {
151
+ default: g(() => [d(e.$slots, "default", {
152
+ status: j.value,
153
+ document: O.value
154
+ })]),
155
+ _: 3
156
+ }, 8, ["as-child", "data-state"]));
157
+ }
158
+ });
159
+ //#endregion
160
+ export { x as default };
161
+
162
+ //# sourceMappingURL=InkRoot.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkRoot.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_renderSlot","InkRoot_vue_vue_type_script_setup_true_lang_default","__expose","__emit","props","__props","emit","primitive","useTemplateRef","rootEl","shallowRef","syncRootEl","el","document","override","documentStatus","useReadable","status","computed","annotationList","selection","viewport","tools","internalTool","ref","activated","controlled","identity","src","generation","release","open","gen","refHistory","doc","openDocument","cssVariableDefaults","next","change","cause","error","InkError","s","createRefHistory","list","coreCanUndo","coreCanRedo","inkHistory","fn","onMounted","onUpdated","watch","t","setTool","id","onBeforeUnmount","provideInkContext","z","p","openBlock","createBlock","unref","Primitive","withCtx","renderSlot","_ctx"],"sources":["../../src/components/InkRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { InkError, openDocument } from '@inkbar/core'\nimport { cssVariableDefaults } from '@inkbar/core/dom'\nimport { Primitive } from 'reka-ui'\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n onUpdated,\n ref,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { provideInkContext, type InkHistory, type InkStatus } from '../context'\nimport { createRefHistory } from '../ref-history'\nimport { useReadable } from '../use-readable'\n\nimport type {\n Annotation,\n AnnotationChange,\n AnnotationDefaults,\n DocumentSource,\n InkDocument,\n PdfAssets,\n} from '@inkbar/core'\nimport type { ToolController, ToolId, Viewport, ZoomValue } from '@inkbar/core/dom'\n\nconst props = withDefaults(\n defineProps<{\n src: DocumentSource | null\n assets: PdfAssets\n password?: string | undefined\n /** Colour defaults. Without it, the theme's CSS variables on the root element apply. */\n defaults?: AnnotationDefaults | undefined\n /**\n * Pass (with v-model) to put annotations under the host's control. The mode is fixed when a\n * document opens: passing or dropping this prop later takes effect on the next open.\n */\n annotations?: Annotation[] | undefined\n tool?: ToolId | undefined\n page?: number | undefined\n zoom?: ZoomValue | undefined\n /** Undo history. Defaults to on for uncontrolled, off for controlled. */\n history?: boolean | undefined\n asChild?: boolean\n }>(),\n {\n password: undefined,\n defaults: undefined,\n annotations: undefined,\n tool: undefined,\n page: undefined,\n zoom: undefined,\n history: undefined,\n asChild: false,\n }\n)\n\nconst emit = defineEmits<{\n 'update:annotations': [next: Annotation[]]\n change: [change: AnnotationChange]\n 'update:tool': [tool: ToolId]\n 'update:page': [page: number]\n 'update:zoom': [zoom: ZoomValue]\n ready: [doc: InkDocument]\n error: [error: InkError]\n activate: [id: string]\n}>()\n\ntype TestHookElement = HTMLElement & { __inkDocument?: InkDocument | undefined }\n\n// A template ref on Primitive is a component instance; the context needs its element.\nconst primitive = useTemplateRef<{ $el: unknown }>('primitive')\nconst rootEl = shallowRef<HTMLElement | null>(null)\nfunction syncRootEl(): void {\n const el = primitive.value?.$el\n rootEl.value = el instanceof HTMLElement ? el : null\n}\n\nconst document = shallowRef<InkDocument | null>(null)\n/** Overrides the document's status while opening, and when opening itself failed. */\nconst override = shallowRef<InkStatus | null>(null)\nconst idle: InkStatus = { state: 'idle' }\nconst documentStatus = useReadable<InkStatus>(() => document.value?.status ?? null, idle)\nconst status = computed<InkStatus>(() => override.value ?? documentStatus.value)\nconst annotationList = useReadable<readonly Annotation[]>(\n () => document.value?.annotations.list ?? null,\n []\n)\nconst selection = useReadable<readonly string[]>(\n () => document.value?.annotations.selection ?? null,\n []\n)\nconst viewport = shallowRef<Viewport | null>(null)\nconst tools = shallowRef<ToolController | null>(null)\nconst internalTool = ref<ToolId>(props.tool ?? 'view')\nconst activated = ref<string | null>(null)\n\nconst controlled = computed(() => props.annotations !== undefined)\n\n/** Signed URLs change; the key does not. Bytes and Blobs are their own identity. */\nfunction identity(src: DocumentSource | null): unknown {\n if (src === null) return null\n if (typeof src === 'string') return src\n if ('key' in src) return src.key\n return src\n}\n\nfunction setTestHook(doc: InkDocument | undefined): void {\n if (import.meta.env.DEV && rootEl.value)\n (rootEl.value as TestHookElement).__inkDocument = doc\n}\n\nlet generation = 0\nfunction release(): void {\n document.value?.destroy()\n document.value = null\n setTestHook(undefined)\n}\n\nasync function open(): Promise<void> {\n const gen = ++generation\n const src = props.src\n release()\n refHistory.clear()\n if (src === null) {\n override.value = null\n return\n }\n override.value = { state: 'loading' }\n syncRootEl()\n let doc: InkDocument\n try {\n doc = await openDocument(src, {\n assets: props.assets,\n password: props.password,\n defaults:\n props.defaults ?? (rootEl.value ? cssVariableDefaults(rootEl.value) : undefined),\n // Controlled hosts get the ref history below; core's own stack stays off.\n history: controlled.value ? false : (props.history ?? true),\n annotations: controlled.value\n ? {\n mode: 'controlled',\n initial: props.annotations ?? [],\n onChange: (next, change) => {\n emit('update:annotations', next)\n emit('change', change)\n },\n }\n : { mode: 'uncontrolled' },\n })\n } catch (cause) {\n if (gen !== generation) return\n const error =\n cause instanceof InkError\n ? cause\n : new InkError(\n 'InvalidPdf',\n cause instanceof Error ? cause.message : String(cause),\n {},\n cause\n )\n override.value = { state: 'error', error }\n emit('error', error)\n return\n }\n if (gen !== generation) {\n doc.destroy()\n return\n }\n // The prop may have changed while the file loaded, when there was no store to apply it to.\n if (doc.annotations.mode === 'controlled' && props.annotations !== undefined)\n doc.annotations.setControlledValue(props.annotations)\n document.value = doc\n override.value = null\n setTestHook(doc)\n const s = doc.status.get()\n if (s.state === 'ready') emit('ready', doc)\n else if (s.state === 'error') emit('error', s.error)\n}\n\nconst refHistory = createRefHistory({\n source: () => props.annotations,\n apply: (list) => document.value?.annotations.replaceAll(list, 'history'),\n enabled: computed(() => controlled.value && props.history === true),\n})\nconst coreCanUndo = useReadable(() => document.value?.history.canUndo ?? null, false)\nconst coreCanRedo = useReadable(() => document.value?.history.canRedo ?? null, false)\nconst inkHistory: InkHistory = {\n canUndo: computed(() =>\n controlled.value ? refHistory.canUndo.value : coreCanUndo.value\n ),\n canRedo: computed(() =>\n controlled.value ? refHistory.canRedo.value : coreCanRedo.value\n ),\n undo: () => (controlled.value ? refHistory.undo() : document.value?.history.undo()),\n redo: () => (controlled.value ? refHistory.redo() : document.value?.history.redo()),\n clear: () => (controlled.value ? refHistory.clear() : document.value?.history.clear()),\n batch: (fn) => {\n if (controlled.value) refHistory.batch(fn)\n else if (document.value) document.value.history.batch(fn)\n else fn()\n },\n}\n\n// Open on the client only: on the server InkRoot renders its empty slot.\nonMounted(() => {\n syncRootEl()\n void open()\n})\nonUpdated(syncRootEl)\n\n// Separate sources, so a new `{ url, key }` object with the same key compares equal.\nwatch([() => identity(props.src), () => props.password], () => void open())\n\nwatch(\n () => props.annotations,\n (next) => {\n if (next && document.value?.annotations.mode === 'controlled')\n document.value.annotations.setControlledValue(next)\n }\n)\n\nwatch(\n () => props.tool,\n (t) => {\n if (t) internalTool.value = t\n }\n)\n\nfunction setTool(id: ToolId): void {\n internalTool.value = id\n emit('update:tool', id)\n}\n\nonBeforeUnmount(() => {\n generation++\n release()\n})\n\nprovideInkContext({\n assets: computed(() => props.assets),\n document,\n status,\n annotations: annotationList,\n selection,\n viewport,\n tools,\n tool: internalTool,\n setTool,\n zoomModel: computed(() => props.zoom),\n pageModel: computed(() => props.page),\n reportZoom: (z) => emit('update:zoom', z),\n reportPage: (p) => emit('update:page', p),\n activated,\n setActivated(id) {\n activated.value = id\n if (id) emit('activate', id)\n },\n history: inkHistory,\n rootEl,\n})\n\n// `history` is what `useHistory()` returns inside the root, for hosts that hold a template ref:\n// a controlled host calls `history.clear()` after loading its saved list.\ndefineExpose({ document, status, rootEl, history: inkHistory })\n</script>\n\n<template>\n <Primitive\n ref=\"primitive\"\n :as-child=\"props.asChild\"\n as=\"div\"\n data-ink-root\n :data-state=\"status.state\"\n >\n <slot :status=\"status\" :document=\"document\" />\n </Primitive>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,IAAMQ,IAAQC,GA+BRC,IAAOH,GAcPI,IAAYC,EAAiC,WAAW,GACxDC,IAASC,EAA+B,IAAI;EAClD,SAASC,IAAmB;GAC1B,IAAMC,IAAKL,EAAU,OAAO;GAC5B,EAAO,QAAQK,aAAc,cAAcA,IAAK;EAClD;EAEA,IAAMC,IAAWH,EAA+B,IAAI,GAE9CI,IAAWJ,EAA6B,IAAI,GAE5CK,IAAiBC,QAA6BH,EAAS,OAAO,UAAU,MAAM,EAD1D,OAAO,OACmD,CAAI,GAClFI,IAASC,QAA0BJ,EAAS,SAASC,EAAe,KAAK,GACzEI,IAAiBH,QACfH,EA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AA;IAAvC,QAAQhD,EAAA;IAAS,UAAUJ,EAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkSuggestionCard.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkSuggestionCard.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkSuggestionCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkSuggestionCard.js","names":["_sfc_main","InkSuggestionCard_vue_vue_type_script_setup_true_lang_default","InkSuggestionCard_default"],"sources":["../../src/components/InkSuggestionCard.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * Review card for a suggested redaction: opens when the activated annotation, or the only\n * selected one, is a redaction with `origin: 'suggested'`. Locked suggestions cannot be\n * dismissed, so they get no Dismiss button. A press on the overlay selects and\n * activates, so a click opens it whatever the tool. Closing clears `activated` and the\n * selection.\n */\nimport { confidenceBucket } from '@inkbar/core'\nimport { PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useAnnotations } from '../composables/useAnnotations'\nimport { injectInkContext } from '../context'\n\nimport { useAnnotationElement } from './annotation-element'\nimport { keepOpenOnAnnotation, useFocusReturn } from './popover-focus'\n\nimport type { ConfidenceBucket, RedactAnnotation } from '@inkbar/core'\nimport type { SuggestionCardSlotProps } from '@inkbar/core/dom'\n\nexport type { ConfidenceBucket } from '@inkbar/core'\n\nexport type { SuggestionCardSlotProps } from '@inkbar/core/dom'\n\ndefineSlots<{ default?(props: SuggestionCardSlotProps): unknown }>()\n\nconst ctx = injectInkContext()\nconst {\n annotations,\n selection,\n accept: acceptId,\n dismiss: dismissId,\n select,\n} = useAnnotations()\n\nfunction suggestion(id: string | null | undefined): RedactAnnotation | null {\n const a = id ? annotations.value.find((x) => x.id === id) : undefined\n return a?.type === 'redact' && a.origin === 'suggested' ? a : null\n}\n// The activated annotation when it is a suggestion; otherwise the only selected one (a\n// marquee selects without activating).\nconst target = computed<RedactAnnotation | null>(\n () =>\n suggestion(ctx.activated.value) ??\n (selection.value.length === 1 ? suggestion(selection.value[0]) : null)\n)\nconst anchor = useAnnotationElement(\n ctx,\n computed(() => target.value?.id ?? null)\n)\nconst focusReturn = useFocusReturn(ctx)\nconst open = computed(() => target.value !== null && anchor.value !== null)\nconst bucket = computed<ConfidenceBucket | undefined>(() =>\n target.value?.suggestion\n ? confidenceBucket(target.value.suggestion.confidence)\n : undefined\n)\n\nfunction close(): void {\n ctx.setActivated(null)\n select([])\n}\nfunction accept(): void {\n if (target.value) acceptId(target.value.id)\n close()\n}\n/** Locked annotations cannot be removed: dismissing one does nothing and keeps the card. */\nfunction dismiss(): void {\n const t = target.value\n if (!t || t.locked) return\n focusReturn.beforeRemove(anchor.value, '[data-origin=\"suggested\"]')\n dismissId(t.id)\n close()\n}\nfunction onOpenChange(next: boolean): void {\n if (!next) close()\n}\n</script>\n\n<template>\n <PopoverRoot :open=\"open\" @update:open=\"onOpenChange\">\n <PopoverPortal>\n <PopoverContent\n v-if=\"target && anchor\"\n :reference=\"anchor\"\n class=\"ink-suggestion-card\"\n data-ink-suggestion-card\n side=\"bottom\"\n :side-offset=\"6\"\n :collision-padding=\"8\"\n v-bind=\"{ 'aria-label': 'Suggested redaction' }\"\n @interact-outside=\"keepOpenOnAnnotation\"\n @close-auto-focus=\"focusReturn.onCloseAutoFocus($event, anchor)\"\n >\n <slot\n :annotation=\"target\"\n :suggestion=\"target.suggestion\"\n :bucket=\"bucket\"\n :accept=\"accept\"\n :dismiss=\"dismiss\"\n :close=\"close\"\n >\n <p class=\"ink-suggestion-reason\">\n <strong>{{ target.suggestion?.reason ?? 'Suggested redaction' }}</strong>\n <span\n v-if=\"bucket\"\n class=\"ink-suggestion-confidence\"\n :data-confidence=\"bucket\"\n >\n {{ bucket }} confidence\n </span>\n </p>\n <p v-if=\"target.suggestion?.explanation\" class=\"ink-suggestion-explanation\">\n {{ target.suggestion.explanation }}\n </p>\n <div class=\"ink-suggestion-actions\">\n <button type=\"button\" @click=\"accept\">Accept</button>\n <button v-if=\"!target.locked\" type=\"button\" @click=\"dismiss\">Dismiss</button>\n </div>\n </slot>\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { SuggestionCardSlotProps } from '@inkbar/core/dom';
2
+ export type { ConfidenceBucket } from '@inkbar/core';
3
+ export type { SuggestionCardSlotProps } from '@inkbar/core/dom';
4
+ type __VLS_Slots = {
5
+ default?(props: SuggestionCardSlotProps): unknown;
6
+ };
7
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
11
+ type __VLS_WithSlots<T, S> = T & {
12
+ new (): {
13
+ $slots: S;
14
+ };
15
+ };
16
+ //# sourceMappingURL=InkSuggestionCard.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkSuggestionCard.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkSuggestionCard.vue"],"names":[],"mappings":"AAiJA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAA;CAAE,CAAC;AAwMzE,QAAA,MAAM,UAAU,+QACd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { injectInkContext as e } from "../context.js";
2
+ import { useAnnotations as t } from "../composables/useAnnotations.js";
3
+ import { useAnnotationElement as n } from "./annotation-element.js";
4
+ import { keepOpenOnAnnotation as r, useFocusReturn as i } from "./popover-focus.js";
5
+ import { computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeProps as f, openBlock as p, renderSlot as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
6
+ import { confidenceBucket as v } from "@inkbar/core";
7
+ import { PopoverContent as y, PopoverPortal as b, PopoverRoot as x } from "reka-ui";
8
+ //#region src/components/InkSuggestionCard.vue?vue&type=script&setup=true&lang.ts
9
+ var S = { class: "ink-suggestion-reason" }, C = ["data-confidence"], w = {
10
+ key: 0,
11
+ class: "ink-suggestion-explanation"
12
+ }, T = { class: "ink-suggestion-actions" }, E = /*@__PURE__*/ d({
13
+ __name: "InkSuggestionCard",
14
+ setup(d) {
15
+ let E = e(), { annotations: D, selection: O, accept: k, dismiss: A, select: j } = t();
16
+ function M(e) {
17
+ let t = e ? D.value.find((t) => t.id === e) : void 0;
18
+ return t?.type === "redact" && t.origin === "suggested" ? t : null;
19
+ }
20
+ let N = a(() => M(E.activated.value) ?? (O.value.length === 1 ? M(O.value[0]) : null)), P = n(E, a(() => N.value?.id ?? null)), F = i(E), I = a(() => N.value !== null && P.value !== null), L = a(() => N.value?.suggestion ? v(N.value.suggestion.confidence) : void 0);
21
+ function R() {
22
+ E.setActivated(null), j([]);
23
+ }
24
+ function z() {
25
+ N.value && k(N.value.id), R();
26
+ }
27
+ function B() {
28
+ let e = N.value;
29
+ e && !e.locked && (F.beforeRemove(P.value, "[data-origin=\"suggested\"]"), A(e.id), R());
30
+ }
31
+ function V(e) {
32
+ e || R();
33
+ }
34
+ return (e, t) => (p(), o(g(x), {
35
+ open: I.value,
36
+ "onUpdate:open": V
37
+ }, {
38
+ default: _(() => [u(g(b), null, {
39
+ default: _(() => [N.value && g(P) ? (p(), o(g(y), f({
40
+ key: 0,
41
+ reference: g(P),
42
+ class: "ink-suggestion-card",
43
+ "data-ink-suggestion-card": "",
44
+ side: "bottom",
45
+ "side-offset": 6,
46
+ "collision-padding": 8
47
+ }, { "aria-label": "Suggested redaction" }, {
48
+ onInteractOutside: g(r),
49
+ onCloseAutoFocus: t[0] ||= (e) => g(F).onCloseAutoFocus(e, g(P))
50
+ }), {
51
+ default: _(() => [m(e.$slots, "default", {
52
+ annotation: N.value,
53
+ suggestion: N.value.suggestion,
54
+ bucket: L.value,
55
+ accept: z,
56
+ dismiss: B,
57
+ close: R
58
+ }, () => [
59
+ l("p", S, [l("strong", null, h(N.value.suggestion?.reason ?? "Suggested redaction"), 1), L.value ? (p(), c("span", {
60
+ key: 0,
61
+ class: "ink-suggestion-confidence",
62
+ "data-confidence": L.value
63
+ }, h(L.value) + " confidence ", 9, C)) : s("", !0)]),
64
+ N.value.suggestion?.explanation ? (p(), c("p", w, h(N.value.suggestion.explanation), 1)) : s("", !0),
65
+ l("div", T, [l("button", {
66
+ type: "button",
67
+ onClick: z
68
+ }, "Accept"), N.value.locked ? s("", !0) : (p(), c("button", {
69
+ key: 0,
70
+ type: "button",
71
+ onClick: B
72
+ }, "Dismiss"))])
73
+ ])]),
74
+ _: 3
75
+ }, 16, ["reference", "onInteractOutside"])) : s("", !0)]),
76
+ _: 3
77
+ })]),
78
+ _: 3
79
+ }, 8, ["open"]));
80
+ }
81
+ });
82
+ //#endregion
83
+ export { E as default };
84
+
85
+ //# sourceMappingURL=InkSuggestionCard.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkSuggestionCard.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_renderSlot","_createElementVNode","_toDisplayString","_createElementBlock","_createCommentVNode","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","InkSuggestionCard_vue_vue_type_script_setup_true_lang_default","ctx","injectInkContext","acceptId","dismissId","useAnnotations","suggestion","a","id","annotations","x","target","computed","selection","anchor","useAnnotationElement","focusReturn","useFocusReturn","open","bucket","confidenceBucket","close","select","accept","dismiss","t","onOpenChange","next","openBlock","createBlock","unref","PopoverRoot","withCtx","createVNode","PopoverPortal","PopoverContent","mergeProps","keepOpenOnAnnotation","_cache","$event","renderSlot","_ctx","createElementVNode","toDisplayString","createElementBlock","createCommentVNode"],"sources":["../../src/components/InkSuggestionCard.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * Review card for a suggested redaction: opens when the activated annotation, or the only\n * selected one, is a redaction with `origin: 'suggested'`. Locked suggestions cannot be\n * dismissed, so they get no Dismiss button. A press on the overlay selects and\n * activates, so a click opens it whatever the tool. Closing clears `activated` and the\n * selection.\n */\nimport { confidenceBucket } from '@inkbar/core'\nimport { PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useAnnotations } from '../composables/useAnnotations'\nimport { injectInkContext } from '../context'\n\nimport { useAnnotationElement } from './annotation-element'\nimport { keepOpenOnAnnotation, useFocusReturn } from './popover-focus'\n\nimport type { ConfidenceBucket, RedactAnnotation } from '@inkbar/core'\nimport type { SuggestionCardSlotProps } from '@inkbar/core/dom'\n\nexport type { ConfidenceBucket } from '@inkbar/core'\n\nexport type { SuggestionCardSlotProps } from '@inkbar/core/dom'\n\ndefineSlots<{ default?(props: SuggestionCardSlotProps): unknown }>()\n\nconst ctx = injectInkContext()\nconst {\n annotations,\n selection,\n accept: acceptId,\n dismiss: dismissId,\n select,\n} = useAnnotations()\n\nfunction suggestion(id: string | null | undefined): RedactAnnotation | null {\n const a = id ? annotations.value.find((x) => x.id === id) : undefined\n return a?.type === 'redact' && a.origin === 'suggested' ? a : null\n}\n// The activated annotation when it is a suggestion; otherwise the only selected one (a\n// marquee selects without activating).\nconst target = computed<RedactAnnotation | null>(\n () =>\n suggestion(ctx.activated.value) ??\n (selection.value.length === 1 ? suggestion(selection.value[0]) : null)\n)\nconst anchor = useAnnotationElement(\n ctx,\n computed(() => target.value?.id ?? null)\n)\nconst focusReturn = useFocusReturn(ctx)\nconst open = computed(() => target.value !== null && anchor.value !== null)\nconst bucket = computed<ConfidenceBucket | undefined>(() =>\n target.value?.suggestion\n ? confidenceBucket(target.value.suggestion.confidence)\n : undefined\n)\n\nfunction close(): void {\n ctx.setActivated(null)\n select([])\n}\nfunction accept(): void {\n if (target.value) acceptId(target.value.id)\n close()\n}\n/** Locked annotations cannot be removed: dismissing one does nothing and keeps the card. */\nfunction dismiss(): void {\n const t = target.value\n if (!t || t.locked) return\n focusReturn.beforeRemove(anchor.value, '[data-origin=\"suggested\"]')\n dismissId(t.id)\n close()\n}\nfunction onOpenChange(next: boolean): void {\n if (!next) close()\n}\n</script>\n\n<template>\n <PopoverRoot :open=\"open\" @update:open=\"onOpenChange\">\n <PopoverPortal>\n <PopoverContent\n v-if=\"target && anchor\"\n :reference=\"anchor\"\n class=\"ink-suggestion-card\"\n data-ink-suggestion-card\n side=\"bottom\"\n :side-offset=\"6\"\n :collision-padding=\"8\"\n v-bind=\"{ 'aria-label': 'Suggested redaction' }\"\n @interact-outside=\"keepOpenOnAnnotation\"\n @close-auto-focus=\"focusReturn.onCloseAutoFocus($event, anchor)\"\n >\n <slot\n :annotation=\"target\"\n :suggestion=\"target.suggestion\"\n :bucket=\"bucket\"\n :accept=\"accept\"\n :dismiss=\"dismiss\"\n :close=\"close\"\n >\n <p class=\"ink-suggestion-reason\">\n <strong>{{ target.suggestion?.reason ?? 'Suggested redaction' }}</strong>\n <span\n v-if=\"bucket\"\n class=\"ink-suggestion-confidence\"\n :data-confidence=\"bucket\"\n >\n {{ bucket }} confidence\n </span>\n </p>\n <p v-if=\"target.suggestion?.explanation\" class=\"ink-suggestion-explanation\">\n {{ target.suggestion.explanation }}\n </p>\n <div class=\"ink-suggestion-actions\">\n <button type=\"button\" @click=\"accept\">Accept</button>\n <button v-if=\"!target.locked\" type=\"button\" @click=\"dismiss\">Dismiss</button>\n </div>\n </slot>\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EA2BA,IAAMgB,IAAMC,EAAiB,GACvB,EACJ,gBACA,cACA,QAAQC,GACR,SAASC,GACT,cACEC,EAAe;EAEnB,SAASC,EAAW,GAAwD;GAC1E,IAAMC,IAAIC,IAAKC,EAAY,MAAM,MAAM,MAAMC,EAAE,OAAOF,CAAE,IAAI,KAAA;GAC5D,OAAOD,GAAG,SAAS,YAAYA,EAAE,WAAW,cAAcA,IAAI;EAChE;EAGA,IAAMI,IAASC,QAEXN,EAAWL,EAAI,UAAU,KAAK,MAC7BY,EAAU,MAAM,WAAW,IAAIP,EAAWO,EAAU,MAAM,EAAE,IAAI,KACrE,GACMC,IAASC,EACbd,GACAW,QAAeD,EAAO,OAAO,MAAM,IAAI,CACzC,GACMK,IAAcC,EAAehB,CAAG,GAChCiB,IAAON,QAAeD,EAAO,UAAU,QAAQG,EAAO,UAAU,IAAI,GACpEK,IAASP,QACbD,EAAO,OAAO,aACVS,EAAiBT,EAAO,MAAM,WAAW,UAAU,IACnD,KAAA,CACN;EAEA,SAASU,IAAc;GAErB,AADApB,EAAI,aAAa,IAAI,GACrBqB,EAAO,CAAC,CAAC;EACX;EACA,SAASC,IAAe;GAEtB,AADIZ,EAAO,SAAOR,EAASQ,EAAO,MAAM,EAAE,GAC1CU,EAAM;EACR;EAEA,SAASG,IAAgB;GACvB,IAAMC,IAAId,EAAO;GACjB,AAAKc,KAAK,GAAE,WACZT,EAAY,aAAaF,EAAO,OAAO,6BAA2B,GAClEV,EAAUqB,EAAE,EAAE,GACdJ,EAAM;EACR;EACA,SAASK,EAAa,GAAqB;GACzC,AA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;MAAQ,GAAA,QAAM,GAC7BZ,EAAA,MAAO,SAA8CkC,EAAA,IAAA,EAAA,KAApE5D,EAAA,GAAAS,EAA6E,UAAA;;OAA/C,MAAK;OAAU,SAAO8B;MAAS,GAAA,SAAO,EAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkToolButton.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkToolButton.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkToolButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolButton.js","names":["_sfc_main","InkToolButton_vue_vue_type_script_setup_true_lang_default","InkToolButton_default"],"sources":["../../src/components/InkToolButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { TOOL_LABELS } from '@inkbar/core/dom'\nimport { Hand, Highlighter, MessageSquare, MousePointer2, Square } 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<Record<ToolId, IconNode>> = {\n view: Hand,\n select: MousePointer2,\n highlight: Highlighter,\n 'redact-area': Square,\n note: MessageSquare,\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)\nconst name = computed(() => props.label ?? TOOL_LABELS[props.tool])\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 :icon=\"ICONS[tool]\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { ToolId } from '@inkbar/core/dom';
2
+ type __VLS_Props = {
3
+ tool: ToolId;
4
+ label?: string | undefined;
5
+ asChild?: boolean;
6
+ };
7
+ declare var __VLS_7: {
8
+ active: boolean;
9
+ label: string;
10
+ };
11
+ type __VLS_Slots = {} & {
12
+ default?: (props: typeof __VLS_7) => any;
13
+ };
14
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
15
+ asChild: boolean;
16
+ label: string | undefined;
17
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
26
+ //# sourceMappingURL=InkToolButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolButton.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkToolButton.vue"],"names":[],"mappings":"AA6DA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAY9C,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAqEnF,QAAA,IAAI,OAAO;;;CAAW,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,53 @@
1
+ import { useTool as e } from "../composables/useTool.js";
2
+ import t from "./InkIcon.js";
3
+ import { computed as n, createBlock as r, createVNode as i, defineComponent as a, mergeProps as o, openBlock as s, renderSlot as c, unref as l, withCtx as u } from "vue";
4
+ import { TOOL_LABELS as d } from "@inkbar/core/dom";
5
+ import { ToolbarButton as f } from "reka-ui";
6
+ import { Hand as p, Highlighter as m, MessageSquare as h, MousePointer2 as g, Square as _ } from "@inkbar/icons";
7
+ //#region src/components/InkToolButton.vue?vue&type=script&setup=true&lang.ts
8
+ var v = /*@__PURE__*/ a({
9
+ __name: "InkToolButton",
10
+ props: {
11
+ tool: {},
12
+ label: { default: void 0 },
13
+ asChild: {
14
+ type: Boolean,
15
+ default: !1
16
+ }
17
+ },
18
+ setup(a) {
19
+ let v = {
20
+ view: p,
21
+ select: g,
22
+ highlight: m,
23
+ "redact-area": _,
24
+ note: h
25
+ }, y = a, { tool: b, setTool: x } = e(), S = n(() => b.value === y.tool), C = n(() => y.label ?? d[y.tool]), w = n(() => ({
26
+ "aria-pressed": String(S.value),
27
+ "aria-label": C.value,
28
+ title: C.value,
29
+ onClick: () => x(y.tool)
30
+ }));
31
+ return (e, n) => (s(), r(l(f), o({
32
+ "as-child": a.asChild,
33
+ class: "ink-tool-button",
34
+ "data-ink-tool-button": "",
35
+ "data-tool": a.tool,
36
+ "data-state": S.value ? "on" : "off"
37
+ }, w.value), {
38
+ default: u(() => [c(e.$slots, "default", {
39
+ active: S.value,
40
+ label: C.value
41
+ }, () => [i(t, { icon: v[a.tool] }, null, 8, ["icon"])])]),
42
+ _: 3
43
+ }, 16, [
44
+ "as-child",
45
+ "data-tool",
46
+ "data-state"
47
+ ]));
48
+ }
49
+ });
50
+ //#endregion
51
+ export { v as default };
52
+
53
+ //# sourceMappingURL=InkToolButton.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolButton.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createVNode","InkIcon","InkIcon_default","InkToolButton_vue_vue_type_script_setup_true_lang_default","ICONS","Hand","MousePointer2","Highlighter","Square","MessageSquare","props","__props","current","useTool","active","computed","name","TOOL_LABELS","attrs","setTool","openBlock","createBlock","unref","ToolbarButton","mergeProps","withCtx","renderSlot","_ctx","createVNode"],"sources":["../../src/components/InkToolButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { TOOL_LABELS } from '@inkbar/core/dom'\nimport { Hand, Highlighter, MessageSquare, MousePointer2, Square } 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<Record<ToolId, IconNode>> = {\n view: Hand,\n select: MousePointer2,\n highlight: Highlighter,\n 'redact-area': Square,\n note: MessageSquare,\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)\nconst name = computed(() => props.label ?? TOOL_LABELS[props.tool])\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 :icon=\"ICONS[tool]\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAaA,IAAMU,IAA4C;GAChD,MAAMC;GACN,QAAQC;GACR,WAAWC;GACX,eAAeC;GACf,MAAMC;EACR,GAEMC,IAAQC,GAKR,EAAE,MAAMC,GAAS,eAAYC,EAAQ,GACrCC,IAASC,QAAeH,EAAQ,UAAUF,EAAM,IAAI,GACpDM,IAAOD,QAAeL,EAAM,SAASO,EAAYP,EAAM,KAAK,GAE5DQ,IAAQH,SAAgB;GAC5B,gBAAgB,OAAOD,EAAO,KAAK;GACnC,cAAcE,EAAK;GACnB,OAAOA,EAAK;GACZ,eAAeG,EAAQT,EAAM,IAAI;EACnC,EAAE;oBAIAhB,EAAA,GAAAC,EASgBC,EAAA2B,CAAA,GAThB1B,EASgB;GARb,YAAUc,EAAA;GACX,OAAM;GACN,wBAAA;GACC,aAAWA,EAAA;GACX,cAAYG,EAAA,QAAM,OAAA;EACX,GAAAI,EAAA,KAAK,GAAA;GAEb,SAAApB,QAA2E,CAA3EC,EAA2E4B,EAAA,QAAA,WAAA;IAApE,QAAQb,EAAA;IAAS,OAAOE,EAAA;GAA/B,SAA2E,CAAtChB,EAA+BC,GAAA,EAArB,MAAMG,EAAMO,EAAA,MAAA,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkToolbar.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkToolbar.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolbar.js","names":["_sfc_main","InkToolbar_vue_vue_type_script_setup_true_lang_default","InkToolbar_default"],"sources":["../../src/components/InkToolbar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarRoot } from 'reka-ui'\n\nwithDefaults(defineProps<{ label?: string; asChild?: boolean }>(), {\n label: 'Document tools',\n asChild: false,\n})\n</script>\n\n<template>\n <ToolbarRoot\n :as-child=\"asChild\"\n orientation=\"horizontal\"\n v-bind=\"{ 'aria-label': label }\"\n data-ink-toolbar\n class=\"ink-toolbar\"\n >\n <slot />\n </ToolbarRoot>\n</template>\n"],"mappings":""}
@@ -0,0 +1,21 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ asChild?: boolean;
4
+ };
5
+ declare var __VLS_7: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_7) => any;
8
+ };
9
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ asChild: boolean;
11
+ label: string;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
21
+ //# sourceMappingURL=InkToolbar.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkToolbar.vue"],"names":[],"mappings":"AAyBA,KAAK,WAAW,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA6CzD,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,29 @@
1
+ import { createBlock as e, defineComponent as t, mergeProps as n, openBlock as r, renderSlot as i, unref as a, withCtx as o } from "vue";
2
+ import { ToolbarRoot as s } from "reka-ui";
3
+ //#region src/components/InkToolbar.vue?vue&type=script&setup=true&lang.ts
4
+ var c = /*@__PURE__*/ t({
5
+ __name: "InkToolbar",
6
+ props: {
7
+ label: { default: "Document tools" },
8
+ asChild: {
9
+ type: Boolean,
10
+ default: !1
11
+ }
12
+ },
13
+ setup(t) {
14
+ return (c, l) => (r(), e(a(s), n({
15
+ "as-child": t.asChild,
16
+ orientation: "horizontal"
17
+ }, { "aria-label": t.label }, {
18
+ "data-ink-toolbar": "",
19
+ class: "ink-toolbar"
20
+ }), {
21
+ default: o(() => [i(c.$slots, "default")]),
22
+ _: 3
23
+ }, 16, ["as-child"]));
24
+ }
25
+ });
26
+ //#endregion
27
+ export { c as default };
28
+
29
+ //# sourceMappingURL=InkToolbar.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolbar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","InkToolbar_vue_vue_type_script_setup_true_lang_default","openBlock","createBlock","unref","ToolbarRoot","mergeProps","__props","withCtx","renderSlot","_ctx"],"sources":["../../src/components/InkToolbar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarRoot } from 'reka-ui'\n\nwithDefaults(defineProps<{ label?: string; asChild?: boolean }>(), {\n label: 'Document tools',\n asChild: false,\n})\n</script>\n\n<template>\n <ToolbarRoot\n :as-child=\"asChild\"\n orientation=\"horizontal\"\n v-bind=\"{ 'aria-label': label }\"\n data-ink-toolbar\n class=\"ink-toolbar\"\n >\n <slot />\n </ToolbarRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;oBAUEA,EAAA,GAAAC,EAQcC,EAAAQ,CAAA,GARdP,EAQc;GAPX,YAAUS,EAAA;GACX,aAAY;EACY,GAAA,EAAA,cAAAA,EAAA,MAAK,GAAA;GAC7B,oBAAA;GACA,OAAM;;GAEN,SAAAR,QAAQ,CAARC,EAAQU,EAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkToolbarSeparator.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkToolbarSeparator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolbarSeparator.js","names":["_sfc_main","InkToolbarSeparator_vue_vue_type_script_setup_true_lang_default","InkToolbarSeparator_default"],"sources":["../../src/components/InkToolbarSeparator.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/* A divider between groups of controls in a horizontal toolbar. Not focusable. */\n</script>\n\n<template>\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n class=\"ink-toolbar-separator\"\n data-ink-toolbar-separator\n />\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=InkToolbarSeparator.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolbarSeparator.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkToolbarSeparator.vue"],"names":[],"mappings":"AA6BA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,17 @@
1
+ import { createElementBlock as e, defineComponent as t, openBlock as n } from "vue";
2
+ //#region src/components/InkToolbarSeparator.vue?vue&type=script&setup=true&lang.ts
3
+ var r = {
4
+ role: "separator",
5
+ "aria-orientation": "vertical",
6
+ class: "ink-toolbar-separator",
7
+ "data-ink-toolbar-separator": ""
8
+ }, i = /*@__PURE__*/ t({
9
+ __name: "InkToolbarSeparator",
10
+ setup(t) {
11
+ return (t, i) => (n(), e("div", r));
12
+ }
13
+ });
14
+ //#endregion
15
+ export { i as default };
16
+
17
+ //# sourceMappingURL=InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_hoisted_1","InkToolbarSeparator_vue_vue_type_script_setup_true_lang_default","openBlock","createElementBlock"],"sources":["../../src/components/InkToolbarSeparator.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/* A divider between groups of controls in a horizontal toolbar. Not focusable. */\n</script>\n\n<template>\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n class=\"ink-toolbar-separator\"\n data-ink-toolbar-separator\n />\n</template>\n"],"mappings":";;;;;;;;;;oBAKEA,EAAA,GAAAC,EAKE,OALFC,CAKE"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkUndo.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkUndo.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkUndo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkUndo.js","names":["_sfc_main","InkUndo_vue_vue_type_script_setup_true_lang_default","InkUndo_default"],"sources":["../../src/components/InkUndo.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Undo2 } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useHistory } from '../composables/useHistory'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { canUndo, undo } = useHistory()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Undo',\n title: 'Undo',\n onClick: () => undo(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"!canUndo\"\n class=\"ink-undo\"\n data-ink-undo\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"Undo2\" /></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=InkUndo.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkUndo.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkUndo.vue"],"names":[],"mappings":"AAuCA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAyDzC,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"}