@inkbar/vue 0.8.0 → 0.9.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 (55) hide show
  1. package/README.md +7 -2
  2. package/dist/components/InkHighlightMenu.js.map +1 -1
  3. package/dist/components/InkHighlightMenu.vue.d.ts.map +1 -1
  4. package/dist/components/InkHighlightMenu.vue_vue_type_script_setup_true_lang.js +67 -65
  5. package/dist/components/InkHighlightMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/InkRoot.js.map +1 -1
  7. package/dist/components/InkRoot.vue.d.ts +9 -4
  8. package/dist/components/InkRoot.vue.d.ts.map +1 -1
  9. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js +176 -163
  10. package/dist/components/InkRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/InkShapeMenu.js.map +1 -1
  12. package/dist/components/InkShapeMenu.vue.d.ts.map +1 -1
  13. package/dist/components/InkShapeMenu.vue_vue_type_script_setup_true_lang.js +58 -56
  14. package/dist/components/InkShapeMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/InkSignatureDialog.js.map +1 -1
  16. package/dist/components/InkSignatureDialog.vue.d.ts +3 -2
  17. package/dist/components/InkSignatureDialog.vue.d.ts.map +1 -1
  18. package/dist/components/InkSignatureDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/InkSignatureMenu.js.map +1 -1
  20. package/dist/components/InkSignatureMenu.vue.d.ts.map +1 -1
  21. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js +77 -75
  22. package/dist/components/InkSignatureMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  23. package/dist/components/InkToolButton.js.map +1 -1
  24. package/dist/components/InkToolButton.vue.d.ts.map +1 -1
  25. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js +39 -36
  26. package/dist/components/InkToolButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  27. package/dist/components/InkToolbarButton.js +7 -0
  28. package/dist/components/InkToolbarButton.js.map +1 -0
  29. package/dist/components/InkToolbarButton.vue.d.ts +22 -0
  30. package/dist/components/InkToolbarButton.vue.d.ts.map +1 -0
  31. package/dist/components/InkToolbarButton.vue_vue_type_script_setup_true_lang.js +32 -0
  32. package/dist/components/InkToolbarButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  33. package/dist/components/InkViewport.js.map +1 -1
  34. package/dist/components/InkViewport.vue.d.ts.map +1 -1
  35. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js +37 -36
  36. package/dist/components/InkViewport.vue_vue_type_script_setup_true_lang.js.map +1 -1
  37. package/dist/components/SignatureForm.js.map +1 -1
  38. package/dist/components/SignatureForm.vue.d.ts.map +1 -1
  39. package/dist/components/SignatureForm.vue_vue_type_script_setup_true_lang.js +56 -55
  40. package/dist/components/SignatureForm.vue_vue_type_script_setup_true_lang.js.map +1 -1
  41. package/dist/composables/useRegisteredTool.d.ts +21 -0
  42. package/dist/composables/useRegisteredTool.d.ts.map +1 -0
  43. package/dist/composables/useRegisteredTool.js +25 -0
  44. package/dist/composables/useRegisteredTool.js.map +1 -0
  45. package/dist/composables/useToolOptions.d.ts +8 -0
  46. package/dist/composables/useToolOptions.d.ts.map +1 -1
  47. package/dist/composables/useToolOptions.js +10 -5
  48. package/dist/composables/useToolOptions.js.map +1 -1
  49. package/dist/context.d.ts +5 -0
  50. package/dist/context.d.ts.map +1 -1
  51. package/dist/context.js.map +1 -1
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +21 -20
  55. package/package.json +5 -5
@@ -1,86 +1,88 @@
1
- import { useTool as e } from "../composables/useTool.js";
2
- import { useToolOptions as t } from "../composables/useToolOptions.js";
3
- import n from "./InkIcon.js";
4
- import { Fragment as r, computed as i, createBlock as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, guardReactiveProps as d, mergeProps as f, normalizeProps as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, withCtx as b } from "vue";
5
- import { SHAPE_COLUMNS as x, SHAPE_ICONS as S, SHAPE_KINDS as C, focusInitialMenuItem as w, handleMenuKeys as T, menuItems as E, shapeMenuModel as D } from "@inkbar/core/dom";
6
- import { PopoverAnchor as O, PopoverContent as k, PopoverPortal as A, PopoverRoot as j, PopoverTrigger as M, ToolbarButton as N } from "reka-ui";
7
- import { ChevronDown as P } from "@inkbar/icons";
1
+ import { useRegisteredTool as e } from "../composables/useRegisteredTool.js";
2
+ import { useTool as t } from "../composables/useTool.js";
3
+ import { useToolOptionsWhile as n } from "../composables/useToolOptions.js";
4
+ import r from "./InkIcon.js";
5
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, guardReactiveProps as p, mergeProps as m, normalizeProps as h, openBlock as g, ref as _, renderList as v, renderSlot as y, toDisplayString as b, unref as x, withCtx as S } from "vue";
6
+ import { SHAPE_COLUMNS as C, SHAPE_ICONS as w, SHAPE_KINDS as T, focusInitialMenuItem as E, handleMenuKeys as D, menuItems as O, shapeMenuModel as k } from "@inkbar/core/dom";
7
+ import { PopoverAnchor as A, PopoverContent as j, PopoverPortal as M, PopoverRoot as N, PopoverTrigger as P, ToolbarButton as F } from "reka-ui";
8
+ import { ChevronDown as I } from "@inkbar/icons";
8
9
  //#region src/components/InkShapeMenu.vue?vue&type=script&setup=true&lang.ts
