@inkbar/vue 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +137 -2
- package/dist/components/InkAnnotation.js +7 -0
- package/dist/components/InkAnnotation.js.map +1 -0
- package/dist/components/InkAnnotation.vue.d.ts +22 -0
- package/dist/components/InkAnnotation.vue.d.ts.map +1 -0
- package/dist/components/InkAnnotation.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/InkAnnotation.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkIcon.js +7 -0
- package/dist/components/InkIcon.js.map +1 -0
- package/dist/components/InkIcon.vue.d.ts +11 -0
- package/dist/components/InkIcon.vue.d.ts.map +1 -0
- package/dist/components/InkIcon.vue_vue_type_script_setup_true_lang.js +22 -0
- package/dist/components/InkIcon.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkNextPage.js +7 -0
- package/dist/components/InkNextPage.js.map +1 -0
- package/dist/components/InkNextPage.vue.d.ts +19 -0
- package/dist/components/InkNextPage.vue.d.ts.map +1 -0
- package/dist/components/InkNextPage.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/InkNextPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkNotePopover.js +7 -0
- package/dist/components/InkNotePopover.js.map +1 -0
- package/dist/components/InkNotePopover.vue.d.ts +15 -0
- package/dist/components/InkNotePopover.vue.d.ts.map +1 -0
- package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkPage.js +7 -0
- package/dist/components/InkPage.js.map +1 -0
- package/dist/components/InkPage.vue.d.ts +32 -0
- package/dist/components/InkPage.vue.d.ts.map +1 -0
- package/dist/components/InkPage.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/InkPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkPageCount.js +7 -0
- package/dist/components/InkPageCount.js.map +1 -0
- package/dist/components/InkPageCount.vue.d.ts +4 -0
- package/dist/components/InkPageCount.vue.d.ts.map +1 -0
- package/dist/components/InkPageCount.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/components/InkPageCount.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkPageInput.js +7 -0
- package/dist/components/InkPageInput.js.map +1 -0
- package/dist/components/InkPageInput.vue.d.ts +4 -0
- package/dist/components/InkPageInput.vue.d.ts.map +1 -0
- package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/InkPageInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkPrevPage.js +7 -0
- package/dist/components/InkPrevPage.js.map +1 -0
- package/dist/components/InkPrevPage.vue.d.ts +19 -0
- package/dist/components/InkPrevPage.vue.d.ts.map +1 -0
- package/dist/components/InkPrevPage.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/InkPrevPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkRedo.js +7 -0
- package/dist/components/InkRedo.js.map +1 -0
- package/dist/components/InkRedo.vue.d.ts +19 -0
- package/dist/components/InkRedo.vue.d.ts.map +1 -0
- package/dist/components/InkRedo.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/InkRedo.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkRoot.js +7 -0
- package/dist/components/InkRoot.js.map +1 -0
- package/dist/components/InkRoot.vue.d.ts +784 -0
- package/dist/components/InkRoot.vue.d.ts.map +1 -0
- package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +162 -0
- package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkSuggestionCard.js +7 -0
- package/dist/components/InkSuggestionCard.js.map +1 -0
- package/dist/components/InkSuggestionCard.vue.d.ts +16 -0
- package/dist/components/InkSuggestionCard.vue.d.ts.map +1 -0
- package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js +85 -0
- package/dist/components/InkSuggestionCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkToolButton.js +7 -0
- package/dist/components/InkToolButton.js.map +1 -0
- package/dist/components/InkToolButton.vue.d.ts +26 -0
- package/dist/components/InkToolButton.vue.d.ts.map +1 -0
- package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkToolbar.js +7 -0
- package/dist/components/InkToolbar.js.map +1 -0
- package/dist/components/InkToolbar.vue.d.ts +21 -0
- package/dist/components/InkToolbar.vue.d.ts.map +1 -0
- package/dist/components/InkToolbar.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/components/InkToolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkToolbarSeparator.js +7 -0
- package/dist/components/InkToolbarSeparator.js.map +1 -0
- package/dist/components/InkToolbarSeparator.vue.d.ts +4 -0
- package/dist/components/InkToolbarSeparator.vue.d.ts.map +1 -0
- package/dist/components/InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/components/InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkUndo.js +7 -0
- package/dist/components/InkUndo.js.map +1 -0
- package/dist/components/InkUndo.vue.d.ts +19 -0
- package/dist/components/InkUndo.vue.d.ts.map +1 -0
- package/dist/components/InkUndo.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/InkUndo.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkViewport.js +7 -0
- package/dist/components/InkViewport.js.map +1 -0
- package/dist/components/InkViewport.vue.d.ts +39 -0
- package/dist/components/InkViewport.vue.d.ts.map +1 -0
- package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +148 -0
- package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkZoomIn.js +7 -0
- package/dist/components/InkZoomIn.js.map +1 -0
- package/dist/components/InkZoomIn.vue.d.ts +19 -0
- package/dist/components/InkZoomIn.vue.d.ts.map +1 -0
- package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkZoomOut.js +7 -0
- package/dist/components/InkZoomOut.js.map +1 -0
- package/dist/components/InkZoomOut.vue.d.ts +19 -0
- package/dist/components/InkZoomOut.vue.d.ts.map +1 -0
- package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkZoomSelect.js +7 -0
- package/dist/components/InkZoomSelect.js.map +1 -0
- package/dist/components/InkZoomSelect.vue.d.ts +4 -0
- package/dist/components/InkZoomSelect.vue.d.ts.map +1 -0
- package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js +115 -0
- package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/annotation-element.d.ts +5 -0
- package/dist/components/annotation-element.d.ts.map +1 -0
- package/dist/components/annotation-element.js +18 -0
- package/dist/components/annotation-element.js.map +1 -0
- package/dist/components/annotation-slot.d.ts +2 -0
- package/dist/components/annotation-slot.d.ts.map +1 -0
- package/dist/components/popover-focus.d.ts +9 -0
- package/dist/components/popover-focus.d.ts.map +1 -0
- package/dist/components/popover-focus.js +15 -0
- package/dist/components/popover-focus.js.map +1 -0
- package/dist/composables/useAnnotations.d.ts +1921 -0
- package/dist/composables/useAnnotations.d.ts.map +1 -0
- package/dist/composables/useAnnotations.js +27 -0
- package/dist/composables/useAnnotations.js.map +1 -0
- package/dist/composables/useDocument.d.ts +12 -0
- package/dist/composables/useDocument.d.ts.map +1 -0
- package/dist/composables/useDocument.js +20 -0
- package/dist/composables/useDocument.js.map +1 -0
- package/dist/composables/useEmbedded.d.ts +6 -0
- package/dist/composables/useEmbedded.d.ts.map +1 -0
- package/dist/composables/useEmbedded.js +15 -0
- package/dist/composables/useEmbedded.js.map +1 -0
- package/dist/composables/useHistory.d.ts +7 -0
- package/dist/composables/useHistory.d.ts.map +1 -0
- package/dist/composables/useHistory.js +9 -0
- package/dist/composables/useHistory.js.map +1 -0
- package/dist/composables/usePage.d.ts +10 -0
- package/dist/composables/usePage.d.ts.map +1 -0
- package/dist/composables/usePage.js +22 -0
- package/dist/composables/usePage.js.map +1 -0
- package/dist/composables/useSelection.d.ts +6 -0
- package/dist/composables/useSelection.d.ts.map +1 -0
- package/dist/composables/useSelection.js +14 -0
- package/dist/composables/useSelection.js.map +1 -0
- package/dist/composables/useTool.d.ts +6 -0
- package/dist/composables/useTool.d.ts.map +1 -0
- package/dist/composables/useTool.js +13 -0
- package/dist/composables/useTool.js.map +1 -0
- package/dist/composables/useZoom.d.ts +9 -0
- package/dist/composables/useZoom.d.ts.map +1 -0
- package/dist/composables/useZoom.js +17 -0
- package/dist/composables/useZoom.js.map +1 -0
- package/dist/context.d.ts +50 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +13 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/ref-history.d.ts +18 -0
- package/dist/ref-history.d.ts.map +1 -0
- package/dist/ref-history.js +25 -0
- package/dist/ref-history.js.map +1 -0
- package/dist/use-readable.d.ts +5 -0
- package/dist/use-readable.d.ts.map +1 -0
- package/dist/use-readable.js +16 -0
- package/dist/use-readable.js.map +1 -0
- package/package.json +52 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnnotations.d.ts","sourceRoot":"","sources":["../../src/composables/useAnnotations.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,eA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAIL,MAAM;EAEvB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { computed as t } from "vue";
|
|
3
|
+
import { acceptSuggestion as n, repliesTo as r } from "@inkbar/core";
|
|
4
|
+
//#region src/composables/useAnnotations.ts
|
|
5
|
+
function i() {
|
|
6
|
+
let i = e("useAnnotations()"), a = () => i.document.value?.annotations;
|
|
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
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { i as useAnnotations };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=useAnnotations.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnnotationDocument, ImportOptions } from '@inkbar/core';
|
|
2
|
+
export declare function useDocument(): {
|
|
3
|
+
document: Readonly<import('vue').ShallowRef<import('@inkbar/core').InkDocument | null>>;
|
|
4
|
+
status: Readonly<import('vue').Ref<import('@inkbar/core').InkStatus, import('@inkbar/core').InkStatus>>;
|
|
5
|
+
isReady: import('vue').ComputedRef<boolean>;
|
|
6
|
+
error: import('vue').ComputedRef<import('@inkbar/core').InkError | null>;
|
|
7
|
+
pages: import('vue').ComputedRef<readonly import('@inkbar/core').PageInfo[]>;
|
|
8
|
+
info: import('vue').ComputedRef<import('@inkbar/core').DocumentInfo | null>;
|
|
9
|
+
exportAnnotations: () => AnnotationDocument | undefined;
|
|
10
|
+
importAnnotations: (data: AnnotationDocument | string, opts?: ImportOptions) => import('@inkbar/core').ImportResult | undefined;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDocument.d.ts","sourceRoot":"","sources":["../../src/composables/useDocument.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAErE,wBAAgB,WAAW;;;;;;;;8BAYG,kBAAkB,GAAG,MAAM,SAAS,aAAa;EAG9E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { computed as t } from "vue";
|
|
3
|
+
//#region src/composables/useDocument.ts
|
|
4
|
+
function n() {
|
|
5
|
+
let n = e("useDocument()");
|
|
6
|
+
return {
|
|
7
|
+
document: n.document,
|
|
8
|
+
status: n.status,
|
|
9
|
+
isReady: t(() => n.status.value.state === "ready"),
|
|
10
|
+
error: t(() => n.status.value.state === "error" ? n.status.value.error : null),
|
|
11
|
+
pages: t(() => n.document.value?.pages ?? []),
|
|
12
|
+
info: t(() => n.document.value?.info ?? null),
|
|
13
|
+
exportAnnotations: () => n.document.value?.exportAnnotations("json"),
|
|
14
|
+
importAnnotations: (e, t) => n.document.value?.importAnnotations(e, t)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as useDocument };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=useDocument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDocument.js","names":["useDocument","ctx","useInkContext","computed","data","opts"],"sources":["../../src/composables/useDocument.ts"],"sourcesContent":["import { computed } from 'vue'\n\nimport { useInkContext } from '../context'\n\nimport type { AnnotationDocument, ImportOptions } from '@inkbar/core'\n\nexport function useDocument() {\n const ctx = useInkContext('useDocument()')\n return {\n document: ctx.document,\n status: ctx.status,\n isReady: computed(() => ctx.status.value.state === 'ready'),\n error: computed(() =>\n ctx.status.value.state === 'error' ? ctx.status.value.error : null\n ),\n pages: computed(() => ctx.document.value?.pages ?? []),\n info: computed(() => ctx.document.value?.info ?? null),\n exportAnnotations: () => ctx.document.value?.exportAnnotations('json'),\n importAnnotations: (data: AnnotationDocument | string, opts?: ImportOptions) =>\n ctx.document.value?.importAnnotations(data, opts),\n }\n}\n"],"mappings":";;;AAMA,SAAgBA,IAAc;CAC5B,IAAMC,IAAMC,EAAc,eAAe;CACzC,OAAO;EACL,UAAUD,EAAI;EACd,QAAQA,EAAI;EACZ,SAASE,QAAeF,EAAI,OAAO,MAAM,UAAU,OAAO;EAC1D,OAAOE,QACLF,EAAI,OAAO,MAAM,UAAU,UAAUA,EAAI,OAAO,MAAM,QAAQ,IAChE;EACA,OAAOE,QAAeF,EAAI,SAAS,OAAO,SAAS,CAAC,CAAC;EACrD,MAAME,QAAeF,EAAI,SAAS,OAAO,QAAQ,IAAI;EACrD,yBAAyBA,EAAI,SAAS,OAAO,kBAAkB,MAAM;EACrE,oBAAoB,GAAmC,MACrDA,EAAI,SAAS,OAAO,kBAAkBG,GAAMC,CAAI;CACpD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEmbedded.d.ts","sourceRoot":"","sources":["../../src/composables/useEmbedded.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW;;;;EAQ1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { computed as t } from "vue";
|
|
3
|
+
//#region src/composables/useEmbedded.ts
|
|
4
|
+
function n() {
|
|
5
|
+
let n = e("useEmbedded()"), r = t(() => n.document.value?.embedded ?? []);
|
|
6
|
+
return {
|
|
7
|
+
summary: r,
|
|
8
|
+
total: t(() => r.value.reduce((e, t) => e + t.count, 0)),
|
|
9
|
+
hasAny: t(() => r.value.length > 0)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as useEmbedded };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=useEmbedded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEmbedded.js","names":["useEmbedded","ctx","useInkContext","summary","computed","n","s"],"sources":["../../src/composables/useEmbedded.ts"],"sourcesContent":["import { computed } from 'vue'\n\nimport { useInkContext } from '../context'\n\nexport function useEmbedded() {\n const ctx = useInkContext('useEmbedded()')\n const summary = computed(() => ctx.document.value?.embedded ?? [])\n return {\n summary,\n total: computed(() => summary.value.reduce((n, s) => n + s.count, 0)),\n hasAny: computed(() => summary.value.length > 0),\n }\n}\n"],"mappings":";;;AAIA,SAAgBA,IAAc;CAC5B,IAAMC,IAAMC,EAAc,eAAe,GACnCC,IAAUC,QAAeH,EAAI,SAAS,OAAO,YAAY,CAAC,CAAC;CACjE,OAAO;EACL;EACA,OAAOG,QAAeD,EAAQ,MAAM,QAAQ,GAAG,MAAME,IAAIC,EAAE,OAAO,CAAC,CAAC;EACpE,QAAQF,QAAeD,EAAQ,MAAM,SAAS,CAAC;CACjD;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InkHistory } from '../context';
|
|
2
|
+
/**
|
|
3
|
+
* Undo and redo. Uncontrolled documents use the core history; controlled hosts that pass
|
|
4
|
+
* `history` to InkRoot get a snapshot stack over their own list, applied through v-model.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useHistory(): InkHistory;
|
|
7
|
+
//# sourceMappingURL=useHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHistory.d.ts","sourceRoot":"","sources":["../../src/composables/useHistory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;GAGG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAEvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHistory.js","names":["useHistory","useInkContext"],"sources":["../../src/composables/useHistory.ts"],"sourcesContent":["import { useInkContext } from '../context'\n\nimport type { InkHistory } from '../context'\n\n/**\n * Undo and redo. Uncontrolled documents use the core history; controlled hosts that pass\n * `history` to InkRoot get a snapshot stack over their own list, applied through v-model.\n */\nexport function useHistory(): InkHistory {\n return useInkContext('useHistory()').history\n}\n"],"mappings":";;AAQA,SAAgBA,IAAyB;CACvC,OAAOC,EAAc,cAAc,CAAC,CAAC;AACvC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function usePage(): {
|
|
2
|
+
/** 0-based. */
|
|
3
|
+
current: Readonly<import('vue').Ref<number, number>>;
|
|
4
|
+
count: import('vue').ComputedRef<number>;
|
|
5
|
+
goTo: (index: number) => void | undefined;
|
|
6
|
+
next: () => void | undefined;
|
|
7
|
+
previous: () => void | undefined;
|
|
8
|
+
scrollToAnnotation(id: string): void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=usePage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePage.d.ts","sourceRoot":"","sources":["../../src/composables/usePage.ts"],"names":[],"mappings":"AAKA,wBAAgB,OAAO;IAInB,eAAe;;;kBAGD,MAAM;;;2BAGG,MAAM;EAKhC"}
|
|
@@ -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 } from "vue";
|
|
4
|
+
//#region src/composables/usePage.ts
|
|
5
|
+
function r() {
|
|
6
|
+
let r = e("usePage()"), i = t(() => r.viewport.value?.currentPage ?? null, 0);
|
|
7
|
+
return {
|
|
8
|
+
current: i,
|
|
9
|
+
count: n(() => r.document.value?.pages.length ?? 0),
|
|
10
|
+
goTo: (e) => r.viewport.value?.scrollToPage(e),
|
|
11
|
+
next: () => r.viewport.value?.scrollToPage(i.value + 1),
|
|
12
|
+
previous: () => r.viewport.value?.scrollToPage(i.value - 1),
|
|
13
|
+
scrollToAnnotation(e) {
|
|
14
|
+
let t = r.document.value?.annotations.get(e);
|
|
15
|
+
t && r.viewport.value?.scrollToRect(t.page, t.rect);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as usePage };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=usePage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePage.js","names":["usePage","ctx","useInkContext","current","useReadable","computed","index","a","id"],"sources":["../../src/composables/usePage.ts"],"sourcesContent":["import { computed } from 'vue'\n\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nexport function usePage() {\n const ctx = useInkContext('usePage()')\n const current = useReadable<number>(() => ctx.viewport.value?.currentPage ?? null, 0)\n return {\n /** 0-based. */\n current,\n count: computed(() => ctx.document.value?.pages.length ?? 0),\n goTo: (index: number) => ctx.viewport.value?.scrollToPage(index),\n next: () => ctx.viewport.value?.scrollToPage(current.value + 1),\n previous: () => ctx.viewport.value?.scrollToPage(current.value - 1),\n scrollToAnnotation(id: string) {\n const a = ctx.document.value?.annotations.get(id)\n if (a) ctx.viewport.value?.scrollToRect(a.page, a.rect)\n },\n }\n}\n"],"mappings":";;;;AAKA,SAAgBA,IAAU;CACxB,IAAMC,IAAMC,EAAc,WAAW,GAC/BC,IAAUC,QAA0BH,EAAI,SAAS,OAAO,eAAe,MAAM,CAAC;CACpF,OAAO;EAEL;EACA,OAAOI,QAAeJ,EAAI,SAAS,OAAO,MAAM,UAAU,CAAC;EAC3D,OAAO,MAAkBA,EAAI,SAAS,OAAO,aAAaK,CAAK;EAC/D,YAAYL,EAAI,SAAS,OAAO,aAAaE,EAAQ,QAAQ,CAAC;EAC9D,gBAAgBF,EAAI,SAAS,OAAO,aAAaE,EAAQ,QAAQ,CAAC;EAClE,mBAAmB,GAAY;GAC7B,IAAMI,IAAIN,EAAI,SAAS,OAAO,YAAY,IAAIO,CAAE;GAChD,AAAID,KAAGN,EAAI,SAAS,OAAO,aAAaM,EAAE,MAAMA,EAAE,IAAI;EACxD;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelection.d.ts","sourceRoot":"","sources":["../../src/composables/useSelection.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY;;kBAIV,MAAM,EAAE;;EAGzB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
//#region src/composables/useSelection.ts
|
|
3
|
+
function t() {
|
|
4
|
+
let t = e("useSelection()");
|
|
5
|
+
return {
|
|
6
|
+
selection: t.selection,
|
|
7
|
+
select: (e) => t.document.value?.annotations.select(e),
|
|
8
|
+
clear: () => t.document.value?.annotations.select([])
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as useSelection };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=useSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelection.js","names":["useSelection","ctx","useInkContext","ids"],"sources":["../../src/composables/useSelection.ts"],"sourcesContent":["import { useInkContext } from '../context'\n\nexport function useSelection() {\n const ctx = useInkContext('useSelection()')\n return {\n selection: ctx.selection,\n select: (ids: string[]) => ctx.document.value?.annotations.select(ids),\n clear: () => ctx.document.value?.annotations.select([]),\n }\n}\n"],"mappings":";;AAEA,SAAgBA,IAAe;CAC7B,IAAMC,IAAMC,EAAc,gBAAgB;CAC1C,OAAO;EACL,WAAWD,EAAI;EACf,SAAS,MAAkBA,EAAI,SAAS,OAAO,YAAY,OAAOE,CAAG;EACrE,aAAaF,EAAI,SAAS,OAAO,YAAY,OAAO,CAAC,CAAC;CACxD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTool.d.ts","sourceRoot":"","sources":["../../src/composables/useTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,wBAAgB,OAAO;;kBAEkB,MAAM;EAC9C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
//#region src/composables/useTool.ts
|
|
3
|
+
function t() {
|
|
4
|
+
let t = e("useTool()");
|
|
5
|
+
return {
|
|
6
|
+
tool: t.tool,
|
|
7
|
+
setTool: (e) => t.setTool(e)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as useTool };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=useTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTool.js","names":["useTool","ctx","useInkContext","id"],"sources":["../../src/composables/useTool.ts"],"sourcesContent":["import { useInkContext } from '../context'\n\nimport type { ToolId } from '@inkbar/core/dom'\n\nexport function useTool() {\n const ctx = useInkContext('useTool()')\n return { tool: ctx.tool, setTool: (id: ToolId) => ctx.setTool(id) }\n}\n"],"mappings":";;AAIA,SAAgBA,IAAU;CACxB,IAAMC,IAAMC,EAAc,WAAW;CACrC,OAAO;EAAE,MAAMD,EAAI;EAAM,UAAU,MAAeA,EAAI,QAAQE,CAAE;CAAE;AACpE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ZoomValue } from '@inkbar/core/dom';
|
|
2
|
+
export declare function useZoom(): {
|
|
3
|
+
zoom: Readonly<import('vue').Ref<ZoomValue, ZoomValue>>;
|
|
4
|
+
scale: Readonly<import('vue').Ref<number, number>>;
|
|
5
|
+
setZoom: (z: ZoomValue) => void | undefined;
|
|
6
|
+
zoomIn: () => void | undefined;
|
|
7
|
+
zoomOut: () => void | undefined;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useZoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoom.d.ts","sourceRoot":"","sources":["../../src/composables/useZoom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,wBAAgB,OAAO;;;iBAON,SAAS;;;EAIzB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useInkContext as e } from "../context.js";
|
|
2
|
+
import { useReadable as t } from "../use-readable.js";
|
|
3
|
+
//#region src/composables/useZoom.ts
|
|
4
|
+
function n() {
|
|
5
|
+
let n = e("useZoom()");
|
|
6
|
+
return {
|
|
7
|
+
zoom: t(() => n.viewport.value?.zoom ?? null, "fit-width"),
|
|
8
|
+
scale: t(() => n.viewport.value?.scale ?? null, 1),
|
|
9
|
+
setZoom: (e) => n.viewport.value?.setZoom(e),
|
|
10
|
+
zoomIn: () => n.viewport.value?.zoomBy(1.25),
|
|
11
|
+
zoomOut: () => n.viewport.value?.zoomBy(.8)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as useZoom };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=useZoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoom.js","names":["useZoom","ctx","useInkContext","useReadable","z"],"sources":["../../src/composables/useZoom.ts"],"sourcesContent":["import { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nexport function useZoom() {\n const ctx = useInkContext('useZoom()')\n const zoom = useReadable<ZoomValue>(() => ctx.viewport.value?.zoom ?? null, 'fit-width')\n const scale = useReadable<number>(() => ctx.viewport.value?.scale ?? null, 1)\n return {\n zoom,\n scale,\n setZoom: (z: ZoomValue) => ctx.viewport.value?.setZoom(z),\n zoomIn: () => ctx.viewport.value?.zoomBy(1.25),\n zoomOut: () => ctx.viewport.value?.zoomBy(0.8),\n }\n}\n"],"mappings":";;;AAKA,SAAgBA,IAAU;CACxB,IAAMC,IAAMC,EAAc,WAAW;CAGrC,OAAO;EACL,MAHWC,QAA6BF,EAAI,SAAS,OAAO,QAAQ,MAAM,WAG1E;EACA,OAHYE,QAA0BF,EAAI,SAAS,OAAO,SAAS,MAAM,CAGzE;EACA,UAAU,MAAiBA,EAAI,SAAS,OAAO,QAAQG,CAAC;EACxD,cAAcH,EAAI,SAAS,OAAO,OAAO,IAAI;EAC7C,eAAeA,EAAI,SAAS,OAAO,OAAO,EAAG;CAC/C;AACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Annotation, InkDocument, InkStatus, PdfAssets } from '@inkbar/core';
|
|
2
|
+
import { ToolController, ToolId, Viewport, ZoomValue } from '@inkbar/core/dom';
|
|
3
|
+
import { Ref, ShallowRef } from 'vue';
|
|
4
|
+
export type { InkStatus };
|
|
5
|
+
/** Undo and redo for the current document, whichever mode its annotations are in. */
|
|
6
|
+
export interface InkHistory {
|
|
7
|
+
canUndo: Readonly<Ref<boolean>>;
|
|
8
|
+
canRedo: Readonly<Ref<boolean>>;
|
|
9
|
+
undo: () => void;
|
|
10
|
+
redo: () => void;
|
|
11
|
+
clear: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Runs `fn` and records what it changes as one undo step. The host still receives one change
|
|
14
|
+
* per add. Controlled, the history groups the resulting list changes into one step, and
|
|
15
|
+
* `canUndo` updates once the current task ends. Any other change the host applies in that
|
|
16
|
+
* same window joins the step.
|
|
17
|
+
*/
|
|
18
|
+
batch: (fn: () => void) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface InkContext {
|
|
21
|
+
assets: Readonly<Ref<PdfAssets>>;
|
|
22
|
+
document: Readonly<ShallowRef<InkDocument | null>>;
|
|
23
|
+
/** `loading` from the moment a document starts opening, then the document's own status. */
|
|
24
|
+
status: Readonly<Ref<InkStatus>>;
|
|
25
|
+
annotations: Readonly<Ref<readonly Annotation[]>>;
|
|
26
|
+
selection: Readonly<Ref<readonly string[]>>;
|
|
27
|
+
/** Set by InkViewport once it has mounted its viewport and tool controller. */
|
|
28
|
+
viewport: ShallowRef<Viewport | null>;
|
|
29
|
+
tools: ShallowRef<ToolController | null>;
|
|
30
|
+
/** Desired tool; InkViewport applies it to the controller. */
|
|
31
|
+
tool: Readonly<Ref<ToolId>>;
|
|
32
|
+
setTool(id: ToolId): void;
|
|
33
|
+
/** Desired zoom and page from the host's v-models; InkViewport applies and reports back. */
|
|
34
|
+
zoomModel: Readonly<Ref<ZoomValue | undefined>>;
|
|
35
|
+
pageModel: Readonly<Ref<number | undefined>>;
|
|
36
|
+
reportZoom(z: ZoomValue): void;
|
|
37
|
+
reportPage(p: number): void;
|
|
38
|
+
/** Last activated annotation (Enter, click with the note tool, etc.). Popovers key off this. */
|
|
39
|
+
activated: Readonly<Ref<string | null>>;
|
|
40
|
+
setActivated(id: string | null): void;
|
|
41
|
+
history: InkHistory;
|
|
42
|
+
rootEl: Readonly<Ref<HTMLElement | null>>;
|
|
43
|
+
}
|
|
44
|
+
export declare const injectInkContext: <T extends InkContext | null | undefined = InkContext>(fallback?: T | undefined) => T extends null ? InkContext | null : InkContext, provideInkContext: (contextValue: InkContext) => InkContext;
|
|
45
|
+
/**
|
|
46
|
+
* The context for composables: throws a readable error when called outside a component
|
|
47
|
+
* rendered inside `InkRoot`, instead of Vue's injection warning.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useInkContext(consumer: string): InkContext;
|
|
50
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +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,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAA;IAChC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAA;IAClD,2FAA2F;IAC3F,MAAM,EAAE,QAAQ,CAAC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{ getCurrentInstance as e } from "vue";
|
|
2
|
+
import { createContext as t } from "reka-ui";
|
|
3
|
+
//#region src/context.ts
|
|
4
|
+
var [n, r] = t("InkRoot");
|
|
5
|
+
function i(t) {
|
|
6
|
+
let r = e() ? n(null) : null;
|
|
7
|
+
if (!r) throw Error(`[inkbar] ${t} must be called in a component inside <InkRoot>.`);
|
|
8
|
+
return r;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { n as injectInkContext, r as provideInkContext, i as useInkContext };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { default as InkRoot } from './components/InkRoot.vue';
|
|
2
|
+
export { injectInkContext } from './context';
|
|
3
|
+
export type { InkContext, InkHistory, InkStatus } from './context';
|
|
4
|
+
export { useReadable } from './use-readable';
|
|
5
|
+
export { useDocument } from './composables/useDocument';
|
|
6
|
+
export { useAnnotations } from './composables/useAnnotations';
|
|
7
|
+
export { useTool } from './composables/useTool';
|
|
8
|
+
export { useSelection } from './composables/useSelection';
|
|
9
|
+
export { useZoom } from './composables/useZoom';
|
|
10
|
+
export { usePage } from './composables/usePage';
|
|
11
|
+
export { useHistory } from './composables/useHistory';
|
|
12
|
+
export { useEmbedded } from './composables/useEmbedded';
|
|
13
|
+
export { default as InkViewport } from './components/InkViewport.vue';
|
|
14
|
+
export { default as InkPage } from './components/InkPage.vue';
|
|
15
|
+
export { default as InkAnnotation } from './components/InkAnnotation.vue';
|
|
16
|
+
export type { AnnotationSlotProps, AnnotationState } from './components/annotation-slot';
|
|
17
|
+
export { default as InkToolbar } from './components/InkToolbar.vue';
|
|
18
|
+
export { default as InkIcon } from './components/InkIcon.vue';
|
|
19
|
+
export { default as InkToolButton } from './components/InkToolButton.vue';
|
|
20
|
+
export { default as InkToolbarSeparator } from './components/InkToolbarSeparator.vue';
|
|
21
|
+
export { default as InkUndo } from './components/InkUndo.vue';
|
|
22
|
+
export { default as InkRedo } from './components/InkRedo.vue';
|
|
23
|
+
export { default as InkZoomIn } from './components/InkZoomIn.vue';
|
|
24
|
+
export { default as InkZoomOut } from './components/InkZoomOut.vue';
|
|
25
|
+
export { default as InkZoomSelect } from './components/InkZoomSelect.vue';
|
|
26
|
+
export { default as InkPageInput } from './components/InkPageInput.vue';
|
|
27
|
+
export { default as InkPageCount } from './components/InkPageCount.vue';
|
|
28
|
+
export { default as InkPrevPage } from './components/InkPrevPage.vue';
|
|
29
|
+
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';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MA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,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,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACjF,YAAY,EACV,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,oCAAoC,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { injectInkContext as e } from "./context.js";
|
|
2
|
+
import { useReadable as t } from "./use-readable.js";
|
|
3
|
+
import n from "./components/InkRoot.js";
|
|
4
|
+
import { useDocument as r } from "./composables/useDocument.js";
|
|
5
|
+
import { useAnnotations as i } from "./composables/useAnnotations.js";
|
|
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 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { InkHistory } from './context';
|
|
3
|
+
import { Annotation } from '@inkbar/core';
|
|
4
|
+
export interface RefHistoryOptions {
|
|
5
|
+
/** The host's list (the `annotations` v-model). Undefined when the host does not control it. */
|
|
6
|
+
source: () => readonly Annotation[] | undefined;
|
|
7
|
+
/** Proposes a list to the host; the step only counts once the host applies it. */
|
|
8
|
+
apply: (list: Annotation[]) => void;
|
|
9
|
+
enabled: Readonly<Ref<boolean>>;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Snapshot undo and redo over a host-owned annotation list, for controlled hosts. The stacks
|
|
14
|
+
* live in core's `createSnapshotHistory`; this wrapper feeds it from a watch on the host's list
|
|
15
|
+
* and exposes refs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createRefHistory(opts: RefHistoryOptions): InkHistory;
|
|
18
|
+
//# sourceMappingURL=ref-history.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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";
|
|
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 }
|
|
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);
|
|
13
|
+
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)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { i as createRefHistory };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=ref-history.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { Readable } from '@inkbar/core';
|
|
3
|
+
/** Mirrors a core `Readable` into a Vue ref. Re-subscribes when the source changes. */
|
|
4
|
+
export declare function useReadable<T>(source: MaybeRefOrGetter<Readable<T> | null | undefined>, fallback: T): Readonly<Ref<T>>;
|
|
5
|
+
//# sourceMappingURL=use-readable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-readable.d.ts","sourceRoot":"","sources":["../src/use-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,GAAG,EACT,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EACxD,QAAQ,EAAE,CAAC,GACV,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAwBlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { onScopeDispose as e, shallowRef as t, toValue as n, watch as r } from "vue";
|
|
2
|
+
//#region src/use-readable.ts
|
|
3
|
+
function i(i, a) {
|
|
4
|
+
let o = t(a), s;
|
|
5
|
+
return r(() => n(i), (e) => {
|
|
6
|
+
s?.(), s = void 0, e ? (o.value = e.get(), s = e.subscribe((e) => {
|
|
7
|
+
o.value = e;
|
|
8
|
+
})) : o.value = a;
|
|
9
|
+
}, { immediate: !0 }), e(() => {
|
|
10
|
+
s?.(), s = void 0;
|
|
11
|
+
}), o;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as useReadable };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=use-readable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-readable.js","names":["useReadable","value","shallowRef","fallback","off","watch","toValue","source","s","v","onScopeDispose"],"sources":["../src/use-readable.ts"],"sourcesContent":["import {\n onScopeDispose,\n shallowRef,\n toValue,\n watch,\n type MaybeRefOrGetter,\n type Ref,\n} from 'vue'\n\nimport type { Readable } from '@inkbar/core'\n\n/** Mirrors a core `Readable` into a Vue ref. Re-subscribes when the source changes. */\nexport function useReadable<T>(\n source: MaybeRefOrGetter<Readable<T> | null | undefined>,\n fallback: T\n): Readonly<Ref<T>> {\n const value = shallowRef<T>(fallback)\n let off: (() => void) | undefined\n watch(\n () => toValue(source),\n (s) => {\n off?.()\n off = undefined\n if (!s) {\n value.value = fallback\n return\n }\n value.value = s.get()\n off = s.subscribe((v) => {\n value.value = v\n })\n },\n { immediate: true }\n )\n onScopeDispose(() => {\n off?.()\n off = undefined\n })\n return value\n}\n"],"mappings":";;AAYA,SAAgBA,EACd,GACA,GACkB;CAClB,IAAMC,IAAQC,EAAcC,CAAQ,GAChCC;CAqBJ,OApBAC,QACQC,EAAQC,CAAM,IACnB,MAAM;EAGL,AAFAH,IAAM,GACN,IAAM,KAAA,GACDI,KAIL,EAAM,QAAQA,EAAE,IAAI,GACpB,IAAMA,EAAE,WAAW,MAAM;GACvB,EAAM,QAAQC;EAChB,CAAC,KANC,EAAM,QAAQN;CAOlB,GACA,EAAE,WAAW,GAAK,CACpB,GACAO,QAAqB;EAEnB,AADAN,IAAM,GACN,IAAM,KAAA;CACR,CAAC,GACMH;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkbar/vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Vue 3 components and composables for Inkbar, the browser PDF viewer and editor.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://inkbar.dev",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/inkbar/inkbar.git",
|
|
10
|
+
"directory": "packages/vue"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/inkbar/inkbar/issues",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@inkbar/icons": "^0.2.0",
|
|
28
|
+
"reka-ui": "^2.11.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@inkbar/core": "^0.2.0",
|
|
32
|
+
"vue": "^3.5.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@inkbar/core": "0.2.0",
|
|
36
|
+
"@inkbar/fixtures": "0.0.0",
|
|
37
|
+
"@inkbar/theme": "0.2.0",
|
|
38
|
+
"@playwright/experimental-ct-vue": "1.62.1",
|
|
39
|
+
"@playwright/test": "1.62.1",
|
|
40
|
+
"@vitejs/plugin-vue": "^6.0.10",
|
|
41
|
+
"@vue/compiler-dom": "^3.5.43",
|
|
42
|
+
"vite": "^8.3.4",
|
|
43
|
+
"vite-plugin-dts": "^5.1.2",
|
|
44
|
+
"vitest": "^5.0.4",
|
|
45
|
+
"vue": "^3.5.43",
|
|
46
|
+
"vue-tsc": "^3.3.13"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "vue-tsc --noEmit -p tsconfig.json && vite build",
|
|
50
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.json",
|
|
51
|
+
"lint": "eslint src playwright",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:browser": "playwright test -c playwright-ct.config.ts"
|
|
54
|
+
}
|
|
6
55
|
}
|