@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.
Files changed (67) hide show
  1. package/README.md +51 -5
  2. package/dist/components/InkIcon.js +7 -0
  3. package/dist/components/InkIcon.js.map +1 -0
  4. package/dist/components/InkIcon.vue.d.ts +11 -0
  5. package/dist/components/InkIcon.vue.d.ts.map +1 -0
  6. package/dist/components/InkIcon.vue_vue_type_script_setup_true_lang.js +22 -0
  7. package/dist/components/InkIcon.vue_vue_type_script_setup_true_lang.js.map +1 -0
  8. package/dist/components/InkNextPage.js +7 -0
  9. package/dist/components/InkNextPage.js.map +1 -0
  10. package/dist/components/InkNextPage.vue.d.ts +19 -0
  11. package/dist/components/InkNextPage.vue.d.ts.map +1 -0
  12. package/dist/components/InkNextPage.vue_vue_type_script_setup_true_lang.js +33 -0
  13. package/dist/components/InkNextPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  14. package/dist/components/InkNotePopover.js.map +1 -1
  15. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js +2 -2
  16. package/dist/components/InkNotePopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/InkPrevPage.js +7 -0
  18. package/dist/components/InkPrevPage.js.map +1 -0
  19. package/dist/components/InkPrevPage.vue.d.ts +19 -0
  20. package/dist/components/InkPrevPage.vue.d.ts.map +1 -0
  21. package/dist/components/InkPrevPage.vue_vue_type_script_setup_true_lang.js +33 -0
  22. package/dist/components/InkPrevPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  23. package/dist/components/InkRedo.js +7 -0
  24. package/dist/components/InkRedo.js.map +1 -0
  25. package/dist/{compositions/DefaultToolbar.vue.d.ts → components/InkRedo.vue.d.ts} +5 -5
  26. package/dist/components/InkRedo.vue.d.ts.map +1 -0
  27. package/dist/components/InkRedo.vue_vue_type_script_setup_true_lang.js +33 -0
  28. package/dist/components/InkRedo.vue_vue_type_script_setup_true_lang.js.map +1 -0
  29. package/dist/components/InkRoot.vue.d.ts +42 -42
  30. package/dist/components/InkToolButton.js.map +1 -1
  31. package/dist/components/InkToolButton.vue.d.ts.map +1 -1
  32. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +26 -18
  33. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/components/InkToolbarSeparator.js +7 -0
  35. package/dist/components/InkToolbarSeparator.js.map +1 -0
  36. package/dist/components/InkToolbarSeparator.vue.d.ts +4 -0
  37. package/dist/components/InkToolbarSeparator.vue.d.ts.map +1 -0
  38. package/dist/components/InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js +17 -0
  39. package/dist/components/InkToolbarSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -0
  40. package/dist/components/InkUndo.js +7 -0
  41. package/dist/components/InkUndo.js.map +1 -0
  42. package/dist/components/InkUndo.vue.d.ts +19 -0
  43. package/dist/components/InkUndo.vue.d.ts.map +1 -0
  44. package/dist/components/InkUndo.vue_vue_type_script_setup_true_lang.js +33 -0
  45. package/dist/components/InkUndo.vue_vue_type_script_setup_true_lang.js.map +1 -0
  46. package/dist/components/InkZoomIn.js.map +1 -1
  47. package/dist/components/InkZoomIn.vue.d.ts.map +1 -1
  48. package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js +13 -11
  49. package/dist/components/InkZoomIn.vue_vue_type_script_setup_true_lang.js.map +1 -1
  50. package/dist/components/InkZoomOut.js.map +1 -1
  51. package/dist/components/InkZoomOut.vue.d.ts.map +1 -1
  52. package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js +13 -11
  53. package/dist/components/InkZoomOut.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/components/InkZoomSelect.js.map +1 -1
  55. package/dist/components/InkZoomSelect.vue.d.ts.map +1 -1
  56. package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js +105 -29
  57. package/dist/components/InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  58. package/dist/composables/useAnnotations.d.ts +112 -112
  59. package/dist/index.d.ts +6 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +15 -10
  62. package/package.json +5 -5
  63. package/dist/compositions/DefaultToolbar.js +0 -7
  64. package/dist/compositions/DefaultToolbar.js.map +0 -1
  65. package/dist/compositions/DefaultToolbar.vue.d.ts.map +0 -1
  66. package/dist/compositions/DefaultToolbar.vue_vue_type_script_setup_true_lang.js +0 -100
  67. package/dist/compositions/DefaultToolbar.vue_vue_type_script_setup_true_lang.js.map +0 -1
