@inkbar/vue 0.3.0 → 0.5.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 (101) hide show
  1. package/README.md +17 -12
  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 +7 -0
  7. package/dist/components/InkColorMenu.js.map +1 -0
  8. package/dist/components/InkColorMenu.vue.d.ts +34 -0
  9. package/dist/components/InkColorMenu.vue.d.ts.map +1 -0
  10. package/dist/components/InkColorMenu.vue_vue_type_script_setup_true_lang.js +153 -0
  11. package/dist/components/InkColorMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  12. package/dist/components/InkHighlightMenu.js +7 -0
  13. package/dist/components/InkHighlightMenu.js.map +1 -0
  14. package/dist/components/{InkSuggestionCard.vue.d.ts → InkHighlightMenu.vue.d.ts} +7 -6
  15. package/dist/components/InkHighlightMenu.vue.d.ts.map +1 -0
  16. package/dist/components/InkHighlightMenu.vue_vue_type_script_setup_true_lang.js +150 -0
  17. package/dist/components/InkHighlightMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  18. package/dist/components/InkLineStyleMenu.js +7 -0
  19. package/dist/components/InkLineStyleMenu.js.map +1 -0
  20. package/dist/components/InkLineStyleMenu.vue.d.ts +14 -0
  21. package/dist/components/InkLineStyleMenu.vue.d.ts.map +1 -0
  22. package/dist/components/InkLineStyleMenu.vue_vue_type_script_setup_true_lang.js +109 -0
  23. package/dist/components/InkLineStyleMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  24. package/dist/components/InkRoot.js.map +1 -1
  25. package/dist/components/InkRoot.vue.d.ts +730 -202
  26. package/dist/components/InkRoot.vue.d.ts.map +1 -1
  27. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +122 -87
  28. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
  29. package/dist/components/InkShapeMenu.js +7 -0
  30. package/dist/components/InkShapeMenu.js.map +1 -0
  31. package/dist/components/InkShapeMenu.vue.d.ts +18 -0
  32. package/dist/components/InkShapeMenu.vue.d.ts.map +1 -0
  33. package/dist/components/InkShapeMenu.vue_vue_type_script_setup_true_lang.js +126 -0
  34. package/dist/components/InkShapeMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  35. package/dist/components/InkSignatureDialog.js +7 -0
  36. package/dist/components/InkSignatureDialog.js.map +1 -0
  37. package/dist/components/InkSignatureDialog.vue.d.ts +21 -0
  38. package/dist/components/InkSignatureDialog.vue.d.ts.map +1 -0
  39. package/dist/components/InkSignatureDialog.vue_vue_type_script_setup_true_lang.js +58 -0
  40. package/dist/components/InkSignatureDialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
  41. package/dist/components/InkSignatureMenu.js +7 -0
  42. package/dist/components/InkSignatureMenu.js.map +1 -0
  43. package/dist/components/InkSignatureMenu.vue.d.ts +20 -0
  44. package/dist/components/InkSignatureMenu.vue.d.ts.map +1 -0
  45. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js +218 -0
  46. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  47. package/dist/components/InkTextStyleMenu.js +7 -0
  48. package/dist/components/InkTextStyleMenu.js.map +1 -0
  49. package/dist/components/InkTextStyleMenu.vue.d.ts +14 -0
  50. package/dist/components/InkTextStyleMenu.vue.d.ts.map +1 -0
  51. package/dist/components/InkTextStyleMenu.vue_vue_type_script_setup_true_lang.js +200 -0
  52. package/dist/components/InkTextStyleMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  53. package/dist/components/InkThreadPopover.js +7 -0
  54. package/dist/components/InkThreadPopover.js.map +1 -0
  55. package/dist/components/{InkNotePopover.vue.d.ts → InkThreadPopover.vue.d.ts} +4 -4
  56. package/dist/components/InkThreadPopover.vue.d.ts.map +1 -0
  57. package/dist/components/{InkNotePopover.vue_vue_type_script_setup_true_lang.js → InkThreadPopover.vue_vue_type_script_setup_true_lang.js} +44 -42
  58. package/dist/components/InkThreadPopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
  59. package/dist/components/InkToolButton.js.map +1 -1
  60. package/dist/components/InkToolButton.vue.d.ts.map +1 -1
  61. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +27 -20
  62. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  63. package/dist/components/InkViewport.js.map +1 -1
  64. package/dist/components/InkViewport.vue.d.ts +1 -1
  65. package/dist/components/InkViewport.vue.d.ts.map +1 -1
  66. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +15 -2
  67. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/components/SignatureForm.js +7 -0
  69. package/dist/components/SignatureForm.js.map +1 -0
  70. package/dist/components/SignatureForm.vue.d.ts +14 -0
  71. package/dist/components/SignatureForm.vue.d.ts.map +1 -0
  72. package/dist/components/SignatureForm.vue_vue_type_script_setup_true_lang.js +181 -0
  73. package/dist/components/SignatureForm.vue_vue_type_script_setup_true_lang.js.map +1 -0
  74. package/dist/composables/useAnnotations.d.ts +1551 -630
  75. package/dist/composables/useAnnotations.d.ts.map +1 -1
  76. package/dist/composables/useAnnotations.js +13 -18
  77. package/dist/composables/useAnnotations.js.map +1 -1
  78. package/dist/composables/useToolOptions.d.ts +11 -0
  79. package/dist/composables/useToolOptions.d.ts.map +1 -0
  80. package/dist/composables/useToolOptions.js +16 -0
  81. package/dist/composables/useToolOptions.js.map +1 -0
  82. package/dist/composables/useToolStyle.d.ts +32 -0
  83. package/dist/composables/useToolStyle.d.ts.map +1 -0
  84. package/dist/composables/useToolStyle.js +24 -0
  85. package/dist/composables/useToolStyle.js.map +1 -0
  86. package/dist/context.d.ts +21 -2
  87. package/dist/context.d.ts.map +1 -1
  88. package/dist/context.js.map +1 -1
  89. package/dist/index.d.ts +13 -4
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +32 -24
  92. package/package.json +5 -5
  93. package/dist/components/InkNotePopover.js +0 -7
  94. package/dist/components/InkNotePopover.js.map +0 -1
  95. package/dist/components/InkNotePopover.vue.d.ts.map +0 -1
  96. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js.map +0 -1
  97. package/dist/components/InkSuggestionCard.js +0 -7
  98. package/dist/components/InkSuggestionCard.js.map +0 -1
  99. package/dist/components/InkSuggestionCard.vue.d.ts.map +0 -1
  100. package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js +0 -85
  101. 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,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE/D,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 } 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: Partial<Annotation>) => 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,MAA+BL,EAAM,CAAC,EAAE,OAAOG,GAAIG,CAAK;EAC7E,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,11 @@
