@inkbar/vue 0.1.1 → 0.3.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/README.md +51 -5
- 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.map +1 -1
- package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- 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/{compositions/DefaultToolbar.vue.d.ts → components/InkRedo.vue.d.ts} +5 -5
- 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.vue.d.ts +42 -42
- package/dist/components/InkToolButton.js.map +1 -1
- package/dist/components/InkToolButton.vue.d.ts.map +1 -1
- package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +26 -18
- package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- 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/InkZoomIn.js.map +1 -1
- package/dist/components/InkZoomIn.vue.d.ts.map +1 -1
- package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js +13 -11
- package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkZoomOut.js.map +1 -1
- package/dist/components/InkZoomOut.vue.d.ts.map +1 -1
- package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js +13 -11
- package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkZoomSelect.js.map +1 -1
- package/dist/components/InkZoomSelect.vue.d.ts.map +1 -1
- package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js +105 -29
- package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useAnnotations.d.ts +112 -112
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -10
- package/package.json +5 -5
- package/dist/compositions/DefaultToolbar.js +0 -7
- package/dist/compositions/DefaultToolbar.js.map +0 -1
- package/dist/compositions/DefaultToolbar.vue.d.ts.map +0 -1
- package/dist/compositions/DefaultToolbar.vue_vue_type_script_setup_true_lang.js +0 -100
- package/dist/compositions/DefaultToolbar.vue_vue_type_script_setup_true_lang.js.map +0 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
Drop a PDF viewer into your Vue app and let people highlight text, leave notes with replies and review redactions. `@inkbar/vue` gives you
|
|
23
|
+
Drop a PDF viewer into your Vue app and let people highlight text, leave notes with replies and review redactions. `@inkbar/vue` gives you components and composables to build your own toolbars, plus note and suggestion popovers, all styled by `@inkbar/theme`.
|
|
24
24
|
|
|
25
25
|
Annotations are plain typed objects. Bind them with `v-model` to keep them in your own state, or let Inkbar hold them with undo and redo.
|
|
26
26
|
|
|
@@ -40,7 +40,16 @@ import { ref } from 'vue'
|
|
|
40
40
|
import {
|
|
41
41
|
InkRoot,
|
|
42
42
|
InkViewport,
|
|
43
|
-
|
|
43
|
+
InkToolbar,
|
|
44
|
+
InkToolButton,
|
|
45
|
+
InkToolbarSeparator,
|
|
46
|
+
InkUndo,
|
|
47
|
+
InkRedo,
|
|
48
|
+
InkPrevPage,
|
|
49
|
+
InkPageInput,
|
|
50
|
+
InkPageCount,
|
|
51
|
+
InkNextPage,
|
|
52
|
+
InkZoomSelect,
|
|
44
53
|
InkNotePopover,
|
|
45
54
|
InkSuggestionCard,
|
|
46
55
|
} from '@inkbar/vue'
|
|
@@ -59,14 +68,32 @@ const annotations = ref<Annotation[]>([])
|
|
|
59
68
|
:assets="assets"
|
|
60
69
|
v-model:annotations="annotations"
|
|
61
70
|
>
|
|
62
|
-
<
|
|
71
|
+
<InkToolbar>
|
|
72
|
+
<InkToolButton tool="view" />
|
|
73
|
+
<InkToolButton tool="select" />
|
|
74
|
+
<InkToolButton tool="highlight" />
|
|
75
|
+
<InkToolButton tool="redact-area" />
|
|
76
|
+
<InkToolButton tool="note" />
|
|
77
|
+
<InkToolbarSeparator />
|
|
78
|
+
<InkUndo />
|
|
79
|
+
<InkRedo />
|
|
80
|
+
</InkToolbar>
|
|
63
81
|
<InkViewport />
|
|
82
|
+
<InkToolbar label="Page and zoom">
|
|
83
|
+
<InkPrevPage />
|
|
84
|
+
<InkPageInput />
|
|
85
|
+
<InkPageCount />
|
|
86
|
+
<InkNextPage />
|
|
87
|
+
<InkZoomSelect />
|
|
88
|
+
</InkToolbar>
|
|
64
89
|
<InkNotePopover />
|
|
65
90
|
<InkSuggestionCard />
|
|
66
91
|
</InkRoot>
|
|
67
92
|
</template>
|
|
68
93
|
```
|
|
69
94
|
|
|
95
|
+
Each control is a separate component, so put them in any order or leave some out. Buttons show icons from `@inkbar/icons`. Put your own in a button's default slot to replace one, and use `InkIcon` to put the same icons on your own buttons.
|
|
96
|
+
|
|
70
97
|
`v-model:annotations` makes your list the source of truth. Leave it off and Inkbar keeps the state itself, with undo and redo.
|
|
71
98
|
|
|
72
99
|
## Controlled mode
|
|
@@ -93,11 +120,30 @@ Inside `InkRoot`, `useHistory()` returns the same object. Its `batch(fn)` runs `
|
|
|
93
120
|
|
|
94
121
|
`InkNotePopover` opens the thread of the activated note. A new note has no text yet, so the form first writes the note's own text (labelled "Comment"); after that it adds replies.
|
|
95
122
|
|
|
96
|
-
A root note with no text and no replies is removed when its popover closes, or when activation moves to another annotation, so abandoned notes do not stay on the page. Locked notes are never removed. If you add notes yourself (`add({ type: '
|
|
123
|
+
A root note with no text and no replies is removed when its popover closes, or when activation moves to another annotation, so abandoned notes do not stay on the page. Locked notes are never removed. If you add notes yourself (`add({ type: 'text', ... })`), give them `contents`, or they will be removed the first time someone opens and closes them.
|
|
124
|
+
|
|
125
|
+
## Custom rendering
|
|
126
|
+
|
|
127
|
+
Slots let you render parts yourself. `InkViewport` has `loading`, `empty`, `error`, `annotation` and `page-error` slots. `InkNotePopover` and `InkSuggestionCard` have a scoped default slot that receives the popover's props, and the default slot of `InkToolButton` receives `{ active, label }`. The props are typed as `AnnotationSlotProps`, `NotePopoverSlotProps` and `SuggestionCardSlotProps`, the same types the React and Svelte packages export.
|
|
128
|
+
|
|
129
|
+
`InkRoot`, `InkToolbar`, `InkToolButton`, `InkUndo`, `InkRedo`, `InkPrevPage`, `InkNextPage`, `InkZoomIn` and `InkZoomOut` take `as-child` to render your own element in place of theirs, such as a button from your design system. Put that element in the default slot. The control keeps its behaviour and accessible name.
|
|
97
130
|
|
|
98
131
|
## Keyboard
|
|
99
132
|
|
|
100
|
-
The scroll
|
|
133
|
+
The scroll area takes focus. From there:
|
|
134
|
+
|
|
135
|
+
- With the `highlight` or `redact-area` tool active, `Enter` turns the text selection into a mark.
|
|
136
|
+
- With the `note` tool active, `Enter` places a note at the centre of the current page and opens it.
|
|
137
|
+
|
|
138
|
+
On a focused annotation:
|
|
139
|
+
|
|
140
|
+
- `Enter` or `Space` selects and activates it. A note opens its thread and a suggested redaction its card; other types are only selected.
|
|
141
|
+
- `ArrowUp` and `ArrowDown` move to the previous or next annotation on the page.
|
|
142
|
+
- `Shift` + arrow moves it by 1 pt, or by 10 pt with `Alt` as well.
|
|
143
|
+
- `Ctrl` or `Cmd` + `Shift` + arrow resizes an area redaction, text box or shape.
|
|
144
|
+
- `Delete` or `Backspace` removes it.
|
|
145
|
+
|
|
146
|
+
The full table, with the zoom and page keys, is in the [`@inkbar/core` README](https://github.com/inkbar/inkbar/tree/main/packages/core#tools-and-keyboard).
|
|
101
147
|
|
|
102
148
|
## Styling
|
|
103
149
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkIcon.js","names":["_sfc_main","InkIcon_vue_vue_type_script_setup_true_lang_default","InkIcon_default"],"sources":["../../src/components/InkIcon.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * An icon from `@inkbar/icons`, hidden from assistive technology: the control it sits in\n * carries the name. The theme sizes it with `--ink-icon-size`.\n */\nimport { ICON_ATTRIBUTES } from '@inkbar/icons'\n\nimport type { IconNode } from '@inkbar/icons'\n\nwithDefaults(defineProps<{ icon: IconNode; size?: number }>(), { size: 18 })\n</script>\n\n<template>\n <svg\n v-bind=\"ICON_ATTRIBUTES\"\n :width=\"size\"\n :height=\"size\"\n class=\"ink-icon\"\n aria-hidden=\"true\"\n >\n <component :is=\"tag\" v-for=\"([tag, attrs], i) in icon\" :key=\"i\" v-bind=\"attrs\" />\n </svg>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconNode } from '@inkbar/icons';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
icon: IconNode;
|
|
4
|
+
size?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
size: number;
|
|
8
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=InkIcon.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkIcon.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkIcon.vue"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG7C,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAyCrD,QAAA,MAAM,YAAY;;6EAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Fragment as e, createBlock as t, createElementBlock as n, defineComponent as r, mergeProps as i, openBlock as a, renderList as o, resolveDynamicComponent as s, unref as c } from "vue";
|
|
2
|
+
import { ICON_ATTRIBUTES as l } from "@inkbar/icons";
|
|
3
|
+
//#region src/components/InkIcon.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var u = ["width", "height"], d = /*@__PURE__*/ r({
|
|
5
|
+
__name: "InkIcon",
|
|
6
|
+
props: {
|
|
7
|
+
icon: {},
|
|
8
|
+
size: { default: 18 }
|
|
9
|
+
},
|
|
10
|
+
setup(r) {
|
|
11
|
+
return (d, f) => (a(), n("svg", i(c(l), {
|
|
12
|
+
width: r.size,
|
|
13
|
+
height: r.size,
|
|
14
|
+
class: "ink-icon",
|
|
15
|
+
"aria-hidden": "true"
|
|
16
|
+
}), [(a(!0), n(e, null, o(r.icon, ([e, n], r) => (a(), t(s(e), i({ key: r }, { ref_for: !0 }, n), null, 16))), 128))], 16, u));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { d as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=InkIcon.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkIcon.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_hoisted_1","InkIcon_vue_vue_type_script_setup_true_lang_default","openBlock","createElementBlock","mergeProps","unref","ICON_ATTRIBUTES","__props","Fragment","renderList","tag","attrs","createBlock","resolveDynamicComponent","i"],"sources":["../../src/components/InkIcon.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * An icon from `@inkbar/icons`, hidden from assistive technology: the control it sits in\n * carries the name. The theme sizes it with `--ink-icon-size`.\n */\nimport { ICON_ATTRIBUTES } from '@inkbar/icons'\n\nimport type { IconNode } from '@inkbar/icons'\n\nwithDefaults(defineProps<{ icon: IconNode; size?: number }>(), { size: 18 })\n</script>\n\n<template>\n <svg\n v-bind=\"ICON_ATTRIBUTES\"\n :width=\"size\"\n :height=\"size\"\n class=\"ink-icon\"\n aria-hidden=\"true\"\n >\n <component :is=\"tag\" v-for=\"([tag, attrs], i) in icon\" :key=\"i\" v-bind=\"attrs\" />\n </svg>\n</template>\n"],"mappings":";;;;;;;;;;oBAaEA,EAAA,GAAAC,EAQM,OARNC,EACUC,EAOJW,CAAA,GAPmB;GACtB,OAAOC,EAAA;GACP,QAAQA,EAAA;GACT,OAAM;GACN,eAAY;EAEZf,CAAAA,GAAAA,EAAAA,EAAA,EAAA,GAAAC,EAAiFG,GAAA,MAAAC,EAAhCU,EAAA,OAAI,CAAvBG,GAAKC,IAAQ,OAA3CnB,EAAA,GAAAM,EAAiFC,EAAjEW,CAAG,GAAnBhB,EAAiF,EAAzB,KAAKoB,EAAC,GAAA,EAAA,SAAA,GAAA,GAAUH,CAAK,GAAA,MAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkNextPage.js","names":["_sfc_main","InkNextPage_vue_vue_type_script_setup_true_lang_default","InkNextPage_default"],"sources":["../../src/components/InkNextPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ChevronRight } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { usePage } from '../composables/usePage'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { current, count, next } = usePage()\nconst disabled = computed(() => current.value >= count.value - 1)\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Next page',\n title: 'Next page',\n onClick: () => next(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"disabled\"\n class=\"ink-next-page\"\n data-ink-next-page\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"ChevronRight\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
asChild?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_7: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_7) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
|
+
asChild: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=InkNextPage.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkNextPage.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkNextPage.vue"],"names":[],"mappings":"AA0CA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAwDzC,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { usePage as e } from "../composables/usePage.js";
|
|
2
|
+
import t from "./InkIcon.js";
|
|
3
|
+
import { computed as n, createBlock as r, createVNode as i, defineComponent as a, mergeProps as o, openBlock as s, renderSlot as c, unref as l, withCtx as u } from "vue";
|
|
4
|
+
import { ToolbarButton as d } from "reka-ui";
|
|
5
|
+
import { ChevronRight as f } from "@inkbar/icons";
|
|
6
|
+
//#region src/components/InkNextPage.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var p = /*@__PURE__*/ a({
|
|
8
|
+
__name: "InkNextPage",
|
|
9
|
+
props: { asChild: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
} },
|
|
13
|
+
setup(a) {
|
|
14
|
+
let { current: p, count: m, next: h } = e(), g = n(() => p.value >= m.value - 1), _ = {
|
|
15
|
+
"aria-label": "Next page",
|
|
16
|
+
title: "Next page",
|
|
17
|
+
onClick: () => h()
|
|
18
|
+
};
|
|
19
|
+
return (e, n) => (s(), r(l(d), o({
|
|
20
|
+
"as-child": a.asChild,
|
|
21
|
+
disabled: g.value,
|
|
22
|
+
class: "ink-next-page",
|
|
23
|
+
"data-ink-next-page": ""
|
|
24
|
+
}, _), {
|
|
25
|
+
default: u(() => [c(e.$slots, "default", {}, () => [i(t, { icon: l(f) }, null, 8, ["icon"])])]),
|
|
26
|
+
_: 3
|
|
27
|
+
}, 16, ["as-child", "disabled"]));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { p as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=InkNextPage.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkNextPage.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createVNode","InkIcon","InkIcon_default","InkNextPage_vue_vue_type_script_setup_true_lang_default","usePage","disabled","computed","current","count","attrs","next","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","withCtx","renderSlot","_ctx","createVNode","ChevronRight"],"sources":["../../src/components/InkNextPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ChevronRight } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { usePage } from '../composables/usePage'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { current, count, next } = usePage()\nconst disabled = computed(() => current.value >= count.value - 1)\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Next page',\n title: 'Next page',\n onClick: () => next(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"disabled\"\n class=\"ink-next-page\"\n data-ink-next-page\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"ChevronRight\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAUA,IAAM,EAAE,YAAS,UAAO,YAASU,EAAQ,GACnCC,IAAWC,QAAeC,EAAQ,SAASC,EAAM,QAAQ,CAAC,GAE1DC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAK;EACtB;oBAIEhB,EAAA,GAAAC,EAQgBC,EAAAkB,CAAA,GARhBjB,EAQgB;GAPb,YAAUmB,EAAA;GACV,UAAUX,EAAA;GACX,OAAM;GACN,sBAAA;EACQ,GAAAI,CAAK,GAAA;GAEb,SAAAX,QAA6C,CAA7CC,EAA6CoB,EAAA,QAAA,WAAA,CAAA,SAAA,CAAvCnB,EAAgCC,GAAA,EAAtB,MAAML,EAAAyB,CAAA,EAAY,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
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 === '
|
|
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":""}
|
|
@@ -15,7 +15,7 @@ var ie = {
|
|
|
15
15
|
setup(f) {
|
|
16
16
|
let N = e(), { annotations: P, add: F, update: I, remove: L } = t(), R = (e) => e ? P.value.find((t) => t.id === e) : void 0, z = o(() => {
|
|
17
17
|
let e = R(N.activated.value ?? void 0);
|
|
18
|
-
return e?.type === "
|
|
18
|
+
return e?.type === "text" ? ee(P.value, e) : null;
|
|
19
19
|
}), B = n(N, o(() => z.value?.id ?? null)), V = i(N), H = o(() => z.value !== null && B.value !== null), U = o(() => z.value ? E(P.value, z.value) : []), W = o(() => {
|
|
20
20
|
let e = z.value;
|
|
21
21
|
return e !== null && !e.locked && !e.contents?.trim();
|
|
@@ -30,7 +30,7 @@ var ie = {
|
|
|
30
30
|
function X(e) {
|
|
31
31
|
let t = z.value, n = e.trim();
|
|
32
32
|
t && n && (q.add(t.id), F({
|
|
33
|
-
type: "
|
|
33
|
+
type: "text",
|
|
34
34
|
page: t.page,
|
|
35
35
|
rect: t.rect,
|
|
36
36
|
contents: n,
|
|
@@ -1 +1 @@
|
|
|
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 === 'note' ? 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: 'note', 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,IAA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;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
|
+
{"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,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ARNY,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPrevPage.js","names":["_sfc_main","InkPrevPage_vue_vue_type_script_setup_true_lang_default","InkPrevPage_default"],"sources":["../../src/components/InkPrevPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ChevronLeft } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { usePage } from '../composables/usePage'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { current, previous } = usePage()\nconst disabled = computed(() => current.value <= 0)\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Previous page',\n title: 'Previous page',\n onClick: () => previous(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"disabled\"\n class=\"ink-prev-page\"\n data-ink-prev-page\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"ChevronLeft\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
asChild?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_7: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_7) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
|
+
asChild: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=InkPrevPage.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPrevPage.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkPrevPage.vue"],"names":[],"mappings":"AA0CA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAwDzC,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { usePage as e } from "../composables/usePage.js";
|
|
2
|
+
import t from "./InkIcon.js";
|
|
3
|
+
import { computed as n, createBlock as r, createVNode as i, defineComponent as a, mergeProps as o, openBlock as s, renderSlot as c, unref as l, withCtx as u } from "vue";
|
|
4
|
+
import { ToolbarButton as d } from "reka-ui";
|
|
5
|
+
import { ChevronLeft as f } from "@inkbar/icons";
|
|
6
|
+
//#region src/components/InkPrevPage.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var p = /*@__PURE__*/ a({
|
|
8
|
+
__name: "InkPrevPage",
|
|
9
|
+
props: { asChild: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
} },
|
|
13
|
+
setup(a) {
|
|
14
|
+
let { current: p, previous: m } = e(), h = n(() => p.value <= 0), g = {
|
|
15
|
+
"aria-label": "Previous page",
|
|
16
|
+
title: "Previous page",
|
|
17
|
+
onClick: () => m()
|
|
18
|
+
};
|
|
19
|
+
return (e, n) => (s(), r(l(d), o({
|
|
20
|
+
"as-child": a.asChild,
|
|
21
|
+
disabled: h.value,
|
|
22
|
+
class: "ink-prev-page",
|
|
23
|
+
"data-ink-prev-page": ""
|
|
24
|
+
}, g), {
|
|
25
|
+
default: u(() => [c(e.$slots, "default", {}, () => [i(t, { icon: l(f) }, null, 8, ["icon"])])]),
|
|
26
|
+
_: 3
|
|
27
|
+
}, 16, ["as-child", "disabled"]));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { p as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=InkPrevPage.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPrevPage.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createVNode","InkIcon","InkIcon_default","InkPrevPage_vue_vue_type_script_setup_true_lang_default","usePage","disabled","computed","current","attrs","previous","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","withCtx","renderSlot","_ctx","createVNode","ChevronLeft"],"sources":["../../src/components/InkPrevPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ChevronLeft } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { usePage } from '../composables/usePage'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { current, previous } = usePage()\nconst disabled = computed(() => current.value <= 0)\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Previous page',\n title: 'Previous page',\n onClick: () => previous(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"disabled\"\n class=\"ink-prev-page\"\n data-ink-prev-page\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"ChevronLeft\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAUA,IAAM,EAAE,YAAS,gBAAaU,EAAQ,GAChCC,IAAWC,QAAeC,EAAQ,SAAS,CAAC,GAE5CC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAS;EAC1B;oBAIEf,EAAA,GAAAC,EAQgBC,EAAAiB,CAAA,GARhBhB,EAQgB;GAPb,YAAUkB,EAAA;GACV,UAAUV,EAAA;GACX,OAAM;GACN,sBAAA;EACQ,GAAAG,CAAK,GAAA;GAEb,SAAAV,QAA4C,CAA5CC,EAA4CmB,EAAA,QAAA,WAAA,CAAA,SAAA,CAAtClB,EAA+BC,GAAA,EAArB,MAAML,EAAAwB,CAAA,EAAW,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkRedo.js","names":["_sfc_main","InkRedo_vue_vue_type_script_setup_true_lang_default","InkRedo_default"],"sources":["../../src/components/InkRedo.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Redo2 } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useHistory } from '../composables/useHistory'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { canRedo, redo } = useHistory()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Redo',\n title: 'Redo',\n onClick: () => redo(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"!canRedo\"\n class=\"ink-redo\"\n data-ink-redo\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"Redo2\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":""}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
|
|
2
|
+
asChild?: boolean;
|
|
3
3
|
};
|
|
4
|
-
declare var
|
|
4
|
+
declare var __VLS_7: {};
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
|
-
default?: (props: typeof
|
|
6
|
+
default?: (props: typeof __VLS_7) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
|
-
|
|
9
|
+
asChild: boolean;
|
|
10
10
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
|
@@ -16,4 +16,4 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
16
16
|
$slots: S;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=InkRedo.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkRedo.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkRedo.vue"],"names":[],"mappings":"AAuCA,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAyDzC,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useHistory as e } from "../composables/useHistory.js";
|
|
2
|
+
import t from "./InkIcon.js";
|
|
3
|
+
import { createBlock as n, createVNode as r, defineComponent as i, mergeProps as a, openBlock as o, renderSlot as s, unref as c, withCtx as l } from "vue";
|
|
4
|
+
import { ToolbarButton as u } from "reka-ui";
|
|
5
|
+
import { Redo2 as d } from "@inkbar/icons";
|
|
6
|
+
//#region src/components/InkRedo.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var f = /*@__PURE__*/ i({
|
|
8
|
+
__name: "InkRedo",
|
|
9
|
+
props: { asChild: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
} },
|
|
13
|
+
setup(i) {
|
|
14
|
+
let { canRedo: f, redo: p } = e(), m = {
|
|
15
|
+
"aria-label": "Redo",
|
|
16
|
+
title: "Redo",
|
|
17
|
+
onClick: () => p()
|
|
18
|
+
};
|
|
19
|
+
return (e, p) => (o(), n(c(u), a({
|
|
20
|
+
"as-child": i.asChild,
|
|
21
|
+
disabled: !c(f),
|
|
22
|
+
class: "ink-redo",
|
|
23
|
+
"data-ink-redo": ""
|
|
24
|
+
}, m), {
|
|
25
|
+
default: l(() => [s(e.$slots, "default", {}, () => [r(t, { icon: c(d) }, null, 8, ["icon"])])]),
|
|
26
|
+
_: 3
|
|
27
|
+
}, 16, ["as-child", "disabled"]));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { f as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=InkRedo.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkRedo.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createVNode","InkIcon","InkIcon_default","InkRedo_vue_vue_type_script_setup_true_lang_default","useHistory","attrs","redo","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","canRedo","withCtx","renderSlot","_ctx","createVNode","Redo2"],"sources":["../../src/components/InkRedo.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Redo2 } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useHistory } from '../composables/useHistory'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { canRedo, redo } = useHistory()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Redo',\n title: 'Redo',\n onClick: () => redo(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n :disabled=\"!canRedo\"\n class=\"ink-redo\"\n data-ink-redo\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"Redo2\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;EASA,IAAM,EAAE,YAAS,YAASU,EAAW,GAE/BC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAK;EACtB;oBAIEZ,EAAA,GAAAC,EAQgBC,EAAAc,CAAA,GARhBb,EAQgB;GAPb,YAAUe,EAAA;GACV,UAAQ,CAAGhB,EAAAiB,CAAA;GACZ,OAAM;GACN,iBAAA;EACQ,GAAAR,CAAK,GAAA;GAEb,SAAAP,QAAsC,CAAtCC,EAAsCiB,EAAA,QAAA,WAAA,CAAA,SAAA,CAAhChB,EAAyBC,GAAA,EAAf,MAAML,EAAAsB,CAAA,EAAK,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
|