@@ -1,30 +1,32 @@
1
1
  import { useZoom as e } from "../composables/useZoom.js";
2
- import { createBlock as t, createTextVNode as n, defineComponent as r, mergeProps as i, openBlock as a, renderSlot as o, unref as s, withCtx as c } from "vue";
3
- import { ToolbarButton as l } from "reka-ui";
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 { ZoomOut as d } from "@inkbar/icons";
4
6
  //#region src/components/InkZoomOut.vue?vue&type=script&setup=true&lang.ts
5
- var u = /*@__PURE__*/ r({
7
+ var f = /*@__PURE__*/ i({
6
8
  __name: "InkZoomOut",
7
9
  props: { asChild: {
8
10
  type: Boolean,
9
11
  default: !1
10
12
  } },
11
- setup(r) {
12
- let { zoomOut: u } = e(), d = {
13
+ setup(i) {
14
+ let { zoomOut: f } = e(), p = {
13
15
  "aria-label": "Zoom out",
14
16
  title: "Zoom out",
15
- onClick: () => u()
17
+ onClick: () => f()
16
18
  };
17
- return (e, u) => (a(), t(s(l), i({
18
- "as-child": r.asChild,
19
+ return (e, f) => (o(), n(c(u), a({
20
+ "as-child": i.asChild,
19
21
  class: "ink-zoom-out",
20
22
  "data-ink-zoom-out": ""
21
- }, d), {
22
- default: c(() => [o(e.$slots, "default", {}, () => [u[0] ||= n("−", -1)])]),
23
+ }, p), {
24
+ default: l(() => [s(e.$slots, "default", {}, () => [r(t, { icon: c(d) }, null, 8, ["icon"])])]),
23
25
  _: 3
24
26
  }, 16, ["as-child"]));
25
27
  }
26
28
  });
27
29
  //#endregion
28
- export { u as default };
30
+ export { f as default };
29
31
 
30
32
  //# sourceMappingURL=InkZoomOut.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InkZoomOut.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createTextVNode","InkZoomOut_vue_vue_type_script_setup_true_lang_default","useZoom","attrs","zoomOut","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","withCtx","renderSlot","_ctx","_cache","createTextVNode"],"sources":["../../src/components/InkZoomOut.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useZoom } from '../composables/useZoom'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { zoomOut } = useZoom()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Zoom out',\n title: 'Zoom out',\n onClick: () => zoomOut(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-zoom-out\"\n data-ink-zoom-out\n v-bind=\"attrs\"\n >\n <slot>−</slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;EAMA,IAAM,EAAE,eAAYQ,EAAQ,GAEtBC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAQ;EACzB;oBAIEV,EAAA,GAAAC,EAOgBC,EAAAY,CAAA,GAPhBX,EAOgB;GANb,YAAUa,EAAA;GACX,OAAM;GACN,qBAAA;EACQ,GAAAP,CAAK,GAAA;GAEb,SAAAL,QAAc,CAAdC,EAAcc,EAAA,QAAA,WAAA,CAAA,SAAA,CAAR,AAAAC,EAAA,OAAAd,EAAA,KAAC,EAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"InkZoomOut.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_mergeProps","_withCtx","_renderSlot","_createVNode","InkIcon","InkIcon_default","InkZoomOut_vue_vue_type_script_setup_true_lang_default","useZoom","attrs","zoomOut","openBlock","createBlock","unref","ToolbarButton","mergeProps","__props","withCtx","renderSlot","_ctx","createVNode","ZoomOut"],"sources":["../../src/components/InkZoomOut.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZoomOut } from '@inkbar/icons'\nimport { ToolbarButton } from 'reka-ui'\n\nimport { useZoom } from '../composables/useZoom'\n\nimport InkIcon from './InkIcon.vue'\n\nwithDefaults(defineProps<{ asChild?: boolean }>(), { asChild: false })\nconst { zoomOut } = useZoom()\n// Reka's typed props stop at its own; ARIA and listeners go through a bound object.\nconst attrs = {\n 'aria-label': 'Zoom out',\n title: 'Zoom out',\n onClick: () => zoomOut(),\n}\n</script>\n\n<template>\n <ToolbarButton\n :as-child=\"asChild\"\n class=\"ink-zoom-out\"\n data-ink-zoom-out\n v-bind=\"attrs\"\n >\n <slot><InkIcon :icon=\"ZoomOut\" /></slot>\n </ToolbarButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;EASA,IAAM,EAAE,eAAYU,EAAQ,GAEtBC,IAAQ;GACZ,cAAc;GACd,OAAO;GACP,eAAeC,EAAQ;EACzB;oBAIEZ,EAAA,GAAAC,EAOgBC,EAAAc,CAAA,GAPhBb,EAOgB;GANb,YAAUe,EAAA;GACX,OAAM;GACN,qBAAA;EACQ,GAAAP,CAAK,GAAA;GAEb,SAAAP,QAAwC,CAAxCC,EAAwCgB,EAAA,QAAA,WAAA,CAAA,SAAA,CAAlCf,EAA2BC,GAAA,EAAjB,MAAML,EAAAqB,CAAA,EAAO,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -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 { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\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(e: Event): void {\n const v = (e.target as HTMLSelectElement).value\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n</script>\n\n<template>\n <select\n class=\"ink-zoom-select\"\n data-ink-zoom-select\n aria-label=\"Zoom\"\n :value=\"value\"\n @change=\"onChange\"\n >\n <option value=\"fit-width\">Fit width</option>\n <option value=\"fit-page\">Fit page</option>\n <option v-for=\"l in ZOOM_LEVELS\" :key=\"l\" :value=\"String(l)\">\n {{ Math.round(l * 100) }}%\n </option>\n <option v-if=\"custom !== null\" :value=\"`${CUSTOM}${custom}`\">\n {{ Math.round(scale * 100) }}%\n </option>\n </select>\n</template>\n"],"mappings":""}
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-zoom-select ink-select-trigger\"\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":"AAwHA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"InkZoomSelect.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkZoomSelect.vue"],"names":[],"mappings":"AA8bA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,39 +1,115 @@
1
1
  import { useZoom as e } from "../composables/useZoom.js";
2
- import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, openBlock as s, renderList as c, toDisplayString as l, unref as u } from "vue";
3
- import { ZOOM_LEVELS as d } from "@inkbar/core/dom";
2
+ import t from "./InkIcon.js";
3
+ import { Fragment as n, computed as r, createBlock as i, createElementBlock as a, createTextVNode as o, createVNode as s, defineComponent as c, mergeProps as l, openBlock as u, renderList as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
4
+ import { ZOOM_LEVELS as h } from "@inkbar/core/dom";
5
+ import { SelectContent as g, SelectIcon as _, SelectItem as v, SelectItemIndicator as y, SelectItemText as b, SelectPortal as x, SelectRoot as S, SelectSeparator as C, SelectTrigger as w, SelectValue as T, SelectViewport as E } from "reka-ui";
6
+ import { Check as D, ChevronDown as O } from "@inkbar/icons";
4
7
  //#region src/components/InkZoomSelect.vue?vue&type=script&setup=true&lang.ts
5
- var f = ["value"], p = ["value"], m = ["value"], h = "custom:", g = /*@__PURE__*/ o({
8
+ var k = "custom:", A = /*@__PURE__*/ c({
6
9
  __name: "InkZoomSelect",
7
- setup(o) {
8
- let { zoom: g, scale: _, setZoom: v } = e(), y = (e) => d.find((t) => Math.abs(t - e) < .001), b = n(() => typeof g.value == "number" && y(g.value) === void 0 ? g.value : null), x = n(() => {
9
- let e = g.value;
10
- return typeof e == "number" ? b.value === null ? String(y(e)) : `${h}${e}` : e;
10
+ setup(c) {
11
+ let { zoom: A, scale: j, setZoom: M } = e(), N = (e) => h.find((t) => Math.abs(t - e) < .001), P = r(() => typeof A.value == "number" && N(A.value) === void 0 ? A.value : null), F = r(() => {
12
+ let e = A.value;
13
+ return typeof e == "number" ? P.value === null ? String(N(e)) : `${k}${e}` : e;
11
14
  });
12
- function S(e) {
13
- let t = e.target.value, n = t === "fit-width" || t === "fit-page" ? t : Number(t.replace(h, ""));
14
- v(n);
15
+ function I(e) {
16
+ if (typeof e != "string" || e === F.value) return;
17
+ let t = e === "fit-width" || e === "fit-page" ? e : Number(e.replace(k, ""));
18
+ M(t);
15
19
  }
16
- return (e, n) => (s(), i("select", {
17
- class: "ink-zoom-select",
18
- "data-ink-zoom-select": "",
19
- "aria-label": "Zoom",
20
- value: x.value,
21
- onChange: S
22
- }, [
23
- n[0] ||= a("option", { value: "fit-width" }, "Fit width", -1),
24
- n[1] ||= a("option", { value: "fit-page" }, "Fit page", -1),
25
- (s(!0), i(t, null, c(u(d), (e) => (s(), i("option", {
26
- key: e,
27
- value: String(e)
28
- }, l(Math.round(e * 100)) + "% ", 9, p))), 128)),
29
- b.value === null ? r("", !0) : (s(), i("option", {
30
- key: 0,
31
- value: `${h}${b.value}`
32
- }, l(Math.round(u(_) * 100)) + "% ", 9, m))
33
- ], 40, f));
20
+ let L = [{
21
+ value: "fit-width",
22
+ label: "Fit width"
23
+ }, {
24
+ value: "fit-page",
25
+ label: "Fit page"
26
+ }], R = { "aria-label": "Zoom" }, z = (e) => `${Math.round(e * 100)}%`, B = r(() => {
27
+ let e = h.map((e) => ({
28
+ z: e,
29
+ value: String(e),
30
+ label: z(e)
31
+ })), t = P.value;
32
+ return t !== null && e.push({
33
+ z: t,
34
+ value: `${k}${t}`,
35
+ label: z(j.value)
36
+ }), e.sort((e, t) => e.z - t.z);
37
+ });
38
+ return (e, r) => (u(), i(p(S), {
39
+ "model-value": F.value,
40
+ "onUpdate:modelValue": I
41
+ }, {
42
+ default: m(() => [s(p(w), l({
43
+ class: "ink-zoom-select ink-select-trigger",
44
+ "data-ink-zoom-select": ""
45
+ }, R), {
46
+ default: m(() => [s(p(T), { class: "ink-select-value" }), s(p(_), { class: "ink-select-icon" }, {
47
+ default: m(() => [s(t, {
48
+ icon: p(O),
49
+ size: 16
50
+ }, null, 8, ["icon"])]),
51
+ _: 1
52
+ })]),
53
+ _: 1
54
+ }, 16), s(p(x), null, {
55
+ default: m(() => [s(p(g), {
56
+ class: "ink-select-content",
57
+ "data-ink-select-content": "",
58
+ position: "popper",
59
+ side: "top",
60
+ "side-offset": 4
61
+ }, {
62
+ default: m(() => [s(p(E), null, {
63
+ default: m(() => [
64
+ (u(), a(n, null, d(L, (e) => s(p(v), {
65
+ key: e.value,
66
+ value: e.value,
67
+ class: "ink-select-item",
68
+ "data-ink-select-item": ""
69
+ }, {
70
+ default: m(() => [s(p(b), null, {
71
+ default: m(() => [o(f(e.label), 1)]),
72
+ _: 2
73
+ }, 1024), s(p(y), { class: "ink-select-indicator" }, {
74
+ default: m(() => [s(t, {
75
+ icon: p(D),
76
+ size: 16
77
+ }, null, 8, ["icon"])]),
78
+ _: 1
79
+ })]),
80
+ _: 2
81
+ }, 1032, ["value"])), 64)),
82
+ s(p(C), { class: "ink-select-separator" }),
83
+ (u(!0), a(n, null, d(B.value, (e) => (u(), i(p(v), {
84
+ key: e.value,
85
+ value: e.value,
86
+ class: "ink-select-item",
87
+ "data-ink-select-item": ""
88
+ }, {
89
+ default: m(() => [s(p(b), null, {
90
+ default: m(() => [o(f(e.label), 1)]),
91
+ _: 2
92
+ }, 1024), s(p(y), { class: "ink-select-indicator" }, {
93
+ default: m(() => [s(t, {
94
+ icon: p(D),
95
+ size: 16
96
+ }, null, 8, ["icon"])]),
97
+ _: 1
98
+ })]),
99
+ _: 2
100
+ }, 1032, ["value"]))), 128))
101
+ ]),
102
+ _: 1
103
+ })]),
104
+ _: 1
105
+ })]),
106
+ _: 1
107
+ })]),
108
+ _: 1
109
+ }, 8, ["model-value"]));
34
110
  }
35
111
  });
36
112
  //#endregion
37
- export { g as default };
113
+ export { A as default };
38
114
 
39
115
  //# sourceMappingURL=InkZoomSelect.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InkZoomSelect.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_Fragment","_renderList","_unref","_toDisplayString","_createCommentVNode","_hoisted_1","_hoisted_2","_hoisted_3","CUSTOM","InkZoomSelect_vue_vue_type_script_setup_true_lang_default","useZoom","level","ZOOM_LEVELS","l","z","custom","computed","zoom","value","onChange","v","next","openBlock","createElementBlock","_cache","createElementVNode","Fragment","renderList","unref","toDisplayString","createCommentVNode","scale"],"sources":["../../src/components/InkZoomSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ZOOM_LEVELS } from '@inkbar/core/dom'\nimport { computed } from 'vue'\n\nimport { useZoom } from '../composables/useZoom'\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(e: Event): void {\n const v = (e.target as HTMLSelectElement).value\n const next: ZoomValue =\n v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))\n setZoom(next)\n}\n</script>\n\n<template>\n <select\n class=\"ink-zoom-select\"\n data-ink-zoom-select\n aria-label=\"Zoom\"\n :value=\"value\"\n @change=\"onChange\"\n >\n <option value=\"fit-width\">Fit width</option>\n <option value=\"fit-page\">Fit page</option>\n <option v-for=\"l in ZOOM_LEVELS\" :key=\"l\" :value=\"String(l)\">\n {{ Math.round(l * 100) }}%\n </option>\n <option v-if=\"custom !== null\" :value=\"`${CUSTOM}${custom}`\">\n {{ Math.round(scale * 100) }}%\n </option>\n </select>\n</template>\n"],"mappings":";;;;iDAQMW,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,GAAgB;GAChC,IAAMC,IAAK,EAAE,OAA6B,OACpCC,IACJD,MAAM,eAAeA,MAAM,aAAaA,IAAI,OAAOA,EAAE,QAAQZ,GAAQ,EAAE,CAAC;GAC1E,EAAQa,CAAI;EACd;oBAIExB,EAAA,GAAAC,EAeS,UAAA;GAdP,OAAM;GACN,wBAAA;GACA,cAAW;GACV,OAAOoB,EAAA;GACC;;GAET,AAAAM,EAAA,OAAAzB,EAA4C,UAAA,EAApC,OAAM,YAAW,GAAC,aAAS,EAAA;GACnC,AAAAyB,EAAA,OAAAzB,EAA0C,UAAA,EAAlC,OAAM,WAAU,GAAC,YAAQ,EAAA;IACjCF,EAAA,EAAA,GAAAC,EAESE,GAAA,MAAAC,EAFWC,EAAAU,CAAA,IAAL,OAAff,EAAA,GAAAC,EAES,UAAA;IAFyB,KAAKe;IAAI,OAAO,OAAOA,CAAC;GACrD,GAAAV,EAAA,KAAK,MAAMU,IAAC,GAAA,CAAA,IAAU,MAC3B,GAAAP,CAAA;GACcS,EAAA,UAAM,OAEpBe,EAAA,IAAA,EAAA,KAFAjC,EAAA,GAAAC,EAES,UAAA;;IAFuB,OAAK,GAAKU,IAASO,EAAA;GAC9C,GAAAZ,EAAA,KAAK,MAAMD,EAAA6B,CAAA,IAAK,GAAA,CAAA,IAAU,MAC/B,GAAAxB,CAAA"}
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-zoom-select ink-select-trigger\"\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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