1
+ import { MaybeRefOrGetter, Ref } from 'vue';
2
+ import { ToolId } from '@inkbar/core/dom';
3
+ /**
4
+ * A tool's options and a setter that merges a patch into them without switching tools.
5
+ * Options are empty, and the setter does nothing, until the viewport has mounted.
6
+ */
7
+ export declare function useToolOptions<O extends object = object>(id: MaybeRefOrGetter<ToolId>): {
8
+ options: Readonly<Ref<O>>;
9
+ setOptions: (patch: Partial<O>) => void;
10
+ };
11
+ //# sourceMappingURL=useToolOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolOptions.d.ts","sourceRoot":"","sources":["../../src/composables/useToolOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAK9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACtD,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAC3B;IAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAAC,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;CAAE,CAUxE"}
@@ -0,0 +1,16 @@
1
+ import { useInkContext as e } from "../context.js";
2
+ import { useReadable as t } from "../use-readable.js";
3
+ import { toValue as n } from "vue";
4
+ //#region src/composables/useToolOptions.ts
5
+ var r = {};
6
+ function i(i) {
7
+ let a = e("useToolOptions()");
8
+ return {
9
+ options: t(() => a.tools.value?.options(n(i)), r),
10
+ setOptions: (e) => a.tools.value?.setOptions(n(i), e)
11
+ };
12
+ }
13
+ //#endregion
14
+ export { i as useToolOptions };
15
+
16
+ //# sourceMappingURL=useToolOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolOptions.js","names":["NO_OPTIONS","useToolOptions","ctx","useInkContext","useReadable","toValue","id","patch"],"sources":["../../src/composables/useToolOptions.ts"],"sourcesContent":["import { toValue, type MaybeRefOrGetter, type Ref } from 'vue'\n\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport type { ToolId } from '@inkbar/core/dom'\n\nconst NO_OPTIONS: object = {}\n\n/**\n * A tool's options and a setter that merges a patch into them without switching tools.\n * Options are empty, and the setter does nothing, until the viewport has mounted.\n */\nexport function useToolOptions<O extends object = object>(\n id: MaybeRefOrGetter<ToolId>\n): { options: Readonly<Ref<O>>; setOptions: (patch: Partial<O>) => void } {\n const ctx = useInkContext('useToolOptions()')\n const options = useReadable(\n () => ctx.tools.value?.options(toValue(id)),\n NO_OPTIONS\n ) as Readonly<Ref<O>>\n return {\n options,\n setOptions: (patch) => ctx.tools.value?.setOptions(toValue(id), patch),\n }\n}\n"],"mappings":";;;;AAOA,IAAMA,IAAqB,CAAC;AAM5B,SAAgBC,EACd,GACwE;CACxE,IAAMC,IAAMC,EAAc,kBAAkB;CAK5C,OAAO;EACL,SALcC,QACRF,EAAI,MAAM,OAAO,QAAQG,EAAQC,CAAE,CAAC,GAC1CN,CAGA;EACA,aAAa,MAAUE,EAAI,MAAM,OAAO,WAAWG,EAAQC,CAAE,GAAGC,CAAK;CACvE;AACF"}
@@ -0,0 +1,32 @@
1
+ import { MaybeRefOrGetter, Ref } from 'vue';
2
+ import { CurrentStyle, StyleGroup, StyleKey, StyleProps } from '@inkbar/core';
3
+ interface ToolStyleView {
4
+ current: Readonly<Ref<CurrentStyle>>;
5
+ supported: Readonly<Ref<ReadonlySet<StyleKey>>>;
6
+ /** A group's own style. */
7
+ get: (group: StyleGroup) => Readonly<StyleProps>;
8
+ }
9
+ /** The tool style for the active tool or the selection. */
10
+ export interface ToolStyleHandle extends ToolStyleView {
11
+ set: (patch: StyleProps, opts?: {
12
+ group?: StyleGroup;
13
+ apply?: boolean;
14
+ }) => void;
15
+ }
16
+ /** The tool style scoped to one group: `set` writes that group, so it takes no options. */
17
+ export interface ScopedToolStyleHandle extends ToolStyleView {
18
+ set: (patch: StyleProps) => void;
19
+ }
20
+ /**
21
+ * The tool style the style controls read and write: `current` shows the selection's values
22
+ * (`'mixed'` where they differ), else the active tool's group; `supported` names the props
23
+ * the active tool or the selection has. `set` updates the group and the selected annotations.
24
+ *
25
+ * With `group` (a value, ref or getter), the style as a control for that group sees it, whatever tool is active: the
26
+ * selection's when it is all in the group, else the group's own; `set` updates the group, and
27
+ * the selection only when it is all in the group.
28
+ */
29
+ export declare function useToolStyle(): ToolStyleHandle;
30
+ export declare function useToolStyle(group: MaybeRefOrGetter<StyleGroup | undefined>): ScopedToolStyleHandle;
31
+ export {};
32
+ //# sourceMappingURL=useToolStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolStyle.d.ts","sourceRoot":"","sources":["../../src/composables/useToolStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAK9D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAMlF,UAAU,aAAa;IACrB,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA;IACpC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC/C,2BAA2B;IAC3B,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,QAAQ,CAAC,UAAU,CAAC,CAAA;CACjD;AAED,2DAA2D;AAC3D,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;CACjF;AAED,2FAA2F;AAC3F,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAAA;AAC/C,wBAAgB,YAAY,CAC1B,KAAK,EAAE,gBAAgB,CAAC,UAAU,GAAG,SAAS,CAAC,GAC9C,qBAAqB,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { useInkContext as e } from "../context.js";
2
+ import { useReadable as t } from "../use-readable.js";
3
+ import { toValue as n } from "vue";
4
+ //#region src/composables/useToolStyle.ts
5
+ var r = {}, i = /* @__PURE__ */ new Set(), a = {};
6
+ function o(o) {
7
+ let s = e("useToolStyle()"), c = () => {
8
+ let e = s.toolStyle.value, t = n(o);
9
+ return t && e ? e.scoped(t) : e;
10
+ };
11
+ return {
12
+ current: t(() => c()?.current, r),
13
+ supported: t(() => c()?.supported, i),
14
+ set: (e, t) => {
15
+ let r = s.toolStyle.value, i = n(o);
16
+ i ? r?.scoped(i).set(e) : r?.set(e, t);
17
+ },
18
+ get: (e) => s.toolStyle.value?.get(e) ?? a
19
+ };
20
+ }
21
+ //#endregion
22
+ export { o as useToolStyle };
23
+
24
+ //# sourceMappingURL=useToolStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolStyle.js","names":["NO_STYLE","NO_PROPS","EMPTY","useToolStyle","ctx","useInkContext","view","style","g","toValue","group","useReadable","patch","opts"],"sources":["../../src/composables/useToolStyle.ts"],"sourcesContent":["import { toValue, type MaybeRefOrGetter, type Ref } from 'vue'\n\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport type { CurrentStyle, StyleGroup, StyleKey, StyleProps } from '@inkbar/core'\n\nconst NO_STYLE: CurrentStyle = {}\nconst NO_PROPS: ReadonlySet<StyleKey> = new Set()\nconst EMPTY: Readonly<StyleProps> = {}\n\ninterface ToolStyleView {\n current: Readonly<Ref<CurrentStyle>>\n supported: Readonly<Ref<ReadonlySet<StyleKey>>>\n /** A group's own style. */\n get: (group: StyleGroup) => Readonly<StyleProps>\n}\n\n/** The tool style for the active tool or the selection. */\nexport interface ToolStyleHandle extends ToolStyleView {\n set: (patch: StyleProps, opts?: { group?: StyleGroup; apply?: boolean }) => void\n}\n\n/** The tool style scoped to one group: `set` writes that group, so it takes no options. */\nexport interface ScopedToolStyleHandle extends ToolStyleView {\n set: (patch: StyleProps) => void\n}\n\n/**\n * The tool style the style controls read and write: `current` shows the selection's values\n * (`'mixed'` where they differ), else the active tool's group; `supported` names the props\n * the active tool or the selection has. `set` updates the group and the selected annotations.\n *\n * With `group` (a value, ref or getter), the style as a control for that group sees it, whatever tool is active: the\n * selection's when it is all in the group, else the group's own; `set` updates the group, and\n * the selection only when it is all in the group.\n */\nexport function useToolStyle(): ToolStyleHandle\nexport function useToolStyle(\n group: MaybeRefOrGetter<StyleGroup | undefined>\n): ScopedToolStyleHandle\nexport function useToolStyle(\n group?: MaybeRefOrGetter<StyleGroup | undefined>\n): ToolStyleHandle {\n const ctx = useInkContext('useToolStyle()')\n const view = () => {\n const style = ctx.toolStyle.value\n const g = toValue(group)\n return g && style ? style.scoped(g) : style\n }\n return {\n current: useReadable(() => view()?.current, NO_STYLE),\n supported: useReadable(() => view()?.supported, NO_PROPS),\n set: (patch: StyleProps, opts?: { group?: StyleGroup; apply?: boolean }) => {\n const style = ctx.toolStyle.value\n const g = toValue(group)\n if (g) style?.scoped(g).set(patch)\n else style?.set(patch, opts)\n },\n get: (group: StyleGroup): Readonly<StyleProps> =>\n ctx.toolStyle.value?.get(group) ?? EMPTY,\n }\n}\n"],"mappings":";;;;AAOA,IAAMA,IAAyB,CAAC,GAC1BC,oBAAkC,IAAI,IAAI,GAC1CC,IAA8B,CAAC;AAgCrC,SAAgBC,EACd,GACiB;CACjB,IAAMC,IAAMC,EAAc,gBAAgB,GACpCC,UAAa;EACjB,IAAMC,IAAQH,EAAI,UAAU,OACtBI,IAAIC,EAAQC,CAAK;EACvB,OAAOF,KAAKD,IAAQA,EAAM,OAAOC,CAAC,IAAID;CACxC;CACA,OAAO;EACL,SAASI,QAAkBL,EAAK,CAAC,EAAE,SAASN,CAAQ;EACpD,WAAWW,QAAkBL,EAAK,CAAC,EAAE,WAAWL,CAAQ;EACxD,MAAM,GAAmB,MAAmD;GAC1E,IAAMM,IAAQH,EAAI,UAAU,OACtBI,IAAIC,EAAQC,CAAK;GACvB,AAAIF,IAAGD,GAAO,OAAOC,CAAC,CAAC,CAAC,IAAII,CAAK,IAC5BL,GAAO,IAAIK,GAAOC,CAAI;EAC7B;EACA,MAAM,MACJT,EAAI,UAAU,OAAO,IAAIM,CAAK,KAAKR;CACvC;AACF"}
package/dist/context.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Annotation, InkDocument, InkStatus, PdfAssets } from '@inkbar/core';
2
- import { ToolController, ToolId, Viewport, ZoomValue } from '@inkbar/core/dom';
1
+ import { Annotation, InkDocument, InkStatus, PdfAssets, SignatureLibrary } from '@inkbar/core';
2
+ import { DecorateAnnotation, Tool, ToolController, ToolId, ToolOptions, ToolStyle, Viewport, ZoomValue } from '@inkbar/core/dom';
3
3
  import { Ref, ShallowRef } from 'vue';
