@inkbar/vue 0.6.0 → 0.8.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 (69) hide show
  1. package/README.md +12 -1
  2. package/dist/components/InkFindBar.js +7 -0
  3. package/dist/components/InkFindBar.js.map +1 -0
  4. package/dist/components/InkFindBar.vue.d.ts +4 -0
  5. package/dist/components/InkFindBar.vue.d.ts.map +1 -0
  6. package/dist/components/InkFindBar.vue_vue_type_script_setup_true_lang.js +133 -0
  7. package/dist/components/InkFindBar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  8. package/dist/components/InkFormAlert.js +7 -0
  9. package/dist/components/InkFormAlert.js.map +1 -0
  10. package/dist/components/InkFormAlert.vue.d.ts +16 -0
  11. package/dist/components/InkFormAlert.vue.d.ts.map +1 -0
  12. package/dist/components/InkFormAlert.vue_vue_type_script_setup_true_lang.js +90 -0
  13. package/dist/components/InkFormAlert.vue_vue_type_script_setup_true_lang.js.map +1 -0
  14. package/dist/components/InkRoot.js.map +1 -1
  15. package/dist/components/InkRoot.vue.d.ts +15 -1
  16. package/dist/components/InkRoot.vue.d.ts.map +1 -1
  17. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +179 -132
  18. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/InkSearchButton.js +7 -0
  20. package/dist/components/InkSearchButton.js.map +1 -0
  21. package/dist/components/InkSearchButton.vue.d.ts +19 -0
  22. package/dist/components/InkSearchButton.vue.d.ts.map +1 -0
  23. package/dist/components/InkSearchButton.vue_vue_type_script_setup_true_lang.js +43 -0
  24. package/dist/components/InkSearchButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  25. package/dist/components/InkSignFieldPopover.js +7 -0
  26. package/dist/components/InkSignFieldPopover.js.map +1 -0
  27. package/dist/components/InkSignFieldPopover.vue.d.ts +13 -0
  28. package/dist/components/InkSignFieldPopover.vue.d.ts.map +1 -0
  29. package/dist/components/InkSignFieldPopover.vue_vue_type_script_setup_true_lang.js +116 -0
  30. package/dist/components/InkSignFieldPopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
  31. package/dist/components/InkSignatureDialog.js.map +1 -1
  32. package/dist/components/InkSignatureDialog.vue.d.ts +9 -1
  33. package/dist/components/InkSignatureDialog.vue.d.ts.map +1 -1
  34. package/dist/components/InkSignatureDialog.vue_vue_type_script_setup_true_lang.js +9 -2
  35. package/dist/components/InkSignatureDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/InkSignatureMenu.js.map +1 -1
  37. package/dist/components/InkSignatureMenu.vue.d.ts.map +1 -1
  38. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js +72 -159
  39. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/dist/components/InkViewport.js.map +1 -1
  41. package/dist/components/InkViewport.vue.d.ts.map +1 -1
  42. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +117 -85
  43. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -1
  44. package/dist/components/SignatureForm.js.map +1 -1
  45. package/dist/components/SignatureForm.vue.d.ts +7 -3
  46. package/dist/components/SignatureForm.vue.d.ts.map +1 -1
  47. package/dist/components/SignatureForm.vue_vue_type_script_setup_true_lang.js +27 -21
  48. package/dist/components/SignatureForm.vue_vue_type_script_setup_true_lang.js.map +1 -1
  49. package/dist/components/SignatureMenuPanel.js +7 -0
  50. package/dist/components/SignatureMenuPanel.js.map +1 -0
  51. package/dist/components/SignatureMenuPanel.vue.d.ts +15 -0
  52. package/dist/components/SignatureMenuPanel.vue.d.ts.map +1 -0
  53. package/dist/components/SignatureMenuPanel.vue_vue_type_script_setup_true_lang.js +116 -0
  54. package/dist/components/SignatureMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  55. package/dist/composables/useForm.d.ts +18 -0
  56. package/dist/composables/useForm.d.ts.map +1 -0
  57. package/dist/composables/useForm.js +17 -0
  58. package/dist/composables/useForm.js.map +1 -0
  59. package/dist/composables/useSearch.d.ts +12 -0
  60. package/dist/composables/useSearch.d.ts.map +1 -0
  61. package/dist/composables/useSearch.js +27 -0
  62. package/dist/composables/useSearch.js.map +1 -0
  63. package/dist/context.d.ts +14 -2
  64. package/dist/context.d.ts.map +1 -1
  65. package/dist/context.js.map +1 -1
  66. package/dist/index.d.ts +5 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +31 -27
  69. package/package.json +6 -5
@@ -1,12 +1,12 @@
1
1
  import { provideInkContext as e } from "../context.js";
2
2
  import { useReadable as t } from "../use-readable.js";
3
3
  import { createRefHistory as n } from "../ref-history.js";
4
- import { computed as r, createBlock as ee, defineComponent as i, onBeforeUnmount as te, onMounted as ne, onUnmounted as a, onUpdated as o, openBlock as s, ref as c, renderSlot as re, shallowRef as l, unref as ie, useTemplateRef as u, watch as d, withCtx as f } from "vue";
5
- import { InkError as p, createMemorySignatureStore as ae, createSignatureLibrary as oe, openDocument as m, readonly as h, writable as g } from "@inkbar/core";
6
- import { FONT_FAMILIES as se, SIGNATURE_FONTS as ce, createPluginHost as _, createToolOptions as v, cssVariableDefaults as y, trackToolStyle as le } from "@inkbar/core/dom";
7
- import { Primitive as b } from "reka-ui";
4
+ import { computed as r, createBlock as i, defineComponent as a, onBeforeUnmount as ee, onMounted as te, onUnmounted as ne, onUpdated as re, openBlock as ie, ref as o, renderSlot as s, shallowRef as c, unref as ae, useTemplateRef as l, watch as u, withCtx as d } from "vue";
5
+ import { InkError as f, createMemorySignatureStore as oe, createSignatureLibrary as se, openDocument as p, readonly as m, writable as h } from "@inkbar/core";
6
+ import { FONT_FAMILIES as ce, SIGNATURE_FONTS as le, attachHistoryKeys as g, createPluginHost as ue, createSearchController as de, createToolOptions as fe, cssVariableDefaults as pe, handleFindKey as me, keepHistoryFocus as he, pageSelectionText as ge, trackToolStyle as _, viewerSearchOf as _e } from "@inkbar/core/dom";
7
+ import { Primitive as v } from "reka-ui";
8
8
  //#region src/components/InkRoot.vue?vue&type=script&setup=true&lang.ts
