@inkbar/vue 0.4.0 → 0.6.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 (73) hide show
  1. package/README.md +23 -7
  2. package/dist/components/InkAnnotation.js.map +1 -1
  3. package/dist/components/InkAnnotation.vue.d.ts.map +1 -1
  4. package/dist/components/InkAnnotation.vue_vue_type_script_setup_true_lang.js +16 -24
  5. package/dist/components/InkAnnotation.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/InkColorMenu.js.map +1 -1
  7. package/dist/components/InkColorMenu.vue.d.ts +2 -0
  8. package/dist/components/InkColorMenu.vue.d.ts.map +1 -1
  9. package/dist/components/InkColorMenu.vue_vue_type_script_setup_true_lang.js +3 -2
  10. package/dist/components/InkColorMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/InkCommand.js +7 -0
  12. package/dist/components/InkCommand.js.map +1 -0
  13. package/dist/components/InkCommand.vue.d.ts +23 -0
  14. package/dist/components/InkCommand.vue.d.ts.map +1 -0
  15. package/dist/components/InkCommand.vue_vue_type_script_setup_true_lang.js +51 -0
  16. package/dist/components/InkCommand.vue_vue_type_script_setup_true_lang.js.map +1 -0
  17. package/dist/components/InkHighlightMenu.js.map +1 -1
  18. package/dist/components/InkHighlightMenu.vue.d.ts +2 -2
  19. package/dist/components/InkHighlightMenu.vue.d.ts.map +1 -1
  20. package/dist/components/InkHighlightMenu.vue_vue_type_script_setup_true_lang.js +118 -108
  21. package/dist/components/InkHighlightMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/InkPageInput.js.map +1 -1
  23. package/dist/components/InkPageInput.vue.d.ts.map +1 -1
  24. package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js +1 -1
  25. package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/InkRoot.js.map +1 -1
  27. package/dist/components/InkRoot.vue.d.ts +415 -424
  28. package/dist/components/InkRoot.vue.d.ts.map +1 -1
  29. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +145 -102
  30. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
  31. package/dist/components/InkShapeMenu.js.map +1 -1
  32. package/dist/components/InkShapeMenu.vue.d.ts +2 -2
  33. package/dist/components/InkShapeMenu.vue.d.ts.map +1 -1
  34. package/dist/components/InkShapeMenu.vue_vue_type_script_setup_true_lang.js +99 -91
  35. package/dist/components/InkShapeMenu.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 +2 -2
  38. package/dist/components/InkSignatureMenu.vue.d.ts.map +1 -1
  39. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js +156 -151
  40. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  41. package/dist/components/InkToolButton.js.map +1 -1
  42. package/dist/components/InkToolButton.vue.d.ts.map +1 -1
  43. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +36 -35
  44. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  45. package/dist/components/InkViewport.js.map +1 -1
  46. package/dist/components/InkViewport.vue.d.ts.map +1 -1
  47. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +14 -4
  48. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -1
  49. package/dist/composables/useAnnotations.d.ts +915 -1386
  50. package/dist/composables/useAnnotations.d.ts.map +1 -1
  51. package/dist/composables/useAnnotations.js +13 -18
  52. package/dist/composables/useAnnotations.js.map +1 -1
  53. package/dist/composables/useCommand.d.ts +23 -0
  54. package/dist/composables/useCommand.d.ts.map +1 -0
  55. package/dist/composables/useCommand.js +22 -0
  56. package/dist/composables/useCommand.js.map +1 -0
  57. package/dist/context.d.ts +22 -4
  58. package/dist/context.d.ts.map +1 -1
  59. package/dist/context.js.map +1 -1
  60. package/dist/index.d.ts +4 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +27 -26
  63. package/dist/ref-history.d.ts +12 -3
  64. package/dist/ref-history.d.ts.map +1 -1
  65. package/dist/ref-history.js +27 -16
  66. package/dist/ref-history.js.map +1 -1
  67. package/package.json +5 -5
  68. package/dist/components/InkSuggestionCard.js +0 -7
  69. package/dist/components/InkSuggestionCard.js.map +0 -1
  70. package/dist/components/InkSuggestionCard.vue.d.ts +0 -16
  71. package/dist/components/InkSuggestionCard.vue.d.ts.map +0 -1
  72. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js +0 -85
  73. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useAnnotations.d.ts","sourceRoot":"","sources":["../../src/composables/useAnnotations.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEhF,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;iBACf,MAAM,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAC9B,MAAM;kBACL,MAAM,EAAE;IACtB,+CAA+C;kBACjC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEvB"}
@@ -1,27 +1,22 @@
1
1
  import { useInkContext as e } from "../context.js";
2
2
  import { computed as t } from "vue";
3
- import { acceptSuggestion as n, repliesTo as r } from "@inkbar/core";
3
+ import { repliesTo as n } from "@inkbar/core";
4
4
  //#region src/composables/useAnnotations.ts