9
- var F = ["data-state"], I = ["data-ink-menu-columns"], L = [
10
+ var ee = ["data-state"], L = ["data-ink-menu-columns"], R = [
10
11
  "data-key",
11
12
  "aria-checked",
12
13
  "data-state",
13
14
  "onClick"
14
- ], R = /*@__PURE__*/ u({
15
+ ], z = /*@__PURE__*/ f({
15
16
  inheritAttrs: !1,
16
17
  __name: "InkShapeMenu",
17
- setup(u) {
18
- let { tool: R, setTool: z } = e(), { options: B, setOptions: V } = t("shape"), H = h(!1), U = i(() => D(B.value, C)), W = i(() => R.value === "shape"), G = i(() => S[U.value.kind]), K = !1;
19
- function q(e) {
20
- e.key !== "ArrowDown" || e.defaultPrevented || H.value || (e.preventDefault(), K = !0, H.value = !0);
18
+ setup(f) {
19
+ let { tool: z, setTool: B } = t(), V = e("shape"), { options: H, setOptions: U } = n("shape", V), W = _(!1), G = a(() => k(H.value, T)), K = a(() => z.value === "shape"), q = a(() => w[G.value.kind]), J = !1;
20
+ function Y(e) {
21
+ e.key !== "ArrowDown" || e.defaultPrevented || W.value || (e.preventDefault(), J = !0, W.value = !0);
21
22
  }
22
- function J(e) {
23
+ function X(e) {
23
24
  e.preventDefault();
24
25
  let t = document.querySelector("[data-ink-menu=\"shape\"] [role=\"menu\"]");
25
- t && (K ? E(t)[0]?.focus({ preventScroll: !0 }) : w(t)), K = !1;
26
+ t && (J ? O(t)[0]?.focus({ preventScroll: !0 }) : E(t)), J = !1;
26
27
  }
27
- function Y(e) {
28
- V({ kind: e }), z("shape"), H.value = !1;
28
+ function Z(e) {
29
+ U({ kind: e }), B("shape"), W.value = !1;
29
30
  }
30
- let X = i(() => ({
31
- "aria-pressed": String(W.value),
32
- "aria-label": U.value.label,
33
- title: U.value.label,
34
- onClick: () => z("shape")
35
- })), Z = {
31
+ let Q = a(() => ({
32
+ "aria-pressed": String(K.value),
33
+ "aria-label": G.value.label,
34
+ title: G.value.label,
35
+ onClick: () => B("shape")
36
+ })), $ = {
36
37
  "aria-label": "Choose shape",
37
38
  title: "Choose shape",
38
39
  "aria-haspopup": "menu",
39
- onKeydown: q
40
- }, Q = { "aria-label": "Shapes" }, $ = {
40
+ onKeydown: Y
41
+ }, te = { "aria-label": "Shapes" }, ne = {
41
42
  role: "menu",
42
43
  "aria-label": "Shapes",
43
- onKeydown: (e) => T(e, e.currentTarget)
44
+ onKeydown: (e) => D(e, e.currentTarget)
44
45
  };
45
- return (e, t) => (m(), a(y(j), {
46
- open: H.value,
47
- "onUpdate:open": t[0] ||= (e) => H.value = e
46
+ return (e, t) => x(V) ? (g(), o(x(N), {
47
+ key: 0,
48
+ open: W.value,
49
+ "onUpdate:open": t[0] ||= (e) => W.value = e
48
50
  }, {
49
- default: b(() => [l(y(O), { "as-child": "" }, {
50
- default: b(() => [s("div", f({
51
+ default: S(() => [d(x(A), { "as-child": "" }, {
52
+ default: S(() => [l("div", m({
51
53
  role: "group",
52
54
  "aria-label": "Shape",
53
55
  class: "ink-split-button ink-shape-menu",
54
56
  "data-ink-shape-menu": ""
55
57
  }, e.$attrs), [
56
- l(y(N), f({
58
+ d(x(F), m({
57
59
  class: "ink-tool-button ink-shape-button",
58
60
  "data-ink-tool-button": "",
59
61
  "data-ink-shape-button": "",
60
62
  "data-tool": "shape",
61
- "data-kind": U.value.kind,
62
- "data-state": W.value ? "on" : "off"
63
- }, X.value), {
64
- default: b(() => [_(e.$slots, "default", {
65
- active: W.value,
66
- kind: U.value.kind
67
- }, () => [l(n, { icon: G.value }, null, 8, ["icon"])])]),
63
+ "data-kind": G.value.kind,
64
+ "data-state": K.value ? "on" : "off"
65
+ }, Q.value), {
66
+ default: S(() => [y(e.$slots, "default", {
67
+ active: K.value,
68
+ kind: G.value.kind
69
+ }, () => [d(r, { icon: q.value }, null, 8, ["icon"])])]),
68
70
  _: 3
69
71
  }, 16, ["data-kind", "data-state"]),
70
- l(y(N), { "as-child": "" }, {
71
- default: b(() => [l(y(M), { "as-child": "" }, {
72
- default: b(() => [s("button", f({
72
+ d(x(F), { "as-child": "" }, {
73
+ default: S(() => [d(x(P), { "as-child": "" }, {
74
+ default: S(() => [l("button", m({
73
75
  type: "button",
74
76
  class: "ink-menu-trigger ink-shape-menu-trigger",
75
77
  "data-ink-shape-menu-trigger": "",
76
- "data-state": H.value ? "open" : "closed"
77
- }, Z), [l(n, { icon: y(P) }, null, 8, ["icon"])], 16, F)]),
78
+ "data-state": W.value ? "open" : "closed"
79
+ }, $), [d(r, { icon: x(I) }, null, 8, ["icon"])], 16, ee)]),
78
80
  _: 1
79
81
  })]),
80
82
  _: 1
81
83
  }),
82
- l(y(A), null, {
83
- default: b(() => [l(y(k), f({
84
+ d(x(M), null, {
85
+ default: S(() => [d(x(j), m({
84
86
  class: "ink-select-content ink-menu-content",
85
87
  "data-ink-select-content": "",
86
88
  "data-ink-menu": "shape",
@@ -88,13 +90,13 @@ var F = ["data-state"], I = ["data-ink-menu-columns"], L = [
88
90
  align: "start",
89
91
  "side-offset": 4,
90
92
  "collision-padding": 8
91
- }, Q, { onOpenAutoFocus: J }), {
92
- default: b(() => [s("div", p(d($)), [s("div", {
93
+ }, te, { onOpenAutoFocus: X }), {
94
+ default: S(() => [l("div", h(p(ne)), [l("div", {
93
95
  role: "group",
94
96
  "aria-label": "Shapes",
95
97
  class: "ink-shape-grid",
96
- "data-ink-menu-columns": y(x)
97
- }, [(m(!0), o(r, null, g(U.value.items, (e) => (m(), o("button", {
98
+ "data-ink-menu-columns": x(C)
99
+ }, [(g(!0), c(i, null, v(G.value.items, (e) => (g(), c("button", {
98
100
  key: e.kind,
99
101
  type: "button",
100
102
  role: "menuitemradio",
@@ -104,11 +106,11 @@ var F = ["data-state"], I = ["data-ink-menu-columns"], L = [
104
106
  "data-key": e.kind,
105
107
  "aria-checked": e.checked,
106
108
  "data-state": e.checked ? "checked" : "unchecked",
107
- onClick: (t) => Y(e.kind)
108
- }, [l(n, {
109
- icon: y(S)[e.kind],
109
+ onClick: (t) => Z(e.kind)
110
+ }, [d(r, {
111
+ icon: x(w)[e.kind],
110
112
  size: 16
111
- }, null, 8, ["icon"]), c(" " + v(e.label), 1)], 8, L))), 128))], 8, I)], 16)]),
113
+ }, null, 8, ["icon"]), u(" " + b(e.label), 1)], 8, R))), 128))], 8, L)], 16)]),
112
114
  _: 1
113
115
  }, 16)]),
114
116
  _: 1
@@ -117,10 +119,10 @@ var F = ["data-state"], I = ["data-ink-menu-columns"], L = [
117
119
  _: 3
118
120
  })]),
119
121
  _: 3
120
- }, 8, ["open"]));
122
+ }, 8, ["open"])) : s("", !0);
121
123
  }
122
124
  });
123
125
  //#endregion
124
- export { R as default };
126
+ export { z as default };
125
127
 
126
128
  //# sourceMappingURL=InkShapeMenu.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InkShapeMenu.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_createElementVNode","_mergeProps","_renderSlot","InkIcon","_normalizeProps","_guardReactiveProps","_createElementBlock","_Fragment","_renderList","_createTextVNode","_toDisplayString","InkIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","InkShapeMenu_vue_vue_type_script_setup_true_lang_default","useTool","useToolOptions","open","ref","model","computed","shapeMenuModel","options","SHAPE_KINDS","active","tool","icon","SHAPE_ICONS","focusFirst","onTriggerKeydown","onOpenAutoFocus","menu","menuItems","focusInitialMenuItem","choose","setOptions","setTool","mainAttrs","triggerAttrs","menuAttrs","innerAttrs","handleMenuKeys","openBlock","createBlock","unref","PopoverRoot","_cache","$event","withCtx","createVNode","PopoverAnchor","createElementVNode","mergeProps","_ctx","ToolbarButton","renderSlot","PopoverTrigger","ChevronDown","PopoverPortal","PopoverContent","normalizeProps","guardReactiveProps","SHAPE_COLUMNS","createElementBlock","Fragment","renderList","item","createTextVNode","toDisplayString"],"sources":["../../src/components/InkShapeMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A split button for the shape tool. The main part activates the tool with the current\n * kind and draws that kind's icon; the chevron opens a two-column grid of kinds. Choosing a\n * kind switches to the tool with it.\n */\nimport {\n focusInitialMenuItem,\n handleMenuKeys,\n menuItems,\n SHAPE_COLUMNS,\n SHAPE_ICONS,\n SHAPE_KINDS,\n shapeMenuModel,\n type ShapeKind,\n type ShapeOptions,\n} from '@inkbar/core/dom'\nimport { ChevronDown } from '@inkbar/icons'\nimport {\n PopoverAnchor,\n PopoverContent,\n PopoverPortal,\n PopoverRoot,\n PopoverTrigger,\n ToolbarButton,\n} from 'reka-ui'\nimport { computed, ref } from 'vue'\n\nimport { useTool } from '../composables/useTool'\nimport { useToolOptions } from '../composables/useToolOptions'\n\nimport InkIcon from './InkIcon.vue'\n\ndefineOptions({ inheritAttrs: false })\nconst { tool, setTool } = useTool()\nconst { options, setOptions } = useToolOptions<ShapeOptions>('shape')\nconst open = ref(false)\n\nconst model = computed(() => shapeMenuModel(options.value, SHAPE_KINDS))\nconst active = computed(() => tool.value === 'shape')\nconst icon = computed(() => SHAPE_ICONS[model.value.kind])\n\n/** ArrowDown opens on the first item; a click opens on the checked one. */\nlet focusFirst = false\nfunction onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key !== 'ArrowDown' || e.defaultPrevented || open.value) return\n e.preventDefault()\n focusFirst = true\n open.value = true\n}\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n // One menu is open at a time.\n const menu = document.querySelector('[data-ink-menu=\"shape\"] [role=\"menu\"]')\n if (menu) {\n if (focusFirst) menuItems(menu)[0]?.focus({ preventScroll: true })\n else focusInitialMenuItem(menu)\n }\n focusFirst = false\n}\n\nfunction choose(kind: ShapeKind): void {\n setOptions({ kind })\n setTool('shape')\n open.value = false\n}\n\n// Reka's typed props stop at its own; ARIA and listeners go through bound objects.\nconst mainAttrs = computed(() => ({\n 'aria-pressed': String(active.value),\n 'aria-label': model.value.label,\n title: model.value.label,\n onClick: () => setTool('shape'),\n}))\nconst triggerAttrs = {\n 'aria-label': 'Choose shape',\n title: 'Choose shape',\n 'aria-haspopup': 'menu' as const,\n onKeydown: onTriggerKeydown,\n}\nconst menuAttrs = { 'aria-label': 'Shapes' }\nconst innerAttrs = {\n role: 'menu',\n 'aria-label': 'Shapes',\n onKeydown: (e: KeyboardEvent) => handleMenuKeys(e, e.currentTarget as HTMLElement),\n}\n</script>\n\n<template>\n <PopoverRoot v-model:open=\"open\">\n <PopoverAnchor as-child>\n <div\n role=\"group\"\n aria-label=\"Shape\"\n class=\"ink-split-button ink-shape-menu\"\n data-ink-shape-menu\n v-bind=\"$attrs\"\n >\n <ToolbarButton\n class=\"ink-tool-button ink-shape-button\"\n data-ink-tool-button\n data-ink-shape-button\n data-tool=\"shape\"\n :data-kind=\"model.kind\"\n :data-state=\"active ? 'on' : 'off'\"\n v-bind=\"mainAttrs\"\n >\n <slot :active=\"active\" :kind=\"model.kind\"><InkIcon :icon=\"icon\" /></slot>\n </ToolbarButton>\n <ToolbarButton as-child>\n <PopoverTrigger as-child>\n <button\n type=\"button\"\n class=\"ink-menu-trigger ink-shape-menu-trigger\"\n data-ink-shape-menu-trigger\n :data-state=\"open ? 'open' : 'closed'\"\n v-bind=\"triggerAttrs\"\n >\n <InkIcon :icon=\"ChevronDown\" />\n </button>\n </PopoverTrigger>\n </ToolbarButton>\n <PopoverPortal>\n <PopoverContent\n class=\"ink-select-content ink-menu-content\"\n data-ink-select-content\n data-ink-menu=\"shape\"\n side=\"bottom\"\n align=\"start\"\n :side-offset=\"4\"\n :collision-padding=\"8\"\n v-bind=\"menuAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n >\n <div v-bind=\"innerAttrs\">\n <div\n role=\"group\"\n aria-label=\"Shapes\"\n class=\"ink-shape-grid\"\n :data-ink-menu-columns=\"SHAPE_COLUMNS\"\n >\n <button\n v-for=\"item in model.items\"\n :key=\"item.kind\"\n type=\"button\"\n role=\"menuitemradio\"\n class=\"ink-select-item ink-menu-item ink-shape-item\"\n data-ink-select-item\n tabindex=\"-1\"\n :data-key=\"item.kind\"\n :aria-checked=\"item.checked\"\n :data-state=\"item.checked ? 'checked' : 'unchecked'\"\n @click=\"choose(item.kind)\"\n >\n <InkIcon :icon=\"SHAPE_ICONS[item.kind]\" :size=\"16\" />\n {{ item.label }}\n </button>\n </div>\n </div>\n </PopoverContent>\n </PopoverPortal>\n </div>\n </PopoverAnchor>\n </PopoverRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAkCA,IAAM,EAAE,SAAM,eAAYsB,EAAQ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C,QAwBM,CAxBNE,EAwBM,OAAAI,EAAAC,EAxBOoC,CAAU,CAAA,GAAA,CACrBzC,EAsBM,OAAA;QArBJ,MAAK;QACL,cAAW;QACX,OAAM;QACL,yBAAuBH,EAAAkE,CAAA;OAExBpE,GAAAA,EAAAA,EAAA,EAAA,GAAAW,EAeSC,GAAA,MAAAC,EAdQY,EAAA,MAAM,QAAd,OADTzB,EAAA,GAAAW,EAeS,UAAA;QAbN,KAAK6D,EAAK;QACX,MAAK;QACL,MAAK;QACL,OAAM;QACN,wBAAA;QACA,UAAS;QACR,YAAUA,EAAK;QACf,gBAAcA,EAAK;QACnB,cAAYA,EAAK,UAAO,YAAA;QACxB,UAAK,MAAEhC,EAAOgC,EAAK,IAAI;OAExBpE,GAAAA,CAAAA,EAAqDI,GAAA;QAA3C,MAAMN,EAAA+B,CAAA,CAAW,CAACuC,EAAK;QAAQ,MAAM;OAAM1D,GAAAA,MAAAA,GAAAA,CAAAA,MAAAA,CAAAA,GAAAA,EAAA,MACrDC,EAAGyD,EAAK,KAAK,GAAA,CAAA,CAAA,GAAA,GAAArD,CAAA"}
1
+ {"version":3,"file":"InkShapeMenu.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_unref","_openBlock","_createBlock","_withCtx","_createVNode","_createElementVNode","_mergeProps","_renderSlot","InkIcon","_normalizeProps","_guardReactiveProps","_createElementBlock","_Fragment","_renderList","_createTextVNode","_toDisplayString","_createCommentVNode","InkIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","InkShapeMenu_vue_vue_type_script_setup_true_lang_default","useTool","registered","useRegisteredTool","useToolOptionsWhile","open","ref","model","computed","shapeMenuModel","options","SHAPE_KINDS","active","tool","icon","SHAPE_ICONS","focusFirst","onTriggerKeydown","onOpenAutoFocus","menu","menuItems","focusInitialMenuItem","choose","setOptions","setTool","mainAttrs","triggerAttrs","menuAttrs","innerAttrs","handleMenuKeys","unref","openBlock","createBlock","PopoverRoot","_cache","$event","withCtx","createVNode","PopoverAnchor","createElementVNode","mergeProps","_ctx","ToolbarButton","renderSlot","PopoverTrigger","ChevronDown","PopoverPortal","PopoverContent","normalizeProps","guardReactiveProps","SHAPE_COLUMNS","createElementBlock","Fragment","renderList","item","createTextVNode","toDisplayString","createCommentVNode"],"sources":["../../src/components/InkShapeMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A split button for the shape tool. The main part activates the tool with the current\n * kind and draws that kind's icon; the chevron opens a two-column grid of kinds. Choosing a\n * kind switches to the tool with it.\n */\nimport {\n focusInitialMenuItem,\n handleMenuKeys,\n menuItems,\n SHAPE_COLUMNS,\n SHAPE_ICONS,\n SHAPE_KINDS,\n shapeMenuModel,\n type ShapeKind,\n type ShapeOptions,\n} from '@inkbar/core/dom'\nimport { ChevronDown } from '@inkbar/icons'\nimport {\n PopoverAnchor,\n PopoverContent,\n PopoverPortal,\n PopoverRoot,\n PopoverTrigger,\n ToolbarButton,\n} from 'reka-ui'\nimport { computed, ref } from 'vue'\n\nimport { useRegisteredTool } from '../composables/useRegisteredTool'\nimport { useTool } from '../composables/useTool'\nimport { useToolOptionsWhile } from '../composables/useToolOptions'\n\nimport InkIcon from './InkIcon.vue'\n\ndefineOptions({ inheritAttrs: false })\nconst { tool, setTool } = useTool()\n// Nothing renders while no `shape` tool is registered.\nconst registered = useRegisteredTool('shape')\nconst { options, setOptions } = useToolOptionsWhile<ShapeOptions>('shape', registered)\nconst open = ref(false)\n\nconst model = computed(() => shapeMenuModel(options.value, SHAPE_KINDS))\nconst active = computed(() => tool.value === 'shape')\nconst icon = computed(() => SHAPE_ICONS[model.value.kind])\n\n/** ArrowDown opens on the first item; a click opens on the checked one. */\nlet focusFirst = false\nfunction onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key !== 'ArrowDown' || e.defaultPrevented || open.value) return\n e.preventDefault()\n focusFirst = true\n open.value = true\n}\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n // One menu is open at a time.\n const menu = document.querySelector('[data-ink-menu=\"shape\"] [role=\"menu\"]')\n if (menu) {\n if (focusFirst) menuItems(menu)[0]?.focus({ preventScroll: true })\n else focusInitialMenuItem(menu)\n }\n focusFirst = false\n}\n\nfunction choose(kind: ShapeKind): void {\n setOptions({ kind })\n setTool('shape')\n open.value = false\n}\n\n// Reka's typed props stop at its own; ARIA and listeners go through bound objects.\nconst mainAttrs = computed(() => ({\n 'aria-pressed': String(active.value),\n 'aria-label': model.value.label,\n title: model.value.label,\n onClick: () => setTool('shape'),\n}))\nconst triggerAttrs = {\n 'aria-label': 'Choose shape',\n title: 'Choose shape',\n 'aria-haspopup': 'menu' as const,\n onKeydown: onTriggerKeydown,\n}\nconst menuAttrs = { 'aria-label': 'Shapes' }\nconst innerAttrs = {\n role: 'menu',\n 'aria-label': 'Shapes',\n onKeydown: (e: KeyboardEvent) => handleMenuKeys(e, e.currentTarget as HTMLElement),\n}\n</script>\n\n<template>\n <PopoverRoot v-if=\"registered\" v-model:open=\"open\">\n <PopoverAnchor as-child>\n <div\n role=\"group\"\n aria-label=\"Shape\"\n class=\"ink-split-button ink-shape-menu\"\n data-ink-shape-menu\n v-bind=\"$attrs\"\n >\n <ToolbarButton\n class=\"ink-tool-button ink-shape-button\"\n data-ink-tool-button\n data-ink-shape-button\n data-tool=\"shape\"\n :data-kind=\"model.kind\"\n :data-state=\"active ? 'on' : 'off'\"\n v-bind=\"mainAttrs\"\n >\n <slot :active=\"active\" :kind=\"model.kind\"><InkIcon :icon=\"icon\" /></slot>\n </ToolbarButton>\n <ToolbarButton as-child>\n <PopoverTrigger as-child>\n <button\n type=\"button\"\n class=\"ink-menu-trigger ink-shape-menu-trigger\"\n data-ink-shape-menu-trigger\n :data-state=\"open ? 'open' : 'closed'\"\n v-bind=\"triggerAttrs\"\n >\n <InkIcon :icon=\"ChevronDown\" />\n </button>\n </PopoverTrigger>\n </ToolbarButton>\n <PopoverPortal>\n <PopoverContent\n class=\"ink-select-content ink-menu-content\"\n data-ink-select-content\n data-ink-menu=\"shape\"\n side=\"bottom\"\n align=\"start\"\n :side-offset=\"4\"\n :collision-padding=\"8\"\n v-bind=\"menuAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n >\n <div v-bind=\"innerAttrs\">\n <div\n role=\"group\"\n aria-label=\"Shapes\"\n class=\"ink-shape-grid\"\n :data-ink-menu-columns=\"SHAPE_COLUMNS\"\n >\n <button\n v-for=\"item in model.items\"\n :key=\"item.kind\"\n type=\"button\"\n role=\"menuitemradio\"\n class=\"ink-select-item ink-menu-item ink-shape-item\"\n data-ink-select-item\n tabindex=\"-1\"\n :data-key=\"item.kind\"\n :aria-checked=\"item.checked\"\n :data-state=\"item.checked ? 'checked' : 'unchecked'\"\n @click=\"choose(item.kind)\"\n >\n <InkIcon :icon=\"SHAPE_ICONS[item.kind]\" :size=\"16\" />\n {{ item.label }}\n </button>\n </div>\n </div>\n </PopoverContent>\n </PopoverPortal>\n </div>\n </PopoverAnchor>\n </PopoverRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAmCA,IAAM,EAAE,SAAM,eAAYuB,EAAQ,GAE5BC,IAAaC,EAAkB,OAAO,GACtC,EAAE,YAAS,kBAAeC,EAAkC,SAASF,CAAU,GAC/EG,IAAOC,EAAI,EAAK,GAEhBC,IAAQC,QAAeC,EAAeC,EAAQ,OAAOC,CAAW,CAAC,GACjEC,IAASJ,QAAeK,EAAK,UAAU,OAAO,GAC9CC,IAAON,QAAeO,EAAYR,EAAM,MAAM,KAAK,GAGrDS,IAAa;EACjB,SAASC,EAAiB,GAAwB;GAChD,AAAI,EAAE,QAAQ,eAAe,EAAE,oBAAoBZ,EAAK,UACxD,EAAE,eAAe,GACjB,IAAa,IACb,EAAK,QAAQ;EACf;EAEA,SAASa,EAAgB,GAAgB;GACvC,EAAE,eAAe;GAEjB,IAAMC,IAAO,SAAS,cAAc,2CAAuC;GAK3E,AAJIA,MACEH,IAAYI,EAAUD,CAAI,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,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QAA3C,MAAMR,EAAAoC,CAAA,CAAW,CAACuC,EAAK;QAAQ,MAAM;OAAM7D,GAAAA,MAAAA,GAAAA,CAAAA,MAAAA,CAAAA,GAAAA,EAAA,MACrDC,EAAG4D,EAAK,KAAK,GAAA,CAAA,CAAA,GAAA,GAAAvD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"InkSignatureDialog.js","names":["_sfc_main","InkSignatureDialog_vue_vue_type_script_setup_true_lang_default","InkSignatureDialog_default"],"sources":["../../src/components/InkSignatureDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * \"Create signature\": a modal with Draw, Type and Image tabs. Draw is a pad with the draw\n * tool's renderer; Type sets a name in one of the host's handwriting fonts; Image takes a PNG\n * or JPEG scan. Save stores the template through InkRoot's signature store and, unless `select`\n * is false, selects it for the `signature` tool. Escape, Cancel or a press outside closes it.\n */\nimport { SIGNATURE_LABELS } from '@inkbar/core/dom'\nimport {\n DialogContent,\n DialogOverlay,\n DialogPortal,\n DialogRoot,\n DialogTitle,\n} from 'reka-ui'\n\nimport SignatureForm from './SignatureForm.vue'\n\nimport type { SignatureTemplate } from '@inkbar/core'\n\nconst props = withDefaults(\n defineProps<{\n /** The fonts the Type tab offers. Default: InkRoot's `signatureFonts`. */\n fonts?: readonly string[] | undefined\n /**\n * Whether saving selects the new signature for the `signature` tool. False leaves the tool\n * alone, for a dialog that signs a field with it through `save`.\n */\n select?: boolean\n }>(),\n { fonts: undefined, select: true }\n)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{\n /** The new template, once saved (and selected, with `select`). */\n save: [template: SignatureTemplate]\n /** Reka's close auto-focus; prevent it to place focus yourself. */\n closeAutoFocus: [event: Event]\n}>()\n\n// Reka's typed props stop at its own; ARIA goes through a bound object. No description: the\n// title says it all.\nconst contentAttrs = { 'aria-modal': 'true', 'aria-describedby': undefined }\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n ;(e.target as HTMLElement | null)\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus({ preventScroll: true })\n}\n</script>\n\n<template>\n <DialogRoot v-model:open=\"open\">\n <DialogPortal>\n <DialogOverlay class=\"ink-dialog-overlay\" data-ink-dialog-overlay />\n <DialogContent\n class=\"ink-dialog ink-signature-dialog\"\n data-ink-signature-dialog\n v-bind=\"contentAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n @close-auto-focus=\"emit('closeAutoFocus', $event)\"\n >\n <DialogTitle class=\"ink-dialog-title\">{{ SIGNATURE_LABELS.dialog }}</DialogTitle>\n <SignatureForm\n :fonts=\"props.fonts\"\n :select=\"props.select\"\n @saved=\"emit('save', $event)\"\n @close=\"open = false\"\n />\n </DialogContent>\n </DialogPortal>\n </DialogRoot>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"InkSignatureDialog.js","names":["_sfc_main","InkSignatureDialog_vue_vue_type_script_setup_true_lang_default","InkSignatureDialog_default"],"sources":["../../src/components/InkSignatureDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * \"Create signature\": a modal with Draw, Type and Image tabs. Draw is a pad with the draw\n * tool's renderer; Type sets a name in one of the host's handwriting fonts; Image takes a PNG\n * or JPEG scan. Save stores the template through InkRoot's signature store and, unless `select`\n * is false or no `signature` tool is registered, selects it for that tool. Escape, Cancel or a\n * press outside closes it.\n */\nimport { SIGNATURE_LABELS } from '@inkbar/core/dom'\nimport {\n DialogContent,\n DialogOverlay,\n DialogPortal,\n DialogRoot,\n DialogTitle,\n} from 'reka-ui'\n\nimport SignatureForm from './SignatureForm.vue'\n\nimport type { SignatureTemplate } from '@inkbar/core'\n\nconst props = withDefaults(\n defineProps<{\n /** The fonts the Type tab offers. Default: InkRoot's `signatureFonts`. */\n fonts?: readonly string[] | undefined\n /**\n * Whether saving selects the new signature for the `signature` tool, when one is\n * registered. False leaves the tool alone, for a dialog that signs a field with it through\n * `save`.\n */\n select?: boolean\n }>(),\n { fonts: undefined, select: true }\n)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{\n /** The new template, once saved (and selected, with `select`). */\n save: [template: SignatureTemplate]\n /** Reka's close auto-focus; prevent it to place focus yourself. */\n closeAutoFocus: [event: Event]\n}>()\n\n// Reka's typed props stop at its own; ARIA goes through a bound object. No description: the\n// title says it all.\nconst contentAttrs = { 'aria-modal': 'true', 'aria-describedby': undefined }\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n ;(e.target as HTMLElement | null)\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus({ preventScroll: true })\n}\n</script>\n\n<template>\n <DialogRoot v-model:open=\"open\">\n <DialogPortal>\n <DialogOverlay class=\"ink-dialog-overlay\" data-ink-dialog-overlay />\n <DialogContent\n class=\"ink-dialog ink-signature-dialog\"\n data-ink-signature-dialog\n v-bind=\"contentAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n @close-auto-focus=\"emit('closeAutoFocus', $event)\"\n >\n <DialogTitle class=\"ink-dialog-title\">{{ SIGNATURE_LABELS.dialog }}</DialogTitle>\n <SignatureForm\n :fonts=\"props.fonts\"\n :select=\"props.select\"\n @saved=\"emit('save', $event)\"\n @close=\"open = false\"\n />\n </DialogContent>\n </DialogPortal>\n </DialogRoot>\n</template>\n"],"mappings":""}
@@ -3,8 +3,9 @@ type __VLS_Props = {
3
3
  /** The fonts the Type tab offers. Default: InkRoot's `signatureFonts`. */
4
4
  fonts?: readonly string[] | undefined;
5
5
  /**
6
- * Whether saving selects the new signature for the `signature` tool. False leaves the tool
7
- * alone, for a dialog that signs a field with it through `save`.
6
+ * Whether saving selects the new signature for the `signature` tool, when one is
7
+ * registered. False leaves the tool alone, for a dialog that signs a field with it through
8
+ * `save`.
8
9
  */
9
10
  select?: boolean;
10
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InkSignatureDialog.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkSignatureDialog.vue"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,KAAK,WAAW,GAAG;IACf,0EAA0E;IAC1E,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AA4BJ,KAAK,gBAAgB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAOF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAoKxD,QAAA,MAAM,YAAY;;;;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"InkSignatureDialog.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkSignatureDialog.vue"],"names":[],"mappings":"AAgGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,KAAK,WAAW,GAAG;IACf,0EAA0E;IAC1E,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AA4BJ,KAAK,gBAAgB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAOF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAoKxD,QAAA,MAAM,YAAY;;;;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"InkSignatureDialog.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_createTextVNode","_toDisplayString","SignatureForm","SignatureForm_default","InkSignatureDialog_vue_vue_type_script_setup_true_lang_default","\"open\"","\"openModifiers\"","__emit","props","__props","open","useModel","emit","contentAttrs","onOpenAutoFocus","openBlock","createBlock","unref","DialogRoot","_cache","$event","withCtx","createVNode","DialogPortal","DialogOverlay","DialogContent","mergeProps","DialogTitle","createTextVNode","toDisplayString","SIGNATURE_LABELS"],"sources":["../../src/components/InkSignatureDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * \"Create signature\": a modal with Draw, Type and Image tabs. Draw is a pad with the draw\n * tool's renderer; Type sets a name in one of the host's handwriting fonts; Image takes a PNG\n * or JPEG scan. Save stores the template through InkRoot's signature store and, unless `select`\n * is false, selects it for the `signature` tool. Escape, Cancel or a press outside closes it.\n */\nimport { SIGNATURE_LABELS } from '@inkbar/core/dom'\nimport {\n DialogContent,\n DialogOverlay,\n DialogPortal,\n DialogRoot,\n DialogTitle,\n} from 'reka-ui'\n\nimport SignatureForm from './SignatureForm.vue'\n\nimport type { SignatureTemplate } from '@inkbar/core'\n\nconst props = withDefaults(\n defineProps<{\n /** The fonts the Type tab offers. Default: InkRoot's `signatureFonts`. */\n fonts?: readonly string[] | undefined\n /**\n * Whether saving selects the new signature for the `signature` tool. False leaves the tool\n * alone, for a dialog that signs a field with it through `save`.\n */\n select?: boolean\n }>(),\n { fonts: undefined, select: true }\n)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{\n /** The new template, once saved (and selected, with `select`). */\n save: [template: SignatureTemplate]\n /** Reka's close auto-focus; prevent it to place focus yourself. */\n closeAutoFocus: [event: Event]\n}>()\n\n// Reka's typed props stop at its own; ARIA goes through a bound object. No description: the\n// title says it all.\nconst contentAttrs = { 'aria-modal': 'true', 'aria-describedby': undefined }\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n ;(e.target as HTMLElement | null)\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus({ preventScroll: true })\n}\n</script>\n\n<template>\n <DialogRoot v-model:open=\"open\">\n <DialogPortal>\n <DialogOverlay class=\"ink-dialog-overlay\" data-ink-dialog-overlay />\n <DialogContent\n class=\"ink-dialog ink-signature-dialog\"\n data-ink-signature-dialog\n v-bind=\"contentAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n @close-auto-focus=\"emit('closeAutoFocus', $event)\"\n >\n <DialogTitle class=\"ink-dialog-title\">{{ SIGNATURE_LABELS.dialog }}</DialogTitle>\n <SignatureForm\n :fonts=\"props.fonts\"\n :select=\"props.select\"\n @saved=\"emit('save', $event)\"\n @close=\"open = false\"\n />\n </DialogContent>\n </DialogPortal>\n </DialogRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAoBA,IAAMe,IAAQC,GAYRC,IAAOjB,EAAoBgB,GAAC,MAA0B,GACtDG,IAAOL,GASPM,IAAe;GAAE,cAAc;GAAQ,oBAAoB,KAAA;EAAU;EAE3E,SAASC,EAAgB,GAAgB;GAEtC,AADD,EAAE,eAAe,GAChB,EAAG,QACA,cAA2B,wCAAoC,CAAA,EAC/D,MAAM,EAAE,eAAe,GAAK,CAAC;EACnC;oBAIEpB,EAAA,GAAAC,EAmBaC,EAAAsB,CAAA,GAAA;GAnBO,MAAMR,EAAA;GAAA,iBAAA,AAAAS,EAAA,QAAA,MAAA,EAAI,QAAAC;;GAC5B,SAAAvB,QAiBe,CAjBfC,EAiBeF,EAAA2B,CAAA,GAAA,MAAA;IAhBb,SAAA1B,QAAoE,CAApEC,EAAoEF,EAAA4B,CAAA,GAAA;KAArD,OAAM;KAAqB,2BAAA;IAC1C1B,CAAAA,GAAAA,EAcgBF,EAAA6B,CAAA,GAdhB1B,EAcgB;KAbd,OAAM;KACN,6BAAA;IACQ,GAAAc,GAAY;KACF;KACjB,kBAAgB,AAAAM,EAAA,QAAA,MAAEP,EAAI,kBAAmBQ,CAAM;;KAEhD,SAAAvB,QAAiF,CAAjFC,EAAiFF,EAAA+B,CAAA,GAAA,EAApE,OAAM,mBAAkB,GAAA;MAAC,SAAA9B,QAA6B,CAA1BG,EAAAC,EAAAL,EAAAkC,CAAA,CAAgB,CAAC,MAAM,GAAA,CAAA,CAAA,CAAA;;KAChEhC,CAAAA,GAAAA,EAKEI,GAAA;MAJC,OAAOM,EAAM;MACb,QAAQA,EAAM;MACd,SAAK,AAAAW,EAAA,QAAA,MAAEP,EAAI,QAASQ,CAAM;MAC1B,SAAK,AAAAD,EAAA,QAAA,MAAE,EAAA,QAAI"}
1
+ {"version":3,"file":"InkSignatureDialog.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_createTextVNode","_toDisplayString","SignatureForm","SignatureForm_default","InkSignatureDialog_vue_vue_type_script_setup_true_lang_default","\"open\"","\"openModifiers\"","__emit","props","__props","open","useModel","emit","contentAttrs","onOpenAutoFocus","openBlock","createBlock","unref","DialogRoot","_cache","$event","withCtx","createVNode","DialogPortal","DialogOverlay","DialogContent","mergeProps","DialogTitle","createTextVNode","toDisplayString","SIGNATURE_LABELS"],"sources":["../../src/components/InkSignatureDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * \"Create signature\": a modal with Draw, Type and Image tabs. Draw is a pad with the draw\n * tool's renderer; Type sets a name in one of the host's handwriting fonts; Image takes a PNG\n * or JPEG scan. Save stores the template through InkRoot's signature store and, unless `select`\n * is false or no `signature` tool is registered, selects it for that tool. Escape, Cancel or a\n * press outside closes it.\n */\nimport { SIGNATURE_LABELS } from '@inkbar/core/dom'\nimport {\n DialogContent,\n DialogOverlay,\n DialogPortal,\n DialogRoot,\n DialogTitle,\n} from 'reka-ui'\n\nimport SignatureForm from './SignatureForm.vue'\n\nimport type { SignatureTemplate } from '@inkbar/core'\n\nconst props = withDefaults(\n defineProps<{\n /** The fonts the Type tab offers. Default: InkRoot's `signatureFonts`. */\n fonts?: readonly string[] | undefined\n /**\n * Whether saving selects the new signature for the `signature` tool, when one is\n * registered. False leaves the tool alone, for a dialog that signs a field with it through\n * `save`.\n */\n select?: boolean\n }>(),\n { fonts: undefined, select: true }\n)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{\n /** The new template, once saved (and selected, with `select`). */\n save: [template: SignatureTemplate]\n /** Reka's close auto-focus; prevent it to place focus yourself. */\n closeAutoFocus: [event: Event]\n}>()\n\n// Reka's typed props stop at its own; ARIA goes through a bound object. No description: the\n// title says it all.\nconst contentAttrs = { 'aria-modal': 'true', 'aria-describedby': undefined }\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n ;(e.target as HTMLElement | null)\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus({ preventScroll: true })\n}\n</script>\n\n<template>\n <DialogRoot v-model:open=\"open\">\n <DialogPortal>\n <DialogOverlay class=\"ink-dialog-overlay\" data-ink-dialog-overlay />\n <DialogContent\n class=\"ink-dialog ink-signature-dialog\"\n data-ink-signature-dialog\n v-bind=\"contentAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n @close-auto-focus=\"emit('closeAutoFocus', $event)\"\n >\n <DialogTitle class=\"ink-dialog-title\">{{ SIGNATURE_LABELS.dialog }}</DialogTitle>\n <SignatureForm\n :fonts=\"props.fonts\"\n :select=\"props.select\"\n @saved=\"emit('save', $event)\"\n @close=\"open = false\"\n />\n </DialogContent>\n </DialogPortal>\n </DialogRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAqBA,IAAMe,IAAQC,GAaRC,IAAOjB,EAAoBgB,GAAC,MAA0B,GACtDG,IAAOL,GASPM,IAAe;GAAE,cAAc;GAAQ,oBAAoB,KAAA;EAAU;EAE3E,SAASC,EAAgB,GAAgB;GAEtC,AADD,EAAE,eAAe,GAChB,EAAG,QACA,cAA2B,wCAAoC,CAAA,EAC/D,MAAM,EAAE,eAAe,GAAK,CAAC;EACnC;oBAIEpB,EAAA,GAAAC,EAmBaC,EAAAsB,CAAA,GAAA;GAnBO,MAAMR,EAAA;GAAA,iBAAA,AAAAS,EAAA,QAAA,MAAA,EAAI,QAAAC;;GAC5B,SAAAvB,QAiBe,CAjBfC,EAiBeF,EAAA2B,CAAA,GAAA,MAAA;IAhBb,SAAA1B,QAAoE,CAApEC,EAAoEF,EAAA4B,CAAA,GAAA;KAArD,OAAM;KAAqB,2BAAA;IAC1C1B,CAAAA,GAAAA,EAcgBF,EAAA6B,CAAA,GAdhB1B,EAcgB;KAbd,OAAM;KACN,6BAAA;IACQ,GAAAc,GAAY;KACF;KACjB,kBAAgB,AAAAM,EAAA,QAAA,MAAEP,EAAI,kBAAmBQ,CAAM;;KAEhD,SAAAvB,QAAiF,CAAjFC,EAAiFF,EAAA+B,CAAA,GAAA,EAApE,OAAM,mBAAkB,GAAA;MAAC,SAAA9B,QAA6B,CAA1BG,EAAAC,EAAAL,EAAAkC,CAAA,CAAgB,CAAC,MAAM,GAAA,CAAA,CAAA,CAAA;;KAChEhC,CAAAA,GAAAA,EAKEI,GAAA;MAJC,OAAOM,EAAM;MACb,QAAQA,EAAM;MACd,SAAK,AAAAW,EAAA,QAAA,MAAEP,EAAI,QAASQ,CAAM;MAC1B,SAAK,AAAAD,EAAA,QAAA,MAAE,EAAA,QAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"InkSignatureMenu.js","names":["_sfc_main","InkSignatureMenu_vue_vue_type_script_setup_true_lang_default","InkSignatureMenu_default"],"sources":["../../src/components/InkSignatureMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A split button for the signature tool. The main part activates the tool with the chosen\n * signature, or opens the menu when none is chosen; the chevron opens the saved signatures as\n * previews, each with a remove button, and \"Create signature\", which opens\n * `InkSignatureDialog`. Choosing a signature switches to the tool with it.\n */\nimport {\n focusInitialMenuItem,\n menuItems,\n SIGNATURE_LABELS,\n signatureMenuModel,\n} from '@inkbar/core/dom'\nimport { ChevronDown, Signature } from '@inkbar/icons'\nimport {\n PopoverAnchor,\n PopoverContent,\n PopoverPortal,\n PopoverRoot,\n PopoverTrigger,\n ToolbarButton,\n} from 'reka-ui'\nimport { computed, ref, useTemplateRef, watch } from 'vue'\n\nimport { useTool } from '../composables/useTool'\nimport { useToolOptions } from '../composables/useToolOptions'\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport InkIcon from './InkIcon.vue'\nimport InkSignatureDialog from './InkSignatureDialog.vue'\nimport SignatureMenuPanel from './SignatureMenuPanel.vue'\n\nimport type { SignatureOptions, SignatureTemplate } from '@inkbar/core'\n\ndefineOptions({ inheritAttrs: false })\nconst props = defineProps<{\n /** The fonts the dialog's Type tab offers. Default: InkRoot's `signatureFonts`. */\n fonts?: readonly string[] | undefined\n}>()\n\nconst NO_TEMPLATES: readonly SignatureTemplate[] = []\n\nconst { tool, setTool } = useTool()\nconst { options, setOptions } = useToolOptions<SignatureOptions>('signature')\nconst ctx = useInkContext('InkSignatureMenu')\nconst templates = useReadable(() => ctx.signatures.value.templates, NO_TEMPLATES)\nconst model = computed(() => signatureMenuModel(templates.value, options.value))\nconst active = computed(() => tool.value === 'signature')\nconst open = ref(false)\nconst creating = ref(false)\n// An old removal error is not news when the menu opens again.\nwatch(open, (isOpen) => {\n if (isOpen) ctx.signatures.value.clearRemoveError()\n})\nconst main = useTemplateRef<{ $el: HTMLElement }>('main')\n\n/** ArrowDown opens on the first item; a click opens on the checked one. */\nlet focusFirst = false\n/** Set while the menu closes for the dialog, which takes focus instead of the trigger. */\nlet toDialog = false\n\nfunction onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key !== 'ArrowDown' || e.defaultPrevented || open.value) return\n e.preventDefault()\n focusFirst = true\n open.value = true\n}\n\n// Not a signature field's menu, which shares the attribute.\nconst panel = (): HTMLElement | null =>\n document.querySelector<HTMLElement>(\n '[data-ink-menu=\"signature\"]:not([data-ink-sign-field-menu]) [role=\"menu\"]'\n )\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n const menu = panel()\n if (menu) {\n if (focusFirst) menuItems(menu)[0]?.focus({ preventScroll: true })\n else focusInitialMenuItem(menu)\n }\n focusFirst = false\n}\n\nfunction onCloseAutoFocus(e: Event): void {\n if (toDialog) e.preventDefault()\n toDialog = false\n}\n\nfunction onMain(): void {\n if (model.value.selected) setTool('signature')\n else open.value = true\n}\n\nfunction choose(id: string): void {\n setOptions({ templateId: id })\n setTool('signature')\n open.value = false\n}\n\nfunction create(): void {\n toDialog = true\n open.value = false\n creating.value = true\n}\n\nfunction onDialogCloseAutoFocus(e: Event): void {\n e.preventDefault()\n main.value?.$el.focus({ preventScroll: true })\n}\n\n// Reka's typed props stop at its own; ARIA and listeners go through bound objects.\nconst mainAttrs = computed(() => ({\n 'aria-pressed': String(active.value),\n 'aria-label': SIGNATURE_LABELS.sign,\n title: SIGNATURE_LABELS.sign,\n onClick: onMain,\n}))\nconst triggerAttrs = {\n 'aria-label': SIGNATURE_LABELS.trigger,\n title: SIGNATURE_LABELS.trigger,\n 'aria-haspopup': 'menu' as const,\n onKeydown: onTriggerKeydown,\n}\nconst menuAttrs = { 'aria-label': SIGNATURE_LABELS.menu }\n</script>\n\n<template>\n <PopoverRoot v-model:open=\"open\">\n <PopoverAnchor as-child>\n <div\n role=\"group\"\n :aria-label=\"SIGNATURE_LABELS.sign\"\n class=\"ink-split-button ink-signature-menu\"\n data-ink-signature-menu\n v-bind=\"$attrs\"\n >\n <ToolbarButton\n ref=\"main\"\n class=\"ink-tool-button ink-signature-button\"\n data-ink-tool-button\n data-ink-signature-button\n data-tool=\"signature\"\n :data-state=\"active ? 'on' : 'off'\"\n v-bind=\"mainAttrs\"\n >\n <slot :active=\"active\"><InkIcon :icon=\"Signature\" /></slot>\n </ToolbarButton>\n <ToolbarButton as-child>\n <PopoverTrigger as-child>\n <button\n type=\"button\"\n class=\"ink-menu-trigger ink-signature-menu-trigger\"\n data-ink-signature-menu-trigger\n :data-state=\"open ? 'open' : 'closed'\"\n v-bind=\"triggerAttrs\"\n >\n <InkIcon :icon=\"ChevronDown\" />\n </button>\n </PopoverTrigger>\n </ToolbarButton>\n <PopoverPortal>\n <PopoverContent\n class=\"ink-select-content ink-menu-content\"\n data-ink-select-content\n data-ink-menu=\"signature\"\n side=\"bottom\"\n align=\"start\"\n :side-offset=\"4\"\n :collision-padding=\"8\"\n v-bind=\"menuAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n @close-auto-focus=\"onCloseAutoFocus\"\n >\n <SignatureMenuPanel\n :items=\"model.items\"\n @choose=\"choose($event.id)\"\n @create=\"create\"\n />\n </PopoverContent>\n </PopoverPortal>\n <InkSignatureDialog\n v-model:open=\"creating\"\n :fonts=\"props.fonts\"\n @close-auto-focus=\"onDialogCloseAutoFocus\"\n />\n </div>\n </PopoverAnchor>\n </PopoverRoot>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"InkSignatureMenu.js","names":["_sfc_main","InkSignatureMenu_vue_vue_type_script_setup_true_lang_default","InkSignatureMenu_default"],"sources":["../../src/components/InkSignatureMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/*\n * A split button for the signature tool. The main part activates the tool with the chosen\n * signature, or opens the menu when none is chosen; the chevron opens the saved signatures as\n * previews, each with a remove button, and \"Create signature\", which opens\n * `InkSignatureDialog`. Choosing a signature switches to the tool with it.\n */\nimport {\n focusInitialMenuItem,\n menuItems,\n SIGNATURE_LABELS,\n signatureMenuModel,\n} from '@inkbar/core/dom'\nimport { ChevronDown, Signature } from '@inkbar/icons'\nimport {\n PopoverAnchor,\n PopoverContent,\n PopoverPortal,\n PopoverRoot,\n PopoverTrigger,\n ToolbarButton,\n} from 'reka-ui'\nimport { computed, ref, useTemplateRef, watch } from 'vue'\n\nimport { useRegisteredTool } from '../composables/useRegisteredTool'\nimport { useTool } from '../composables/useTool'\nimport { useToolOptionsWhile } from '../composables/useToolOptions'\nimport { useInkContext } from '../context'\nimport { useReadable } from '../use-readable'\n\nimport InkIcon from './InkIcon.vue'\nimport InkSignatureDialog from './InkSignatureDialog.vue'\nimport SignatureMenuPanel from './SignatureMenuPanel.vue'\n\nimport type { SignatureOptions, SignatureTemplate } from '@inkbar/core'\n\ndefineOptions({ inheritAttrs: false })\nconst props = defineProps<{\n /** The fonts the dialog's Type tab offers. Default: InkRoot's `signatureFonts`. */\n fonts?: readonly string[] | undefined\n}>()\n\nconst NO_TEMPLATES: readonly SignatureTemplate[] = []\n\nconst { tool, setTool } = useTool()\n// Nothing renders while no `signature` tool is registered.\nconst registered = useRegisteredTool('signature')\nconst { options, setOptions } = useToolOptionsWhile<SignatureOptions>(\n 'signature',\n registered\n)\nconst ctx = useInkContext('InkSignatureMenu')\nconst templates = useReadable(() => ctx.signatures.value.templates, NO_TEMPLATES)\nconst model = computed(() => signatureMenuModel(templates.value, options.value))\nconst active = computed(() => tool.value === 'signature')\nconst open = ref(false)\nconst creating = ref(false)\n// An old removal error is not news when the menu opens again.\nwatch(open, (isOpen) => {\n if (isOpen) ctx.signatures.value.clearRemoveError()\n})\nconst main = useTemplateRef<{ $el: HTMLElement }>('main')\n\n/** ArrowDown opens on the first item; a click opens on the checked one. */\nlet focusFirst = false\n/** Set while the menu closes for the dialog, which takes focus instead of the trigger. */\nlet toDialog = false\n\nfunction onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key !== 'ArrowDown' || e.defaultPrevented || open.value) return\n e.preventDefault()\n focusFirst = true\n open.value = true\n}\n\n// Not a signature field's menu, which shares the attribute.\nconst panel = (): HTMLElement | null =>\n document.querySelector<HTMLElement>(\n '[data-ink-menu=\"signature\"]:not([data-ink-sign-field-menu]) [role=\"menu\"]'\n )\n\nfunction onOpenAutoFocus(e: Event): void {\n e.preventDefault()\n const menu = panel()\n if (menu) {\n if (focusFirst) menuItems(menu)[0]?.focus({ preventScroll: true })\n else focusInitialMenuItem(menu)\n }\n focusFirst = false\n}\n\nfunction onCloseAutoFocus(e: Event): void {\n if (toDialog) e.preventDefault()\n toDialog = false\n}\n\nfunction onMain(): void {\n if (model.value.selected) setTool('signature')\n else open.value = true\n}\n\nfunction choose(id: string): void {\n setOptions({ templateId: id })\n setTool('signature')\n open.value = false\n}\n\nfunction create(): void {\n toDialog = true\n open.value = false\n creating.value = true\n}\n\nfunction onDialogCloseAutoFocus(e: Event): void {\n e.preventDefault()\n main.value?.$el.focus({ preventScroll: true })\n}\n\n// Reka's typed props stop at its own; ARIA and listeners go through bound objects.\nconst mainAttrs = computed(() => ({\n 'aria-pressed': String(active.value),\n 'aria-label': SIGNATURE_LABELS.sign,\n title: SIGNATURE_LABELS.sign,\n onClick: onMain,\n}))\nconst triggerAttrs = {\n 'aria-label': SIGNATURE_LABELS.trigger,\n title: SIGNATURE_LABELS.trigger,\n 'aria-haspopup': 'menu' as const,\n onKeydown: onTriggerKeydown,\n}\nconst menuAttrs = { 'aria-label': SIGNATURE_LABELS.menu }\n</script>\n\n<template>\n <PopoverRoot v-if=\"registered\" v-model:open=\"open\">\n <PopoverAnchor as-child>\n <div\n role=\"group\"\n :aria-label=\"SIGNATURE_LABELS.sign\"\n class=\"ink-split-button ink-signature-menu\"\n data-ink-signature-menu\n v-bind=\"$attrs\"\n >\n <ToolbarButton\n ref=\"main\"\n class=\"ink-tool-button ink-signature-button\"\n data-ink-tool-button\n data-ink-signature-button\n data-tool=\"signature\"\n :data-state=\"active ? 'on' : 'off'\"\n v-bind=\"mainAttrs\"\n >\n <slot :active=\"active\"><InkIcon :icon=\"Signature\" /></slot>\n </ToolbarButton>\n <ToolbarButton as-child>\n <PopoverTrigger as-child>\n <button\n type=\"button\"\n class=\"ink-menu-trigger ink-signature-menu-trigger\"\n data-ink-signature-menu-trigger\n :data-state=\"open ? 'open' : 'closed'\"\n v-bind=\"triggerAttrs\"\n >\n <InkIcon :icon=\"ChevronDown\" />\n </button>\n </PopoverTrigger>\n </ToolbarButton>\n <PopoverPortal>\n <PopoverContent\n class=\"ink-select-content ink-menu-content\"\n data-ink-select-content\n data-ink-menu=\"signature\"\n side=\"bottom\"\n align=\"start\"\n :side-offset=\"4\"\n :collision-padding=\"8\"\n v-bind=\"menuAttrs\"\n @open-auto-focus=\"onOpenAutoFocus\"\n @close-auto-focus=\"onCloseAutoFocus\"\n >\n <SignatureMenuPanel\n :items=\"model.items\"\n @choose=\"choose($event.id)\"\n @create=\"create\"\n />\n </PopoverContent>\n </PopoverPortal>\n <InkSignatureDialog\n v-model:open=\"creating\"\n :fonts=\"props.fonts\"\n @close-auto-focus=\"onDialogCloseAutoFocus\"\n />\n </div>\n </PopoverAnchor>\n </PopoverRoot>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"InkSignatureMenu.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkSignatureMenu.vue"],"names":[],"mappings":"AAqOA,KAAK,WAAW,GAAG;IACjB,mFAAmF;IACnF,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CACtC,CAAC;AAsVF,QAAA,IAAI,QAAQ;;CAAY,CAAC;AACzB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAGhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"InkSignatureMenu.vue.d.ts","sourceRoot":"","sources":["../../src/components/InkSignatureMenu.vue"],"names":[],"mappings":"AA4OA,KAAK,WAAW,GAAG;IACjB,mFAAmF;IACnF,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CACtC,CAAC;AAkWF,QAAA,IAAI,QAAQ;;CAAY,CAAC;AACzB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAGhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,97 +1,99 @@
1
1
  import { useInkContext as e } from "../context.js";
2
- import { useReadable as t } from "../use-readable.js";
3
- import { useTool as n } from "../composables/useTool.js";
4
- import { useToolOptions as r } from "../composables/useToolOptions.js";
5
- import i from "./InkSignatureDialog.js";
6
- import a from "./InkIcon.js";
7
- import o from "./SignatureMenuPanel.js";
8
- import { computed as s, createBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeProps as f, openBlock as p, ref as m, renderSlot as ee, unref as h, useTemplateRef as g, watch as _, withCtx as v } from "vue";
9
- import { SIGNATURE_LABELS as y, focusInitialMenuItem as b, menuItems as x, signatureMenuModel as S } from "@inkbar/core/dom";
10
- import { PopoverAnchor as C, PopoverContent as w, PopoverPortal as T, PopoverRoot as E, PopoverTrigger as D, ToolbarButton as O } from "reka-ui";
11
- import { ChevronDown as k, Signature as A } from "@inkbar/icons";
2
+ import { useRegisteredTool as t } from "../composables/useRegisteredTool.js";
3
+ import { useReadable as n } from "../use-readable.js";
4
+ import { useTool as r } from "../composables/useTool.js";
5
+ import { useToolOptionsWhile as i } from "../composables/useToolOptions.js";
6
+ import a from "./InkSignatureDialog.js";
7
+ import o from "./InkIcon.js";
8
+ import s from "./SignatureMenuPanel.js";
9
+ import { computed as c, createBlock as l, createCommentVNode as u, createElementVNode as d, createVNode as f, defineComponent as p, mergeProps as m, openBlock as h, ref as g, renderSlot as _, unref as v, useTemplateRef as y, watch as b, withCtx as x } from "vue";
10
+ import { SIGNATURE_LABELS as S, focusInitialMenuItem as C, menuItems as w, signatureMenuModel as T } from "@inkbar/core/dom";
11
+ import { PopoverAnchor as E, PopoverContent as D, PopoverPortal as O, PopoverRoot as k, PopoverTrigger as A, ToolbarButton as j } from "reka-ui";
12
+ import { ChevronDown as M, Signature as N } from "@inkbar/icons";
12
13
  //#region src/components/InkSignatureMenu.vue?vue&type=script&setup=true&lang.ts
13
- var j = ["aria-label"], M = ["data-state"], N = /*@__PURE__*/ d({
14
+ var P = ["aria-label"], F = ["data-state"], I = /*@__PURE__*/ p({
14
15
  inheritAttrs: !1,
15
16
  __name: "InkSignatureMenu",
16
17
  props: { fonts: {} },
17
- setup(d) {
18
- let N = d, P = [], { tool: F, setTool: I } = n(), { options: L, setOptions: R } = r("signature"), z = e("InkSignatureMenu"), B = t(() => z.signatures.value.templates, P), V = s(() => S(B.value, L.value)), H = s(() => F.value === "signature"), U = m(!1), W = m(!1);
19
- _(U, (e) => {
20
- e && z.signatures.value.clearRemoveError();
18
+ setup(p) {
19
+ let I = p, L = [], { tool: R, setTool: z } = r(), B = t("signature"), { options: ee, setOptions: V } = i("signature", B), H = e("InkSignatureMenu"), U = n(() => H.signatures.value.templates, L), W = c(() => T(U.value, ee.value)), G = c(() => R.value === "signature"), K = g(!1), q = g(!1);
20
+ b(K, (e) => {
21
+ e && H.signatures.value.clearRemoveError();
21
22
  });
22
- let G = g("main"), K = !1, q = !1;
23
- function J(e) {
24
- e.key !== "ArrowDown" || e.defaultPrevented || U.value || (e.preventDefault(), K = !0, U.value = !0);
23
+ let J = y("main"), Y = !1, X = !1;
24
+ function Z(e) {
25
+ e.key !== "ArrowDown" || e.defaultPrevented || K.value || (e.preventDefault(), Y = !0, K.value = !0);
25
26
  }
26
- let Y = () => document.querySelector("[data-ink-menu=\"signature\"]:not([data-ink-sign-field-menu]) [role=\"menu\"]");
27
- function X(e) {
27
+ let Q = () => document.querySelector("[data-ink-menu=\"signature\"]:not([data-ink-sign-field-menu]) [role=\"menu\"]");
28
+ function $(e) {
28
29
  e.preventDefault();
29
- let t = Y();
30
- t && (K ? x(t)[0]?.focus({ preventScroll: !0 }) : b(t)), K = !1;
30
+ let t = Q();
31
+ t && (Y ? w(t)[0]?.focus({ preventScroll: !0 }) : C(t)), Y = !1;
31
32
  }
32
- function Z(e) {
33
- q && e.preventDefault(), q = !1;
33
+ function te(e) {
34
+ X && e.preventDefault(), X = !1;
34
35
  }
35
- function Q() {
36
- V.value.selected ? I("signature") : U.value = !0;
36
+ function ne() {
37
+ W.value.selected ? z("signature") : K.value = !0;
37
38
  }
38
- function $(e) {
39
- R({ templateId: e }), I("signature"), U.value = !1;
39
+ function re(e) {
40
+ V({ templateId: e }), z("signature"), K.value = !1;
40
41
  }
41
- function te() {
42
- q = !0, U.value = !1, W.value = !0;
42
+ function ie() {
43
+ X = !0, K.value = !1, q.value = !0;
43
44
  }
44
- function ne(e) {
45
- e.preventDefault(), G.value?.$el.focus({ preventScroll: !0 });
45
+ function ae(e) {
46
+ e.preventDefault(), J.value?.$el.focus({ preventScroll: !0 });
46
47
  }
47
- let re = s(() => ({
48
- "aria-pressed": String(H.value),
49
- "aria-label": y.sign,
50
- title: y.sign,
51
- onClick: Q
52
- })), ie = {
53
- "aria-label": y.trigger,
54
- title: y.trigger,
48
+ let oe = c(() => ({
49
+ "aria-pressed": String(G.value),
50
+ "aria-label": S.sign,
51
+ title: S.sign,
52
+ onClick: ne
53
+ })), se = {
54
+ "aria-label": S.trigger,
55
+ title: S.trigger,
55
56
  "aria-haspopup": "menu",
56
- onKeydown: J
57
- }, ae = { "aria-label": y.menu };
58
- return (e, t) => (p(), c(h(E), {
59
- open: U.value,
60
- "onUpdate:open": t[2] ||= (e) => U.value = e
57
+ onKeydown: Z
58
+ }, ce = { "aria-label": S.menu };
59
+ return (e, t) => v(B) ? (h(), l(v(k), {
60
+ key: 0,
61
+ open: K.value,
62
+ "onUpdate:open": t[2] ||= (e) => K.value = e
61
63
  }, {
62
- default: v(() => [u(h(C), { "as-child": "" }, {
63
- default: v(() => [l("div", f({
64
+ default: x(() => [f(v(E), { "as-child": "" }, {
65
+ default: x(() => [d("div", m({
64
66
  role: "group",
65
- "aria-label": h(y).sign,
67
+ "aria-label": v(S).sign,
66
68
  class: "ink-split-button ink-signature-menu",
67
69
  "data-ink-signature-menu": ""
68
70
  }, e.$attrs), [
69
- u(h(O), f({
71
+ f(v(j), m({
70
72
  ref_key: "main",
71
- ref: G,
73
+ ref: J,
72
74
  class: "ink-tool-button ink-signature-button",
73
75
  "data-ink-tool-button": "",
74
76
  "data-ink-signature-button": "",
75
77
  "data-tool": "signature",
76
- "data-state": H.value ? "on" : "off"
77
- }, re.value), {
78
- default: v(() => [ee(e.$slots, "default", { active: H.value }, () => [u(a, { icon: h(A) }, null, 8, ["icon"])])]),
78
+ "data-state": G.value ? "on" : "off"
79
+ }, oe.value), {
80
+ default: x(() => [_(e.$slots, "default", { active: G.value }, () => [f(o, { icon: v(N) }, null, 8, ["icon"])])]),
79
81
  _: 3
80
82
  }, 16, ["data-state"]),
81
- u(h(O), { "as-child": "" }, {
82
- default: v(() => [u(h(D), { "as-child": "" }, {
83
- default: v(() => [l("button", f({
83
+ f(v(j), { "as-child": "" }, {
84
+ default: x(() => [f(v(A), { "as-child": "" }, {
85
+ default: x(() => [d("button", m({
84
86
  type: "button",
85
87
  class: "ink-menu-trigger ink-signature-menu-trigger",
86
88
  "data-ink-signature-menu-trigger": "",
87
- "data-state": U.value ? "open" : "closed"
88
- }, ie), [u(a, { icon: h(k) }, null, 8, ["icon"])], 16, M)]),
89
+ "data-state": K.value ? "open" : "closed"
90
+ }, se), [f(o, { icon: v(M) }, null, 8, ["icon"])], 16, F)]),
89
91
  _: 1
90
92
  })]),
91
93
  _: 1
92
94
  }),
93
- u(h(T), null, {
94
- default: v(() => [u(h(w), f({
95
+ f(v(O), null, {
96
+ default: x(() => [f(v(D), m({
95
97
  class: "ink-select-content ink-menu-content",
96
98
  "data-ink-select-content": "",
97
99
  "data-ink-menu": "signature",
@@ -99,33 +101,33 @@ var j = ["aria-label"], M = ["data-state"], N = /*@__PURE__*/ d({
99
101
  align: "start",
100
102
  "side-offset": 4,
101
103
  "collision-padding": 8
102
- }, ae, {
103
- onOpenAutoFocus: X,
104
- onCloseAutoFocus: Z
104
+ }, ce, {
105
+ onOpenAutoFocus: $,
106
+ onCloseAutoFocus: te
105
107
  }), {
106
- default: v(() => [u(o, {
107
- items: V.value.items,
108
- onChoose: t[0] ||= (e) => $(e.id),
109
- onCreate: te
108
+ default: x(() => [f(s, {
109
+ items: W.value.items,
110
+ onChoose: t[0] ||= (e) => re(e.id),
111
+ onCreate: ie
110
112
  }, null, 8, ["items"])]),
111
113
  _: 1
112
114
  }, 16)]),
113
115
  _: 1
114
116
  }),
115
- u(i, {
116
- open: W.value,
117
- "onUpdate:open": t[1] ||= (e) => W.value = e,
118
- fonts: N.fonts,
119
- onCloseAutoFocus: ne
117
+ f(a, {
118
+ open: q.value,
119
+ "onUpdate:open": t[1] ||= (e) => q.value = e,
120
+ fonts: I.fonts,
121
+ onCloseAutoFocus: ae
120
122
  }, null, 8, ["open", "fonts"])
121
- ], 16, j)]),
123
+ ], 16, P)]),
122
124
  _: 3
123
125
  })]),
124
126
  _: 3
125
- }, 8, ["open"]));
127
+ }, 8, ["open"])) : u("", !0);
126
128
  }
127
129
  });
128
130
  //#endregion
129
- export { N as default };
131
+ export { I as default };
130
132
 
131
133
  //# sourceMappingURL=InkSignatureMenu.vue_vue_type_script_setup_true_lang.js.map