9
- var x = /*@__PURE__*/ i({
9
+ var y = /*@__PURE__*/ a({
10
10
  __name: "InkRoot",
11
11
  props: {
12
12
  src: {},
@@ -14,6 +14,11 @@ var x = /*@__PURE__*/ i({
14
14
  password: { default: void 0 },
15
15
  defaults: { default: void 0 },
16
16
  annotations: { default: void 0 },
17
+ fields: { default: void 0 },
18
+ formHighlight: {
19
+ type: Boolean,
20
+ default: void 0
21
+ },
17
22
  tool: { default: void 0 },
18
23
  tools: { default: void 0 },
19
24
  plugins: { default: void 0 },
@@ -38,6 +43,8 @@ var x = /*@__PURE__*/ i({
38
43
  emits: [
39
44
  "update:annotations",
40
45
  "change",
46
+ "update:fields",
47
+ "form-action",
41
48
  "update:tool",
42
49
  "update:page",
43
50
  "update:zoom",
@@ -45,190 +52,230 @@ var x = /*@__PURE__*/ i({
45
52
  "error",
46
53
  "activate"
47
54
  ],
48
- setup(i, { expose: x, emit: S }) {
49
- let C = i, w = S, T = u("primitive"), E = l(null);
50
- function D() {
51
- let e = T.value?.$el;
52
- E.value = e instanceof HTMLElement ? e : null;
55
+ setup(a, { expose: y, emit: ve }) {
56
+ let b = a, x = ve, S = l("primitive"), C = c(null);
57
+ function w() {
58
+ let e = S.value?.$el;
59
+ C.value = e instanceof HTMLElement ? e : null;
53
60
  }
54
- let O = l(null), k = l(null), ue = t(() => O.value?.status ?? null, { state: "idle" }), A = r(() => k.value ?? ue.value), j = t(() => O.value?.annotations.list ?? null, []), M = t(() => O.value?.annotations.selection ?? null, []), N = l(null), P = l(null), F = c(C.tool ?? "select-text"), I = c(null), L = r(() => C.annotations !== void 0);
55
- function R(e) {
56
- I.value = e, e && w("activate", e);
61
+ let T = c(null), E = c(null), D = t(() => T.value?.status ?? null, { state: "idle" }), O = r(() => E.value ?? D.value), k = t(() => T.value?.annotations.list ?? null, []), A = t(() => T.value?.annotations.selection ?? null, []), j = c(null), M = c(null), N = o(b.tool ?? "select-text"), P = o(null), F = r(() => b.annotations !== void 0), ye = r(() => b.fields !== void 0);
62
+ function I(e) {
63
+ P.value = e, e && x("activate", e);
57
64
  }
58
- let z = () => {};
59
- function B(e) {
65
+ let L = () => {};
66
+ function be(e) {
60
67
  return e === null ? null : typeof e == "string" ? e : "key" in e ? e.key : e;
61
68
  }
62
- let V = 0;
63
- function H() {
64
- let e = O.value;
65
- O.value = null, e?.destroy();
69
+ let R = 0, z = L;
70
+ function B() {
71
+ z(), z = L;
72
+ let e = T.value;
73
+ T.value = null, e?.destroy();
66
74
  }
67
- async function U() {
68
- let e = ++V, t = C.src;
69
- if (H(), W.clear(), t === null) {
70
- k.value = null;
75
+ async function V() {
76
+ let e = ++R, t = b.src;
77
+ if (B(), H.clear(), t === null) {
78
+ E.value = null;
71
79
  return;
72
80
  }
73
- k.value = { state: "loading" }, D();
81
+ E.value = { state: "loading" }, w();
74
82
  let n;
75
83
  try {
76
- n = await m(t, {
77
- assets: C.assets,
78
- password: C.password,
79
- defaults: C.defaults ?? (E.value ? y(E.value) : void 0),
80
- history: L.value ? !1 : C.history ?? !0,
81
- annotations: L.value ? {
84
+ n = await p(t, {
85
+ assets: b.assets,
86
+ password: b.password,
87
+ defaults: b.defaults ?? (C.value ? pe(C.value) : void 0),
88
+ history: F.value ? !1 : b.history ?? !0,
89
+ annotations: F.value ? {
82
90
  mode: "controlled",
83
- initial: C.annotations ?? [],
91
+ initial: b.annotations ?? [],
84
92
  onChange: (e, t) => {
85
- w("update:annotations", e), w("change", t);
93
+ x("update:annotations", e), x("change", t);
86
94
  }
95
+ } : { mode: "uncontrolled" },
96
+ fields: ye.value ? {
97
+ mode: "controlled",
98
+ initial: b.fields ?? {},
99
+ onChange: (e, t) => x("update:fields", e, t)
87
100
  } : { mode: "uncontrolled" }
88
101
  });
89
102
  } catch (t) {
90
- if (e !== V) return;
91
- let n = t instanceof p ? t : new p("InvalidPdf", t instanceof Error ? t.message : String(t), {}, t);
92
- k.value = {
103
+ if (e !== R) return;
104
+ let n = t instanceof f ? t : new f("InvalidPdf", t instanceof Error ? t.message : String(t), {}, t);
105
+ E.value = {
93
106
  state: "error",
94
107
  error: n
95
- }, w("error", n);
108
+ }, x("error", n);
96
109
  return;
97
110
  }
98
- if (e !== V) {
111
+ if (e !== R) {
99
112
  n.destroy();
100
113
  return;
101
114
  }
102
- n.annotations.mode === "controlled" && C.annotations !== void 0 && n.annotations.setControlledValue(C.annotations), O.value = n, k.value = null;
103
- let r = n.status.get();
104
- r.state === "ready" ? w("ready", n) : r.state === "error" && w("error", r.error);
115
+ n.annotations.mode === "controlled" && b.annotations !== void 0 && n.annotations.setControlledValue(b.annotations), b.fields !== void 0 && n.form.setControlledValue(b.fields);
116
+ let r = [];
117
+ z = n.form.on("error", (e) => {
118
+ r ? r.push(e) : x("error", e);
119
+ }), T.value = n, E.value = null;
120
+ let i = n.status.get();
121
+ i.state === "ready" ? x("ready", n) : i.state === "error" && x("error", i.error);
122
+ let a = r;
123
+ if (r = void 0, e === R) for (let e of a) x("error", e);
105
124
  }
106
- let W = n({
107
- source: () => C.annotations,
108
- apply: (e) => O.value?.annotations.replaceAll(e, "history"),
109
- enabled: r(() => L.value && C.history === !0),
110
- store: () => O.value?.annotations.mode === "controlled" ? O.value.annotations : null
111
- }), de = t(() => O.value?.history.canUndo ?? null, !1), fe = t(() => O.value?.history.canRedo ?? null, !1), G = {
112
- canUndo: r(() => L.value ? W.canUndo.value : de.value),
113
- canRedo: r(() => L.value ? W.canRedo.value : fe.value),
114
- undo: () => L.value ? W.undo() : O.value?.history.undo(),
115
- redo: () => L.value ? W.redo() : O.value?.history.redo(),
116
- clear: () => L.value ? W.clear() : O.value?.history.clear(),
125
+ let H = n({
126
+ source: () => b.annotations,
127
+ apply: (e) => T.value?.annotations.replaceAll(e, "history"),
128
+ enabled: r(() => F.value && b.history === !0),
129
+ store: () => T.value?.annotations.mode === "controlled" ? T.value.annotations : null
130
+ }), xe = t(() => T.value?.history.canUndo ?? null, !1), Se = t(() => T.value?.history.canRedo ?? null, !1), U = {
131
+ canUndo: r(() => F.value ? H.canUndo.value : xe.value),
132
+ canRedo: r(() => F.value ? H.canRedo.value : Se.value),
133
+ undo: () => F.value ? H.undo() : T.value?.history.undo(),
134
+ redo: () => F.value ? H.redo() : T.value?.history.redo(),
135
+ clear: () => F.value ? H.clear() : T.value?.history.clear(),
117
136
  batch: (e) => {
118
- L.value ? W.batch(e) : O.value ? O.value.history.batch(e) : e();
137
+ F.value ? H.batch(e) : T.value ? T.value.history.batch(e) : e();
119
138
  },
120
- track: (e) => L.value ? W.track(e) : O.value?.history.track(e) ?? z,
121
- react: (e) => L.value ? W.react(e) : O.value?.history.react(e) ?? z
122
- }, K = g(null);
123
- d(O, (e) => K.set(e), { flush: "sync" });
124
- let q = l(null), J = g(null);
125
- d(q, (e) => J.set(e), { flush: "sync" });
126
- let Y = g(null);
127
- d(I, (e) => Y.set(e), { flush: "sync" });
128
- let X = l(null);
129
- function pe() {
130
- X.value = _({
131
- plugins: C.plugins ?? [],
132
- document: h(K),
133
- history: () => G,
134
- activated: h(Y),
139
+ track: (e) => F.value ? H.track(e) : T.value?.history.track(e) ?? L,
140
+ react: (e) => F.value ? H.react(e) : T.value?.history.react(e) ?? L
141
+ };
142
+ u(C, (e, t, n) => {
143
+ if (!e) return;
144
+ let r = g(e, () => ({
145
+ canUndo: U.canUndo.value,
146
+ canRedo: U.canRedo.value,
147
+ undo: U.undo,
148
+ redo: U.redo
149
+ })), i = he(e, () => e.querySelector("[data-ink-scroll]"));
150
+ e.addEventListener("keydown", X), n(() => {
151
+ r(), i(), e.removeEventListener("keydown", X);
152
+ });
153
+ }, { immediate: !0 });
154
+ let W = h(null);
155
+ u(T, (e) => W.set(e), { flush: "sync" });
156
+ let G = c(null), K = h(null);
157
+ u(G, (e) => K.set(e), { flush: "sync" });
158
+ let q = h(null);
159
+ u(P, (e) => q.set(e), { flush: "sync" });
160
+ let J = c(null), Y = c(null);
161
+ function Ce() {
162
+ let e = de({
163
+ document: m(W),
164
+ viewport: () => j.value
165
+ });
166
+ Y.value = e, J.value = ue({
167
+ plugins: b.plugins ?? [],
168
+ document: m(W),
169
+ history: () => U,
170
+ activated: m(q),
135
171
  setActivated: (e) => {
136
- (e === null || O.value?.annotations.get(e)) && R(e);
172
+ (e === null || T.value?.annotations.get(e)) && I(e);
137
173
  },
138
- root: h(J),
139
- decorate: () => C.decorateAnnotation,
140
- viewport: () => N.value
174
+ root: m(K),
175
+ decorate: () => b.decorateAnnotation,
176
+ viewport: () => j.value,
177
+ search: _e(e)
141
178
  });
142
179
  }
143
- let Z = l(null), Q;
144
- d(O, (e) => {
180
+ function X(e) {
181
+ let t = Y.value, n = e.currentTarget;
182
+ t && n instanceof HTMLElement && me(e, t, () => ge(n));
183
+ }
184
+ let Z = c(null), Q;
185
+ u(T, (e) => {
145
186
  if (!e) {
146
187
  Z.value = null, Q = void 0;
147
188
  return;
148
189
  }
149
- let t = le({
190
+ let t = _({
150
191
  store: e.annotations,
151
- history: { batch: (e) => G.batch(e) },
152
- tools: [...C.tools ?? [], ...X.value?.tools ?? []],
153
- tool: F.value
192
+ history: { batch: (e) => U.batch(e) },
193
+ tools: [...b.tools ?? [], ...J.value?.tools ?? []],
194
+ tool: N.value
154
195
  });
155
196
  Q = (e) => t.setTool(e), Z.value = t.toolStyle;
156
197
  }, {
157
198
  immediate: !0,
158
199
  flush: "sync"
159
- }), d(F, (e) => Q?.(e)), ne(() => {
160
- D();
200
+ }), u(N, (e) => Q?.(e)), te(() => {
201
+ w();
161
202
  try {
162
- pe();
203
+ Ce();
163
204
  } finally {
164
- U();
205
+ V();
165
206
  }
166
- }), o(D), d([() => B(C.src), () => C.password], () => void U()), d(() => C.annotations, (e) => {
167
- e && O.value?.annotations.mode === "controlled" && O.value.annotations.setControlledValue(e);
168
- }), d(() => C.tool, (e) => {
169
- e && (F.value = e);
207
+ }), re(w), u([() => be(b.src), () => b.password], () => void V()), u(() => b.annotations, (e) => {
208
+ e && T.value?.annotations.mode === "controlled" && T.value.annotations.setControlledValue(e);
209
+ }), u(() => b.fields, (e) => {
210
+ e && T.value?.form.setControlledValue(e);
211
+ }), u(() => b.tool, (e) => {
212
+ e && (N.value = e);
170
213
  });
171
- function me(e) {
172
- let t = P.value;
173
- F.value === e && t?.active.get() === e && t.set(e), F.value = e, w("update:tool", e);
214
+ function we(e) {
215
+ let t = M.value;
216
+ N.value === e && t?.active.get() === e && t.set(e), N.value = e, x("update:tool", e);
174
217
  }
175
- te(() => {
176
- V++, H();
177
- }), a(() => {
178
- X.value?.destroy(), X.value = null;
218
+ ee(() => {
219
+ R++, B();
220
+ }), ne(() => {
221
+ J.value?.destroy(), J.value = null, Y.value?.destroy(), Y.value = null;
179
222
  });
180
- let $ = r(() => oe(C.signatures ?? ae()));
181
- d($, (e) => void e.refresh(), { immediate: !0 });
182
- let he = v();
223
+ let $ = r(() => se(b.signatures ?? oe()));
224
+ u($, (e) => void e.refresh(), { immediate: !0 });
225
+ let Te = fe();
183
226
  return e({
184
- assets: r(() => C.assets),
185
- document: O,
186
- status: A,
187
- annotations: j,
188
- selection: M,
189
- viewport: N,
190
- tools: P,
191
- tool: F,
192
- setTool: me,
193
- hostTools: r(() => C.tools),
194
- decorateAnnotation: r(() => C.decorateAnnotation),
195
- fonts: r(() => C.fonts ?? se),
196
- toolOptions: he,
227
+ assets: r(() => b.assets),
228
+ document: T,
229
+ status: O,
230
+ annotations: k,
231
+ selection: A,
232
+ viewport: j,
233
+ tools: M,
234
+ tool: N,
235
+ setTool: we,
236
+ hostTools: r(() => b.tools),
237
+ decorateAnnotation: r(() => b.decorateAnnotation),
238
+ fonts: r(() => b.fonts ?? ce),
239
+ toolOptions: Te,
197
240
  signatures: $,
198
- signatureFonts: r(() => C.signatureFonts ?? ce),
241
+ signatureFonts: r(() => b.signatureFonts ?? le),
199
242
  toolStyle: Z,
200
- zoomModel: r(() => C.zoom),
201
- pageModel: r(() => C.page),
202
- reportZoom: (e) => w("update:zoom", e),
203
- reportPage: (e) => w("update:page", e),
204
- activated: I,
205
- setActivated: R,
206
- pluginHost: X,
207
- viewportEl: q,
208
- history: G,
209
- rootEl: E
210
- }), x({
211
- document: O,
212
- status: A,
213
- rootEl: E,
214
- history: G
215
- }), (e, t) => (s(), ee(ie(b), {
243
+ zoomModel: r(() => b.zoom),
244
+ pageModel: r(() => b.page),
245
+ reportZoom: (e) => x("update:zoom", e),
246
+ reportPage: (e) => x("update:page", e),
247
+ activated: P,
248
+ setActivated: I,
249
+ pluginHost: J,
250
+ search: Y,
251
+ viewportEl: G,
252
+ history: U,
253
+ rootEl: C,
254
+ formHighlight: r(() => b.formHighlight),
255
+ reportFormAction: (e) => x("form-action", e),
256
+ reportError: (e) => x("error", e)
257
+ }), y({
258
+ document: T,
259
+ status: O,
260
+ rootEl: C,
261
+ history: U
262
+ }), (e, t) => (ie(), i(ae(v), {
216
263
  ref_key: "primitive",
217
- ref: T,
218
- "as-child": C.asChild,
264
+ ref: S,
265
+ "as-child": b.asChild,
219
266
  as: "div",
220
267
  "data-ink-root": "",
221
- "data-state": A.value.state
268
+ "data-state": O.value.state
222
269
  }, {
223
- default: f(() => [re(e.$slots, "default", {
224
- status: A.value,
225
- document: O.value
270
+ default: d(() => [s(e.$slots, "default", {
271
+ status: O.value,
272
+ document: T.value
226
273
  })]),
227
274
  _: 3
228
275
  }, 8, ["as-child", "data-state"]));
229
276
  }
230
277
  });
231
278
  //#endregion
232
- export { x as default };
279
+ export { y as default };
233
280
 
234
281
  //# sourceMappingURL=InkRoot.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +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","toolController","internalTool","ref","activated","controlled","setActivated","id","noop","identity","src","generation","release","doc","open","gen","refHistory","openDocument","cssVariableDefaults","next","change","cause","error","InkError","s","createRefHistory","list","coreCanUndo","coreCanRedo","inkHistory","fn","store","hostDocument","writable","viewportEl","hostRoot","hostActivated","pluginHost","setUpPlugins","createPluginHost","readonly","toolStyle","setStyleTool","watch","tracker","trackToolStyle","onMounted","onUpdated","t","setTool","tc","onBeforeUnmount","onUnmounted","signatures","createSignatureLibrary","createMemorySignatureStore","lib","toolOptions","createToolOptions","provideInkContext","FONT_FAMILIES","SIGNATURE_FONTS","z","p","openBlock","createBlock","unref","Primitive","withCtx","renderSlot","_ctx"],"sources":["../../src/components/InkRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n createMemorySignatureStore,\n createSignatureLibrary,\n InkError,\n openDocument,\n readonly,\n writable,\n} from '@inkbar/core'\nimport {\n createPluginHost,\n createToolOptions,\n cssVariableDefaults,\n FONT_FAMILIES,\n SIGNATURE_FONTS,\n trackToolStyle,\n} from '@inkbar/core/dom'\nimport { Primitive } from 'reka-ui'\nimport {\n computed,\n onBeforeUnmount,\n onUnmounted,\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 SignatureStore,\n} from '@inkbar/core'\nimport type {\n DecorateAnnotation,\n InkPlugin,\n PluginHost,\n Tool,\n ToolController,\n ToolId,\n ToolStyle,\n Viewport,\n ZoomValue,\n} 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 /**\n * Host tools, added to the built-ins; one with a built-in's id replaces it. Read when a\n * document opens.\n */\n tools?: Tool[] | undefined\n /**\n * Plugins, set up once when the root is created; a later change to this prop is not\n * applied. Their tools join `tools`, their decoration and page layers apply to every\n * document, and their commands are placed with `InkCommand` or `useCommand`.\n */\n plugins?: InkPlugin[] | undefined\n /**\n * Adds `data-*` attributes, classes and a screen-reader description to each annotation's\n * element (see `DecorateAnnotation`). Decorations re-apply whenever the annotations change\n * and when this prop changes, without rebuilding the viewer. Pass a new function when its\n * output would change for any other reason.\n */\n decorateAnnotation?: DecorateAnnotation | undefined\n /**\n * The font families text boxes offer, replacing the PDF standard families\n * (`FONT_FAMILIES`). Fonts beyond those are the PDF writer's to embed.\n */\n fonts?: string[] | undefined\n /**\n * Where saved signatures live. Default: memory, gone on reload.\n * `createLocalSignatureStore` keeps them in the browser; a host can keep them anywhere.\n * A new store takes effect at once, for the menus and the `signature` tool alike.\n */\n signatures?: SignatureStore | undefined\n /** The handwriting fonts a typed signature offers; the host loads them. */\n signatureFonts?: string[] | 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 tools: undefined,\n plugins: undefined,\n decorateAnnotation: undefined,\n fonts: undefined,\n signatures: undefined,\n signatureFonts: 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 toolController = shallowRef<ToolController | null>(null)\nconst internalTool = ref<ToolId>(props.tool ?? 'select-text')\nconst activated = ref<string | null>(null)\n\nconst controlled = computed(() => props.annotations !== undefined)\n\nfunction setActivated(id: string | null): void {\n activated.value = id\n if (id) emit('activate', id)\n}\n\nconst noop = () => {}\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 // Cleared first, so the plugins close their stores while the document is still alive.\n const doc = document.value\n document.value = null\n doc?.destroy()\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 store: () =>\n document.value?.annotations.mode === 'controlled' ? document.value.annotations : null,\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 track: (store) =>\n controlled.value\n ? refHistory.track(store)\n : (document.value?.history.track(store) ?? noop),\n react: (fn) =>\n controlled.value ? refHistory.react(fn) : (document.value?.history.react(fn) ?? noop),\n}\n\n/*\n * One plugin host for the root's life, built once mounted so that no `setup` runs on the\n * server, where nothing would clean it up. Until then `pluginHost` is null, and InkCommand\n * renders its command disabled. The host follows `hostDocument`, which is set after `document`\n * (a sync watch): when the host reads `inkHistory` for a new document, it is that document's\n * history.\n */\nconst hostDocument = writable<InkDocument | null>(null)\nwatch(document, (doc) => hostDocument.set(doc), { flush: 'sync' })\nconst viewportEl = shallowRef<HTMLElement | null>(null)\nconst hostRoot = writable<HTMLElement | null>(null)\nwatch(viewportEl, (el) => hostRoot.set(el), { flush: 'sync' })\nconst hostActivated = writable<string | null>(null)\nwatch(activated, (id) => hostActivated.set(id), { flush: 'sync' })\nconst pluginHost = shallowRef<PluginHost | null>(null)\nfunction setUpPlugins(): void {\n pluginHost.value = createPluginHost({\n plugins: props.plugins ?? [],\n document: readonly(hostDocument),\n history: () => inkHistory,\n activated: readonly(hostActivated),\n // As in `createViewer`: an id not in the open document is ignored.\n setActivated: (id) => {\n if (id === null || document.value?.annotations.get(id)) setActivated(id)\n },\n root: readonly(hostRoot),\n decorate: () => props.decorateAnnotation,\n viewport: () => viewport.value,\n })\n}\n\n/** The document's tool style; it batches through `inkHistory`, whichever mode is on. */\nconst toolStyle = shallowRef<ToolStyle | null>(null)\nlet setStyleTool: ((id: ToolId) => void) | undefined\nwatch(\n document,\n (doc) => {\n if (!doc) {\n toolStyle.value = null\n setStyleTool = undefined\n return\n }\n const tracker = trackToolStyle({\n store: doc.annotations,\n history: { batch: (fn) => inkHistory.batch(fn) },\n // The plugins' tools too, so a plugin tool's style group applies (the host is set by now:\n // it is built on mount, before the first document opens).\n tools: [...(props.tools ?? []), ...(pluginHost.value?.tools ?? [])],\n tool: internalTool.value,\n })\n setStyleTool = (id) => tracker.setTool(id)\n toolStyle.value = tracker.toolStyle\n },\n // Sync: the style is in place before InkViewport's watcher mounts the engine with it.\n { immediate: true, flush: 'sync' }\n)\nwatch(internalTool, (id) => setStyleTool?.(id))\n\n// Plugins and the document on the client only: on the server InkRoot renders its empty slot.\n// The plugins first, so the first document opens with their stores and reactions.\nonMounted(() => {\n syncRootEl()\n // A plugin whose setup throws still leaves the document to open; the error then goes to\n // Vue's error handling (`onErrorCaptured`, `app.config.errorHandler`).\n try {\n setUpPlugins()\n } finally {\n void open()\n }\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 // Picking the active tool again starts it afresh, as after a one-shot tool's use.\n const tc = toolController.value\n if (internalTool.value === id && tc?.active.get() === id) tc.set(id)\n internalTool.value = id\n emit('update:tool', id)\n}\n\nonBeforeUnmount(() => {\n generation++\n release()\n})\n\n// After the children: InkViewport's engine, and the plugin layers with it, are gone by now, as\n// in `createViewer`, so no layer `destroy` runs after the plugins' cleanups.\nonUnmounted(() => {\n pluginHost.value?.destroy()\n pluginHost.value = null\n})\n\nconst signatures = computed(() =>\n createSignatureLibrary(props.signatures ?? createMemorySignatureStore())\n)\nwatch(signatures, (lib) => void lib.refresh(), { immediate: true })\n/** Tool options last as long as the root; the tool style is per document. */\nconst toolOptions = createToolOptions()\n\nprovideInkContext({\n assets: computed(() => props.assets),\n document,\n status,\n annotations: annotationList,\n selection,\n viewport,\n tools: toolController,\n tool: internalTool,\n setTool,\n hostTools: computed(() => props.tools),\n decorateAnnotation: computed(() => props.decorateAnnotation),\n fonts: computed(() => props.fonts ?? FONT_FAMILIES),\n toolOptions,\n signatures,\n signatureFonts: computed(() => props.signatureFonts ?? SIGNATURE_FONTS),\n toolStyle,\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,\n pluginHost,\n viewportEl,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDA,IAAMQ,IAAQC,GAoERC,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,KAAiBC,QAA6BH,EAAS,OAAO,UAAU,MAAM,EAD1D,OAAO,OACmD,CAAI,GAClFI,IAASC,QAA0BJ,EAAS,SAASC,GAAe,KAAK,GACzEI,IAAiBH,QACfH,EAAS,OAAO,YAAY,QAAQ,MAC1C,CAAC,CACH,GACMO,IAAYJ,QACVH,EAAS,OAAO,YAAY,aAAa,MAC/C,CAAC,CACH,GACMQ,IAAWX,EAA4B,IAAI,GAC3CY,IAAiBZ,EAAkC,IAAI,GACvDa,IAAeC,EAAYpB,EAAM,QAAQ,aAAa,GACtDqB,IAAYD,EAAmB,IAAI,GAEnCE,IAAaR,QAAed,EAAM,gBAAgB,KAAA,CAAS;EAEjE,SAASuB,EAAa,GAAyB;GAE7C,AADA,EAAU,QAAQC,GACdA,KAAItB,EAAK,YAAYsB,CAAE;EAC7B;EAEA,IAAMC,UAAa,CAAC;EAGpB,SAASC,EAAS,GAA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B;GAC3D,OAAOc,QAAed,EAAM,SAAS6E,EAAa;GAClD;GACA;GACA,gBAAgB/D,QAAed,EAAM,kBAAkB8E,EAAe;GACtE;GACA,WAAWhE,QAAed,EAAM,IAAI;GACpC,WAAWc,QAAed,EAAM,IAAI;GACpC,aAAa,MAAME,EAAK,eAAe6E,CAAC;GACxC,aAAa,MAAM7E,EAAK,eAAe8E,CAAC;GACxC;GACA;GACA;GACA;GACA,SAASlC;GACT;EACF,CAAC,GAIDhD,EAAa;GAAE;GAAU;GAAQ;GAAQ,SAASgD;EAAW,CAAC,cAI5DtD,EAAA,GAAAC,GAQYC,GAAA0F,CAAA,GAAA;GAPN,SAAA;GAAJ,KAAIjF;GACH,YAAUH,EAAM;GACjB,IAAG;GACH,iBAAA;GACC,cAAYa,EAAA,MAAO;;GAEpB,SAAAlB,QAA8C,CAA9CC,GAA8C2F,EAAA,QAAA,WAAA;IAAvC,QAAQ1E,EAAA;IAAS,UAAUJ,EAAA"}
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","toolController","internalTool","ref","activated","controlled","fieldsControlled","setActivated","id","noop","identity","src","generation","stopFormErrors","release","doc","open","gen","refHistory","openDocument","cssVariableDefaults","next","change","cause","error","InkError","held","s","early","createRefHistory","list","coreCanUndo","coreCanRedo","inkHistory","fn","store","stopKeys","attachHistoryKeys","stopFocus","keepHistoryFocus","onKeydown","onCleanup","hostDocument","writable","viewportEl","hostRoot","hostActivated","pluginHost","search","setUpPlugins","controller","createSearchController","readonly","createPluginHost","viewerSearchOf","root","handleFindKey","pageSelectionText","toolStyle","setStyleTool","watch","tracker","trackToolStyle","onMounted","onUpdated","t","setTool","tc","onBeforeUnmount","onUnmounted","signatures","createSignatureLibrary","createMemorySignatureStore","lib","toolOptions","createToolOptions","provideInkContext","FONT_FAMILIES","SIGNATURE_FONTS","z","p","a","openBlock","createBlock","unref","Primitive","withCtx","renderSlot","_ctx"],"sources":["../../src/components/InkRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n createMemorySignatureStore,\n createSignatureLibrary,\n InkError,\n openDocument,\n readonly,\n writable,\n} from '@inkbar/core'\nimport {\n attachHistoryKeys,\n createPluginHost,\n createSearchController,\n createToolOptions,\n handleFindKey,\n pageSelectionText,\n viewerSearchOf,\n cssVariableDefaults,\n FONT_FAMILIES,\n keepHistoryFocus,\n SIGNATURE_FONTS,\n trackToolStyle,\n} from '@inkbar/core/dom'\nimport { Primitive } from 'reka-ui'\nimport {\n computed,\n onBeforeUnmount,\n onUnmounted,\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 FieldsChange,\n FieldValues,\n FormAction,\n InkDocument,\n PdfAssets,\n SignatureStore,\n} from '@inkbar/core'\nimport type {\n DecorateAnnotation,\n InkPlugin,\n PluginHost,\n SearchController,\n Tool,\n ToolController,\n ToolId,\n ToolStyle,\n Viewport,\n ZoomValue,\n} 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 /**\n * Pass (with `v-model:fields`) to put the form's field values under the host's control. A\n * commit shows at once and is reported after; the host's push wins. The mode is fixed when\n * a document opens, as for `annotations`.\n */\n fields?: FieldValues | undefined\n /** Tints fillable form fields. Default true. A change applies to the open document in place. */\n formHighlight?: boolean | undefined\n tool?: ToolId | undefined\n /**\n * Host tools, added to the built-ins; one with a built-in's id replaces it. Read when a\n * document opens.\n */\n tools?: Tool[] | undefined\n /**\n * Plugins, set up once when the root is created; a later change to this prop is not\n * applied. Their tools join `tools`, their decoration and page layers apply to every\n * document, and their commands are placed with `InkCommand` or `useCommand`.\n */\n plugins?: InkPlugin[] | undefined\n /**\n * Adds `data-*` attributes, classes and a screen-reader description to each annotation's\n * element (see `DecorateAnnotation`). Decorations re-apply whenever the annotations change\n * and when this prop changes, without rebuilding the viewer. Pass a new function when its\n * output would change for any other reason.\n */\n decorateAnnotation?: DecorateAnnotation | undefined\n /**\n * The font families text boxes offer, replacing the PDF standard families\n * (`FONT_FAMILIES`). Fonts beyond those are the PDF writer's to embed.\n */\n fonts?: string[] | undefined\n /**\n * Where saved signatures live. Default: memory, gone on reload.\n * `createLocalSignatureStore` keeps them in the browser; a host can keep them anywhere.\n * A new store takes effect at once, for the menus and the `signature` tool alike.\n */\n signatures?: SignatureStore | undefined\n /** The handwriting fonts a typed signature offers; the host loads them. */\n signatureFonts?: string[] | 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 fields: undefined,\n formHighlight: undefined,\n tool: undefined,\n tools: undefined,\n plugins: undefined,\n decorateAnnotation: undefined,\n fonts: undefined,\n signatures: undefined,\n signatureFonts: 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 /** Committed field values, in full, with what changed them. */\n 'update:fields': [next: FieldValues, change: FieldsChange]\n /** The form asked to submit, open a link, send mail, print or prompt. Inkbar does none. */\n 'form-action': [action: FormAction]\n 'update:tool': [tool: ToolId]\n 'update:page': [page: number]\n 'update:zoom': [zoom: ZoomValue]\n ready: [doc: InkDocument]\n /**\n * Opening failed, or later a form script failed or a signature field refused its signing.\n * An error from while the document opened comes after `ready`.\n */\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 toolController = shallowRef<ToolController | null>(null)\nconst internalTool = ref<ToolId>(props.tool ?? 'select-text')\nconst activated = ref<string | null>(null)\n\nconst controlled = computed(() => props.annotations !== undefined)\nconst fieldsControlled = computed(() => props.fields !== undefined)\n\nfunction setActivated(id: string | null): void {\n activated.value = id\n if (id) emit('activate', id)\n}\n\nconst noop = () => {}\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\nlet stopFormErrors: () => void = noop\nfunction release(): void {\n stopFormErrors()\n stopFormErrors = noop\n // Cleared first, so the plugins close their stores while the document is still alive.\n const doc = document.value\n document.value = null\n doc?.destroy()\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 fields: fieldsControlled.value\n ? {\n mode: 'controlled',\n initial: props.fields ?? {},\n onChange: (next, change) => emit('update:fields', next, change),\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 // The same for the fields; a document whose fields opened uncontrolled ignores the push.\n if (props.fields !== undefined) doc.form.setControlledValue(props.fields)\n // A form script that fails leaves the form fillable; the failure goes to `error`. Subscribed\n // before anyone hears of the document, so the form replays the errors from while it opened\n // here, not to a listener added in `ready`; they are held until `ready` has gone out.\n let held: InkError[] | undefined = []\n stopFormErrors = doc.form.on('error', (e) => {\n if (held) held.push(e)\n else emit('error', e)\n })\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 const early = held\n held = undefined\n if (gen === generation) for (const e of early) emit('error', e)\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 store: () =>\n document.value?.annotations.mode === 'controlled' ? document.value.annotations : null,\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 track: (store) =>\n controlled.value\n ? refHistory.track(store)\n : (document.value?.history.track(store) ?? noop),\n react: (fn) =>\n controlled.value ? refHistory.react(fn) : (document.value?.history.react(fn) ?? noop),\n}\n\n// The undo and redo keys anywhere in the root do what InkUndo and InkRedo do. When either\n// button undoes or redoes the last step and disables itself, focus goes back to the document.\n// The find key listens here too.\nwatch(\n rootEl,\n (el, _prev, onCleanup) => {\n if (!el) return\n const stopKeys = attachHistoryKeys(el, () => ({\n canUndo: inkHistory.canUndo.value,\n canRedo: inkHistory.canRedo.value,\n undo: inkHistory.undo,\n redo: inkHistory.redo,\n }))\n const stopFocus = keepHistoryFocus(el, () =>\n el.querySelector<HTMLElement>('[data-ink-scroll]')\n )\n // Not a template listener: Vue leaves those on the element when it unmounts.\n el.addEventListener('keydown', onKeydown)\n onCleanup(() => {\n stopKeys()\n stopFocus()\n el.removeEventListener('keydown', onKeydown)\n })\n },\n { immediate: true }\n)\n\n/*\n * One plugin host for the root's life, built once mounted so that no `setup` runs on the\n * server, where nothing would clean it up. Until then `pluginHost` is null, and InkCommand\n * renders its command disabled. The host follows `hostDocument`, which is set after `document`\n * (a sync watch): when the host reads `inkHistory` for a new document, it is that document's\n * history.\n */\nconst hostDocument = writable<InkDocument | null>(null)\nwatch(document, (doc) => hostDocument.set(doc), { flush: 'sync' })\nconst viewportEl = shallowRef<HTMLElement | null>(null)\nconst hostRoot = writable<HTMLElement | null>(null)\nwatch(viewportEl, (el) => hostRoot.set(el), { flush: 'sync' })\nconst hostActivated = writable<string | null>(null)\nwatch(activated, (id) => hostActivated.set(id), { flush: 'sync' })\nconst pluginHost = shallowRef<PluginHost | null>(null)\n/** One search controller for the root's life, built with the plugin host that shares it. */\nconst search = shallowRef<SearchController | null>(null)\nfunction setUpPlugins(): void {\n const controller = createSearchController({\n document: readonly(hostDocument),\n viewport: () => viewport.value,\n })\n search.value = controller\n pluginHost.value = createPluginHost({\n plugins: props.plugins ?? [],\n document: readonly(hostDocument),\n history: () => inkHistory,\n activated: readonly(hostActivated),\n // As in `createViewer`: an id not in the open document is ignored.\n setActivated: (id) => {\n if (id === null || document.value?.annotations.get(id)) setActivated(id)\n },\n root: readonly(hostRoot),\n decorate: () => props.decorateAnnotation,\n viewport: () => viewport.value,\n search: viewerSearchOf(controller),\n })\n}\n\n/** Ctrl/Cmd+F while focus is in the root and a find bar is mounted; else the browser's. */\nfunction onKeydown(e: KeyboardEvent): void {\n const controller = search.value\n const root = e.currentTarget\n if (controller && root instanceof HTMLElement)\n handleFindKey(e, controller, () => pageSelectionText(root))\n}\n\n/** The document's tool style; it batches through `inkHistory`, whichever mode is on. */\nconst toolStyle = shallowRef<ToolStyle | null>(null)\nlet setStyleTool: ((id: ToolId) => void) | undefined\nwatch(\n document,\n (doc) => {\n if (!doc) {\n toolStyle.value = null\n setStyleTool = undefined\n return\n }\n const tracker = trackToolStyle({\n store: doc.annotations,\n history: { batch: (fn) => inkHistory.batch(fn) },\n // The plugins' tools too, so a plugin tool's style group applies (the host is set by now:\n // it is built on mount, before the first document opens).\n tools: [...(props.tools ?? []), ...(pluginHost.value?.tools ?? [])],\n tool: internalTool.value,\n })\n setStyleTool = (id) => tracker.setTool(id)\n toolStyle.value = tracker.toolStyle\n },\n // Sync: the style is in place before InkViewport's watcher mounts the engine with it.\n { immediate: true, flush: 'sync' }\n)\nwatch(internalTool, (id) => setStyleTool?.(id))\n\n// Plugins and the document on the client only: on the server InkRoot renders its empty slot.\n// The plugins first, so the first document opens with their stores and reactions.\nonMounted(() => {\n syncRootEl()\n // A plugin whose setup throws still leaves the document to open; the error then goes to\n // Vue's error handling (`onErrorCaptured`, `app.config.errorHandler`).\n try {\n setUpPlugins()\n } finally {\n void open()\n }\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.fields,\n (next) => {\n if (next) document.value?.form.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 // Picking the active tool again starts it afresh, as after a one-shot tool's use.\n const tc = toolController.value\n if (internalTool.value === id && tc?.active.get() === id) tc.set(id)\n internalTool.value = id\n emit('update:tool', id)\n}\n\nonBeforeUnmount(() => {\n generation++\n release()\n})\n\n// After the children: InkViewport's engine, and the plugin layers with it, are gone by now, as\n// in `createViewer`, so no layer `destroy` runs after the plugins' cleanups.\nonUnmounted(() => {\n pluginHost.value?.destroy()\n pluginHost.value = null\n search.value?.destroy()\n search.value = null\n})\n\nconst signatures = computed(() =>\n createSignatureLibrary(props.signatures ?? createMemorySignatureStore())\n)\nwatch(signatures, (lib) => void lib.refresh(), { immediate: true })\n/** Tool options last as long as the root; the tool style is per document. */\nconst toolOptions = createToolOptions()\n\nprovideInkContext({\n assets: computed(() => props.assets),\n document,\n status,\n annotations: annotationList,\n selection,\n viewport,\n tools: toolController,\n tool: internalTool,\n setTool,\n hostTools: computed(() => props.tools),\n decorateAnnotation: computed(() => props.decorateAnnotation),\n fonts: computed(() => props.fonts ?? FONT_FAMILIES),\n toolOptions,\n signatures,\n signatureFonts: computed(() => props.signatureFonts ?? SIGNATURE_FONTS),\n toolStyle,\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,\n pluginHost,\n search,\n viewportEl,\n history: inkHistory,\n rootEl,\n formHighlight: computed(() => props.formHighlight),\n reportFormAction: (a) => emit('form-action', a),\n reportError: (e) => emit('error', e),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEA,IAAMQ,IAAQC,GA8ERC,IAAOH,IAsBPI,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,EAAS,OAAO,YAA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AUH,EAAM;GACjB,IAAG;GACH,iBAAA;GACC,cAAYa,EAAA,MAAO;;GAEpB,SAAAlB,QAA8C,CAA9CC,EAA8C6G,EAAA,QAAA,WAAA;IAAvC,QAAQ5F,EAAA;IAAS,UAAUJ,EAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkSearchButton.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkSearchButton.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkSearchButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkSearchButton.js","names":["_sfc_main","InkSearchButton_vue_vue_type_script_setup_true_lang_default","InkSearchButton_default"],"sources":["../../src/components/InkSearchButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * Opens the find bar; pressed while it is open. Pressing it again focuses the field. Place it\n * in a toolbar next to `InkFindBar`, which it needs for the field to focus.\n */\nimport { Search } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed, mergeProps, nextTick } from 'vue'\n\nimport { useDocument } from '../composables/useDocument'\nimport { useSearch } from '../composables/useSearch'\nimport { useInkContext } from '../context'\n\nimport InkIcon from './InkIcon.vue'\n\n// Bound below, under the button's own label, so a caller's attributes cannot replace its copy.\ndefineOptions({ inheritAttrs: false })\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst ctx = useInkContext('InkSearchButton')\nconst { state, open } = useSearch()\nconst { isReady } = useDocument()\n\nasync function onClick(): Promise<void> {\n open()\n // The bar shows on the next render; its field takes focus then.\n await nextTick()\n const field = ctx.rootEl.value?.querySelector<HTMLInputElement>(\n '[data-ink-find-bar] input'\n )\n field?.focus()\n field?.select()\n}\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = computed(() => ({\n 'aria-label': 'Find',\n title: 'Find',\n 'aria-pressed': state.value.open,\n 'data-state': state.value.open ? 'on' : 'off',\n onClick,\n}))\n/** Disabled until a document is open, whatever the caller's `disabled` says, as in React and Svelte. */\nconst disabled = (fromCaller: unknown): boolean =>\n !isReady.value || (fromCaller != null && fromCaller !== false)\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-search-button\"\n data-ink-search-button\n v-bind=\"mergeProps($attrs, attrs, { disabled: disabled($attrs.disabled) })\"\n >\n <slot><InkIcon :icon=\"Search\" /></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=InkSearchButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkSearchButton.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkSearchButton.vue"],"names":[],"mappings":"AA4EA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAwEzC,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,43 @@
1
+ import { useInkContext as e } from "../context.js";
2
+ import { useDocument as t } from "../composables/useDocument.js";
3
+ import { useSearch as n } from "../composables/useSearch.js";
4
+ import r from "./InkIcon.js";
5
+ import { computed as i, createBlock as a, createVNode as o, defineComponent as s, mergeProps as c, nextTick as l, openBlock as u, renderSlot as d, unref as f, withCtx as p } from "vue";
6
+ import { ToolbarButton as m } from "reka-ui";
7
+ import { Search as h } from "@inkbar/icons";
8
+ //#region src/components/InkSearchButton.vue?vue&type=script&setup=true&lang.ts
9
+ var g = /*@__PURE__*/ s({
10
+ inheritAttrs: !1,
11
+ __name: "InkSearchButton",
12
+ props: { asChild: {
13
+ type: Boolean,
14
+ default: !1
15
+ } },
16
+ setup(s) {
17
+ let g = e("InkSearchButton"), { state: _, open: v } = n(), { isReady: y } = t();
18
+ async function b() {
19
+ v(), await l();
20
+ let e = g.rootEl.value?.querySelector("[data-ink-find-bar] input");
21
+ e?.focus(), e?.select();
22
+ }
23
+ let x = i(() => ({
24
+ "aria-label": "Find",
25
+ title: "Find",
26
+ "aria-pressed": _.value.open,
27
+ "data-state": _.value.open ? "on" : "off",
28
+ onClick: b
29
+ })), S = (e) => !y.value || e != null && e !== !1;
30
+ return (e, t) => (u(), a(f(m), c({
31
+ "as-child": s.asChild,
32
+ class: "ink-search-button",
33
+ "data-ink-search-button": ""
34
+ }, c(e.$attrs, x.value, { disabled: S(e.$attrs.disabled) })), {
35
+ default: p(() => [d(e.$slots, "default", {}, () => [o(r, { icon: f(h) }, null, 8, ["icon"])])]),
36
+ _: 3
37
+ }, 16, ["as-child"]));
38
+ }
39
+ });
40
+ //#endregion
41
+ export { g as default };
42
+
43
+ //# sourceMappingURL=InkSearchButton.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InkSearchButton.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createVNode","InkIcon","InkIcon_default","InkSearchButton_vue_vue_type_script_setup_true_lang_default","ctx","useInkContext","useSearch","useDocument","onClick","open","nextTick","field","attrs","computed","state","disabled","isReady","fromCaller","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","_ctx","withCtx","renderSlot","createVNode","Search"],"sources":["../../src/components/InkSearchButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * Opens the find bar; pressed while it is open. Pressing it again focuses the field. Place it\n * in a toolbar next to `InkFindBar`, which it needs for the field to focus.\n */\nimport { Search } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed, mergeProps, nextTick } from 'vue'\n\nimport { useDocument } from '../composables/useDocument'\nimport { useSearch } from '../composables/useSearch'\nimport { useInkContext } from '../context'\n\nimport InkIcon from './InkIcon.vue'\n\n// Bound below, under the button's own label, so a caller's attributes cannot replace its copy.\ndefineOptions({ inheritAttrs: false })\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst ctx = useInkContext('InkSearchButton')\nconst { state, open } = useSearch()\nconst { isReady } = useDocument()\n\nasync function onClick(): Promise<void> {\n open()\n // The bar shows on the next render; its field takes focus then.\n await nextTick()\n const field = ctx.rootEl.value?.querySelector<HTMLInputElement>(\n '[data-ink-find-bar] input'\n )\n field?.focus()\n field?.select()\n}\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = computed(() => ({\n 'aria-label': 'Find',\n title: 'Find',\n 'aria-pressed': state.value.open,\n 'data-state': state.value.open ? 'on' : 'off',\n onClick,\n}))\n/** Disabled until a document is open, whatever the caller's `disabled` says, as in React and Svelte. */\nconst disabled = (fromCaller: unknown): boolean =>\n !isReady.value || (fromCaller != null && fromCaller !== false)\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-search-button\"\n data-ink-search-button\n v-bind=\"mergeProps($attrs, attrs, { disabled: disabled($attrs.disabled) })\"\n >\n <slot><InkIcon :icon=\"Search\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAmBA,IAAMW,IAAMC,EAAc,iBAAiB,GACrC,EAAE,UAAO,YAASC,EAAU,GAC5B,EAAE,eAAYC,EAAY;EAEhC,eAAeC,IAAyB;GAGtC,AAFAC,EAAK,GAEL,MAAMC,EAAS;GACf,IAAMC,IAAQP,EAAI,OAAO,OAAO,cAC9B,2BACF;GAEA,AADAO,GAAO,MAAM,GACbA,GAAO,OAAO;EAChB;EAEA,IAAMC,IAAQC,SAAgB;GAC5B,cAAc;GACd,OAAO;GACP,gBAAgBC,EAAM,MAAM;GAC5B,cAAcA,EAAM,MAAM,OAAO,OAAO;GACxC;EACF,EAAE,GAEIC,KAAY,MAChB,CAACC,EAAQ,SAAUC,KAAc,QAAQA,MAAe;oBAIxDvB,EAAA,GAAAC,EAOgBC,EAAAyB,CAAA,GAPhBxB,EAOgB;GANb,YAAU0B,EAAA;GACX,OAAM;GACN,0BAAA;EACQ,GAAAD,EAAW7B,EAAAA,QAAQmB,EAAA,OAAK,EAAA,UAAcG,EAAStB,EAAAA,OAAO,QAAQ,EAAA,CAAA,CAAA,GAAA;GAEtE,SAAAK,QAAuC,CAAvCC,EAAuCyB,EAAA,QAAA,WAAA,CAAA,SAAA,CAAjCxB,EAA0BC,GAAA,EAAhB,MAAML,EAAAgC,CAAA,EAAM,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./InkSignFieldPopover.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/InkSignFieldPopover.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=InkSignFieldPopover.js.map