5
- function i() {
6
- let i = e("useAnnotations()"), a = () => i.document.value?.annotations;
5
+ function r() {
6
+ let r = e("useAnnotations()"), i = () => r.document.value?.annotations;
7
7
  return {
8
- annotations: i.annotations,
9
- selection: i.selection,
10
- selected: t(() => i.selection.value.map((e) => i.annotations.value.find((t) => t.id === e)).filter((e) => !!e)),
11
- byPage: (e) => i.annotations.value.filter((t) => t.page === e),
12
- add: (e) => a()?.add(e),
13
- update: (e, t) => a()?.update(e, t),
14
- remove: (e) => a()?.remove(e) ?? !1,
15
- select: (e) => a()?.select(e),
16
- replies: (e) => r(i.annotations.value, e),
17
- accept: (e) => {
18
- let t = a();
19
- return t ? n(t, e) : void 0;
20
- },
21
- dismiss: (e) => a()?.remove(e) ?? !1
8
+ annotations: r.annotations,
9
+ selection: r.selection,
10
+ selected: t(() => r.selection.value.map((e) => r.annotations.value.find((t) => t.id === e)).filter((e) => !!e)),
11
+ byPage: (e) => r.annotations.value.filter((t) => t.page === e),
12
+ add: (e) => i()?.add(e),
13
+ update: (e, t) => i()?.update(e, t),
14
+ remove: (e) => i()?.remove(e) ?? !1,
15
+ select: (e) => i()?.select(e),
16
+ replies: (e) => n(r.annotations.value, e)
22
17
  };
23
18
  }
24
19
  //#endregion
25
- export { i as useAnnotations };
20
+ export { r as useAnnotations };
26
21
 
27
22
  //# sourceMappingURL=useAnnotations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAnnotations.js","names":["useAnnotations","ctx","useInkContext","store","computed","a","id","page","input","patch","ids","repliesTo","s","acceptSuggestion"],"sources":["../../src/composables/useAnnotations.ts"],"sourcesContent":["import { acceptSuggestion, repliesTo } from '@inkbar/core'\nimport { computed } from 'vue'\n\nimport { useInkContext } from '../context'\n\nimport type { Annotation, AnnotationInput, AnnotationPatch } from '@inkbar/core'\n\nexport function useAnnotations() {\n const ctx = useInkContext('useAnnotations()')\n const store = () => ctx.document.value?.annotations\n return {\n annotations: ctx.annotations,\n selection: ctx.selection,\n selected: computed(() =>\n ctx.selection.value\n .map((id) => ctx.annotations.value.find((a) => a.id === id))\n .filter((a): a is Annotation => !!a)\n ),\n byPage: (page: number) => ctx.annotations.value.filter((a) => a.page === page),\n add: (input: AnnotationInput) => store()?.add(input),\n update: (id: string, patch: AnnotationPatch) => store()?.update(id, patch),\n remove: (id: string) => store()?.remove(id) ?? false,\n select: (ids: string[]) => store()?.select(ids),\n /** Replies in creation order for a note id. */\n replies: (id: string) => repliesTo(ctx.annotations.value, id),\n /** Keeps a suggested redaction as the user's own, in the default redaction colour. */\n accept: (id: string) => {\n const s = store()\n return s ? acceptSuggestion(s, id) : undefined\n },\n dismiss: (id: string) => store()?.remove(id) ?? false,\n }\n}\n"],"mappings":";;;;AAOA,SAAgBA,IAAiB;CAC/B,IAAMC,IAAMC,EAAc,kBAAkB,GACtCC,UAAcF,EAAI,SAAS,OAAO;CACxC,OAAO;EACL,aAAaA,EAAI;EACjB,WAAWA,EAAI;EACf,UAAUG,QACRH,EAAI,UAAU,MACX,KAAK,MAAOA,EAAI,YAAY,MAAM,MAAM,MAAMI,EAAE,OAAOC,CAAE,CAAC,CAAC,CAC3D,QAAQ,MAAuB,CAAC,CAACD,CAAC,CACvC;EACA,SAAS,MAAiBJ,EAAI,YAAY,MAAM,QAAQ,MAAMI,EAAE,SAASE,CAAI;EAC7E,MAAM,MAA2BJ,EAAM,CAAC,EAAE,IAAIK,CAAK;EACnD,SAAS,GAAY,MAA2BL,EAAM,CAAC,EAAE,OAAOG,GAAIG,CAAK;EACzE,SAAS,MAAeN,EAAM,CAAC,EAAE,OAAOG,CAAE,KAAK;EAC/C,SAAS,MAAkBH,EAAM,CAAC,EAAE,OAAOO,CAAG;EAE9C,UAAU,MAAeC,EAAUV,EAAI,YAAY,OAAOK,CAAE;EAE5D,SAAS,MAAe;GACtB,IAAMM,IAAIT,EAAM;GAChB,OAAOS,IAAIC,EAAiBD,GAAGN,CAAE,IAAI,KAAA;EACvC;EACA,UAAU,MAAeH,EAAM,CAAC,EAAE,OAAOG,CAAE,KAAK;CAClD;AACF"}
1
+ {"version":3,"file":"useAnnotations.js","names":["useAnnotations","ctx","useInkContext","store","computed","a","id","page","input","patch","ids","repliesTo"],"sources":["../../src/composables/useAnnotations.ts"],"sourcesContent":["import { repliesTo } from '@inkbar/core'\nimport { computed } from 'vue'\n\nimport { useInkContext } from '../context'\n\nimport type { Annotation, AnnotationInput, AnnotationPatch } from '@inkbar/core'\n\nexport function useAnnotations() {\n const ctx = useInkContext('useAnnotations()')\n const store = () => ctx.document.value?.annotations\n return {\n annotations: ctx.annotations,\n selection: ctx.selection,\n selected: computed(() =>\n ctx.selection.value\n .map((id) => ctx.annotations.value.find((a) => a.id === id))\n .filter((a): a is Annotation => !!a)\n ),\n byPage: (page: number) => ctx.annotations.value.filter((a) => a.page === page),\n add: (input: AnnotationInput) => store()?.add(input),\n update: (id: string, patch: AnnotationPatch) => store()?.update(id, patch),\n remove: (id: string) => store()?.remove(id) ?? false,\n select: (ids: string[]) => store()?.select(ids),\n /** Replies in creation order for a note id. */\n replies: (id: string) => repliesTo(ctx.annotations.value, id),\n }\n}\n"],"mappings":";;;;AAOA,SAAgBA,IAAiB;CAC/B,IAAMC,IAAMC,EAAc,kBAAkB,GACtCC,UAAcF,EAAI,SAAS,OAAO;CACxC,OAAO;EACL,aAAaA,EAAI;EACjB,WAAWA,EAAI;EACf,UAAUG,QACRH,EAAI,UAAU,MACX,KAAK,MAAOA,EAAI,YAAY,MAAM,MAAM,MAAMI,EAAE,OAAOC,CAAE,CAAC,CAAC,CAC3D,QAAQ,MAAuB,CAAC,CAACD,CAAC,CACvC;EACA,SAAS,MAAiBJ,EAAI,YAAY,MAAM,QAAQ,MAAMI,EAAE,SAASE,CAAI;EAC7E,MAAM,MAA2BJ,EAAM,CAAC,EAAE,IAAIK,CAAK;EACnD,SAAS,GAAY,MAA2BL,EAAM,CAAC,EAAE,OAAOG,GAAIG,CAAK;EACzE,SAAS,MAAeN,EAAM,CAAC,EAAE,OAAOG,CAAE,KAAK;EAC/C,SAAS,MAAkBH,EAAM,CAAC,EAAE,OAAOO,CAAG;EAE9C,UAAU,MAAeC,EAAUV,EAAI,YAAY,OAAOK,CAAE;CAC9D;AACF"}
@@ -0,0 +1,23 @@
1
+ import { IconNode } from '@inkbar/icons';
2
+ import { Ref } from 'vue';
3
+ export interface CommandHandle {
4
+ /** Runs the command; does nothing while it is busy or disabled. Never rejects. */
5
+ run(): Promise<void>;
6
+ /** A ready document (or the plugin's own condition), and not busy. */
7
+ enabled: Readonly<Ref<boolean>>;
8
+ busy: Readonly<Ref<boolean>>;
9
+ /** The command's progress or result message, `''` without one. */
10
+ status: Readonly<Ref<string>>;
11
+ /** `''` until the plugins are set up. */
12
+ label: Readonly<Ref<string>>;
13
+ icon: Readonly<Ref<IconNode | undefined>>;
14
+ }
15
+ /**
16
+ * A plugin command by its namespaced id (`sandbox.suggest`), for hosts building their own
17
+ * control. Plugins are set up once InkRoot has mounted, so until then (and on the server) the
18
+ * command is disabled with no label; it fills in then. Once they are set up, an id no plugin
19
+ * passed to InkRoot registered stays that way, and logs `InkError('UnknownCommand')` to the
20
+ * console once.
21
+ */
22
+ export declare function useCommand(id: string): CommandHandle;
23
+ //# sourceMappingURL=useCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCommand.d.ts","sourceRoot":"","sources":["../../src/composables/useCommand.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACpB,sEAAsE;IACtE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5B,kEAAkE;IAClE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7B,yCAAyC;IACzC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAA;CAC1C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAmBpD"}
@@ -0,0 +1,22 @@
1
+ import { useInkContext as e } from "../context.js";
2
+ import { useReadable as t } from "../use-readable.js";
3
+ import { computed as n, watch as r } from "vue";
4
+ import { unknownCommand as i } from "@inkbar/core/dom";
5
+ //#region src/composables/useCommand.ts
6
+ function a(a) {
7
+ let o = e("useCommand()").pluginHost, s = n(() => o.value?.command(a));
8
+ return r(o, (e) => {
9
+ e && !e.command(a) && console.error(i(a, [...e.commands.keys()]));
10
+ }, { immediate: !0 }), {
11
+ run: async () => s.value?.run(),
12
+ enabled: t(() => s.value?.enabled, !1),
13
+ busy: t(() => s.value?.busy, !1),
14
+ status: t(() => s.value?.status, ""),
15
+ label: n(() => s.value?.label ?? ""),
16
+ icon: n(() => s.value?.icon)
17
+ };
18
+ }
19
+ //#endregion
20
+ export { a as useCommand };
21
+
22
+ //# sourceMappingURL=useCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCommand.js","names":["useCommand","host","useInkContext","command","computed","id","watch","set","unknownCommand","useReadable"],"sources":["../../src/composables/useCommand.ts"],"sourcesContent":["import { unknownCommand } from '@inkbar/core/dom'\nimport { computed, watch } from 'vue'\n\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport type { IconNode } from '@inkbar/icons'\nimport type { Ref } from 'vue'\n\nexport interface CommandHandle {\n /** Runs the command; does nothing while it is busy or disabled. Never rejects. */\n run(): Promise<void>\n /** A ready document (or the plugin's own condition), and not busy. */\n enabled: Readonly<Ref<boolean>>\n busy: Readonly<Ref<boolean>>\n /** The command's progress or result message, `''` without one. */\n status: Readonly<Ref<string>>\n /** `''` until the plugins are set up. */\n label: Readonly<Ref<string>>\n icon: Readonly<Ref<IconNode | undefined>>\n}\n\n/**\n * A plugin command by its namespaced id (`sandbox.suggest`), for hosts building their own\n * control. Plugins are set up once InkRoot has mounted, so until then (and on the server) the\n * command is disabled with no label; it fills in then. Once they are set up, an id no plugin\n * passed to InkRoot registered stays that way, and logs `InkError('UnknownCommand')` to the\n * console once.\n */\nexport function useCommand(id: string): CommandHandle {\n const host = useInkContext('useCommand()').pluginHost\n const command = computed(() => host.value?.command(id))\n watch(\n host,\n (set) => {\n if (set && !set.command(id))\n console.error(unknownCommand(id, [...set.commands.keys()]))\n },\n { immediate: true }\n )\n return {\n run: async () => command.value?.run(),\n enabled: useReadable(() => command.value?.enabled, false),\n busy: useReadable(() => command.value?.busy, false),\n status: useReadable(() => command.value?.status, ''),\n label: computed(() => command.value?.label ?? ''),\n icon: computed(() => command.value?.icon),\n }\n}\n"],"mappings":";;;;;AA6BA,SAAgBA,EAAW,GAA2B;CACpD,IAAMC,IAAOC,EAAc,cAAc,CAAC,CAAC,YACrCC,IAAUC,QAAeH,EAAK,OAAO,QAAQI,CAAE,CAAC;CAStD,OARAC,EACEL,IACC,MAAQ;EACP,AAAIM,KAAO,CAACA,EAAI,QAAQF,CAAE,KACxB,QAAQ,MAAMG,EAAeH,GAAI,CAAC,GAAGE,EAAI,SAAS,KAAK,CAAC,CAAC,CAAC;CAC9D,GACA,EAAE,WAAW,GAAK,CACpB,GACO;EACL,KAAK,YAAYJ,EAAQ,OAAO,IAAI;EACpC,SAASM,QAAkBN,EAAQ,OAAO,SAAS,EAAK;EACxD,MAAMM,QAAkBN,EAAQ,OAAO,MAAM,EAAK;EAClD,QAAQM,QAAkBN,EAAQ,OAAO,QAAQ,EAAE;EACnD,OAAOC,QAAeD,EAAQ,OAAO,SAAS,EAAE;EAChD,MAAMC,QAAeD,EAAQ,OAAO,IAAI;CAC1C;AACF"}
package/dist/context.d.ts CHANGED
@@ -1,9 +1,12 @@
1
- import { Annotation, InkDocument, InkStatus, PdfAssets, SignatureLibrary } from '@inkbar/core';
2
- import { Tool, ToolController, ToolId, ToolOptions, ToolStyle, Viewport, ZoomValue } from '@inkbar/core/dom';
1
+ import { Annotation, InkDocument, InkStatus, PdfAssets, PluginHistory, SignatureLibrary } from '@inkbar/core';
2
+ import { DecorateAnnotation, PluginHost, Tool, ToolController, ToolId, ToolOptions, ToolStyle, Viewport, ZoomValue } from '@inkbar/core/dom';
3
3
  import { Ref, ShallowRef } from 'vue';
4
4
  export type { InkStatus };
5
- /** Undo and redo for the current document, whichever mode its annotations are in. */
6
- export interface InkHistory {
5
+ /**
6
+ * Undo and redo for the current document, whichever mode its annotations are in. `track` and
7
+ * `react` (from `PluginHistory`) reach the same history, so plugin stores undo with the edits.
8
+ */
9
+ export interface InkHistory extends PluginHistory {
7
10
  canUndo: Readonly<Ref<boolean>>;
8
11
  canRedo: Readonly<Ref<boolean>>;
9
12
  undo: () => void;
@@ -24,6 +27,14 @@ export interface InkContext {
24
27
  status: Readonly<Ref<InkStatus>>;
25
28
  annotations: Readonly<Ref<readonly Annotation[]>>;
26
29
  selection: Readonly<Ref<readonly string[]>>;
30
+ /**
31
+ * The plugins from InkRoot's `plugins` prop, set up once the root has mounted and kept for
32
+ * its life; `null` before that (and on the server) and once it unmounts. InkViewport hands it
33
+ * to the engine; InkCommand places its commands.
34
+ */
35
+ pluginHost: Readonly<ShallowRef<PluginHost | null>>;
36
+ /** InkViewport's scroll element while it is mounted: the plugins' `root`. */
37
+ viewportEl: ShallowRef<HTMLElement | null>;
27
38
  /** Set by InkViewport once it has mounted its viewport and tool controller. */
28
39
  viewport: ShallowRef<Viewport | null>;
29
40
  tools: ShallowRef<ToolController | null>;
@@ -32,6 +43,8 @@ export interface InkContext {
32
43
  setTool(id: ToolId): void;
33
44
  /** Host tools from InkRoot's `tools` prop; InkViewport registers them. */
34
45
  hostTools: Readonly<Ref<Tool[] | undefined>>;
46
+ /** InkRoot's `decorateAnnotation` prop. InkViewport re-applies decorations when it changes. */
47
+ decorateAnnotation: Readonly<Ref<DecorateAnnotation | undefined>>;
35
48
  /** The font families text boxes offer: InkRoot's `fonts`, else `FONT_FAMILIES`. */
36
49
  fonts: Readonly<Ref<readonly string[]>>;
37
50
  /** The tools' options for InkRoot's life, so they persist across documents. */
@@ -49,6 +62,11 @@ export interface InkContext {
49
62
  reportPage(p: number): void;
50
63
  /** Last activated annotation (Enter, click with the note tool, etc.). Popovers key off this. */
51
64
  activated: Readonly<Ref<string | null>>;
65
+ /**
66
+ * Activates annotation `id`, or clears the activation with `null`. This is the context's
67
+ * own: unlike core's `Viewer.setActivated`, it emits InkRoot's `activate` for an id, and it
68
+ * does not check that the id is in the document.
69
+ */
52
70
  setActivated(id: string | null): void;
53
71
  history: InkHistory;
54
72
  rootEl: Readonly<Ref<HTMLElement | null>>;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,gBAAgB,EACjB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAE1C,YAAY,EAAE,SAAS,EAAE,CAAA;AAEzB,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,I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C,CAAA;CAC1C;AAED,eAAO,MAAO,gBAAgB,uIAAE,iBAAiB,0CAAwC,CAAA;AAEzF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAO1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["injectInkContext","provideInkContext","createContext","useInkContext","ctx","getCurrentInstance","consumer"],"sources":["../src/context.ts"],"sourcesContent":["import { createContext } from 'reka-ui'\nimport { getCurrentInstance } from 'vue'\n\nimport type {\n Annotation,\n InkDocument,\n InkStatus,\n PdfAssets,\n SignatureLibrary,\n} from '@inkbar/core'\nimport type {\n Tool,\n ToolController,\n ToolId,\n ToolOptions,\n ToolStyle,\n Viewport,\n ZoomValue,\n} from '@inkbar/core/dom'\nimport type { Ref, ShallowRef } from 'vue'\n\nexport type { InkStatus }\n\n/** Undo and redo for the current document, whichever mode its annotations are in. */\nexport interface InkHistory {\n canUndo: Readonly<Ref<boolean>>\n canRedo: Readonly<Ref<boolean>>\n undo: () => void\n redo: () => void\n clear: () => void\n /**\n * Runs `fn` and records what it changes as one undo step. The host still receives one change\n * per add. Controlled, the history groups the resulting list changes into one step, and\n * `canUndo` updates once the current task ends. Any other change the host applies in that\n * same window joins the step.\n */\n batch: (fn: () => void) => void\n}\n\nexport interface InkContext {\n assets: Readonly<Ref<PdfAssets>>\n document: Readonly<ShallowRef<InkDocument | null>>\n /** `loading` from the moment a document starts opening, then the document's own status. */\n status: Readonly<Ref<InkStatus>>\n annotations: Readonly<Ref<readonly Annotation[]>>\n selection: Readonly<Ref<readonly string[]>>\n /** Set by InkViewport once it has mounted its viewport and tool controller. */\n viewport: ShallowRef<Viewport | null>\n tools: ShallowRef<ToolController | null>\n /** Desired tool; InkViewport applies it to the controller. */\n tool: Readonly<Ref<ToolId>>\n setTool(id: ToolId): void\n /** Host tools from InkRoot's `tools` prop; InkViewport registers them. */\n hostTools: Readonly<Ref<Tool[] | undefined>>\n /** The font families text boxes offer: InkRoot's `fonts`, else `FONT_FAMILIES`. */\n fonts: Readonly<Ref<readonly string[]>>\n /** The tools' options for InkRoot's life, so they persist across documents. */\n toolOptions: ToolOptions\n /** The saved signatures, from InkRoot's `signatures` store (memory by default). */\n signatures: Readonly<ShallowRef<SignatureLibrary>>\n /** The fonts a typed signature offers: InkRoot's `signatureFonts`, else `SIGNATURE_FONTS`. */\n signatureFonts: Readonly<Ref<readonly string[]>>\n /** The open document's tool style; `null` while no document is open. */\n toolStyle: Readonly<ShallowRef<ToolStyle | null>>\n /** Desired zoom and page from the host's v-models; InkViewport applies and reports back. */\n zoomModel: Readonly<Ref<ZoomValue | undefined>>\n pageModel: Readonly<Ref<number | undefined>>\n reportZoom(z: ZoomValue): void\n reportPage(p: number): void\n /** Last activated annotation (Enter, click with the note tool, etc.). Popovers key off this. */\n activated: Readonly<Ref<string | null>>\n setActivated(id: string | null): void\n history: InkHistory\n rootEl: Readonly<Ref<HTMLElement | null>>\n}\n\nexport const [injectInkContext, provideInkContext] = createContext<InkContext>('InkRoot')\n\n/**\n * The context for composables: throws a readable error when called outside a component\n * rendered inside `InkRoot`, instead of Vue's injection warning.\n */\nexport function useInkContext(consumer: string): InkContext {\n const ctx = getCurrentInstance() ? injectInkContext(null) : null\n if (!ctx)\n throw new Error(\n `[inkbar] ${consumer} must be called in a component inside <InkRoot>.`\n )\n return ctx\n}\n"],"mappings":";;;AA4EA,IAAa,CAACA,GAAkBC,KAAqBC,EAA0B,SAAS;AAMxF,SAAgBC,EAAc,GAA8B;CAC1D,IAAMC,IAAMC,EAAmB,IAAIL,EAAiB,IAAI,IAAI;CAC5D,IAAI,CAACI,GACH,MAAU,MACR,YAAYE,EAAS,iDACvB;CACF,OAAOF;AACT"}
1
+ {"version":3,"file":"context.js","names":["injectInkContext","provideInkContext","createContext","useInkContext","ctx","getCurrentInstance","consumer"],"sources":["../src/context.ts"],"sourcesContent":["import { createContext } from 'reka-ui'\nimport { getCurrentInstance } from 'vue'\n\nimport type {\n Annotation,\n InkDocument,\n InkStatus,\n PdfAssets,\n PluginHistory,\n SignatureLibrary,\n} from '@inkbar/core'\nimport type {\n DecorateAnnotation,\n PluginHost,\n Tool,\n ToolController,\n ToolId,\n ToolOptions,\n ToolStyle,\n Viewport,\n ZoomValue,\n} from '@inkbar/core/dom'\nimport type { Ref, ShallowRef } from 'vue'\n\nexport type { InkStatus }\n\n/**\n * Undo and redo for the current document, whichever mode its annotations are in. `track` and\n * `react` (from `PluginHistory`) reach the same history, so plugin stores undo with the edits.\n */\nexport interface InkHistory extends PluginHistory {\n canUndo: Readonly<Ref<boolean>>\n canRedo: Readonly<Ref<boolean>>\n undo: () => void\n redo: () => void\n clear: () => void\n /**\n * Runs `fn` and records what it changes as one undo step. The host still receives one change\n * per add. Controlled, the history groups the resulting list changes into one step, and\n * `canUndo` updates once the current task ends. Any other change the host applies in that\n * same window joins the step.\n */\n batch: (fn: () => void) => void\n}\n\nexport interface InkContext {\n assets: Readonly<Ref<PdfAssets>>\n document: Readonly<ShallowRef<InkDocument | null>>\n /** `loading` from the moment a document starts opening, then the document's own status. */\n status: Readonly<Ref<InkStatus>>\n annotations: Readonly<Ref<readonly Annotation[]>>\n selection: Readonly<Ref<readonly string[]>>\n /**\n * The plugins from InkRoot's `plugins` prop, set up once the root has mounted and kept for\n * its life; `null` before that (and on the server) and once it unmounts. InkViewport hands it\n * to the engine; InkCommand places its commands.\n */\n pluginHost: Readonly<ShallowRef<PluginHost | null>>\n /** InkViewport's scroll element while it is mounted: the plugins' `root`. */\n viewportEl: ShallowRef<HTMLElement | null>\n /** Set by InkViewport once it has mounted its viewport and tool controller. */\n viewport: ShallowRef<Viewport | null>\n tools: ShallowRef<ToolController | null>\n /** Desired tool; InkViewport applies it to the controller. */\n tool: Readonly<Ref<ToolId>>\n setTool(id: ToolId): void\n /** Host tools from InkRoot's `tools` prop; InkViewport registers them. */\n hostTools: Readonly<Ref<Tool[] | undefined>>\n /** InkRoot's `decorateAnnotation` prop. InkViewport re-applies decorations when it changes. */\n decorateAnnotation: Readonly<Ref<DecorateAnnotation | undefined>>\n /** The font families text boxes offer: InkRoot's `fonts`, else `FONT_FAMILIES`. */\n fonts: Readonly<Ref<readonly string[]>>\n /** The tools' options for InkRoot's life, so they persist across documents. */\n toolOptions: ToolOptions\n /** The saved signatures, from InkRoot's `signatures` store (memory by default). */\n signatures: Readonly<ShallowRef<SignatureLibrary>>\n /** The fonts a typed signature offers: InkRoot's `signatureFonts`, else `SIGNATURE_FONTS`. */\n signatureFonts: Readonly<Ref<readonly string[]>>\n /** The open document's tool style; `null` while no document is open. */\n toolStyle: Readonly<ShallowRef<ToolStyle | null>>\n /** Desired zoom and page from the host's v-models; InkViewport applies and reports back. */\n zoomModel: Readonly<Ref<ZoomValue | undefined>>\n pageModel: Readonly<Ref<number | undefined>>\n reportZoom(z: ZoomValue): void\n reportPage(p: number): void\n /** Last activated annotation (Enter, click with the note tool, etc.). Popovers key off this. */\n activated: Readonly<Ref<string | null>>\n /**\n * Activates annotation `id`, or clears the activation with `null`. This is the context's\n * own: unlike core's `Viewer.setActivated`, it emits InkRoot's `activate` for an id, and it\n * does not check that the id is in the document.\n */\n setActivated(id: string | null): void\n history: InkHistory\n rootEl: Readonly<Ref<HTMLElement | null>>\n}\n\nexport const [injectInkContext, provideInkContext] = createContext<InkContext>('InkRoot')\n\n/**\n * The context for composables: throws a readable error when called outside a component\n * rendered inside `InkRoot`, instead of Vue's injection warning.\n */\nexport function useInkContext(consumer: string): InkContext {\n const ctx = getCurrentInstance() ? injectInkContext(null) : null\n if (!ctx)\n throw new Error(\n `[inkbar] ${consumer} must be called in a component inside <InkRoot>.`\n )\n return ctx\n}\n"],"mappings":";;;AAiGA,IAAa,CAACA,GAAkBC,KAAqBC,EAA0B,SAAS;AAMxF,SAAgBC,EAAc,GAA8B;CAC1D,IAAMC,IAAMC,EAAmB,IAAIL,EAAiB,IAAI,IAAI;CAC5D,IAAI,CAACI,GACH,MAAU,MACR,YAAYE,EAAS,iDACvB;CACF,OAAOF;AACT"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as InkRoot } from './components/InkRoot.vue';
2
2
  export { injectInkContext } from './context';
3
3
  export type { InkContext, InkHistory, InkStatus } from './context';
4
+ export type { AnnotationDecoration, DecorateAnnotation, InkPlugin, } from '@inkbar/core/dom';
4
5
  export { useReadable } from './use-readable';
5
6
  export { useDocument } from './composables/useDocument';
6
7
  export { useAnnotations } from './composables/useAnnotations';
@@ -13,6 +14,8 @@ export { useZoom } from './composables/useZoom';
13
14
  export { usePage } from './composables/usePage';
14
15
  export { useHistory } from './composables/useHistory';
15
16
  export { useEmbedded } from './composables/useEmbedded';
17
+ export { useCommand } from './composables/useCommand';
18
+ export type { CommandHandle } from './composables/useCommand';
16
19
  export { default as InkViewport } from './components/InkViewport.vue';
17
20
  export { default as InkPage } from './components/InkPage.vue';
18
21
  export { default as InkAnnotation } from './components/InkAnnotation.vue';
@@ -20,6 +23,7 @@ export type { AnnotationSlotProps, AnnotationState } from './components/annotati
20
23
  export { default as InkToolbar } from './components/InkToolbar.vue';
21
24
  export { default as InkIcon } from './components/InkIcon.vue';
22
25
  export { default as InkToolButton } from './components/InkToolButton.vue';
26
+ export { default as InkCommand } from './components/InkCommand.vue';
23
27
  export { default as InkToolbarSeparator } from './components/InkToolbarSeparator.vue';
24
28
  export { default as InkUndo } from './components/InkUndo.vue';
25
29
  export { default as InkRedo } from './components/InkRedo.vue';
@@ -39,6 +43,4 @@ export { default as InkPrevPage } from './components/InkPrevPage.vue';
39
43
  export { default as InkNextPage } from './components/InkNextPage.vue';
40
44
  export { default as InkThreadPopover } from './components/InkThreadPopover.vue';
41
45
  export type { ThreadPopoverSlotProps } from './components/InkThreadPopover.vue';
42
- export { default as InkSuggestionCard } from './components/InkSuggestionCard.vue';
43
- export type { ConfidenceBucket, SuggestionCardSlotProps, } from './components/InkSuggestionCard.vue';
44
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"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AAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,YAAY,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA"}
package/dist/index.js CHANGED
@@ -11,29 +11,30 @@ import { useZoom as l } from "./composables/useZoom.js";
11
11
  import { usePage as u } from "./composables/usePage.js";
12
12
  import { useHistory as d } from "./composables/useHistory.js";
13
13
  import { useEmbedded as f } from "./composables/useEmbedded.js";
14
- import p from "./components/InkAnnotation.js";
15
- import m from "./components/InkPage.js";
16
- import h from "./components/InkViewport.js";
17
- import g from "./components/InkToolbar.js";
18
- import _ from "./components/InkIcon.js";
19
- import v from "./components/InkToolButton.js";
20
- import y from "./components/InkToolbarSeparator.js";
21
- import b from "./components/InkUndo.js";
22
- import x from "./components/InkRedo.js";
23
- import S from "./components/InkColorMenu.js";
24
- import C from "./components/InkShapeMenu.js";
25
- import w from "./components/InkSignatureDialog.js";
26
- import T from "./components/InkSignatureMenu.js";
27
- import E from "./components/InkHighlightMenu.js";
28
- import D from "./components/InkLineStyleMenu.js";
29
- import O from "./components/InkTextStyleMenu.js";
30
- import k from "./components/InkZoomIn.js";
31
- import A from "./components/InkZoomOut.js";
32
- import j from "./components/InkZoomSelect.js";
33
- import M from "./components/InkPageInput.js";
34
- import N from "./components/InkPageCount.js";
35
- import P from "./components/InkPrevPage.js";
36
- import F from "./components/InkNextPage.js";
37
- import I from "./components/InkThreadPopover.js";
38
- import L from "./components/InkSuggestionCard.js";
39
- export { p as InkAnnotation, S as InkColorMenu, E as InkHighlightMenu, _ as InkIcon, D as InkLineStyleMenu, F as InkNextPage, m as InkPage, N as InkPageCount, M as InkPageInput, P as InkPrevPage, x as InkRedo, n as InkRoot, C as InkShapeMenu, w as InkSignatureDialog, T as InkSignatureMenu, L as InkSuggestionCard, O as InkTextStyleMenu, I as InkThreadPopover, v as InkToolButton, g as InkToolbar, y as InkToolbarSeparator, b as InkUndo, h as InkViewport, k as InkZoomIn, A as InkZoomOut, j as InkZoomSelect, e as injectInkContext, i as useAnnotations, r as useDocument, f as useEmbedded, d as useHistory, u as usePage, t as useReadable, c as useSelection, a as useTool, s as useToolOptions, o as useToolStyle, l as useZoom };
14
+ import { useCommand as p } from "./composables/useCommand.js";
15
+ import m from "./components/InkAnnotation.js";
16
+ import h from "./components/InkPage.js";
17
+ import g from "./components/InkViewport.js";
18
+ import _ from "./components/InkToolbar.js";
19
+ import v from "./components/InkIcon.js";
20
+ import y from "./components/InkToolButton.js";
21
+ import b from "./components/InkCommand.js";
22
+ import x from "./components/InkToolbarSeparator.js";
23
+ import S from "./components/InkUndo.js";
24
+ import C from "./components/InkRedo.js";
25
+ import w from "./components/InkColorMenu.js";
26
+ import T from "./components/InkShapeMenu.js";
27
+ import E from "./components/InkSignatureDialog.js";
28
+ import D from "./components/InkSignatureMenu.js";
29
+ import O from "./components/InkHighlightMenu.js";
30
+ import k from "./components/InkLineStyleMenu.js";
31
+ import A from "./components/InkTextStyleMenu.js";
32
+ import j from "./components/InkZoomIn.js";
33
+ import M from "./components/InkZoomOut.js";
34
+ import N from "./components/InkZoomSelect.js";
35
+ import P from "./components/InkPageInput.js";
36
+ import F from "./components/InkPageCount.js";
37
+ import I from "./components/InkPrevPage.js";
38
+ import L from "./components/InkNextPage.js";
39
+ import R from "./components/InkThreadPopover.js";
40
+ export { m as InkAnnotation, w as InkColorMenu, b as InkCommand, O as InkHighlightMenu, v as InkIcon, k as InkLineStyleMenu, L as InkNextPage, h as InkPage, F as InkPageCount, P as InkPageInput, I as InkPrevPage, C as InkRedo, n as InkRoot, T as InkShapeMenu, E as InkSignatureDialog, D as InkSignatureMenu, A as InkTextStyleMenu, R as InkThreadPopover, y as InkToolButton, _ as InkToolbar, x as InkToolbarSeparator, S as InkUndo, g as InkViewport, j as InkZoomIn, M as InkZoomOut, N as InkZoomSelect, e as injectInkContext, i as useAnnotations, p as useCommand, r as useDocument, f as useEmbedded, d as useHistory, u as usePage, t as useReadable, c as useSelection, a as useTool, s as useToolOptions, o as useToolStyle, l as useZoom };
@@ -1,18 +1,27 @@
1
1
  import { Ref } from 'vue';
2
2
  import { InkHistory } from './context';
3
- import { Annotation } from '@inkbar/core';
3
+ import { Annotation, AnnotationStore } from '@inkbar/core';
4
4
  export interface RefHistoryOptions {
5
5
  /** The host's list (the `annotations` v-model). Undefined when the host does not control it. */
6
6
  source: () => readonly Annotation[] | undefined;
7
7
  /** Proposes a list to the host; the step only counts once the host applies it. */
8
8
  apply: (list: Annotation[]) => void;
9
9
  enabled: Readonly<Ref<boolean>>;
10
+ /**
11
+ * The open document's controlled store, if any. Its user edits run the plugins' reactions
12
+ * inside the edit's step, with or without `enabled`.
13
+ */
14
+ store?: () => AnnotationStore | null | undefined;
10
15
  limit?: number;
11
16
  }
17
+ export interface RefHistory extends InkHistory {
18
+ /** Runs the reactions for the store's user edits; returns a function that detaches it. */
19
+ attach(store: AnnotationStore): () => void;
20
+ }
12
21
  /**
13
22
  * Snapshot undo and redo over a host-owned annotation list, for controlled hosts. The stacks
14
23
  * live in core's `createSnapshotHistory`; this wrapper feeds it from a watch on the host's list
15
- * and exposes refs.
24
+ * and exposes refs. Plugin stores it tracks are snapshotted with each step.
16
25
  */
17
- export declare function createRefHistory(opts: RefHistoryOptions): InkHistory;
26
+ export declare function createRefHistory(opts: RefHistoryOptions): RefHistory;
18
27
  //# sourceMappingURL=ref-history.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-history.d.ts","sourceRoot":"","sources":["../src/ref-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAI/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,gGAAgG;IAChG,MAAM,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,SAAS,CAAA;IAC/C,kFAAkF;IAClF,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IACnC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAmBpE"}
1
+ {"version":3,"file":"ref-history.d.ts","sourceRoot":"","sources":["../src/ref-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAI/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE/D,MAAM,WAAW,iBAAiB;IAChC,gGAAgG;IAChG,MAAM,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,SAAS,CAAA;IAC/C,kFAAkF;IAClF,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IACnC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;IAChD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,0FAA0F;IAC1F,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,IAAI,CAAA;CAC3C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAmCpE"}
@@ -1,25 +1,36 @@
1
1
  import { useReadable as e } from "./use-readable.js";
2
- import { computed as t, watch as n } from "vue";
3
- import { createSnapshotHistory as r } from "@inkbar/core";
2
+ import { computed as t, onScopeDispose as n, watch as r } from "vue";
3
+ import { createSnapshotHistory as i } from "@inkbar/core";
4
4
  //#region src/ref-history.ts
5
- function i(i) {
6
- let a = r({
7
- apply: i.apply,
8
- enabled: () => i.enabled.value,
9
- ...i.limit === void 0 ? {} : { limit: i.limit }
5
+ function a(a) {
6
+ let o = i({
7
+ apply: a.apply,
8
+ enabled: () => a.enabled.value,
9
+ ...a.limit === void 0 ? {} : { limit: a.limit }
10
10
  });
11
- a.observe(i.source()), n(i.source, (e) => a.observe(e));
12
- let o = e(a.canUndo, !1), s = e(a.canRedo, !1);
11
+ if (o.observe(a.source()), r(a.source, (e) => o.observe(e)), a.store) {
12
+ let e;
13
+ r(a.store, (t) => {
14
+ e?.(), e = t ? o.attach(t) : void 0;
15
+ }, {
16
+ immediate: !0,
17
+ flush: "sync"
18
+ }), n(() => e?.());
19
+ }
20
+ let s = e(o.canUndo, !1), c = e(o.canRedo, !1);
13
21
  return {
14
- canUndo: t(() => i.enabled.value && o.value),
15
- canRedo: t(() => i.enabled.value && s.value),
16
- undo: () => a.undo(),
17
- redo: () => a.redo(),
18
- clear: () => a.clear(),
19
- batch: (e) => a.batch(e)
22
+ canUndo: t(() => a.enabled.value && s.value),
23
+ canRedo: t(() => a.enabled.value && c.value),
24
+ undo: () => o.undo(),
25
+ redo: () => o.redo(),
26
+ clear: () => o.clear(),
27
+ batch: (e) => o.batch(e),
28
+ track: (e) => o.track(e),
29
+ react: (e) => o.react(e),
30
+ attach: (e) => o.attach(e)
20
31
  };
21
32
  }
22
33
  //#endregion
23
- export { i as createRefHistory };
34
+ export { a as createRefHistory };
24
35
 
25
36
  //# sourceMappingURL=ref-history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-history.js","names":["createRefHistory","history","createSnapshotHistory","opts","watch","next","canUndo","useReadable","canRedo","computed","fn"],"sources":["../src/ref-history.ts"],"sourcesContent":["import { createSnapshotHistory } from '@inkbar/core'\nimport { computed, watch, type Ref } from 'vue'\n\nimport { useReadable } from './use-readable'\n\nimport type { InkHistory } from './context'\nimport type { Annotation } from '@inkbar/core'\n\nexport interface RefHistoryOptions {\n /** The host's list (the `annotations` v-model). Undefined when the host does not control it. */\n source: () => readonly Annotation[] | undefined\n /** Proposes a list to the host; the step only counts once the host applies it. */\n apply: (list: Annotation[]) => void\n enabled: Readonly<Ref<boolean>>\n limit?: number\n}\n\n/**\n * Snapshot undo and redo over a host-owned annotation list, for controlled hosts. The stacks\n * live in core's `createSnapshotHistory`; this wrapper feeds it from a watch on the host's list\n * and exposes refs.\n */\nexport function createRefHistory(opts: RefHistoryOptions): InkHistory {\n const history = createSnapshotHistory({\n apply: opts.apply,\n enabled: () => opts.enabled.value,\n ...(opts.limit === undefined ? {} : { limit: opts.limit }),\n })\n // Seeds the current list; later changes are steps.\n history.observe(opts.source())\n watch(opts.source, (next) => history.observe(next))\n const canUndo = useReadable(history.canUndo, false)\n const canRedo = useReadable(history.canRedo, false)\n return {\n canUndo: computed(() => opts.enabled.value && canUndo.value),\n canRedo: computed(() => opts.enabled.value && canRedo.value),\n undo: () => history.undo(),\n redo: () => history.redo(),\n clear: () => history.clear(),\n batch: (fn) => history.batch(fn),\n }\n}\n"],"mappings":";;;;AAsBA,SAAgBA,EAAiB,GAAqC;CACpE,IAAMC,IAAUC,EAAsB;EACpC,OAAOC,EAAK;EACZ,eAAeA,EAAK,QAAQ;EAC5B,GAAIA,EAAK,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAOA,EAAK,MAAM;CAC1D,CAAC;CAGD,AADAF,EAAQ,QAAQE,EAAK,OAAO,CAAC,GAC7BC,EAAMD,EAAK,SAAS,MAASF,EAAQ,QAAQI,CAAI,CAAC;CAClD,IAAMC,IAAUC,EAAYN,EAAQ,SAAS,EAAK,GAC5CO,IAAUD,EAAYN,EAAQ,SAAS,EAAK;CAClD,OAAO;EACL,SAASQ,QAAeN,EAAK,QAAQ,SAASG,EAAQ,KAAK;EAC3D,SAASG,QAAeN,EAAK,QAAQ,SAASK,EAAQ,KAAK;EAC3D,YAAYP,EAAQ,KAAK;EACzB,YAAYA,EAAQ,KAAK;EACzB,aAAaA,EAAQ,MAAM;EAC3B,QAAQ,MAAOA,EAAQ,MAAMS,CAAE;CACjC;AACF"}
1
+ {"version":3,"file":"ref-history.js","names":["createRefHistory","history","createSnapshotHistory","opts","watch","next","detach","store","onScopeDispose","canUndo","useReadable","canRedo","computed","fn"],"sources":["../src/ref-history.ts"],"sourcesContent":["import { createSnapshotHistory } from '@inkbar/core'\nimport { computed, onScopeDispose, watch, type Ref } from 'vue'\n\nimport { useReadable } from './use-readable'\n\nimport type { InkHistory } from './context'\nimport type { Annotation, AnnotationStore } from '@inkbar/core'\n\nexport interface RefHistoryOptions {\n /** The host's list (the `annotations` v-model). Undefined when the host does not control it. */\n source: () => readonly Annotation[] | undefined\n /** Proposes a list to the host; the step only counts once the host applies it. */\n apply: (list: Annotation[]) => void\n enabled: Readonly<Ref<boolean>>\n /**\n * The open document's controlled store, if any. Its user edits run the plugins' reactions\n * inside the edit's step, with or without `enabled`.\n */\n store?: () => AnnotationStore | null | undefined\n limit?: number\n}\n\nexport interface RefHistory extends InkHistory {\n /** Runs the reactions for the store's user edits; returns a function that detaches it. */\n attach(store: AnnotationStore): () => void\n}\n\n/**\n * Snapshot undo and redo over a host-owned annotation list, for controlled hosts. The stacks\n * live in core's `createSnapshotHistory`; this wrapper feeds it from a watch on the host's list\n * and exposes refs. Plugin stores it tracks are snapshotted with each step.\n */\nexport function createRefHistory(opts: RefHistoryOptions): RefHistory {\n const history = createSnapshotHistory({\n apply: opts.apply,\n enabled: () => opts.enabled.value,\n ...(opts.limit === undefined ? {} : { limit: opts.limit }),\n })\n // Seeds the current list; later changes are steps.\n history.observe(opts.source())\n watch(opts.source, (next) => history.observe(next))\n if (opts.store) {\n // Sync, so the store is attached before anyone can edit through it.\n let detach: (() => void) | undefined\n watch(\n opts.store,\n (store) => {\n detach?.()\n detach = store ? history.attach(store) : undefined\n },\n { immediate: true, flush: 'sync' }\n )\n onScopeDispose(() => detach?.())\n }\n const canUndo = useReadable(history.canUndo, false)\n const canRedo = useReadable(history.canRedo, false)\n return {\n canUndo: computed(() => opts.enabled.value && canUndo.value),\n canRedo: computed(() => opts.enabled.value && canRedo.value),\n undo: () => history.undo(),\n redo: () => history.redo(),\n clear: () => history.clear(),\n batch: (fn) => history.batch(fn),\n track: (store) => history.track(store),\n react: (fn) => history.react(fn),\n attach: (store) => history.attach(store),\n }\n}\n"],"mappings":";;;;AAgCA,SAAgBA,EAAiB,GAAqC;CACpE,IAAMC,IAAUC,EAAsB;EACpC,OAAOC,EAAK;EACZ,eAAeA,EAAK,QAAQ;EAC5B,GAAIA,EAAK,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAOA,EAAK,MAAM;CAC1D,CAAC;CAID,IAFAF,EAAQ,QAAQE,EAAK,OAAO,CAAC,GAC7BC,EAAMD,EAAK,SAAS,MAASF,EAAQ,QAAQI,CAAI,CAAC,GAC9CF,EAAK,OAAO;EAEd,IAAIG;EASJ,AARAF,EACED,EAAK,QACJ,MAAU;GAET,AADAG,IAAS,GACT,IAASC,IAAQN,EAAQ,OAAOM,CAAK,IAAI,KAAA;EAC3C,GACA;GAAE,WAAW;GAAM,OAAO;EAAO,CACnC,GACAC,QAAqBF,IAAS,CAAC;CACjC;CACA,IAAMG,IAAUC,EAAYT,EAAQ,SAAS,EAAK,GAC5CU,IAAUD,EAAYT,EAAQ,SAAS,EAAK;CAClD,OAAO;EACL,SAASW,QAAeT,EAAK,QAAQ,SAASM,EAAQ,KAAK;EAC3D,SAASG,QAAeT,EAAK,QAAQ,SAASQ,EAAQ,KAAK;EAC3D,YAAYV,EAAQ,KAAK;EACzB,YAAYA,EAAQ,KAAK;EACzB,aAAaA,EAAQ,MAAM;EAC3B,QAAQ,MAAOA,EAAQ,MAAMY,CAAE;EAC/B,QAAQ,MAAUZ,EAAQ,MAAMM,CAAK;EACrC,QAAQ,MAAON,EAAQ,MAAMY,CAAE;EAC/B,SAAS,MAAUZ,EAAQ,OAAOM,CAAK;CACzC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkbar/vue",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Vue 3 components and composables for Inkbar, the browser PDF viewer and editor.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://inkbar.dev",
@@ -24,17 +24,17 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "dependencies": {
27
- "@inkbar/icons": "^0.4.0",
27
+ "@inkbar/icons": "^0.6.0",
28
28
  "reka-ui": "^2.11.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@inkbar/core": "^0.4.0",
31
+ "@inkbar/core": "^0.6.0",
32
32
  "vue": "^3.5.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@inkbar/core": "0.4.0",
35
+ "@inkbar/core": "0.6.0",
36
36
  "@inkbar/fixtures": "0.0.0",
37
- "@inkbar/theme": "0.4.0",
37
+ "@inkbar/theme": "0.6.0",
38
38
  "@playwright/experimental-ct-vue": "1.62.1",
39
39
  "@playwright/test": "1.62.1",
40
40
  "@vitejs/plugin-vue": "^6.0.10",
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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":""}
@@ -1,16 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,85 +0,0 @@
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