4
4
  export type { InkStatus };
5
5
  /** Undo and redo for the current document, whichever mode its annotations are in. */
@@ -30,6 +30,20 @@ export interface InkContext {
30
30
  /** Desired tool; InkViewport applies it to the controller. */
31
31
  tool: Readonly<Ref<ToolId>>;
32
32
  setTool(id: ToolId): void;
33
+ /** Host tools from InkRoot's `tools` prop; InkViewport registers them. */
34
+ hostTools: Readonly<Ref<Tool[] | undefined>>;
35
+ /** InkRoot's `decorateAnnotation` prop. InkViewport re-applies decorations when it changes. */
36
+ decorateAnnotation: Readonly<Ref<DecorateAnnotation | undefined>>;
37
+ /** The font families text boxes offer: InkRoot's `fonts`, else `FONT_FAMILIES`. */
38
+ fonts: Readonly<Ref<readonly string[]>>;
39
+ /** The tools' options for InkRoot's life, so they persist across documents. */
40
+ toolOptions: ToolOptions;
41
+ /** The saved signatures, from InkRoot's `signatures` store (memory by default). */
42
+ signatures: Readonly<ShallowRef<SignatureLibrary>>;
43
+ /** The fonts a typed signature offers: InkRoot's `signatureFonts`, else `SIGNATURE_FONTS`. */
44
+ signatureFonts: Readonly<Ref<readonly string[]>>;
45
+ /** The open document's tool style; `null` while no document is open. */
46
+ toolStyle: Readonly<ShallowRef<ToolStyle | null>>;
33
47
  /** Desired zoom and page from the host's v-models; InkViewport applies and reports back. */
34
48
  zoomModel: Readonly<Ref<ZoomValue | undefined>>;
35
49
  pageModel: Readonly<Ref<number | undefined>>;
@@ -37,6 +51,11 @@ export interface InkContext {
37
51
  reportPage(p: number): void;
38
52
  /** Last activated annotation (Enter, click with the note tool, etc.). Popovers key off this. */
39
53
  activated: Readonly<Ref<string | null>>;
54
+ /**
55
+ * Activates annotation `id`, or clears the activation with `null`. This is the context's
56
+ * own: unlike core's `Viewer.setActivated`, it emits InkRoot's `activate` for an id, and it
57
+ * does not check that the id is in the document.
58
+ */
40
59
  setActivated(id: string | null): void;
41
60
  history: InkHistory;
42
61
  rootEl: Readonly<Ref<HTMLElement | null>>;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnF,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,IAAI,CAAA;IAChB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB;;;;;OAKG;IACH,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAA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AAS,GAAG,IAAI,CAAA;IAC9B,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,gGAAgG;IAChG,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAA;IACvC;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IACrC,OAAO,EAAE,UAAU,CAAA;IACnB,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAA;CAC1C;AAED,eAAO,MAAO,gBAAgB,uIAAE,iBAAiB,0CAAwC,CAAA;AAEzF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAO1D"}
@@ -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 { Annotation, InkDocument, InkStatus, PdfAssets } from '@inkbar/core'\nimport type { ToolController, ToolId, Viewport, ZoomValue } 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 /** 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":";;;AAkDA,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 SignatureLibrary,\n} from '@inkbar/core'\nimport type {\n DecorateAnnotation,\n Tool,\n ToolController,\n ToolId,\n ToolOptions,\n ToolStyle,\n Viewport,\n ZoomValue,\n} from '@inkbar/core/dom'\nimport type { Ref, ShallowRef } from 'vue'\n\nexport type { InkStatus }\n\n/** 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 /** 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":";;;AAoFA,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,10 +1,14 @@
1
1
  export { default as InkRoot } from './components/InkRoot.vue';
2
2
  export { injectInkContext } from './context';
3
3
  export type { InkContext, InkHistory, InkStatus } from './context';
4
+ export type { AnnotationDecoration, DecorateAnnotation } from '@inkbar/core/dom';
4
5
  export { useReadable } from './use-readable';
5
6
  export { useDocument } from './composables/useDocument';
6
7
  export { useAnnotations } from './composables/useAnnotations';
7
8
  export { useTool } from './composables/useTool';
9
+ export { useToolStyle } from './composables/useToolStyle';
10
+ export type { ScopedToolStyleHandle, ToolStyleHandle } from './composables/useToolStyle';
11
+ export { useToolOptions } from './composables/useToolOptions';
8
12
  export { useSelection } from './composables/useSelection';
9
13
  export { useZoom } from './composables/useZoom';
10
14
  export { usePage } from './composables/usePage';
@@ -20,6 +24,13 @@ export { default as InkToolButton } from './components/InkToolButton.vue';
20
24
  export { default as InkToolbarSeparator } from './components/InkToolbarSeparator.vue';
21
25
  export { default as InkUndo } from './components/InkUndo.vue';
22
26
  export { default as InkRedo } from './components/InkRedo.vue';
27
+ export { default as InkColorMenu } from './components/InkColorMenu.vue';
28
+ export { default as InkShapeMenu } from './components/InkShapeMenu.vue';
29
+ export { default as InkSignatureMenu } from './components/InkSignatureMenu.vue';
30
+ export { default as InkSignatureDialog } from './components/InkSignatureDialog.vue';
31
+ export { default as InkHighlightMenu } from './components/InkHighlightMenu.vue';
32
+ export { default as InkLineStyleMenu } from './components/InkLineStyleMenu.vue';
33
+ export { default as InkTextStyleMenu } from './components/InkTextStyleMenu.vue';
23
34
  export { default as InkZoomIn } from './components/InkZoomIn.vue';
24
35
  export { default as InkZoomOut } from './components/InkZoomOut.vue';
25
36
  export { default as InkZoomSelect } from './components/InkZoomSelect.vue';
@@ -27,8 +38,6 @@ export { default as InkPageInput } from './components/InkPageInput.vue';
27
38
  export { default as InkPageCount } from './components/InkPageCount.vue';
28
39
  export { default as InkPrevPage } from './components/InkPrevPage.vue';
29
40
  export { default as InkNextPage } from './components/InkNextPage.vue';
30
- export { default as InkNotePopover } from './components/InkNotePopover.vue';
31
- export type { NotePopoverSlotProps } from './components/InkNotePopover.vue';
32
- export { default as InkSuggestionCard } from './components/InkSuggestionCard.vue';
33
- export type { ConfidenceBucket, SuggestionCardSlotProps, } from './components/InkSuggestionCard.vue';
41
+ export { default as InkThreadPopover } from './components/InkThreadPopover.vue';
42
+ export type { ThreadPopoverSlotProps } from './components/InkThreadPopover.vue';
34
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,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mCAAmC,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,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
@@ -4,27 +4,35 @@ import n from "./components/InkRoot.js";
4
4
  import { useDocument as r } from "./composables/useDocument.js";
5
5
  import { useAnnotations as i } from "./composables/useAnnotations.js";
6
6
  import { useTool as a } from "./composables/useTool.js";
7
- import { useSelection as o } from "./composables/useSelection.js";
8
- import { useZoom as s } from "./composables/useZoom.js";
9
- import { usePage as c } from "./composables/usePage.js";
10
- import { useHistory as l } from "./composables/useHistory.js";
11
- import { useEmbedded as u } from "./composables/useEmbedded.js";
12
- import d from "./components/InkAnnotation.js";
13
- import f from "./components/InkPage.js";
14
- import p from "./components/InkViewport.js";
15
- import m from "./components/InkToolbar.js";
16
- import h from "./components/InkIcon.js";
17
- import g from "./components/InkToolButton.js";
18
- import _ from "./components/InkToolbarSeparator.js";
19
- import v from "./components/InkUndo.js";
20
- import y from "./components/InkRedo.js";
21
- import b from "./components/InkZoomIn.js";
22
- import x from "./components/InkZoomOut.js";
23
- import S from "./components/InkZoomSelect.js";
24
- import C from "./components/InkPageInput.js";
25
- import w from "./components/InkPageCount.js";
26
- import T from "./components/InkPrevPage.js";
27
- import E from "./components/InkNextPage.js";
28
- import D from "./components/InkNotePopover.js";
29
- import O from "./components/InkSuggestionCard.js";
30
- export { d as InkAnnotation, h as InkIcon, E as InkNextPage, D as InkNotePopover, f as InkPage, w as InkPageCount, C as InkPageInput, T as InkPrevPage, y as InkRedo, n as InkRoot, O as InkSuggestionCard, g as InkToolButton, m as InkToolbar, _ as InkToolbarSeparator, v as InkUndo, p as InkViewport, b as InkZoomIn, x as InkZoomOut, S as InkZoomSelect, e as injectInkContext, i as useAnnotations, r as useDocument, u as useEmbedded, l as useHistory, c as usePage, t as useReadable, o as useSelection, a as useTool, s as useZoom };
7
+ import { useToolStyle as o } from "./composables/useToolStyle.js";
8
+ import { useToolOptions as s } from "./composables/useToolOptions.js";
9
+ import { useSelection as c } from "./composables/useSelection.js";
10
+ import { useZoom as l } from "./composables/useZoom.js";
11
+ import { usePage as u } from "./composables/usePage.js";
12
+ import { useHistory as d } from "./composables/useHistory.js";
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
+ 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, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkbar/vue",
3
- "version": "0.3.0",
3
+ "version": "0.5.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.3.0",
27
+ "@inkbar/icons": "^0.5.0",
28
28
  "reka-ui": "^2.11.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@inkbar/core": "^0.3.0",
31
+ "@inkbar/core": "^0.5.0",
32
32
  "vue": "^3.5.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@inkbar/core": "0.3.0",
35
+ "@inkbar/core": "0.5.0",
36
36
  "@inkbar/fixtures": "0.0.0",
37
- "@inkbar/theme": "0.3.0",
37
+ "@inkbar/theme": "0.5.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 "./InkNotePopover.vue_vue_type_script_setup_true_lang.js";
2
- //#region src/components/InkNotePopover.vue
3
- var t = e;
4
- //#endregion
5
- export { t as default };
6
-
7
- //# sourceMappingURL=InkNotePopover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InkNotePopover.js","names":["_sfc_main","InkNotePopover_vue_vue_type_script_setup_true_lang_default","InkNotePopover_default"],"sources":["../../src/components/InkNotePopover.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The thread for the activated note, anchored to the note's overlay element. Activating a\n * reply opens the whole thread from its root. Closing (Close, Escape, a press outside) clears `activated`.\n *\n * A new note has no text. While its root is empty (and unlocked) the default form writes the\n * root's own `contents`, labelled \"Comment\", and the thread list stays hidden until there is\n * something in it; after that the form adds replies. Closing a root that is still empty and\n * has no replies removes it, so an abandoned note does not stay on the page.\n */\nimport { isAbandonedNote, threadOf, threadRoot } from '@inkbar/core'\nimport { PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui'\nimport { computed, ref, watch } 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 { Annotation, NoteAnnotation } from '@inkbar/core'\nimport type { NotePopoverSlotProps } from '@inkbar/core/dom'\n\nexport type { NotePopoverSlotProps } from '@inkbar/core/dom'\n\ndefineSlots<{ default?(props: NotePopoverSlotProps): unknown }>()\n\nconst ctx = injectInkContext()\nconst { annotations, add, update, remove } = useAnnotations()\n\nconst find = (id: string | undefined) =>\n id ? annotations.value.find((a) => a.id === id) : undefined\n\nconst note = computed<NoteAnnotation | null>(() => {\n const a = find(ctx.activated.value ?? undefined)\n return a?.type === 'text' ? threadRoot(annotations.value, a) : null\n})\nconst anchor = useAnnotationElement(\n ctx,\n computed(() => note.value?.id ?? null)\n)\nconst focusReturn = useFocusReturn(ctx)\nconst open = computed(() => note.value !== null && anchor.value !== null)\nconst thread = computed<Annotation[]>(() =>\n note.value ? threadOf(annotations.value, note.value) : []\n)\n\n/** True while the default form writes the root note's own text rather than a reply. */\nconst editingRoot = computed(() => {\n const root = note.value\n return root !== null && !root.locked && !root.contents?.trim()\n})\n\nconst draft = ref('')\nconst noteId = () => note.value?.id\n// Synchronous, so a render for another note never shows the old draft.\nwatch(noteId, () => (draft.value = ''), { flush: 'sync' })\nwatch(noteId, (_next, previous) => {\n // Activation moved on from a note that never got any text: drop it.\n if (previous !== undefined) dropIfEmpty(previous)\n})\n\n/**\n * Notes this popover wrote text or a reply for. In controlled mode the write is a proposal\n * the host may not have applied yet, so the applied list still shows the note empty; these\n * are never dropped as abandoned.\n */\nconst written = new Set<string>()\n/** Notes this popover has already asked to remove, so a slow host is asked once. */\nconst dropped = new Set<string>()\n\n/** Removes an unlocked root note with no text and no replies. True when it did. */\nfunction dropIfEmpty(id: string): boolean {\n if (dropped.has(id) || written.has(id) || !isAbandonedNote(annotations.value, id))\n return false\n dropped.add(id)\n remove(id)\n return true\n}\n\nfunction reply(text: string): void {\n const root = note.value\n const contents = text.trim()\n if (!root || !contents) return\n written.add(root.id)\n add({ type: 'text', page: root.page, rect: root.rect, contents, inReplyTo: root.id })\n draft.value = ''\n}\nfunction close(): void {\n const root = note.value\n if (root && find(root.id) && isEmptyRoot(root)) {\n focusReturn.beforeRemove(anchor.value)\n dropIfEmpty(root.id)\n }\n ctx.setActivated(null)\n}\nfunction isEmptyRoot(root: NoteAnnotation): boolean {\n return (\n !written.has(root.id) &&\n !root.locked &&\n !root.contents?.trim() &&\n thread.value.length === 1\n )\n}\nfunction submit(): void {\n const text = draft.value.trim()\n if (!text) return\n if (editingRoot.value) {\n updateContents(text)\n draft.value = ''\n } else reply(text)\n}\n/** Locked notes cannot be removed: removing one does nothing and keeps the popover. */\nfunction removeThread(): void {\n const root = note.value\n if (!root || root.locked) return\n focusReturn.beforeRemove(anchor.value)\n // Under a slow controlled host the note stays listed for a while; it is not asked for again.\n dropped.add(root.id)\n remove(root.id)\n ctx.setActivated(null)\n}\nfunction updateContents(contents: string): void {\n if (!note.value || note.value.locked) return\n if (contents.trim()) written.add(note.value.id)\n update(note.value.id, { contents })\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=\"note && anchor\"\n :reference=\"anchor\"\n class=\"ink-note-popover\"\n data-ink-note-popover\n side=\"right\"\n :side-offset=\"8\"\n :collision-padding=\"8\"\n v-bind=\"{ 'aria-label': 'Note thread' }\"\n @interact-outside=\"keepOpenOnAnnotation\"\n @close-auto-focus=\"focusReturn.onCloseAutoFocus($event, anchor)\"\n >\n <slot\n :note=\"note\"\n :replies=\"thread.slice(1)\"\n :reply=\"reply\"\n :update=\"updateContents\"\n :remove=\"removeThread\"\n :close=\"close\"\n >\n <ol v-if=\"!editingRoot || thread.length > 1\" class=\"ink-thread\" data-ink-thread>\n <li\n v-for=\"item in thread\"\n :key=\"item.id\"\n class=\"ink-thread-item\"\n data-ink-thread-item\n :data-reply=\"item.inReplyTo ? '' : undefined\"\n >\n <span class=\"ink-thread-author\">{{ item.author ?? 'Anonymous' }}</span>\n <time class=\"ink-thread-time\" :datetime=\"item.createdAt\">\n {{ new Date(item.createdAt).toLocaleString() }}\n </time>\n <p class=\"ink-thread-text\">{{ item.contents }}</p>\n </li>\n </ol>\n <form class=\"ink-thread-reply\" data-ink-thread-reply @submit.prevent=\"submit\">\n <textarea\n v-model=\"draft\"\n :aria-label=\"editingRoot ? 'Comment' : 'Reply'\"\n rows=\"2\"\n :placeholder=\"editingRoot ? 'Comment' : 'Reply'\"\n />\n <div class=\"ink-thread-actions\">\n <button type=\"submit\" :disabled=\"!draft.trim()\">\n {{ editingRoot ? 'Comment' : 'Reply' }}\n </button>\n <button v-if=\"!note.locked\" type=\"button\" @click=\"removeThread\">\n Delete\n </button>\n <button type=\"button\" @click=\"close\">Close</button>\n </div>\n </form>\n </slot>\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"InkNotePopover.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkNotePopover.vue"],"names":[],"mappings":"AAsNA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAG5D,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;CAAE,CAAC;AA2RtE,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 +0,0 @@
1
- {"version":3,"file":"InkNotePopover.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_renderSlot","_createElementBlock","_Fragment","_renderList","_createElementVNode","_toDisplayString","_createCommentVNode","_withModifiers","_withDirectives","_vModelText","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","InkNotePopover_vue_vue_type_script_setup_true_lang_default","ctx","injectInkContext","useAnnotations","find","id","annotations","a","note","computed","threadRoot","anchor","useAnnotationElement","focusReturn","useFocusReturn","open","thread","threadOf","editingRoot","root","draft","ref","noteId","watch","previous","dropIfEmpty","written","dropped","isAbandonedNote","remove","reply","contents","text","add","close","isEmptyRoot","submit","updateContents","removeThread","update","onOpenChange","next","openBlock","createBlock","unref","PopoverRoot","withCtx","createVNode","PopoverPortal","PopoverContent","mergeProps","keepOpenOnAnnotation","_cache","$event","renderSlot","_ctx","createElementBlock","Fragment","renderList","item","createElementVNode","toDisplayString","createCommentVNode","withModifiers","withDirectives","vModelText"],"sources":["../../src/components/InkNotePopover.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The thread for the activated note, anchored to the note's overlay element. Activating a\n * reply opens the whole thread from its root. Closing (Close, Escape, a press outside) clears `activated`.\n *\n * A new note has no text. While its root is empty (and unlocked) the default form writes the\n * root's own `contents`, labelled \"Comment\", and the thread list stays hidden until there is\n * something in it; after that the form adds replies. Closing a root that is still empty and\n * has no replies removes it, so an abandoned note does not stay on the page.\n */\nimport { isAbandonedNote, threadOf, threadRoot } from '@inkbar/core'\nimport { PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui'\nimport { computed, ref, watch } 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 { Annotation, NoteAnnotation } from '@inkbar/core'\nimport type { NotePopoverSlotProps } from '@inkbar/core/dom'\n\nexport type { NotePopoverSlotProps } from '@inkbar/core/dom'\n\ndefineSlots<{ default?(props: NotePopoverSlotProps): unknown }>()\n\nconst ctx = injectInkContext()\nconst { annotations, add, update, remove } = useAnnotations()\n\nconst find = (id: string | undefined) =>\n id ? annotations.value.find((a) => a.id === id) : undefined\n\nconst note = computed<NoteAnnotation | null>(() => {\n const a = find(ctx.activated.value ?? undefined)\n return a?.type === 'text' ? threadRoot(annotations.value, a) : null\n})\nconst anchor = useAnnotationElement(\n ctx,\n computed(() => note.value?.id ?? null)\n)\nconst focusReturn = useFocusReturn(ctx)\nconst open = computed(() => note.value !== null && anchor.value !== null)\nconst thread = computed<Annotation[]>(() =>\n note.value ? threadOf(annotations.value, note.value) : []\n)\n\n/** True while the default form writes the root note's own text rather than a reply. */\nconst editingRoot = computed(() => {\n const root = note.value\n return root !== null && !root.locked && !root.contents?.trim()\n})\n\nconst draft = ref('')\nconst noteId = () => note.value?.id\n// Synchronous, so a render for another note never shows the old draft.\nwatch(noteId, () => (draft.value = ''), { flush: 'sync' })\nwatch(noteId, (_next, previous) => {\n // Activation moved on from a note that never got any text: drop it.\n if (previous !== undefined) dropIfEmpty(previous)\n})\n\n/**\n * Notes this popover wrote text or a reply for. In controlled mode the write is a proposal\n * the host may not have applied yet, so the applied list still shows the note empty; these\n * are never dropped as abandoned.\n */\nconst written = new Set<string>()\n/** Notes this popover has already asked to remove, so a slow host is asked once. */\nconst dropped = new Set<string>()\n\n/** Removes an unlocked root note with no text and no replies. True when it did. */\nfunction dropIfEmpty(id: string): boolean {\n if (dropped.has(id) || written.has(id) || !isAbandonedNote(annotations.value, id))\n return false\n dropped.add(id)\n remove(id)\n return true\n}\n\nfunction reply(text: string): void {\n const root = note.value\n const contents = text.trim()\n if (!root || !contents) return\n written.add(root.id)\n add({ type: 'text', page: root.page, rect: root.rect, contents, inReplyTo: root.id })\n draft.value = ''\n}\nfunction close(): void {\n const root = note.value\n if (root && find(root.id) && isEmptyRoot(root)) {\n focusReturn.beforeRemove(anchor.value)\n dropIfEmpty(root.id)\n }\n ctx.setActivated(null)\n}\nfunction isEmptyRoot(root: NoteAnnotation): boolean {\n return (\n !written.has(root.id) &&\n !root.locked &&\n !root.contents?.trim() &&\n thread.value.length === 1\n )\n}\nfunction submit(): void {\n const text = draft.value.trim()\n if (!text) return\n if (editingRoot.value) {\n updateContents(text)\n draft.value = ''\n } else reply(text)\n}\n/** Locked notes cannot be removed: removing one does nothing and keeps the popover. */\nfunction removeThread(): void {\n const root = note.value\n if (!root || root.locked) return\n focusReturn.beforeRemove(anchor.value)\n // Under a slow controlled host the note stays listed for a while; it is not asked for again.\n dropped.add(root.id)\n remove(root.id)\n ctx.setActivated(null)\n}\nfunction updateContents(contents: string): void {\n if (!note.value || note.value.locked) return\n if (contents.trim()) written.add(note.value.id)\n update(note.value.id, { contents })\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=\"note && anchor\"\n :reference=\"anchor\"\n class=\"ink-note-popover\"\n data-ink-note-popover\n side=\"right\"\n :side-offset=\"8\"\n :collision-padding=\"8\"\n v-bind=\"{ 'aria-label': 'Note thread' }\"\n @interact-outside=\"keepOpenOnAnnotation\"\n @close-auto-focus=\"focusReturn.onCloseAutoFocus($event, anchor)\"\n >\n <slot\n :note=\"note\"\n :replies=\"thread.slice(1)\"\n :reply=\"reply\"\n :update=\"updateContents\"\n :remove=\"removeThread\"\n :close=\"close\"\n >\n <ol v-if=\"!editingRoot || thread.length > 1\" class=\"ink-thread\" data-ink-thread>\n <li\n v-for=\"item in thread\"\n :key=\"item.id\"\n class=\"ink-thread-item\"\n data-ink-thread-item\n :data-reply=\"item.inReplyTo ? '' : undefined\"\n >\n <span class=\"ink-thread-author\">{{ item.author ?? 'Anonymous' }}</span>\n <time class=\"ink-thread-time\" :datetime=\"item.createdAt\">\n {{ new Date(item.createdAt).toLocaleString() }}\n </time>\n <p class=\"ink-thread-text\">{{ item.contents }}</p>\n </li>\n </ol>\n <form class=\"ink-thread-reply\" data-ink-thread-reply @submit.prevent=\"submit\">\n <textarea\n v-model=\"draft\"\n :aria-label=\"editingRoot ? 'Comment' : 'Reply'\"\n rows=\"2\"\n :placeholder=\"editingRoot ? 'Comment' : 'Reply'\"\n />\n <div class=\"ink-thread-actions\">\n <button type=\"submit\" :disabled=\"!draft.trim()\">\n {{ editingRoot ? 'Comment' : 'Reply' }}\n </button>\n <button v-if=\"!note.locked\" type=\"button\" @click=\"removeThread\">\n Delete\n </button>\n <button type=\"button\" @click=\"close\">Close</button>\n </div>\n </form>\n </slot>\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EA2BA,IAAMyB,IAAMC,EAAiB,GACvB,EAAE,gBAAa,QAAK,WAAQ,cAAWC,EAAe,GAEtDC,KAAQ,MACZC,IAAKC,EAAY,MAAM,MAAM,MAAMC,EAAE,OAAOF,CAAE,IAAI,KAAA,GAE9CG,IAAOC,QAAsC;GACjD,IAAMF,IAAIH,EAAKH,EAAI,UAAU,SAAS,KAAA,CAAS;GAC/C,OAAOM,GAAG,SAAS,SAASG,GAAWJ,EAAY,OAAOC,CAAC,IAAI;EACjE,CAAC,GACKI,IAASC,EACbX,GACAQ,QAAeD,EAAK,OAAO,MAAM,IAAI,CACvC,GACMK,IAAcC,EAAeb,CAAG,GAChCc,IAAON,QAAeD,EAAK,UAAU,QAAQG,EAAO,UAAU,IAAI,GAClEK,IAASP,QACbD,EAAK,QAAQS,EAASX,EAAY,OAAOE,EAAK,KAAK,IAAI,CAAC,CAC1D,GAGMU,IAAcT,QAAe;GACjC,IAAMU,IAAOX,EAAK;GAClB,OAAOW,MAAS,QAAQ,CAACA,EAAK,UAAU,CAACA,EAAK,UAAU,KAAK;EAC/D,CAAC,GAEKC,IAAQC,EAAI,EAAE,GACdC,UAAed,EAAK,OAAO;EAGjC,AADAe,EAAMD,SAAe,EAAM,QAAQ,IAAK,EAAE,OAAO,OAAO,CAAC,GACzDC,EAAMD,IAAS,GAAO,MAAa;GAEjC,AAAIE,MAAa,KAAA,KAAWC,EAAYD,CAAQ;EAClD,CAAC;EAOD,IAAME,oBAAU,IAAI,IAAY,GAE1BC,oBAAU,IAAI,IAAY;EAGhC,SAASF,EAAY,GAAqB;GAKxC,OAJIE,EAAQ,IAAItB,CAAE,KAAKqB,EAAQ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AAA,KAAKwE,EAAK,SAAS,CAAA,CAAE,eAAc,CAAA,GAAA,GAAAhE,CAAA;MAE5CT,EAAkD,KAAlDU,GAAkDT,EAApBwE,EAAK,QAAQ,GAAA,CAAA;eAG/CzE,GAAAA,GAAAA,EAAAA,CAAAA,KAAAA,EAAAA,IAAAA,EAAAA,GAAAA,EAgBO,QAAA;MAhBD,OAAM;MAAmB,yBAAA;MAAuB,UAAMG,EAAU+C,IAAM,CAAA,SAAA,CAAA;KAC1E9C,GAAAA,CAAAA,EAAAJ,EAKE,YAAA;MAJS,uBAAA,AAAAkE,EAAA,QAAA,MAAA,EAAK,QAAAC;MACb,cAAYnC,EAAA,QAAW,YAAA;MACxB,MAAK;MACJ,aAAaA,EAAA,QAAW,YAAA;KAHhB,GAAA,MAAA,GAAArB,CAAA,GAAA,CAAA,CAAAN,GAAA6B,EAAA,KAAK,CAAA,CAAA,GAKhBlC,EAQM,OARNY,GAQM;MAPJZ,EAES,UAAA;OAFD,MAAK;OAAU,UAAQ,CAAGkC,EAAA,MAAM,KAAI;MACvC,GAAAjC,EAAA+B,EAAA,QAAW,YAAA,OAAA,GAAA,GAAAnB,CAAA;MAEDS,EAAA,MAAK,SAEpBsD,EAAA,IAAA,EAAA,KAFAtF,EAAA,GAAAO,EAES,UAAA;;OAFmB,MAAK;OAAU,SAAOuD;MAAc,GAAA,UAEhE;MACApD,EAAmD,UAAA;OAA3C,MAAK;OAAU,SAAOgD;MAAO,GAAA,OAAK"}
@@ -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 +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