@inkbar/vue 0.9.0 → 0.10.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 +63 -2
- package/dist/components/InkDownloadButton.js +7 -0
- package/dist/components/InkDownloadButton.js.map +1 -0
- package/dist/components/InkDownloadButton.vue.d.ts +21 -0
- package/dist/components/InkDownloadButton.vue.d.ts.map +1 -0
- package/dist/components/InkDownloadButton.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/components/InkDownloadButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkFindBar.js.map +1 -1
- package/dist/components/InkFindBar.vue.d.ts.map +1 -1
- package/dist/components/InkFindBar.vue_vue_type_script_setup_true_lang.js +48 -48
- package/dist/components/InkFindBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkPanel.js +7 -0
- package/dist/components/InkPanel.js.map +1 -0
- package/dist/components/InkPanel.vue.d.ts +21 -0
- package/dist/components/InkPanel.vue.d.ts.map +1 -0
- package/dist/components/InkPanel.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/InkPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkPrintButton.js +7 -0
- package/dist/components/InkPrintButton.js.map +1 -0
- package/dist/components/InkPrintButton.vue.d.ts +19 -0
- package/dist/components/InkPrintButton.vue.d.ts.map +1 -0
- package/dist/components/InkPrintButton.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/components/InkPrintButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkRecordList.js +7 -0
- package/dist/components/InkRecordList.js.map +1 -0
- package/dist/components/InkRecordList.vue.d.ts +35 -0
- package/dist/components/InkRecordList.vue.d.ts.map +1 -0
- package/dist/components/InkRecordList.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/components/InkRecordList.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkRoot.js.map +1 -1
- package/dist/components/InkRoot.vue.d.ts +39 -0
- package/dist/components/InkRoot.vue.d.ts.map +1 -1
- package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +45 -45
- package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/InkSearchResults.js +7 -0
- package/dist/components/InkSearchResults.js.map +1 -0
- package/dist/components/InkSearchResults.vue.d.ts +9 -0
- package/dist/components/InkSearchResults.vue.d.ts.map +1 -0
- package/dist/components/InkSearchResults.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/components/InkSearchResults.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkSidebar.js +7 -0
- package/dist/components/InkSidebar.js.map +1 -0
- package/dist/components/InkSidebar.vue.d.ts +34 -0
- package/dist/components/InkSidebar.vue.d.ts.map +1 -0
- package/dist/components/InkSidebar.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/components/InkSidebar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkThumbnail.js +7 -0
- package/dist/components/InkThumbnail.js.map +1 -0
- package/dist/components/InkThumbnail.vue.d.ts +18 -0
- package/dist/components/InkThumbnail.vue.d.ts.map +1 -0
- package/dist/components/InkThumbnail.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/components/InkThumbnail.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InkThumbnails.js +7 -0
- package/dist/components/InkThumbnails.js.map +1 -0
- package/dist/components/InkThumbnails.vue.d.ts +27 -0
- package/dist/components/InkThumbnails.vue.d.ts.map +1 -0
- package/dist/components/InkThumbnails.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/InkThumbnails.vue_vue_type_script_setup_true_lang.js.map +1 -0
- 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 +1 -1
- package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/RecordCards.js +7 -0
- package/dist/components/RecordCards.js.map +1 -0
- package/dist/components/RecordCards.vue.d.ts +25 -0
- package/dist/components/RecordCards.vue.d.ts.map +1 -0
- package/dist/components/RecordCards.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/RecordCards.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/SidebarTrigger.js +7 -0
- package/dist/components/SidebarTrigger.js.map +1 -0
- package/dist/components/SidebarTrigger.vue.d.ts +9 -0
- package/dist/components/SidebarTrigger.vue.d.ts.map +1 -0
- package/dist/components/SidebarTrigger.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/SidebarTrigger.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sidebar-context.d.ts +21 -0
- package/dist/components/sidebar-context.d.ts.map +1 -0
- package/dist/components/sidebar-context.js +7 -0
- package/dist/components/sidebar-context.js.map +1 -0
- package/dist/composables/useAnnotations.d.ts +91 -0
- package/dist/composables/useAnnotations.d.ts.map +1 -1
- package/dist/composables/useRecordSelection.d.ts +12 -0
- package/dist/composables/useRecordSelection.d.ts.map +1 -0
- package/dist/composables/useRecordSelection.js +15 -0
- package/dist/composables/useRecordSelection.js.map +1 -0
- package/dist/composables/useRecords.d.ts +14 -0
- package/dist/composables/useRecords.d.ts.map +1 -0
- package/dist/composables/useRecords.js +16 -0
- package/dist/composables/useRecords.js.map +1 -0
- package/dist/composables/useSearch.d.ts.map +1 -1
- package/dist/composables/useSearch.js +1 -0
- package/dist/composables/useSearch.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -30
- package/dist/to-readable.d.ts +7 -0
- package/dist/to-readable.d.ts.map +1 -0
- package/dist/to-readable.js +11 -0
- package/dist/to-readable.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkSidebar.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_Fragment","_renderList","_createVNode","SidebarTrigger","_createCommentVNode","_createElementVNode","_normalizeClass","_renderSlot","SidebarTrigger_default","InkSidebar_vue_vue_type_script_setup_true_lang_default","\"open\"","\"openModifiers\"","props","__props","open","useModel","entries","shallowRef","panels","computed","controller","createSidebarController","value","useId","layout","side","visible","list","state","useReadable","register","entry","e","arrange","sorted","x","a","y","b","i","view","s","panel","root","useTemplateRef","onMounted","onBeforeUnmount","openBlock","createElementBlock","mergeProps","unref","createCommentVNode","Fragment","renderList","t","createVNode","createElementVNode","normalizeClass","renderSlot","_ctx"],"sources":["../../src/components/InkSidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A sidebar of `InkPanel`s: `createSidebar`'s markup on core's sidebar controller, which holds\n * the open state, the ARIA, the keys and the clicks. Rail and tabs render their triggers here;\n * in a stack each panel renders its own header. Panels register as they are set up and take\n * their place in DOM order once mounted, so a panel added later with `v-if` slots in where it\n * stands. A closed panel stays mounted and hidden, and the panels' content stays in place\n * across layouts, so its state survives switching.\n *\n * `v-model:open` is the open panel's id (or null) for rail and tabs, and the expanded ids for\n * stack. Left unbound, the first panel starts open. It needs no document, so it works outside\n * `InkRoot`. The server renders the root, the panels (the open one shown) and the stack\n * headers; rail and tab buttons follow once mounted, as the panels register after the root\n * has rendered.\n */\nimport {\n createSidebarController,\n type SidebarLayout,\n type SidebarOpen,\n type SidebarSide,\n} from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n shallowRef,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { useReadable } from '../use-readable'\n\nimport { provideSidebarContext, type SidebarPanelEntry } from './sidebar-context'\nimport SidebarTrigger from './SidebarTrigger.vue'\n\nconst props = withDefaults(\n defineProps<{\n side?: SidebarSide | undefined\n layout?: SidebarLayout | undefined\n /** Default true. False hides the whole sidebar and keeps its open panel, content and scroll for when it shows again. */\n visible?: boolean | undefined\n }>(),\n { side: 'left', layout: 'rail', visible: true }\n)\n/** Undefined while unbound and untouched: the controller then opens the first panel. */\nconst open = defineModel<SidebarOpen | undefined>('open')\n\nconst entries = shallowRef<readonly SidebarPanelEntry[]>([])\nconst panels = computed(() => entries.value.map((e) => e.info()))\n\n// Pending until mounted: the panels register one by one while they are set up, and an open id\n// not registered yet is not a removed panel.\nconst controller = createSidebarController({\n layout: props.layout,\n side: props.side,\n visible: props.visible,\n panels: [],\n ...(open.value !== undefined && { open: open.value }),\n pending: true,\n onOpenChange: (value) => {\n open.value = value\n },\n // The same ids on the server and the client.\n idPrefix: useId(),\n})\n// Sync, so a panel set up next reads the attributes its registration gives (on the server too).\nwatch(\n () => [props.layout, props.side, props.visible, panels.value, open.value] as const,\n ([layout, side, visible, list, value]) =>\n controller.update({\n layout,\n side,\n visible,\n panels: list,\n ...(value !== undefined && { open: value }),\n }),\n { flush: 'sync' }\n)\nconst state = useReadable(controller.state, controller.state.get())\n\nfunction register(entry: SidebarPanelEntry): () => void {\n entries.value = [...entries.value, entry]\n return () => {\n entries.value = entries.value.filter((e) => e !== entry)\n }\n}\n\nfunction arrange(): void {\n const list = entries.value\n const sorted = [...list].sort((a, b) => {\n const x = a.element()\n const y = b.element()\n if (!x || !y || x === y) return 0\n return x.compareDocumentPosition(y) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1\n })\n if (sorted.some((e, i) => e !== list[i])) entries.value = sorted\n}\n\nprovideSidebarContext({ controller, state, register, arrange })\n\nconst view = computed(() => {\n const s = state.value\n return {\n root: controller.rootAttrs(),\n tablist: controller.tablistAttrs(),\n triggers: s.panels.map((panel) => ({\n panel,\n attrs: controller.triggerAttrs(panel.id),\n })),\n }\n})\n\nconst root = useTemplateRef<HTMLElement>('root')\n// The controller handles the triggers' clicks and keys, stack headers included.\nonMounted(() => {\n controller.bindTriggers(root.value!)\n controller.update({ pending: false })\n})\nonBeforeUnmount(() => controller.destroy())\n</script>\n\n<template>\n <div ref=\"root\" class=\"ink-sidebar\" v-bind=\"view.root\">\n <div\n v-if=\"state.layout !== 'stack'\"\n :class=\"state.layout === 'rail' ? 'ink-sidebar-rail' : 'ink-sidebar-tabs'\"\n v-bind=\"view.tablist\"\n >\n <button v-for=\"t in view.triggers\" :key=\"t.panel.id\" v-bind=\"t.attrs\">\n <SidebarTrigger :panel=\"t.panel\" :rail=\"state.layout === 'rail'\" />\n </button>\n </div>\n <!-- One element in every layout, so the panels are never remounted. -->\n <div :class=\"{ 'ink-sidebar-panels': state.layout !== 'stack' }\"><slot /></div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAoCA,IAAMiB,IAAQC,GAURC,IAAOnB,EAAoCkB,GAAC,MAAM,GAElDG,IAAUC,EAAyC,CAAC,CAAC,GACrDC,IAASC,QAAeH,EAAQ,MAAM,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,GAI1DI,IAAaC,EAAwB;GACzC,QAAQT,EAAM;GACd,MAAMA,EAAM;GACZ,SAASA,EAAM;GACf,QAAQ,CAAC;GACT,GAAIE,EAAK,UAAU,KAAA,KAAa,EAAE,MAAMA,EAAK,MAAM;GACnD,SAAS;GACT,eAAe,MAAU;IACvB,EAAK,QAAQQ;GACf;GAEA,UAAUC,EAAM;EAClB,CAAC;EAED,QACQ;GAACX,EAAM;GAAQA,EAAM;GAAMA,EAAM;GAASM,EAAO;GAAOJ,EAAK;EAAK,IACvE,CAACU,GAAQC,GAAMC,GAASC,GAAML,OAC7BF,EAAW,OAAO;GAChB;GACA;GACA;GACA,QAAQO;GACR,GAAIL,MAAU,KAAA,KAAa,EAAE,MAAMA,EAAM;EAC3C,CAAC,GACH,EAAE,OAAO,OAAO,CAClB;EACA,IAAMM,IAAQC,EAAYT,EAAW,OAAOA,EAAW,MAAM,IAAI,CAAC;EAElE,SAASU,EAAS,GAAsC;GAEtD,OADA,EAAQ,QAAQ,CAAC,GAAGd,EAAQ,OAAOe,CAAK,SAC3B;IACX,EAAQ,QAAQf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AAAC,EAESG,GAAA,MAAAC,EAFWuC,EAAA,MAAK,WAAV,OAAf5C,EAAA,GAAAC,EAES,UAFTC,EAES,EAF2B,KAAKwD,EAAE,MAAM,GAAY,GAAA,EAAA,SAAA,GAAA,GAAAA,EAAE,KAAK,GAAA,CAClEpD,EAAmEC,GAAA;GAAlD,OAAOmD,EAAE;GAAQ,MAAMvD,EAAA6B,CAAA,CAAK,CAAC,WAAM;uCAIxDvB,GAAAA,GAAAA,EAAAA,GAAAA,EAAAA,IAAAA,EAA+E,OAAA,EAAzE,OAAKC,EAAA,EAAA,sBAA0BP,EAAA6B,CAAA,CAAK,CAAC,WAAM,QAAA,CAAA,EAAA,GAAA,CAAgBrB,EAAQoD,EAAA,QAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkThumbnail.js","names":["_sfc_main","InkThumbnail_vue_vue_type_script_setup_true_lang_default","InkThumbnail_default"],"sources":["../../src/components/InkThumbnail.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * One page as a static image, with its live annotations and plugin marks: core's thumbnail\n * painter on this element, which sizes it, names it (\"Page N\" unless `label` says otherwise)\n * and draws it once it nears the visible area. `page` is 0-based. `width` (default 120) or\n * `height` sets the size; the other follows the page. It is not focusable and does nothing on\n * click: wrap it in the control you need. Inside `InkRoot`; it renders empty on the server.\n */\nimport {\n createThumbnailPainter,\n type ThumbnailOptions,\n type ThumbnailPainter,\n} from '@inkbar/core/dom'\nimport { onBeforeUnmount, onMounted, useTemplateRef, watch } from 'vue'\n\nimport { injectInkContext } from '../context'\nimport { toReadable } from '../to-readable'\n\nconst props = withDefaults(\n defineProps<{\n page: number\n width?: number | undefined\n height?: number | undefined\n annotations?: boolean\n marks?: boolean\n label?: string | undefined\n }>(),\n {\n width: undefined,\n height: undefined,\n annotations: true,\n marks: true,\n label: undefined,\n }\n)\n\nconst ctx = injectInkContext()\nconst deps = {\n document: toReadable(() => ctx.document.value),\n pluginHost: toReadable(() => ctx.pluginHost.value),\n}\nconst options = (): ThumbnailOptions => ({\n page: props.page,\n width: props.width,\n height: props.height,\n annotations: props.annotations,\n marks: props.marks,\n label: props.label,\n})\n\nconst el = useTemplateRef<HTMLElement>('el')\nlet painter: ThumbnailPainter | null = null\nonMounted(() => {\n const p = createThumbnailPainter(el.value!, deps, options())\n painter = p\n watch(options, (next) => p.update(next))\n})\nonBeforeUnmount(() => {\n painter?.destroy()\n painter = null\n})\n</script>\n\n<template>\n <!-- The class is the painter's too: kept here, a re-render never drops it. -->\n <div ref=\"el\" class=\"ink-thumbnail\" />\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
page: number;
|
|
3
|
+
width?: number | undefined;
|
|
4
|
+
height?: number | undefined;
|
|
5
|
+
annotations?: boolean;
|
|
6
|
+
marks?: boolean;
|
|
7
|
+
label?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
10
|
+
width: number | undefined;
|
|
11
|
+
annotations: boolean;
|
|
12
|
+
label: string | undefined;
|
|
13
|
+
height: number | undefined;
|
|
14
|
+
marks: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=InkThumbnail.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkThumbnail.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkThumbnail.vue"],"names":[],"mappings":"AAuFA,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAC;AA+DJ,QAAA,MAAM,YAAY;;;;;;6EAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { injectInkContext as e } from "../context.js";
|
|
2
|
+
import { toReadable as t } from "../to-readable.js";
|
|
3
|
+
import { createElementBlock as n, defineComponent as r, onBeforeUnmount as i, onMounted as a, openBlock as o, useTemplateRef as s, watch as c } from "vue";
|
|
4
|
+
import { createThumbnailPainter as l } from "@inkbar/core/dom";
|
|
5
|
+
//#region src/components/InkThumbnail.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var u = /*@__PURE__*/ r({
|
|
7
|
+
__name: "InkThumbnail",
|
|
8
|
+
props: {
|
|
9
|
+
page: {},
|
|
10
|
+
width: { default: void 0 },
|
|
11
|
+
height: { default: void 0 },
|
|
12
|
+
annotations: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !0
|
|
15
|
+
},
|
|
16
|
+
marks: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !0
|
|
19
|
+
},
|
|
20
|
+
label: { default: void 0 }
|
|
21
|
+
},
|
|
22
|
+
setup(r) {
|
|
23
|
+
let u = r, d = e(), f = {
|
|
24
|
+
document: t(() => d.document.value),
|
|
25
|
+
pluginHost: t(() => d.pluginHost.value)
|
|
26
|
+
}, p = () => ({
|
|
27
|
+
page: u.page,
|
|
28
|
+
width: u.width,
|
|
29
|
+
height: u.height,
|
|
30
|
+
annotations: u.annotations,
|
|
31
|
+
marks: u.marks,
|
|
32
|
+
label: u.label
|
|
33
|
+
}), m = s("el"), h = null;
|
|
34
|
+
return a(() => {
|
|
35
|
+
let e = l(m.value, f, p());
|
|
36
|
+
h = e, c(p, (t) => e.update(t));
|
|
37
|
+
}), i(() => {
|
|
38
|
+
h?.destroy(), h = null;
|
|
39
|
+
}), (e, t) => (o(), n("div", {
|
|
40
|
+
ref_key: "el",
|
|
41
|
+
ref: m,
|
|
42
|
+
class: "ink-thumbnail"
|
|
43
|
+
}, null, 512));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { u as default };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=InkThumbnail.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkThumbnail.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","InkThumbnail_vue_vue_type_script_setup_true_lang_default","props","__props","ctx","injectInkContext","deps","toReadable","options","el","useTemplateRef","painter","onMounted","p","createThumbnailPainter","watch","next","onBeforeUnmount","openBlock","createElementBlock"],"sources":["../../src/components/InkThumbnail.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * One page as a static image, with its live annotations and plugin marks: core's thumbnail\n * painter on this element, which sizes it, names it (\"Page N\" unless `label` says otherwise)\n * and draws it once it nears the visible area. `page` is 0-based. `width` (default 120) or\n * `height` sets the size; the other follows the page. It is not focusable and does nothing on\n * click: wrap it in the control you need. Inside `InkRoot`; it renders empty on the server.\n */\nimport {\n createThumbnailPainter,\n type ThumbnailOptions,\n type ThumbnailPainter,\n} from '@inkbar/core/dom'\nimport { onBeforeUnmount, onMounted, useTemplateRef, watch } from 'vue'\n\nimport { injectInkContext } from '../context'\nimport { toReadable } from '../to-readable'\n\nconst props = withDefaults(\n defineProps<{\n page: number\n width?: number | undefined\n height?: number | undefined\n annotations?: boolean\n marks?: boolean\n label?: string | undefined\n }>(),\n {\n width: undefined,\n height: undefined,\n annotations: true,\n marks: true,\n label: undefined,\n }\n)\n\nconst ctx = injectInkContext()\nconst deps = {\n document: toReadable(() => ctx.document.value),\n pluginHost: toReadable(() => ctx.pluginHost.value),\n}\nconst options = (): ThumbnailOptions => ({\n page: props.page,\n width: props.width,\n height: props.height,\n annotations: props.annotations,\n marks: props.marks,\n label: props.label,\n})\n\nconst el = useTemplateRef<HTMLElement>('el')\nlet painter: ThumbnailPainter | null = null\nonMounted(() => {\n const p = createThumbnailPainter(el.value!, deps, options())\n painter = p\n watch(options, (next) => p.update(next))\n})\nonBeforeUnmount(() => {\n painter?.destroy()\n painter = null\n})\n</script>\n\n<template>\n <!-- The class is the painter's too: kept here, a re-render never drops it. -->\n <div ref=\"el\" class=\"ink-thumbnail\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAkBA,IAAMG,IAAQC,GAkBRC,IAAMC,EAAiB,GACvBC,IAAO;GACX,UAAUC,QAAiBH,EAAI,SAAS,KAAK;GAC7C,YAAYG,QAAiBH,EAAI,WAAW,KAAK;EACnD,GACMI,WAAmC;GACvC,MAAMN,EAAM;GACZ,OAAOA,EAAM;GACb,QAAQA,EAAM;GACd,aAAaA,EAAM;GACnB,OAAOA,EAAM;GACb,OAAOA,EAAM;EACf,IAEMO,IAAKC,EAA4B,IAAI,GACvCC,IAAmC;SACvCC,QAAgB;GACd,IAAMC,IAAIC,EAAuBL,EAAG,OAAQH,GAAME,EAAQ,CAAC;GAE3D,AADA,IAAUK,GACVE,EAAMP,IAAU,MAASK,EAAE,OAAOG,CAAI,CAAC;EACzC,CAAC,GACDC,QAAsB;GAEpB,AADAN,GAAS,QAAQ,GACjB,IAAU;EACZ,CAAC,cAKCZ,EAAA,GAAAC,EAAsC,OAAA;GAA7B,SAAA;GAAJ,KAAIS;GAAK,OAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkThumbnails.js","names":["_sfc_main","InkThumbnails_vue_vue_type_script_setup_true_lang_default","InkThumbnails_default"],"sources":["../../src/components/InkThumbnails.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The pages as a list of thumbnails: `createThumbnails`' markup on core's thumbnails\n * controller, which holds the current page, the keys, the clicks, the Tab stop and the window.\n * Only the items near the visible part are mounted, each placed at its offset over a spacer of\n * the full height, and each holds an `InkThumbnail`. An item is a button that scrolls the\n * viewport to its page; the current page's has `aria-current=\"page\"`.\n *\n * `pages` lists 0-based pages in order (default: all). The `item` slot, given `{ page, current }`,\n * renders inside each item after its number. The item's height is fixed from the page's, so\n * keep what you add out of the flow (position it absolutely) or small. Inside `InkRoot`; it\n * renders empty on the server.\n */\nimport {\n createThumbnailsController,\n THUMBNAIL_WIDTH,\n type ThumbnailsController,\n type ThumbnailsOptions,\n type ThumbnailsState,\n} from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { injectInkContext } from '../context'\nimport { toReadable } from '../to-readable'\n\nimport InkThumbnail from './InkThumbnail.vue'\n\nconst props = withDefaults(\n defineProps<{\n pages?: readonly number[] | undefined\n width?: number | undefined\n annotations?: boolean\n marks?: boolean\n }>(),\n { pages: undefined, width: undefined, annotations: true, marks: true }\n)\n\ndefineSlots<{\n item?(props: { page: number; current: boolean }): unknown\n}>()\n\nconst ctx = injectInkContext()\nconst deps = {\n document: toReadable(() => ctx.document.value),\n pluginHost: toReadable(() => ctx.pluginHost.value),\n viewport: toReadable(() => ctx.viewport.value),\n}\nconst options = (): ThumbnailsOptions => ({\n pages: props.pages,\n width: props.width,\n annotations: props.annotations,\n marks: props.marks,\n})\n\nconst state = shallowRef<ThumbnailsState>({\n pages: [],\n current: -1,\n window: { start: 0, end: 0 },\n offsets: [0],\n width: THUMBNAIL_WIDTH,\n})\nlet controller: ThumbnailsController | null = null\nconst items = computed(() => {\n const { pages, current, window, offsets } = state.value\n return pages.slice(window.start, window.end).map((page, k) => {\n const top = offsets[window.start + k]!\n const bottom = offsets[window.start + k + 1]!\n // Only a mounted controller has a window, so `controller` is set here.\n const attrs = controller?.itemAttrs(window.start + k) ?? {}\n return { page, current: page === current, top, height: bottom - top, attrs }\n })\n})\n\nconst scroller = useTemplateRef<HTMLElement>('scroller')\nlet stopState: (() => void) | null = null\nonMounted(() => {\n const c = createThumbnailsController(deps, options())\n controller = c\n state.value = c.state.get()\n stopState = c.state.subscribe((s) => {\n state.value = s\n })\n watch(options, (next) => c.update(next))\n c.attach(scroller.value!)\n})\nonBeforeUnmount(() => {\n stopState?.()\n stopState = null\n controller?.destroy()\n controller = null\n})\n</script>\n\n<template>\n <div ref=\"scroller\" class=\"ink-thumbnails\" data-ink-thumbnails role=\"list\">\n <div\n class=\"ink-thumbnails-spacer\"\n aria-hidden=\"true\"\n :style=\"{ height: `${state.offsets.at(-1) ?? 0}px` }\"\n />\n <div\n v-for=\"item in items\"\n :key=\"item.page\"\n class=\"ink-thumbnails-entry\"\n v-bind=\"item.attrs\"\n :style=\"{ top: `${item.top}px`, height: `${item.height}px` }\"\n >\n <!-- The controller sets the tabindex. The thumbnail names the button \"Page N\"; the\n visible number repeats it. -->\n <button\n type=\"button\"\n class=\"ink-thumbnails-item\"\n :data-ink-thumbnail-item=\"item.page\"\n :aria-current=\"item.current ? 'page' : undefined\"\n >\n <InkThumbnail\n :page=\"item.page\"\n :width=\"state.width\"\n :annotations=\"annotations\"\n :marks=\"marks\"\n />\n <span class=\"ink-thumbnails-label\" aria-hidden=\"true\">{{ item.page + 1 }}</span>\n <slot name=\"item\" :page=\"item.page\" :current=\"item.current\" />\n </button>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
pages?: readonly number[] | undefined;
|
|
3
|
+
width?: number | undefined;
|
|
4
|
+
annotations?: boolean;
|
|
5
|
+
marks?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_Slots = {
|
|
8
|
+
item?(props: {
|
|
9
|
+
page: number;
|
|
10
|
+
current: boolean;
|
|
11
|
+
}): unknown;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
14
|
+
width: number | undefined;
|
|
15
|
+
annotations: boolean;
|
|
16
|
+
marks: boolean;
|
|
17
|
+
pages: readonly number[] | undefined;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=InkThumbnails.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkThumbnails.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkThumbnails.vue"],"names":[],"mappings":"AA0KA,KAAK,WAAW,GAAG;IACf,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAC;AAMJ,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAA;CAC1D,CAAC;AAgIF,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,107 @@
|
|
|
1
|
+
import { injectInkContext as e } from "../context.js";
|
|
2
|
+
import { toReadable as t } from "../to-readable.js";
|
|
3
|
+
import n from "./InkThumbnail.js";
|
|
4
|
+
import { Fragment as r, computed as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, mergeProps as l, normalizeStyle as u, onBeforeUnmount as d, onMounted as f, openBlock as p, renderList as m, renderSlot as h, shallowRef as g, toDisplayString as _, useTemplateRef as v, watch as y } from "vue";
|
|
5
|
+
import { THUMBNAIL_WIDTH as b, createThumbnailsController as x } from "@inkbar/core/dom";
|
|
6
|
+
//#region src/components/InkThumbnails.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var S = ["data-ink-thumbnail-item", "aria-current"], C = {
|
|
8
|
+
class: "ink-thumbnails-label",
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
}, w = /*@__PURE__*/ c({
|
|
11
|
+
__name: "InkThumbnails",
|
|
12
|
+
props: {
|
|
13
|
+
pages: { default: void 0 },
|
|
14
|
+
width: { default: void 0 },
|
|
15
|
+
annotations: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !0
|
|
18
|
+
},
|
|
19
|
+
marks: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !0
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(c) {
|
|
25
|
+
let w = c, T = e(), E = {
|
|
26
|
+
document: t(() => T.document.value),
|
|
27
|
+
pluginHost: t(() => T.pluginHost.value),
|
|
28
|
+
viewport: t(() => T.viewport.value)
|
|
29
|
+
}, D = () => ({
|
|
30
|
+
pages: w.pages,
|
|
31
|
+
width: w.width,
|
|
32
|
+
annotations: w.annotations,
|
|
33
|
+
marks: w.marks
|
|
34
|
+
}), O = g({
|
|
35
|
+
pages: [],
|
|
36
|
+
current: -1,
|
|
37
|
+
window: {
|
|
38
|
+
start: 0,
|
|
39
|
+
end: 0
|
|
40
|
+
},
|
|
41
|
+
offsets: [0],
|
|
42
|
+
width: b
|
|
43
|
+
}), k = null, A = i(() => {
|
|
44
|
+
let { pages: e, current: t, window: n, offsets: r } = O.value;
|
|
45
|
+
return e.slice(n.start, n.end).map((e, i) => {
|
|
46
|
+
let a = r[n.start + i], o = r[n.start + i + 1], s = k?.itemAttrs(n.start + i) ?? {};
|
|
47
|
+
return {
|
|
48
|
+
page: e,
|
|
49
|
+
current: e === t,
|
|
50
|
+
top: a,
|
|
51
|
+
height: o - a,
|
|
52
|
+
attrs: s
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}), j = v("scroller"), M = null;
|
|
56
|
+
return f(() => {
|
|
57
|
+
let e = x(E, D());
|
|
58
|
+
k = e, O.value = e.state.get(), M = e.state.subscribe((e) => {
|
|
59
|
+
O.value = e;
|
|
60
|
+
}), y(D, (t) => e.update(t)), e.attach(j.value);
|
|
61
|
+
}), d(() => {
|
|
62
|
+
M?.(), M = null, k?.destroy(), k = null;
|
|
63
|
+
}), (e, t) => (p(), a("div", {
|
|
64
|
+
ref_key: "scroller",
|
|
65
|
+
ref: j,
|
|
66
|
+
class: "ink-thumbnails",
|
|
67
|
+
"data-ink-thumbnails": "",
|
|
68
|
+
role: "list"
|
|
69
|
+
}, [o("div", {
|
|
70
|
+
class: "ink-thumbnails-spacer",
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
style: u({ height: `${O.value.offsets.at(-1) ?? 0}px` })
|
|
73
|
+
}, null, 4), (p(!0), a(r, null, m(A.value, (t) => (p(), a("div", l({
|
|
74
|
+
key: t.page,
|
|
75
|
+
class: "ink-thumbnails-entry"
|
|
76
|
+
}, { ref_for: !0 }, t.attrs, { style: {
|
|
77
|
+
top: `${t.top}px`,
|
|
78
|
+
height: `${t.height}px`
|
|
79
|
+
} }), [o("button", {
|
|
80
|
+
type: "button",
|
|
81
|
+
class: "ink-thumbnails-item",
|
|
82
|
+
"data-ink-thumbnail-item": t.page,
|
|
83
|
+
"aria-current": t.current ? "page" : void 0
|
|
84
|
+
}, [
|
|
85
|
+
s(n, {
|
|
86
|
+
page: t.page,
|
|
87
|
+
width: O.value.width,
|
|
88
|
+
annotations: c.annotations,
|
|
89
|
+
marks: c.marks
|
|
90
|
+
}, null, 8, [
|
|
91
|
+
"page",
|
|
92
|
+
"width",
|
|
93
|
+
"annotations",
|
|
94
|
+
"marks"
|
|
95
|
+
]),
|
|
96
|
+
o("span", C, _(t.page + 1), 1),
|
|
97
|
+
h(e.$slots, "item", {
|
|
98
|
+
page: t.page,
|
|
99
|
+
current: t.current
|
|
100
|
+
})
|
|
101
|
+
], 8, S)], 16))), 128))], 512));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { w as default };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=InkThumbnails.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkThumbnails.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_normalizeStyle","_Fragment","_renderList","_mergeProps","_createVNode","InkThumbnail","_toDisplayString","_renderSlot","InkThumbnail_default","_hoisted_1","_hoisted_2","InkThumbnails_vue_vue_type_script_setup_true_lang_default","props","__props","ctx","injectInkContext","deps","toReadable","options","state","shallowRef","THUMBNAIL_WIDTH","controller","items","computed","pages","window","top","offsets","k","bottom","attrs","page","current","scroller","useTemplateRef","stopState","onMounted","c","createThumbnailsController","s","watch","next","onBeforeUnmount","openBlock","createElementBlock","createElementVNode","normalizeStyle","Fragment","renderList","mergeProps","item","createVNode","toDisplayString","renderSlot","_ctx"],"sources":["../../src/components/InkThumbnails.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * The pages as a list of thumbnails: `createThumbnails`' markup on core's thumbnails\n * controller, which holds the current page, the keys, the clicks, the Tab stop and the window.\n * Only the items near the visible part are mounted, each placed at its offset over a spacer of\n * the full height, and each holds an `InkThumbnail`. An item is a button that scrolls the\n * viewport to its page; the current page's has `aria-current=\"page\"`.\n *\n * `pages` lists 0-based pages in order (default: all). The `item` slot, given `{ page, current }`,\n * renders inside each item after its number. The item's height is fixed from the page's, so\n * keep what you add out of the flow (position it absolutely) or small. Inside `InkRoot`; it\n * renders empty on the server.\n */\nimport {\n createThumbnailsController,\n THUMBNAIL_WIDTH,\n type ThumbnailsController,\n type ThumbnailsOptions,\n type ThumbnailsState,\n} from '@inkbar/core/dom'\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n shallowRef,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { injectInkContext } from '../context'\nimport { toReadable } from '../to-readable'\n\nimport InkThumbnail from './InkThumbnail.vue'\n\nconst props = withDefaults(\n defineProps<{\n pages?: readonly number[] | undefined\n width?: number | undefined\n annotations?: boolean\n marks?: boolean\n }>(),\n { pages: undefined, width: undefined, annotations: true, marks: true }\n)\n\ndefineSlots<{\n item?(props: { page: number; current: boolean }): unknown\n}>()\n\nconst ctx = injectInkContext()\nconst deps = {\n document: toReadable(() => ctx.document.value),\n pluginHost: toReadable(() => ctx.pluginHost.value),\n viewport: toReadable(() => ctx.viewport.value),\n}\nconst options = (): ThumbnailsOptions => ({\n pages: props.pages,\n width: props.width,\n annotations: props.annotations,\n marks: props.marks,\n})\n\nconst state = shallowRef<ThumbnailsState>({\n pages: [],\n current: -1,\n window: { start: 0, end: 0 },\n offsets: [0],\n width: THUMBNAIL_WIDTH,\n})\nlet controller: ThumbnailsController | null = null\nconst items = computed(() => {\n const { pages, current, window, offsets } = state.value\n return pages.slice(window.start, window.end).map((page, k) => {\n const top = offsets[window.start + k]!\n const bottom = offsets[window.start + k + 1]!\n // Only a mounted controller has a window, so `controller` is set here.\n const attrs = controller?.itemAttrs(window.start + k) ?? {}\n return { page, current: page === current, top, height: bottom - top, attrs }\n })\n})\n\nconst scroller = useTemplateRef<HTMLElement>('scroller')\nlet stopState: (() => void) | null = null\nonMounted(() => {\n const c = createThumbnailsController(deps, options())\n controller = c\n state.value = c.state.get()\n stopState = c.state.subscribe((s) => {\n state.value = s\n })\n watch(options, (next) => c.update(next))\n c.attach(scroller.value!)\n})\nonBeforeUnmount(() => {\n stopState?.()\n stopState = null\n controller?.destroy()\n controller = null\n})\n</script>\n\n<template>\n <div ref=\"scroller\" class=\"ink-thumbnails\" data-ink-thumbnails role=\"list\">\n <div\n class=\"ink-thumbnails-spacer\"\n aria-hidden=\"true\"\n :style=\"{ height: `${state.offsets.at(-1) ?? 0}px` }\"\n />\n <div\n v-for=\"item in items\"\n :key=\"item.page\"\n class=\"ink-thumbnails-entry\"\n v-bind=\"item.attrs\"\n :style=\"{ top: `${item.top}px`, height: `${item.height}px` }\"\n >\n <!-- The controller sets the tabindex. The thumbnail names the button \"Page N\"; the\n visible number repeats it. -->\n <button\n type=\"button\"\n class=\"ink-thumbnails-item\"\n :data-ink-thumbnail-item=\"item.page\"\n :aria-current=\"item.current ? 'page' : undefined\"\n >\n <InkThumbnail\n :page=\"item.page\"\n :width=\"state.width\"\n :annotations=\"annotations\"\n :marks=\"marks\"\n />\n <span class=\"ink-thumbnails-label\" aria-hidden=\"true\">{{ item.page + 1 }}</span>\n <slot name=\"item\" :page=\"item.page\" :current=\"item.current\" />\n </button>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAkCA,IAAMe,IAAQC,GAcRC,IAAMC,EAAiB,GACvBC,IAAO;GACX,UAAUC,QAAiBH,EAAI,SAAS,KAAK;GAC7C,YAAYG,QAAiBH,EAAI,WAAW,KAAK;GACjD,UAAUG,QAAiBH,EAAI,SAAS,KAAK;EAC/C,GACMI,WAAoC;GACxC,OAAON,EAAM;GACb,OAAOA,EAAM;GACb,aAAaA,EAAM;GACnB,OAAOA,EAAM;EACf,IAEMO,IAA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AA,CAAAA,IAAAA,EAAA,EAAA,GAAAC,EAwBMG,GAAA,MAAAC,EAvBWqB,EAAA,QAAR,OADT1B,EAAA,GAAAC,EAwBM,OAxBNK,EAwBM;GAtBH,KAAKgD,EAAK;GACX,OAAM;EACE,GAAA,EAAA,SAAA,GAAA,GAAAA,EAAK,OAAK,EACjB,OAAK;GAAA,KAAA,GAAYA,EAAK,IAAG;GAAA,QAAA,GAAiBA,EAAK,OAAM;EAAA,EAAA,CAAA,GAAA,CAItDpD,EAcS,UAAA;GAbP,MAAK;GACL,OAAM;GACL,2BAAyBoD,EAAK;GAC9B,gBAAcA,EAAK,UAAO,SAAY,KAAA;;GAEvC/C,EAKEC,GAAA;IAJC,MAAM8C,EAAK;IACX,OAAOhC,EAAA,MAAM;IACb,aAAaN,EAAA;IACb,OAAOA,EAAA;;;;;;;GAEVd,EAAgF,QAAhFW,GAAgFJ,EAAvB6C,EAAK,OAAI,CAAA,GAAA,CAAA;GAClE5C,EAA8DgD,EAAA,QAAA,QAAA;IAA3C,MAAMJ,EAAK;IAAO,SAASA,EAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkZoomSelect.js","names":["_sfc_main","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","InkZoomSelect_default"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { Check, ChevronDown } from '@inkbar/icons'\nimport {\n SelectContent,\n SelectIcon,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectPortal,\n SelectRoot,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n SelectViewport,\n} from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport InkIcon from './InkIcon.vue'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nconst CUSTOM = 'custom:'\n\nconst { zoom, scale, setZoom } = useZoom()\n\nconst level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)\n/** A numeric zoom that is not one of the levels (zoom in and out multiply). */\nconst custom = computed(() =>\n typeof zoom.value === 'number' && level(zoom.value) === undefined ? zoom.value : null\n)\nconst value = computed(() => {\n const z = zoom.value\n if (typeof z !== 'number') return z\n return custom.value === null ? String(level(z)) : `${CUSTOM}${z}`\n})\n\nfunction onChange(v: unknown): void {\n if (typeof v !== 'string' || v === value.value) return\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n\nconst FITS = [\n { value: 'fit-width', label: 'Fit width' },\n { value: 'fit-page', label: 'Fit page' },\n]\n// Reka's typed props stop at its own; ARIA goes through a bound object.\nconst triggerAttrs = { 'aria-label': 'Zoom' }\nconst percent = (z: number) => `${Math.round(z * 100)}%`\n/** The levels, with a custom zoom in its place among them. */\nconst levels = computed(() => {\n const list = ZOOM_LEVELS.map((l) => ({ z: l, value: String(l), label: percent(l) }))\n const c = custom.value\n if (c !== null) list.push({ z: c, value: `${CUSTOM}${c}`, label: percent(scale.value) })\n return list.sort((a, b) => a.z - b.z)\n})\n</script>\n\n<template>\n <SelectRoot :model-value=\"value\" @update:model-value=\"onChange\">\n <SelectTrigger\n class=\"ink-
|
|
1
|
+
{"version":3,"file":"InkZoomSelect.js","names":["_sfc_main","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","InkZoomSelect_default"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { Check, ChevronDown } from '@inkbar/icons'\nimport {\n SelectContent,\n SelectIcon,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectPortal,\n SelectRoot,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n SelectViewport,\n} from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport InkIcon from './InkIcon.vue'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nconst CUSTOM = 'custom:'\n\nconst { zoom, scale, setZoom } = useZoom()\n\nconst level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)\n/** A numeric zoom that is not one of the levels (zoom in and out multiply). */\nconst custom = computed(() =>\n typeof zoom.value === 'number' && level(zoom.value) === undefined ? zoom.value : null\n)\nconst value = computed(() => {\n const z = zoom.value\n if (typeof z !== 'number') return z\n return custom.value === null ? String(level(z)) : `${CUSTOM}${z}`\n})\n\nfunction onChange(v: unknown): void {\n if (typeof v !== 'string' || v === value.value) return\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n\nconst FITS = [\n { value: 'fit-width', label: 'Fit width' },\n { value: 'fit-page', label: 'Fit page' },\n]\n// Reka's typed props stop at its own; ARIA goes through a bound object.\nconst triggerAttrs = { 'aria-label': 'Zoom' }\nconst percent = (z: number) => `${Math.round(z * 100)}%`\n/** The levels, with a custom zoom in its place among them. */\nconst levels = computed(() => {\n const list = ZOOM_LEVELS.map((l) => ({ z: l, value: String(l), label: percent(l) }))\n const c = custom.value\n if (c !== null) list.push({ z: c, value: `${CUSTOM}${c}`, label: percent(scale.value) })\n return list.sort((a, b) => a.z - b.z)\n})\n</script>\n\n<template>\n <SelectRoot :model-value=\"value\" @update:model-value=\"onChange\">\n <SelectTrigger\n class=\"ink-select ink-select-trigger ink-zoom-select\"\n data-ink-zoom-select\n v-bind=\"triggerAttrs\"\n >\n <SelectValue class=\"ink-select-value\" />\n <SelectIcon class=\"ink-select-icon\">\n <InkIcon :icon=\"ChevronDown\" :size=\"16\" />\n </SelectIcon>\n </SelectTrigger>\n <SelectPortal>\n <SelectContent\n class=\"ink-select-content\"\n data-ink-select-content\n position=\"popper\"\n side=\"top\"\n :side-offset=\"4\"\n >\n <SelectViewport>\n <SelectItem\n v-for=\"o in FITS\"\n :key=\"o.value\"\n :value=\"o.value\"\n class=\"ink-select-item\"\n data-ink-select-item\n >\n <SelectItemText>{{ o.label }}</SelectItemText>\n <SelectItemIndicator class=\"ink-select-indicator\">\n <InkIcon :icon=\"Check\" :size=\"16\" />\n </SelectItemIndicator>\n </SelectItem>\n <SelectSeparator class=\"ink-select-separator\" />\n <SelectItem\n v-for=\"o in levels\"\n :key=\"o.value\"\n :value=\"o.value\"\n class=\"ink-select-item\"\n data-ink-select-item\n >\n <SelectItemText>{{ o.label }}</SelectItemText>\n <SelectItemIndicator class=\"ink-select-indicator\">\n <InkIcon :icon=\"Check\" :size=\"16\" />\n </SelectItemIndicator>\n </SelectItem>\n </SelectViewport>\n </SelectContent>\n </SelectPortal>\n </SelectRoot>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkZoomSelect.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkZoomSelect.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InkZoomSelect.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkZoomSelect.vue"],"names":[],"mappings":"AA+bA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -40,7 +40,7 @@ var k = "custom:", A = /*@__PURE__*/ c({
|
|
|
40
40
|
"onUpdate:modelValue": I
|
|
41
41
|
}, {
|
|
42
42
|
default: m(() => [s(p(w), l({
|
|
43
|
-
class: "ink-
|
|
43
|
+
class: "ink-select ink-select-trigger ink-zoom-select",
|
|
44
44
|
"data-ink-zoom-select": ""
|
|
45
45
|
}, R), {
|
|
46
46
|
default: m(() => [s(p(T), { class: "ink-select-value" }), s(p(_), { class: "ink-select-icon" }, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkZoomSelect.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","InkIcon","_createElementBlock","_Fragment","_renderList","_createTextVNode","_toDisplayString","InkIcon_default","CUSTOM","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","useZoom","level","ZOOM_LEVELS","l","z","custom","computed","zoom","value","onChange","v","next","FITS","triggerAttrs","percent","levels","list","c","scale","a","b","openBlock","createBlock","unref","SelectRoot","withCtx","createVNode","SelectTrigger","mergeProps","SelectValue","SelectIcon","ChevronDown","SelectPortal","SelectContent","SelectViewport","createElementBlock","Fragment","renderList","SelectItem","o","SelectItemText","createTextVNode","toDisplayString","SelectItemIndicator","Check","SelectSeparator"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { Check, ChevronDown } from '@inkbar/icons'\nimport {\n SelectContent,\n SelectIcon,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectPortal,\n SelectRoot,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n SelectViewport,\n} from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport InkIcon from './InkIcon.vue'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nconst CUSTOM = 'custom:'\n\nconst { zoom, scale, setZoom } = useZoom()\n\nconst level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)\n/** A numeric zoom that is not one of the levels (zoom in and out multiply). */\nconst custom = computed(() =>\n typeof zoom.value === 'number' && level(zoom.value) === undefined ? zoom.value : null\n)\nconst value = computed(() => {\n const z = zoom.value\n if (typeof z !== 'number') return z\n return custom.value === null ? String(level(z)) : `${CUSTOM}${z}`\n})\n\nfunction onChange(v: unknown): void {\n if (typeof v !== 'string' || v === value.value) return\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n\nconst FITS = [\n { value: 'fit-width', label: 'Fit width' },\n { value: 'fit-page', label: 'Fit page' },\n]\n// Reka's typed props stop at its own; ARIA goes through a bound object.\nconst triggerAttrs = { 'aria-label': 'Zoom' }\nconst percent = (z: number) => `${Math.round(z * 100)}%`\n/** The levels, with a custom zoom in its place among them. */\nconst levels = computed(() => {\n const list = ZOOM_LEVELS.map((l) => ({ z: l, value: String(l), label: percent(l) }))\n const c = custom.value\n if (c !== null) list.push({ z: c, value: `${CUSTOM}${c}`, label: percent(scale.value) })\n return list.sort((a, b) => a.z - b.z)\n})\n</script>\n\n<template>\n <SelectRoot :model-value=\"value\" @update:model-value=\"onChange\">\n <SelectTrigger\n class=\"ink-
|
|
1
|
+
{"version":3,"file":"InkZoomSelect.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","InkIcon","_createElementBlock","_Fragment","_renderList","_createTextVNode","_toDisplayString","InkIcon_default","CUSTOM","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","useZoom","level","ZOOM_LEVELS","l","z","custom","computed","zoom","value","onChange","v","next","FITS","triggerAttrs","percent","levels","list","c","scale","a","b","openBlock","createBlock","unref","SelectRoot","withCtx","createVNode","SelectTrigger","mergeProps","SelectValue","SelectIcon","ChevronDown","SelectPortal","SelectContent","SelectViewport","createElementBlock","Fragment","renderList","SelectItem","o","SelectItemText","createTextVNode","toDisplayString","SelectItemIndicator","Check","SelectSeparator"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { Check, ChevronDown } from '@inkbar/icons'\nimport {\n SelectContent,\n SelectIcon,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectPortal,\n SelectRoot,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n SelectViewport,\n} from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport InkIcon from './InkIcon.vue'\n\nimport type { ZoomValue } from '@inkbar/core/dom'\n\nconst CUSTOM = 'custom:'\n\nconst { zoom, scale, setZoom } = useZoom()\n\nconst level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)\n/** A numeric zoom that is not one of the levels (zoom in and out multiply). */\nconst custom = computed(() =>\n typeof zoom.value === 'number' && level(zoom.value) === undefined ? zoom.value : null\n)\nconst value = computed(() => {\n const z = zoom.value\n if (typeof z !== 'number') return z\n return custom.value === null ? String(level(z)) : `${CUSTOM}${z}`\n})\n\nfunction onChange(v: unknown): void {\n if (typeof v !== 'string' || v === value.value) return\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n\nconst FITS = [\n { value: 'fit-width', label: 'Fit width' },\n { value: 'fit-page', label: 'Fit page' },\n]\n// Reka's typed props stop at its own; ARIA goes through a bound object.\nconst triggerAttrs = { 'aria-label': 'Zoom' }\nconst percent = (z: number) => `${Math.round(z * 100)}%`\n/** The levels, with a custom zoom in its place among them. */\nconst levels = computed(() => {\n const list = ZOOM_LEVELS.map((l) => ({ z: l, value: String(l), label: percent(l) }))\n const c = custom.value\n if (c !== null) list.push({ z: c, value: `${CUSTOM}${c}`, label: percent(scale.value) })\n return list.sort((a, b) => a.z - b.z)\n})\n</script>\n\n<template>\n <SelectRoot :model-value=\"value\" @update:model-value=\"onChange\">\n <SelectTrigger\n class=\"ink-select ink-select-trigger ink-zoom-select\"\n data-ink-zoom-select\n v-bind=\"triggerAttrs\"\n >\n <SelectValue class=\"ink-select-value\" />\n <SelectIcon class=\"ink-select-icon\">\n <InkIcon :icon=\"ChevronDown\" :size=\"16\" />\n </SelectIcon>\n </SelectTrigger>\n <SelectPortal>\n <SelectContent\n class=\"ink-select-content\"\n data-ink-select-content\n position=\"popper\"\n side=\"top\"\n :side-offset=\"4\"\n >\n <SelectViewport>\n <SelectItem\n v-for=\"o in FITS\"\n :key=\"o.value\"\n :value=\"o.value\"\n class=\"ink-select-item\"\n data-ink-select-item\n >\n <SelectItemText>{{ o.label }}</SelectItemText>\n <SelectItemIndicator class=\"ink-select-indicator\">\n <InkIcon :icon=\"Check\" :size=\"16\" />\n </SelectItemIndicator>\n </SelectItem>\n <SelectSeparator class=\"ink-select-separator\" />\n <SelectItem\n v-for=\"o in levels\"\n :key=\"o.value\"\n :value=\"o.value\"\n class=\"ink-select-item\"\n data-ink-select-item\n >\n <SelectItemText>{{ o.label }}</SelectItemText>\n <SelectItemIndicator class=\"ink-select-indicator\">\n <InkIcon :icon=\"Check\" :size=\"16\" />\n </SelectItemIndicator>\n </SelectItem>\n </SelectViewport>\n </SelectContent>\n </SelectPortal>\n </SelectRoot>\n</template>\n"],"mappings":";;;;;;;AAwBA,IAAMa,IAAS;;;EAEf,IAAM,EAAE,SAAM,UAAO,eAAYE,EAAQ,GAEnCC,KAAS,MAAcC,EAAY,MAAM,MAAM,KAAK,IAAIC,IAAIC,CAAC,IAAI,IAAK,GAEtEC,IAASC,QACb,OAAOC,EAAK,SAAU,YAAYN,EAAMM,EAAK,KAAK,MAAM,KAAA,IAAYA,EAAK,QAAQ,IACnF,GACMC,IAAQF,QAAe;GAC3B,IAAMF,IAAIG,EAAK;GAEf,OADI,OAAOH,KAAM,WACVC,EAAO,UAAU,OAAO,OAAOJ,EAAMG,CAAC,CAAC,IAAI,GAAGN,IAASM,MAD5BA;EAEpC,CAAC;EAED,SAASK,EAAS,GAAkB;GAClC,IAAI,OAAOC,KAAM,YAAYA,MAAMF,EAAM,OAAO;GAChD,IAAMG,IACJD,MAAM,eAAeA,MAAM,aAAaA,IAAI,OAAOA,EAAE,QAAQZ,GAAQ,EAAE,CAAC;GAC1E,EAAQa,CAAI;EACd;EAEA,IAAMC,IAAO,CACX;GAAE,OAAO;GAAa,OAAO;EAAY,GACzC;GAAE,OAAO;GAAY,OAAO;EAAW,CACzC,GAEMC,IAAe,EAAE,cAAc,OAAO,GACtCC,KAAW,MAAc,GAAG,KAAK,MAAMV,IAAI,GAAG,EAAE,IAEhDW,IAAST,QAAe;GAC5B,IAAMU,IAAOd,EAAY,KAAK,OA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AAA;SAA9B,SAAApD,QAAa,CAAVO,EAAAC,EAAA2C,EAAE,KAAK,GAAA,CAAA,CAAA,CAAA;;QAC1BlD,GAAAA,IAAAA,GAAAA,EAEsBF,EAAAwD,CAAA,GAAA,EAFD,OAAM,uBAAsB,GAAA;SAC/C,SAAAvD,QAAoC,CAApCC,EAAoCE,GAAA;UAA1B,MAAMJ,EAAAyD,CAAA;UAAQ,MAAM;;;;;;OAGlCvD,EAAgDF,EAAA0D,CAAA,GAAA,EAA/B,OAAM,uBAAsB,CAAA;QAC7C5D,EAAA,EAAA,GAAAO,EAWaC,GAAA,MAAAC,EAVCqB,EAAA,QAAL,OADT9B,EAAA,GAAAC,EAWaC,EAAAmD,CAAA,GAAA;QATV,KAAKC,EAAE;QACP,OAAOA,EAAE;QACV,OAAM;QACN,wBAAA;;QAEA,SAAAnD,QAA8C,CAA9CC,EAA8CF,EAAAqD,CAAA,GAAA,MAAA;SAA9B,SAAApD,QAAa,CAAVO,EAAAC,EAAA2C,EAAE,KAAK,GAAA,CAAA,CAAA,CAAA;;QAC1BlD,GAAAA,IAAAA,GAAAA,EAEsBF,EAAAwD,CAAA,GAAA,EAFD,OAAM,uBAAsB,GAAA;SAC/C,SAAAvD,QAAoC,CAApCC,EAAoCE,GAAA;UAA1B,MAAMJ,EAAAyD,CAAA;UAAQ,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordCards.js","names":["_sfc_main","RecordCards_vue_vue_type_script_setup_true_lang_default","RecordCards_default"],"sources":["../../src/components/RecordCards.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A record list's markup on core's record list controller, shared by `InkRecordList` and\n * `InkSearchResults`: `createRecordList`'s `div.ink-records` holding `ul.ink-record-list` with\n * one `li.ink-record` card per row, the empty text and a polite live region. The controller\n * holds the rows, the count and the announcement, and handles the clicks, keys, Tab stop,\n * focus and scrolling. Empty, with no empty text, until there is a source.\n */\nimport {\n createRecordListController,\n type RecordListController,\n type RecordListRow,\n type RecordListSource,\n} from '@inkbar/core/dom'\nimport { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n source: RecordListSource | null\n /** Whether the empty text shows when there are no rows. */\n emptyShown?: boolean\n }>(),\n { emptyShown: true }\n)\n\nconst emit = defineEmits<{ 'update:count': [count: number] }>()\n\ndefineSlots<{ empty?(): unknown }>()\n\nconst root = useTemplateRef<HTMLElement>('root')\nconst controller = shallowRef<RecordListController | null>(null)\nconst rows = shallowRef<readonly RecordListRow[]>([])\nconst announcement = shallowRef('')\nconst empty = computed(\n () => controller.value !== null && rows.value.length === 0 && props.emptyShown\n)\n\nlet reported: number | null = null\nfunction report(count: number): void {\n if (count === reported) return\n reported = count\n emit('update:count', count)\n}\n\n/**\n * When the rows change under a focused action whose button goes (its card lost that action),\n * focus the same place in the card once it re-renders, else the row. A row that goes is the\n * controller's to re-home.\n */\nfunction keepActionFocus(): void {\n const el = root.value\n const active = el?.ownerDocument.activeElement\n if (!el || !(active instanceof HTMLButtonElement) || !el.contains(active)) return\n const row = active.closest<HTMLElement>('[data-ink-record]')\n if (!row) return\n const id = row.dataset.inkRecord\n const buttons = (r: HTMLElement) => [\n ...r.querySelectorAll<HTMLElement>('.ink-card-actions > button'),\n ]\n const index = buttons(row).indexOf(active)\n void nextTick(() => {\n if (active.isConnected) return\n const now = [...el.querySelectorAll<HTMLElement>('[data-ink-record]')].find(\n (r) => r.dataset.inkRecord === id\n )\n if (now) (buttons(now)[index] ?? now).focus({ preventScroll: true })\n })\n}\n\nwatch(\n [() => props.source, root],\n ([source, el], _, onCleanup) => {\n if (!source || !el) {\n controller.value = null\n rows.value = []\n announcement.value = ''\n return\n }\n const c = createRecordListController(source)\n controller.value = c\n rows.value = c.rows.get()\n announcement.value = c.announcement.get()\n report(c.count.get())\n const stops = [\n c.rows.subscribe((next) => {\n keepActionFocus()\n rows.value = next\n }),\n c.count.subscribe(report),\n c.announcement.subscribe((text) => {\n announcement.value = text\n }),\n ]\n const detach = c.attach(el)\n onCleanup(() => {\n for (const stop of stops) stop()\n detach()\n c.destroy()\n })\n },\n { flush: 'post', immediate: true }\n)\n</script>\n\n<template>\n <div ref=\"root\" class=\"ink-records\" data-ink-records tabindex=\"-1\">\n <ul class=\"ink-record-list\" role=\"list\" :hidden=\"rows.length === 0\">\n <!-- The controller sets each row's tabindex. -->\n <li\n v-for=\"{ item, card, selected } in rows\"\n :key=\"item.id\"\n class=\"ink-record\"\n :data-ink-record=\"item.id\"\n :aria-current=\"selected ? 'true' : undefined\"\n :data-selected=\"selected ? '' : undefined\"\n >\n <div :class=\"['ink-card', card?.className]\">\n <template v-if=\"card\">\n <p class=\"ink-card-title\">{{ card.title }}</p>\n <!-- prettier-ignore -->\n <p v-if=\"card.meta !== undefined\" class=\"ink-card-meta\"><span v-if=\"card.swatch !== undefined\" class=\"ink-card-swatch\" :style=\"{ background: card.swatch }\" />{{ card.meta }}</p>\n <p v-if=\"card.body !== undefined\" class=\"ink-card-body\">{{ card.body }}</p>\n <!-- prettier-ignore -->\n <p v-if=\"card.excerpt !== undefined\" class=\"ink-card-excerpt\">{{ card.excerpt.before }}<mark>{{ card.excerpt.match }}</mark>{{ card.excerpt.after }}</p>\n <div class=\"ink-card-actions\">\n <button\n v-for=\"label in Object.keys(card.actions)\"\n :key=\"label\"\n type=\"button\"\n @click=\"controller?.act(item.id, label)\"\n v-text=\"label\"\n />\n </div>\n </template>\n </div>\n </li>\n </ul>\n <p class=\"ink-record-list-empty\" :hidden=\"!empty\">\n <slot name=\"empty\">Nothing here yet.</slot>\n </p>\n <div\n class=\"ink-visually-hidden\"\n aria-live=\"polite\"\n data-ink-record-status\n v-text=\"announcement\"\n />\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RecordListSource } from '@inkbar/core/dom';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
source: RecordListSource | null;
|
|
4
|
+
/** Whether the empty text shows when there are no rows. */
|
|
5
|
+
emptyShown?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_Slots = {
|
|
8
|
+
empty?(): unknown;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
|
+
"update:count": (count: number) => any;
|
|
12
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
"onUpdate:count"?: (count: number) => any;
|
|
14
|
+
}>, {
|
|
15
|
+
emptyShown: boolean;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=RecordCards.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordCards.vue.d.ts","sourceRoot":"","sources":["../../src/components/RecordCards.vue"],"names":[],"mappings":"AA6JA,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAIzB,KAAK,WAAW,GAAG;IACf,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC/B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC;AASJ,KAAK,WAAW,GAAG;IAAE,KAAK,CAAC,IAAI,OAAO,CAAA;CAAE,CAAC;AAgNzC,QAAA,MAAM,UAAU;;;;;;6EAId,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,120 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, nextTick as s, normalizeClass as c, normalizeStyle as l, openBlock as u, renderList as d, renderSlot as f, shallowRef as p, toDisplayString as m, useTemplateRef as h, watch as g } from "vue";
|
|
2
|
+
import { createRecordListController as _ } from "@inkbar/core/dom";
|
|
3
|
+
//#region src/components/RecordCards.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var v = ["hidden"], y = [
|
|
5
|
+
"data-ink-record",
|
|
6
|
+
"aria-current",
|
|
7
|
+
"data-selected"
|
|
8
|
+
], b = { class: "ink-card-title" }, x = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "ink-card-meta"
|
|
11
|
+
}, S = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "ink-card-body"
|
|
14
|
+
}, C = {
|
|
15
|
+
key: 2,
|
|
16
|
+
class: "ink-card-excerpt"
|
|
17
|
+
}, w = { class: "ink-card-actions" }, T = ["onClick", "textContent"], E = ["hidden"], D = ["textContent"], O = /*@__PURE__*/ o({
|
|
18
|
+
__name: "RecordCards",
|
|
19
|
+
props: {
|
|
20
|
+
source: {},
|
|
21
|
+
emptyShown: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !0
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:count"],
|
|
27
|
+
setup(o, { emit: O }) {
|
|
28
|
+
let k = o, A = O, j = h("root"), M = p(null), N = p([]), P = p(""), F = t(() => M.value !== null && N.value.length === 0 && k.emptyShown), I = null;
|
|
29
|
+
function L(e) {
|
|
30
|
+
e !== I && (I = e, A("update:count", e));
|
|
31
|
+
}
|
|
32
|
+
function R() {
|
|
33
|
+
let e = j.value, t = e?.ownerDocument.activeElement;
|
|
34
|
+
if (!e || !(t instanceof HTMLButtonElement) || !e.contains(t)) return;
|
|
35
|
+
let n = t.closest("[data-ink-record]");
|
|
36
|
+
if (!n) return;
|
|
37
|
+
let r = n.dataset.inkRecord, i = (e) => [...e.querySelectorAll(".ink-card-actions > button")], a = i(n).indexOf(t);
|
|
38
|
+
s(() => {
|
|
39
|
+
if (t.isConnected) return;
|
|
40
|
+
let n = [...e.querySelectorAll("[data-ink-record]")].find((e) => e.dataset.inkRecord === r);
|
|
41
|
+
n && (i(n)[a] ?? n).focus({ preventScroll: !0 });
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return g([() => k.source, j], ([e, t], n, r) => {
|
|
45
|
+
if (!e || !t) {
|
|
46
|
+
M.value = null, N.value = [], P.value = "";
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
let i = _(e);
|
|
50
|
+
M.value = i, N.value = i.rows.get(), P.value = i.announcement.get(), L(i.count.get());
|
|
51
|
+
let a = [
|
|
52
|
+
i.rows.subscribe((e) => {
|
|
53
|
+
R(), N.value = e;
|
|
54
|
+
}),
|
|
55
|
+
i.count.subscribe(L),
|
|
56
|
+
i.announcement.subscribe((e) => {
|
|
57
|
+
P.value = e;
|
|
58
|
+
})
|
|
59
|
+
], o = i.attach(t);
|
|
60
|
+
r(() => {
|
|
61
|
+
for (let e of a) e();
|
|
62
|
+
o(), i.destroy();
|
|
63
|
+
});
|
|
64
|
+
}, {
|
|
65
|
+
flush: "post",
|
|
66
|
+
immediate: !0
|
|
67
|
+
}), (t, o) => (u(), r("div", {
|
|
68
|
+
ref_key: "root",
|
|
69
|
+
ref: j,
|
|
70
|
+
class: "ink-records",
|
|
71
|
+
"data-ink-records": "",
|
|
72
|
+
tabindex: "-1"
|
|
73
|
+
}, [
|
|
74
|
+
i("ul", {
|
|
75
|
+
class: "ink-record-list",
|
|
76
|
+
role: "list",
|
|
77
|
+
hidden: N.value.length === 0
|
|
78
|
+
}, [(u(!0), r(e, null, d(N.value, ({ item: t, card: o, selected: s }) => (u(), r("li", {
|
|
79
|
+
key: t.id,
|
|
80
|
+
class: "ink-record",
|
|
81
|
+
"data-ink-record": t.id,
|
|
82
|
+
"aria-current": s ? "true" : void 0,
|
|
83
|
+
"data-selected": s ? "" : void 0
|
|
84
|
+
}, [i("div", { class: c(["ink-card", o?.className]) }, [o ? (u(), r(e, { key: 0 }, [
|
|
85
|
+
i("p", b, m(o.title), 1),
|
|
86
|
+
o.meta === void 0 ? n("", !0) : (u(), r("p", x, [o.swatch === void 0 ? n("", !0) : (u(), r("span", {
|
|
87
|
+
key: 0,
|
|
88
|
+
class: "ink-card-swatch",
|
|
89
|
+
style: l({ background: o.swatch })
|
|
90
|
+
}, null, 4)), a(m(o.meta), 1)])),
|
|
91
|
+
o.body === void 0 ? n("", !0) : (u(), r("p", S, m(o.body), 1)),
|
|
92
|
+
o.excerpt === void 0 ? n("", !0) : (u(), r("p", C, [
|
|
93
|
+
a(m(o.excerpt.before), 1),
|
|
94
|
+
i("mark", null, m(o.excerpt.match), 1),
|
|
95
|
+
a(m(o.excerpt.after), 1)
|
|
96
|
+
])),
|
|
97
|
+
i("div", w, [(u(!0), r(e, null, d(Object.keys(o.actions), (e) => (u(), r("button", {
|
|
98
|
+
key: e,
|
|
99
|
+
type: "button",
|
|
100
|
+
onClick: (n) => M.value?.act(t.id, e),
|
|
101
|
+
textContent: m(e)
|
|
102
|
+
}, null, 8, T))), 128))])
|
|
103
|
+
], 64)) : n("", !0)], 2)], 8, y))), 128))], 8, v),
|
|
104
|
+
i("p", {
|
|
105
|
+
class: "ink-record-list-empty",
|
|
106
|
+
hidden: !F.value
|
|
107
|
+
}, [f(t.$slots, "empty", {}, () => [o[0] ||= a("Nothing here yet.", -1)])], 8, E),
|
|
108
|
+
i("div", {
|
|
109
|
+
class: "ink-visually-hidden",
|
|
110
|
+
"aria-live": "polite",
|
|
111
|
+
"data-ink-record-status": "",
|
|
112
|
+
textContent: m(P.value)
|
|
113
|
+
}, null, 8, D)
|
|
114
|
+
], 512));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
//#endregion
|
|
118
|
+
export { O as default };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=RecordCards.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordCards.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_Fragment","_renderList","_normalizeClass","_toDisplayString","_normalizeStyle","_createCommentVNode","_createTextVNode","_renderSlot","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","RecordCards_vue_vue_type_script_setup_true_lang_default","__emit","props","__props","emit","root","useTemplateRef","controller","shallowRef","rows","announcement","empty","computed","reported","report","count","keepActionFocus","el","active","row","id","buttons","r","index","now","watch","source","c","createRecordListController","stops","next","text","detach","stop","openBlock","createElementBlock","createElementVNode","Fragment","renderList","item","selected","normalizeClass","card","toDisplayString","createCommentVNode","normalizeStyle","createTextVNode","label","renderSlot","_ctx","_cache"],"sources":["../../src/components/RecordCards.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A record list's markup on core's record list controller, shared by `InkRecordList` and\n * `InkSearchResults`: `createRecordList`'s `div.ink-records` holding `ul.ink-record-list` with\n * one `li.ink-record` card per row, the empty text and a polite live region. The controller\n * holds the rows, the count and the announcement, and handles the clicks, keys, Tab stop,\n * focus and scrolling. Empty, with no empty text, until there is a source.\n */\nimport {\n createRecordListController,\n type RecordListController,\n type RecordListRow,\n type RecordListSource,\n} from '@inkbar/core/dom'\nimport { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n source: RecordListSource | null\n /** Whether the empty text shows when there are no rows. */\n emptyShown?: boolean\n }>(),\n { emptyShown: true }\n)\n\nconst emit = defineEmits<{ 'update:count': [count: number] }>()\n\ndefineSlots<{ empty?(): unknown }>()\n\nconst root = useTemplateRef<HTMLElement>('root')\nconst controller = shallowRef<RecordListController | null>(null)\nconst rows = shallowRef<readonly RecordListRow[]>([])\nconst announcement = shallowRef('')\nconst empty = computed(\n () => controller.value !== null && rows.value.length === 0 && props.emptyShown\n)\n\nlet reported: number | null = null\nfunction report(count: number): void {\n if (count === reported) return\n reported = count\n emit('update:count', count)\n}\n\n/**\n * When the rows change under a focused action whose button goes (its card lost that action),\n * focus the same place in the card once it re-renders, else the row. A row that goes is the\n * controller's to re-home.\n */\nfunction keepActionFocus(): void {\n const el = root.value\n const active = el?.ownerDocument.activeElement\n if (!el || !(active instanceof HTMLButtonElement) || !el.contains(active)) return\n const row = active.closest<HTMLElement>('[data-ink-record]')\n if (!row) return\n const id = row.dataset.inkRecord\n const buttons = (r: HTMLElement) => [\n ...r.querySelectorAll<HTMLElement>('.ink-card-actions > button'),\n ]\n const index = buttons(row).indexOf(active)\n void nextTick(() => {\n if (active.isConnected) return\n const now = [...el.querySelectorAll<HTMLElement>('[data-ink-record]')].find(\n (r) => r.dataset.inkRecord === id\n )\n if (now) (buttons(now)[index] ?? now).focus({ preventScroll: true })\n })\n}\n\nwatch(\n [() => props.source, root],\n ([source, el], _, onCleanup) => {\n if (!source || !el) {\n controller.value = null\n rows.value = []\n announcement.value = ''\n return\n }\n const c = createRecordListController(source)\n controller.value = c\n rows.value = c.rows.get()\n announcement.value = c.announcement.get()\n report(c.count.get())\n const stops = [\n c.rows.subscribe((next) => {\n keepActionFocus()\n rows.value = next\n }),\n c.count.subscribe(report),\n c.announcement.subscribe((text) => {\n announcement.value = text\n }),\n ]\n const detach = c.attach(el)\n onCleanup(() => {\n for (const stop of stops) stop()\n detach()\n c.destroy()\n })\n },\n { flush: 'post', immediate: true }\n)\n</script>\n\n<template>\n <div ref=\"root\" class=\"ink-records\" data-ink-records tabindex=\"-1\">\n <ul class=\"ink-record-list\" role=\"list\" :hidden=\"rows.length === 0\">\n <!-- The controller sets each row's tabindex. -->\n <li\n v-for=\"{ item, card, selected } in rows\"\n :key=\"item.id\"\n class=\"ink-record\"\n :data-ink-record=\"item.id\"\n :aria-current=\"selected ? 'true' : undefined\"\n :data-selected=\"selected ? '' : undefined\"\n >\n <div :class=\"['ink-card', card?.className]\">\n <template v-if=\"card\">\n <p class=\"ink-card-title\">{{ card.title }}</p>\n <!-- prettier-ignore -->\n <p v-if=\"card.meta !== undefined\" class=\"ink-card-meta\"><span v-if=\"card.swatch !== undefined\" class=\"ink-card-swatch\" :style=\"{ background: card.swatch }\" />{{ card.meta }}</p>\n <p v-if=\"card.body !== undefined\" class=\"ink-card-body\">{{ card.body }}</p>\n <!-- prettier-ignore -->\n <p v-if=\"card.excerpt !== undefined\" class=\"ink-card-excerpt\">{{ card.excerpt.before }}<mark>{{ card.excerpt.match }}</mark>{{ card.excerpt.after }}</p>\n <div class=\"ink-card-actions\">\n <button\n v-for=\"label in Object.keys(card.actions)\"\n :key=\"label\"\n type=\"button\"\n @click=\"controller?.act(item.id, label)\"\n v-text=\"label\"\n />\n </div>\n </template>\n </div>\n </li>\n </ul>\n <p class=\"ink-record-list-empty\" :hidden=\"!empty\">\n <slot name=\"empty\">Nothing here yet.</slot>\n </p>\n <div\n class=\"ink-visually-hidden\"\n aria-live=\"polite\"\n data-ink-record-status\n v-text=\"announcement\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,IAAMuB,IAAQC,GASRC,IAAOH,GAIPI,IAAOC,EAA4B,MAAM,GACzCC,IAAaC,EAAwC,IAAI,GACzDC,IAAOD,EAAqC,CAAC,CAAC,GAC9CE,IAAeF,EAAW,EAAE,GAC5BG,IAAQC,QACNL,EAAW,UAAU,QAAQE,EAAK,MAAM,WAAW,KAAKP,EAAM,UACtE,GAEIW,IAA0B;EAC9B,SAASC,EAAO,GAAqB;GACnC,AAAIC,MAAUF,MACd,IAAWE,GACXX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AA,IAA6CE,EAAA,IAAA,EAAA,KAApEjE,EAAA,GAAAC,EAA2E,KAA3Ec,GAA2ET,EAAhByD,EAAK,IAAI,GAAA,CAAA;IAE3DA,EAAK,YAAY,KAAA,iBAA1B/D,EAAA,GAAAC,EAAwJ,KAAxJe,GAAwJ;KAAvFP,EAAAH,EAAAyD,EAAK,QAAQ,MAAM,GAAA,CAAA;KAAG7D,EAAqC,QAAA,MAAAI,EAA5ByD,EAAK,QAAQ,KAAK,GAAA,CAAA;KAAatD,EAAAH,EAAAyD,EAAK,QAAQ,KAAK,GAAA,CAAA;;IACjJ7D,EAQM,OARNe,GAQM,EAPJjB,EAAA,EAAA,GAAAC,EAMEE,GAAA,MAAAC,EALgB,OAAO,KAAK2D,EAAK,OAAO,IAAjC,OADT/D,EAAA,GAAAC,EAME,UAAA;KAJC,KAAKmE;KACN,MAAK;KACJ,UAAK,MAAExC,EAAA,OAAY,IAAIgC,EAAK,IAAIQ,CAAK;KACtC,aAAA9D,EAAQ8D,CAAK;;;GAOzBlE,EAEI,KAAA;IAFD,OAAM;IAAyB,QAAM,CAAG8B,EAAA;GACzCtB,GAAAA,CAAAA,EAA2C4D,EAAA,QAAA,SAAA,CAAA,SAAA,CAAxB,AAAAC,EAAA,OAAA9D,EAAA,qBAAiB,EAAA,CAAA,CAAA,CAAA,GAAA,GAAAU,CAAA;GAEtCjB,EAKE,OAAA;IAJA,OAAM;IACN,aAAU;IACV,0BAAA;IACA,aAAAI,EAAQyB,EAAa,KAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarTrigger.js","names":["_sfc_main","SidebarTrigger_vue_vue_type_script_setup_true_lang_default","SidebarTrigger_default"],"sources":["../../src/components/SidebarTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A sidebar trigger's content: `createSidebar`'s markup, so the theme styles both alike. The\n * rail shows the icon alone (the trigger's `title` carries the label); tabs and stack headers\n * show the label too. The badge is hidden from assistive technology: the trigger's name has it.\n */\nimport { sidebarBadge, type SidebarPanelInfo } from '@inkbar/core/dom'\nimport { computed } from 'vue'\n\nimport InkIcon from './InkIcon.vue'\n\nconst props = defineProps<{ panel: SidebarPanelInfo; rail: boolean }>()\nconst badge = computed(() => sidebarBadge(props.panel.badge))\n</script>\n\n<template>\n <InkIcon v-if=\"panel.icon\" :icon=\"panel.icon\" />\n <span v-if=\"!panel.icon || !rail\" class=\"ink-sidebar-label\">{{ panel.label }}</span>\n <span class=\"ink-sidebar-badge\" aria-hidden=\"true\" :hidden=\"badge === null\">{{\n badge\n }}</span>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SidebarPanelInfo } from '@inkbar/core/dom';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
panel: SidebarPanelInfo;
|
|
4
|
+
rail: boolean;
|
|
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<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=SidebarTrigger.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarTrigger.vue.d.ts","sourceRoot":"","sources":["../../src/components/SidebarTrigger.vue"],"names":[],"mappings":"AA6BA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAMtE,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAgD9D,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|