blessing-ui 0.2.0 → 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 (133) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +137 -125
  3. package/dist/blessing-ui.css +38 -2
  4. package/dist/components/BlessAnnotator.css +1 -0
  5. package/dist/components/BlessAnnotator.js +6 -0
  6. package/dist/components/BlessAnnotator.vue.d.ts +71 -0
  7. package/dist/components/BlessAnnotator.vue_vue_type_script_setup_true_lang.js +264 -0
  8. package/dist/components/BlessAttachment.vue.d.ts +4 -1
  9. package/dist/components/BlessAttachment.vue_vue_type_script_setup_true_lang.js +3 -2
  10. package/dist/components/BlessCalendar.vue.d.ts +4 -0
  11. package/dist/components/BlessCalendar.vue_vue_type_script_setup_true_lang.js +65 -60
  12. package/dist/components/BlessCarousel.vue.d.ts +3 -0
  13. package/dist/components/BlessCarousel.vue_vue_type_script_setup_true_lang.js +10 -9
  14. package/dist/components/BlessCoachmark.css +1 -0
  15. package/dist/components/BlessCoachmark.js +6 -0
  16. package/dist/components/BlessCoachmark.vue.d.ts +40 -0
  17. package/dist/components/BlessCoachmark.vue_vue_type_script_setup_true_lang.js +74 -0
  18. package/dist/components/BlessCodeBlock.vue.d.ts +10 -0
  19. package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +39 -33
  20. package/dist/components/BlessCombobox.vue.d.ts +2 -0
  21. package/dist/components/BlessCombobox.vue_vue_type_script_setup_true_lang.js +3 -2
  22. package/dist/components/BlessCommand.css +1 -1
  23. package/dist/components/BlessCommand.vue.d.ts +26 -0
  24. package/dist/components/BlessCommand.vue_vue_type_script_setup_true_lang.js +137 -70
  25. package/dist/components/BlessConfetti.css +1 -0
  26. package/dist/components/BlessConfetti.js +6 -0
  27. package/dist/components/BlessConfetti.vue.d.ts +40 -0
  28. package/dist/components/BlessConfetti.vue_vue_type_script_setup_true_lang.js +77 -0
  29. package/dist/components/BlessCropper.vue.d.ts +16 -0
  30. package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +47 -39
  31. package/dist/components/BlessDataTable.vue.d.ts +6 -0
  32. package/dist/components/BlessDataTable.vue_vue_type_script_setup_true_lang.js +56 -42
  33. package/dist/components/BlessDataView.vue.d.ts +7 -0
  34. package/dist/components/BlessDataView.vue_vue_type_script_setup_true_lang.js +38 -31
  35. package/dist/components/BlessDatePicker.vue.d.ts +3 -0
  36. package/dist/components/BlessDatePicker.vue_vue_type_script_setup_true_lang.js +46 -45
  37. package/dist/components/BlessDock.css +1 -0
  38. package/dist/components/BlessDock.js +6 -0
  39. package/dist/components/BlessDock.vue.d.ts +55 -0
  40. package/dist/components/BlessDock.vue_vue_type_script_setup_true_lang.js +100 -0
  41. package/dist/components/BlessEditor.vue.d.ts +2 -0
  42. package/dist/components/BlessEditor.vue_vue_type_script_setup_true_lang.js +23 -22
  43. package/dist/components/BlessFileInput.vue.d.ts +2 -0
  44. package/dist/components/BlessFileInput.vue_vue_type_script_setup_true_lang.js +3 -2
  45. package/dist/components/BlessFormula.css +1 -0
  46. package/dist/components/BlessFormula.js +6 -0
  47. package/dist/components/BlessFormula.vue.d.ts +53 -0
  48. package/dist/components/BlessFormula.vue_vue_type_script_setup_true_lang.js +111 -0
  49. package/dist/components/BlessGantt.vue.d.ts +12 -0
  50. package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +74 -68
  51. package/dist/components/BlessInfiniteCanvas.css +1 -0
  52. package/dist/components/BlessInfiniteCanvas.js +6 -0
  53. package/dist/components/BlessInfiniteCanvas.vue.d.ts +91 -0
  54. package/dist/components/BlessInfiniteCanvas.vue_vue_type_script_setup_true_lang.js +232 -0
  55. package/dist/components/BlessInputNumber.vue.d.ts +5 -0
  56. package/dist/components/BlessInputNumber.vue_vue_type_script_setup_true_lang.js +39 -34
  57. package/dist/components/BlessKanban.vue.d.ts +12 -0
  58. package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +127 -97
  59. package/dist/components/BlessLoadingBar.vue.d.ts +2 -0
  60. package/dist/components/BlessLoadingBar.vue_vue_type_script_setup_true_lang.js +8 -3
  61. package/dist/components/BlessMarquee.vue.d.ts +4 -0
  62. package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +32 -27
  63. package/dist/components/BlessNodeGraph.css +1 -0
  64. package/dist/components/BlessNodeGraph.js +6 -0
  65. package/dist/components/BlessNodeGraph.vue.d.ts +110 -0
  66. package/dist/components/BlessNodeGraph.vue_vue_type_script_setup_true_lang.js +321 -0
  67. package/dist/components/BlessOnboardingChecklist.css +1 -0
  68. package/dist/components/BlessOnboardingChecklist.js +6 -0
  69. package/dist/components/BlessOnboardingChecklist.vue.d.ts +72 -0
  70. package/dist/components/BlessOnboardingChecklist.vue_vue_type_script_setup_true_lang.js +157 -0
  71. package/dist/components/BlessOrderList.vue.d.ts +5 -0
  72. package/dist/components/BlessOrderList.vue_vue_type_script_setup_true_lang.js +62 -56
  73. package/dist/components/BlessPagination.vue.d.ts +2 -0
  74. package/dist/components/BlessPagination.vue_vue_type_script_setup_true_lang.js +2 -1
  75. package/dist/components/BlessPickList.vue.d.ts +5 -0
  76. package/dist/components/BlessPickList.vue_vue_type_script_setup_true_lang.js +55 -49
  77. package/dist/components/BlessRangeCalendar.css +1 -0
  78. package/dist/components/BlessRangeCalendar.js +6 -0
  79. package/dist/components/BlessRangeCalendar.vue.d.ts +51 -0
  80. package/dist/components/BlessRangeCalendar.vue_vue_type_script_setup_true_lang.js +217 -0
  81. package/dist/components/BlessScheduler.css +1 -0
  82. package/dist/components/BlessScheduler.js +6 -0
  83. package/dist/components/BlessScheduler.vue.d.ts +95 -0
  84. package/dist/components/BlessScheduler.vue_vue_type_script_setup_true_lang.js +347 -0
  85. package/dist/components/BlessShortcutRecorder.vue.d.ts +10 -0
  86. package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +50 -40
  87. package/dist/components/BlessSignaturePad.vue.d.ts +1 -1
  88. package/dist/components/BlessSliderCaptcha.vue.d.ts +5 -0
  89. package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +89 -84
  90. package/dist/components/BlessSortable.css +1 -1
  91. package/dist/components/BlessSortable.vue.d.ts +19 -1
  92. package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +103 -55
  93. package/dist/components/BlessSparkline.css +1 -0
  94. package/dist/components/BlessSparkline.js +6 -0
  95. package/dist/components/BlessSparkline.vue.d.ts +28 -0
  96. package/dist/components/BlessSparkline.vue_vue_type_script_setup_true_lang.js +107 -0
  97. package/dist/components/BlessSteps.vue.d.ts +2 -0
  98. package/dist/components/BlessSteps.vue_vue_type_script_setup_true_lang.js +3 -2
  99. package/dist/components/BlessSwipeDeck.vue.d.ts +1 -1
  100. package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +2 -1
  101. package/dist/components/BlessTimer.vue.d.ts +18 -0
  102. package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +52 -43
  103. package/dist/components/BlessTour.vue.d.ts +1 -0
  104. package/dist/components/BlessTour.vue_vue_type_script_setup_true_lang.js +48 -42
  105. package/dist/components/BlessTreemap.css +1 -0
  106. package/dist/components/BlessTreemap.js +6 -0
  107. package/dist/components/BlessTreemap.vue.d.ts +46 -0
  108. package/dist/components/BlessTreemap.vue_vue_type_script_setup_true_lang.js +137 -0
  109. package/dist/components/BlessUploader.vue.d.ts +11 -0
  110. package/dist/components/BlessUploader.vue_vue_type_script_setup_true_lang.js +80 -69
  111. package/dist/composables/annotate.d.ts +35 -0
  112. package/dist/composables/annotate.js +33 -0
  113. package/dist/composables/canvasView.d.ts +21 -0
  114. package/dist/composables/canvasView.js +23 -0
  115. package/dist/composables/confetti.d.ts +32 -0
  116. package/dist/composables/confetti.js +23 -0
  117. package/dist/composables/dayBlocks.d.ts +11 -0
  118. package/dist/composables/dayBlocks.js +26 -0
  119. package/dist/composables/formula.d.ts +28 -0
  120. package/dist/composables/formula.js +161 -0
  121. package/dist/composables/graph.d.ts +19 -0
  122. package/dist/composables/graph.js +16 -0
  123. package/dist/composables/schedule.d.ts +27 -0
  124. package/dist/composables/schedule.js +54 -0
  125. package/dist/composables/treemap.d.ts +23 -0
  126. package/dist/composables/treemap.js +77 -0
  127. package/dist/composables/useAutoScroll.d.ts +15 -0
  128. package/dist/composables/useAutoScroll.js +32 -0
  129. package/dist/composables/useSortable.d.ts +42 -2
  130. package/dist/composables/useSortable.js +87 -14
  131. package/dist/index.d.ts +25 -1
  132. package/dist/index.js +78 -63
  133. package/package.json +4 -2
@@ -1,3 +1,11 @@
1
+ export interface BlessCommandScope {
2
+ /** the character that starts it when typed first: `@`, `#`, `>` */
3
+ key: string;
4
+ /** the `group` of the items it searches */
5
+ group: string;
6
+ /** what it is called in the chip and the hint; defaults to the group */
7
+ label?: string;
8
+ }
1
9
  export interface BlessCommandItem {
2
10
  label: string;
3
11
  value: string;
@@ -18,9 +26,24 @@ type __VLS_Props = {
18
26
  /** render inline instead of inside a modal */
19
27
  inline?: boolean;
20
28
  filter?: (item: BlessCommandItem, query: string) => boolean;
29
+ /** prefixes that narrow the search to one group: `[{ key: "@", group: "People" }]` */
30
+ scopes?: BlessCommandScope[];
31
+ /** put the items chosen before at the top while the search is empty */
32
+ recent?: boolean;
33
+ recentLimit?: number;
34
+ /** keep the history in localStorage under this key (read after mount) */
35
+ persist?: string;
36
+ labels?: Partial<{
37
+ recent: string;
38
+ scope: (label: string) => string;
39
+ clearScope: string;
40
+ scopeHint: (parts: string[]) => string;
41
+ }>;
21
42
  };
22
43
  type __VLS_ModelProps = {
23
44
  "open"?: boolean;
45
+ /** values of the items chosen so far, most recent first */
46
+ "history"?: string[];
24
47
  };
25
48
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
26
49
  declare var __VLS_14: {
@@ -34,14 +57,17 @@ type __VLS_Slots = {} & {
34
57
  declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
35
58
  select: (item: BlessCommandItem) => any;
36
59
  "update:open": (value: boolean) => any;
60
+ "update:history": (value: string[]) => any;
37
61
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
38
62
  onSelect?: ((item: BlessCommandItem) => any) | undefined;
39
63
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
64
+ "onUpdate:history"?: ((value: string[]) => any) | undefined;
40
65
  }>, {
41
66
  label: string;
42
67
  placeholder: string;
43
68
  emptyText: string;
44
69
  hotkey: boolean;
70
+ recentLimit: number;
45
71
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
46
72
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
47
73
  declare const _default: typeof __VLS_export;
@@ -1,28 +1,29 @@
1
1
  import e from "./BlessModal.js";
2
2
  import t from "./BlessKbd.js";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, mergeModels as u, mergeProps as d, nextTick as f, normalizeClass as p, onBeforeUnmount as m, onMounted as h, openBlock as g, ref as _, renderList as v, renderSlot as y, resolveDynamicComponent as b, toDisplayString as x, unref as S, useId as C, useModel as w, vModelText as T, watch as E, withCtx as D, withDirectives as O } from "vue";
3
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, mergeModels as u, mergeProps as d, nextTick as f, normalizeClass as p, onBeforeUnmount as m, onMounted as h, openBlock as g, ref as _, renderList as v, renderSlot as y, resolveDynamicComponent as ee, toDisplayString as b, unref as x, useId as S, useModel as C, vModelText as w, watch as T, withCtx as E, withDirectives as te } from "vue";
4
4
  //#region src/components/BlessCommand.vue?vue&type=script&setup=true&lang.ts
5
- var k = { class: "bless-command__box" }, A = { class: "bless-command__search bless-lean--field" }, j = [
5
+ var ne = { class: "bless-command__box" }, re = { class: "bless-command__search bless-lean--field" }, ie = ["title", "aria-label"], ae = [
6
6
  "placeholder",
7
7
  "aria-label",
8
8
  "aria-controls",
9
- "aria-activedescendant"
10
- ], M = ["id", "aria-label"], ee = ["aria-labelledby"], N = ["id"], P = [
9
+ "aria-activedescendant",
10
+ "aria-describedby"
11
+ ], oe = ["id"], D = ["id", "aria-label"], O = ["aria-labelledby"], se = ["id"], ce = [
11
12
  "id",
12
13
  "aria-selected",
13
14
  "aria-disabled",
14
15
  "onMousemove",
15
16
  "onClick"
16
- ], F = {
17
+ ], k = {
17
18
  class: "bless-command__mark",
18
19
  "aria-hidden": "true"
19
- }, I = { class: "bless-command__label" }, L = {
20
+ }, le = { class: "bless-command__label" }, ue = {
20
21
  class: "bless-command__empty",
21
22
  role: "status"
22
- }, R = {
23
- key: 0,
23
+ }, de = {
24
+ key: 1,
24
25
  class: "bless-command__footer"
25
- }, z = /*@__PURE__*/ l({
26
+ }, A = /*@__PURE__*/ l({
26
27
  name: "BlessCommand",
27
28
  __name: "BlessCommand",
28
29
  props: /*@__PURE__*/ u({
@@ -35,120 +36,186 @@ var k = { class: "bless-command__box" }, A = { class: "bless-command__search ble
35
36
  default: !0
36
37
  },
37
38
  inline: { type: Boolean },
38
- filter: {}
39
+ filter: {},
40
+ scopes: {},
41
+ recent: { type: Boolean },
42
+ recentLimit: { default: 5 },
43
+ persist: {},
44
+ labels: {}
39
45
  }, {
40
46
  open: {
41
47
  type: Boolean,
42
48
  default: !1
43
49
  },
44
- openModifiers: {}
50
+ openModifiers: {},
51
+ history: { default: () => [] },
52
+ historyModifiers: {}
45
53
  }),
46
- emits: /*@__PURE__*/ u(["select"], ["update:open"]),
54
+ emits: /*@__PURE__*/ u(["select"], ["update:open", "update:history"]),
47
55
  setup(l, { emit: u }) {
48
- let z = l, B = w(l, "open"), V = u, H = C(), U = _(""), W = _(0), G = _(), K = (e, t) => {
56
+ let A = l, j = r(() => ({
57
+ recent: "Recent",
58
+ scope: (e) => `Only in ${e}`,
59
+ clearScope: "Search everywhere",
60
+ scopeHint: (e) => `Type ${e.join(", ")}`,
61
+ ...A.labels
62
+ })), M = C(l, "open"), N = C(l, "history"), P = u, F = S(), I = _(""), L = _(0), R = _(), z = (e, t) => {
49
63
  let n = [e.label, ...e.keywords ?? []].join(" ").toLowerCase();
50
64
  return t.split(/\s+/).every((e) => n.includes(e));
51
- }, q = r(() => {
52
- let e = U.value.trim().toLowerCase(), t = z.filter ?? K;
53
- return z.items.filter((n) => !e || t(n, e));
54
- }), J = r(() => {
65
+ }, B = _(null);
66
+ T(I, (e) => {
67
+ if (B.value || !A.scopes?.length) return;
68
+ let t = A.scopes.find((t) => e.startsWith(t.key));
69
+ t && (B.value = t, I.value = e.slice(t.key.length).replace(/^\s+/, ""));
70
+ });
71
+ let V = (e) => e.label ?? e.group;
72
+ function fe() {
73
+ B.value = null, f(() => R.value?.focus());
74
+ }
75
+ let H = r(() => A.scopes?.length && !B.value ? j.value.scopeHint(A.scopes.map((e) => `${e.key} ${V(e)}`)) : ""), U = r(() => {
76
+ let e = I.value.trim().toLowerCase(), t = A.filter ?? z;
77
+ return (B.value ? A.items.filter((e) => e.group === B.value.group) : A.items).filter((n) => !e || t(n, e));
78
+ }), W = r(() => !A.recent || I.value.trim() || B.value ? [] : N.value.map((e) => A.items.find((t) => t.value === e && !t.disabled)).filter((e) => !!e).slice(0, A.recentLimit)), G = r(() => {
55
79
  let e = /* @__PURE__ */ new Map();
56
- for (let t of q.value) e.set(t.group ?? "", [...e.get(t.group ?? "") ?? [], t]);
57
- return [...e.entries()];
58
- }), Y = r(() => J.value.flatMap(([, e]) => e)), X = r(() => Y.value[W.value] ? `${H}-${Y.value[W.value].value}` : void 0);
59
- E(q, () => W.value = Math.max(0, Y.value.findIndex((e) => !e.disabled))), E(B, (e) => {
60
- e && (U.value = "", f(() => f(() => G.value?.focus())));
80
+ for (let t of U.value) e.set(t.group ?? "", [...e.get(t.group ?? "") ?? [], t]);
81
+ let t = [...e.entries()].map(([e, t]) => ({
82
+ key: e,
83
+ label: e,
84
+ items: t,
85
+ recent: !1
86
+ }));
87
+ return W.value.length && t.unshift({
88
+ key: "\0recent",
89
+ label: j.value.recent,
90
+ items: W.value,
91
+ recent: !0
92
+ }), t;
93
+ }), K = r(() => G.value.flatMap((e) => e.items)), q = (e, t) => `${F}-${t ? "r-" : ""}${e.value}`, J = r(() => {
94
+ let e = 0;
95
+ for (let t of G.value) for (let n of t.items) if (e++ === L.value) return q(n, t.recent);
96
+ }), Y = (e) => G.value.slice(0, e).reduce((e, t) => e + t.items.length, 0);
97
+ T(U, () => L.value = Math.max(0, K.value.findIndex((e) => !e.disabled))), T(B, () => L.value = Math.max(0, K.value.findIndex((e) => !e.disabled))), T(M, (e) => {
98
+ e && (I.value = "", B.value = null, f(() => f(() => R.value?.focus())));
61
99
  });
62
- function Z(e) {
63
- let t = Y.value.length;
100
+ function X(e) {
101
+ let t = K.value.length;
64
102
  if (!t) return;
65
- let n = W.value;
66
- for (let r = 0; r < t && (n = (n + e + t) % t, Y.value[n].disabled); r++);
67
- W.value = n, f(() => document.getElementById(X.value ?? "")?.scrollIntoView?.({ block: "nearest" }));
103
+ let n = L.value;
104
+ for (let r = 0; r < t && (n = (n + e + t) % t, K.value[n].disabled); r++);
105
+ L.value = n, f(() => document.getElementById(J.value ?? "")?.scrollIntoView?.({ block: "nearest" }));
106
+ }
107
+ let Z = r(() => A.persist ? `bless-command:${A.persist}` : null);
108
+ function pe(e) {
109
+ if (!A.recent) return;
110
+ let t = [e.value, ...N.value.filter((t) => t !== e.value)].slice(0, 20);
111
+ N.value = t;
112
+ try {
113
+ Z.value && localStorage.setItem(Z.value, JSON.stringify(t));
114
+ } catch {}
68
115
  }
69
- function Q(e = Y.value[W.value]) {
70
- e && !e.disabled && (V("select", e), z.inline || (B.value = !1));
116
+ function Q(e = K.value[L.value]) {
117
+ e && !e.disabled && (pe(e), P("select", e), A.inline || (M.value = !1));
71
118
  }
72
- function te(e) {
73
- e.key === "ArrowDown" ? (e.preventDefault(), Z(1)) : e.key === "ArrowUp" ? (e.preventDefault(), Z(-1)) : e.key === "Enter" ? (e.preventDefault(), Q()) : e.key === "Home" ? (e.preventDefault(), W.value = 0) : e.key === "End" && (e.preventDefault(), W.value = Y.value.length - 1);
119
+ function me(e) {
120
+ e.key === "ArrowDown" ? (e.preventDefault(), X(1)) : e.key === "ArrowUp" ? (e.preventDefault(), X(-1)) : e.key === "Enter" ? (e.preventDefault(), Q()) : e.key === "Backspace" && !I.value && B.value ? (e.preventDefault(), B.value = null) : e.key === "Home" ? (e.preventDefault(), L.value = 0) : e.key === "End" && (e.preventDefault(), L.value = K.value.length - 1);
74
121
  }
75
122
  function $(e) {
76
- e.target?.closest?.("[contenteditable]:not([contenteditable=\"false\"])") || z.hotkey && !z.inline && (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k" && (e.preventDefault(), B.value = !B.value);
123
+ e.target?.closest?.("[contenteditable]:not([contenteditable=\"false\"])") || A.hotkey && !A.inline && (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k" && (e.preventDefault(), M.value = !M.value);
77
124
  }
78
- return h(() => addEventListener("keydown", $)), m(() => removeEventListener("keydown", $)), (r, u) => (g(), i(b(l.inline ? "div" : e), d(l.inline ? {} : {
79
- modelValue: B.value,
80
- "onUpdate:modelValue": (e) => B.value = e,
125
+ return h(() => {
126
+ addEventListener("keydown", $);
127
+ try {
128
+ let e = Z.value && localStorage.getItem(Z.value), t = e ? JSON.parse(e) : null;
129
+ Array.isArray(t) && !N.value.length && (N.value = t.filter((e) => typeof e == "string"));
130
+ } catch {}
131
+ }), m(() => removeEventListener("keydown", $)), (r, u) => (g(), i(ee(l.inline ? "div" : e), d(l.inline ? {} : {
132
+ modelValue: M.value,
133
+ "onUpdate:modelValue": (e) => M.value = e,
81
134
  size: "md"
82
135
  }, { class: ["bless-command", { "bless-command--inline": l.inline }] }), {
83
- default: D(() => [s("div", k, [
84
- s("div", A, [
85
- u[2] ||= s("span", {
136
+ default: E(() => [s("div", ne, [
137
+ s("div", re, [
138
+ u[3] ||= s("span", {
86
139
  class: "bless-command__icon",
87
140
  "aria-hidden": "true"
88
141
  }, "⌕", -1),
89
- O(s("input", {
142
+ B.value ? (g(), o("button", {
143
+ key: 0,
144
+ type: "button",
145
+ class: "bless-command__scope",
146
+ title: j.value.clearScope,
147
+ "aria-label": `${j.value.scope(V(B.value))}. ${j.value.clearScope}`,
148
+ onClick: fe
149
+ }, [c(b(V(B.value)) + " ", 1), u[1] ||= s("span", { "aria-hidden": "true" }, "×", -1)], 8, ie)) : a("", !0),
150
+ te(s("input", {
90
151
  ref_key: "input",
91
- ref: G,
92
- "onUpdate:modelValue": u[0] ||= (e) => U.value = e,
152
+ ref: R,
153
+ "onUpdate:modelValue": u[0] ||= (e) => I.value = e,
93
154
  type: "text",
94
155
  class: "bless-command__input",
95
156
  placeholder: l.placeholder,
96
157
  role: "combobox",
97
- "aria-label": l.label,
158
+ "aria-label": B.value ? `${l.label}: ${j.value.scope(V(B.value))}` : l.label,
98
159
  "aria-autocomplete": "list",
99
160
  "aria-expanded": !0,
100
- "aria-controls": `${S(H)}-list`,
101
- "aria-activedescendant": X.value,
161
+ "aria-controls": `${x(F)}-list`,
162
+ "aria-activedescendant": J.value,
163
+ "aria-describedby": H.value ? `${x(F)}-hint` : void 0,
102
164
  autocomplete: "off",
103
165
  spellcheck: "false",
104
- onKeydown: te
105
- }, null, 40, j), [[T, U.value]]),
106
- l.inline ? a("", !0) : (g(), i(t, { key: 0 }, {
107
- default: D(() => [...u[1] ||= [c("Esc", -1)]]),
166
+ onKeydown: me
167
+ }, null, 40, ae), [[w, I.value]]),
168
+ l.inline ? a("", !0) : (g(), i(t, { key: 1 }, {
169
+ default: E(() => [...u[2] ||= [c("Esc", -1)]]),
108
170
  _: 1
109
171
  }))
110
172
  ]),
173
+ H.value ? (g(), o("p", {
174
+ key: 0,
175
+ id: `${x(F)}-hint`,
176
+ class: "bless-command__hint"
177
+ }, b(H.value), 9, oe)) : a("", !0),
111
178
  s("div", {
112
- id: `${S(H)}-list`,
179
+ id: `${x(F)}-list`,
113
180
  class: "bless-command__list",
114
181
  role: "listbox",
115
182
  "aria-label": l.label
116
- }, [(g(!0), o(n, null, v(J.value, ([e, l]) => (g(), o("div", {
117
- key: e,
183
+ }, [(g(!0), o(n, null, v(G.value, (e, l) => (g(), o("div", {
184
+ key: e.key,
118
185
  role: "group",
119
- "aria-labelledby": e ? `${S(H)}-g-${J.value.findIndex(([t]) => t === e)}` : void 0,
186
+ "aria-labelledby": e.label ? `${x(F)}-g-${l}` : void 0,
120
187
  class: "bless-command__section"
121
- }, [e ? (g(), o("div", {
188
+ }, [e.label ? (g(), o("div", {
122
189
  key: 0,
123
- id: `${S(H)}-g-${J.value.findIndex(([t]) => t === e)}`,
190
+ id: `${x(F)}-g-${l}`,
124
191
  class: "bless-command__group",
125
192
  "aria-hidden": "true"
126
- }, x(e), 9, N)) : a("", !0), (g(!0), o(n, null, v(l, (e) => (g(), o("div", {
127
- key: e.value,
128
- id: `${S(H)}-${e.value}`,
129
- class: p(["bless-command__item", { "bless-command__item--active": Y.value[W.value] === e }]),
193
+ }, b(e.label), 9, se)) : a("", !0), (g(!0), o(n, null, v(e.items, (n, u) => (g(), o("div", {
194
+ key: n.value,
195
+ id: q(n, e.recent),
196
+ class: p(["bless-command__item", { "bless-command__item--active": L.value === Y(l) + u }]),
130
197
  role: "option",
131
- "aria-selected": Y.value[W.value] === e,
132
- "aria-disabled": e.disabled || void 0,
133
- onMousemove: (t) => W.value = Y.value.indexOf(e),
134
- onClick: (t) => Q(e)
198
+ "aria-selected": L.value === Y(l) + u,
199
+ "aria-disabled": n.disabled || void 0,
200
+ onMousemove: (e) => L.value = Y(l) + u,
201
+ onClick: (e) => Q(n)
135
202
  }, [
136
- s("span", F, x(e.icon ?? ""), 1),
137
- s("span", I, [y(r.$slots, "item", { item: e }, () => [c(x(e.label), 1)])]),
138
- e.shortcut ? (g(), i(t, {
203
+ s("span", k, b(n.icon ?? ""), 1),
204
+ s("span", le, [y(r.$slots, "item", { item: n }, () => [c(b(n.label), 1)])]),
205
+ n.shortcut ? (g(), i(t, {
139
206
  key: 0,
140
207
  class: "bless-command__shortcut"
141
208
  }, {
142
- default: D(() => [c(x(e.shortcut), 1)]),
209
+ default: E(() => [c(b(n.shortcut), 1)]),
143
210
  _: 2
144
211
  }, 1024)) : a("", !0)
145
- ], 42, P))), 128))], 8, ee))), 128))], 8, M),
146
- s("p", L, x(Y.value.length ? "" : l.emptyText), 1),
147
- r.$slots.footer ? (g(), o("div", R, [y(r.$slots, "footer")])) : a("", !0)
212
+ ], 42, ce))), 128))], 8, O))), 128))], 8, D),
213
+ s("p", ue, b(K.value.length ? "" : l.emptyText), 1),
214
+ r.$slots.footer ? (g(), o("div", de, [y(r.$slots, "footer")])) : a("", !0)
148
215
  ])]),
149
216
  _: 3
150
217
  }, 16, ["class"]));
151
218
  }
152
219
  });
153
220
  //#endregion
154
- export { z as default };
221
+ export { A as default };
@@ -0,0 +1 @@
1
+ .bless-confetti{pointer-events:none;width:100vw;height:100vh;z-index:calc(var(--bless-z-modal) + 1);position:fixed;inset:0}
@@ -0,0 +1,6 @@
1
+ import "./BlessConfetti.css";
2
+ import e from "./BlessConfetti.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessConfetti.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,40 @@
1
+ type __VLS_Props = {
2
+ /** pieces per burst */
3
+ count?: number;
4
+ /** token names (`chart-2`, `accent`…) or CSS colours */
5
+ colors?: string[];
6
+ /** milliseconds until the last piece has faded */
7
+ duration?: number;
8
+ /** width of the cone the pieces leave in, degrees; 360 is all around */
9
+ spread?: number;
10
+ /** launch strength, px per second */
11
+ power?: number;
12
+ gravity?: number;
13
+ };
14
+ declare function stop(): void;
15
+ /**
16
+ * Throw a burst. `from` is a point in viewport px or an element to burst out of (default: the
17
+ * middle of the window); `angle` points the cone (default straight up). Does nothing under
18
+ * `prefers-reduced-motion`.
19
+ */
20
+ declare function fire(from?: {
21
+ x: number;
22
+ y: number;
23
+ } | HTMLElement, angle?: number): undefined;
24
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {
25
+ fire: typeof fire;
26
+ stop: typeof stop;
27
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
+ done: () => any;
29
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
30
+ onDone?: (() => any) | undefined;
31
+ }>, {
32
+ duration: number;
33
+ count: number;
34
+ colors: string[];
35
+ spread: number;
36
+ power: number;
37
+ gravity: number;
38
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
39
+ declare const _default: typeof __VLS_export;
40
+ export default _default;
@@ -0,0 +1,77 @@
1
+ import { reducedMotion as e } from "../composables/useMedia.js";
2
+ import { burst as t, step as n } from "../composables/confetti.js";
3
+ import { createElementBlock as r, defineComponent as i, onBeforeUnmount as a, openBlock as o, ref as s } from "vue";
4
+ //#region src/components/BlessConfetti.vue?vue&type=script&setup=true&lang.ts
5
+ var c = /*@__PURE__*/ i({
6
+ name: "BlessConfetti",
7
+ __name: "BlessConfetti",
8
+ props: {
9
+ count: { default: 90 },
10
+ colors: { default: () => [
11
+ "chart-1",
12
+ "chart-2",
13
+ "chart-3",
14
+ "chart-4",
15
+ "chart-5",
16
+ "warning"
17
+ ] },
18
+ duration: { default: 2200 },
19
+ spread: { default: 80 },
20
+ power: { default: 900 },
21
+ gravity: { default: 1400 }
22
+ },
23
+ emits: ["done"],
24
+ setup(i, { expose: c, emit: l }) {
25
+ let u = i, d = l, f = s(), p = [], m = 0, h = 0, g = (e) => /^[a-z0-9-]+$/i.test(e) && f.value && getComputedStyle(f.value).getPropertyValue(`--bless-color-${e}`).trim() || e;
26
+ function _(e) {
27
+ let t = f.value, r = t?.getContext("2d");
28
+ if (!t || !r) return v();
29
+ let i = Math.min(.05, (e - h) / 1e3);
30
+ h = e, r.clearRect(0, 0, t.width, t.height);
31
+ let a = window.devicePixelRatio || 1;
32
+ for (let e of p) n(e, i, u.gravity, u.duration / 1e3), !(e.life <= 0) && (r.save(), r.globalAlpha = Math.min(1, e.life * 3), r.fillStyle = e.color, r.translate(e.x * a, e.y * a), r.rotate(e.rot), e.round ? (r.beginPath(), r.arc(0, 0, e.size * a / 2, 0, Math.PI * 2), r.fill()) : r.fillRect(-e.size * a / 2, -e.size * a / 3, e.size * a, e.size * a / 1.6), r.restore());
33
+ p = p.filter((e) => e.life > 0 && e.y < window.innerHeight + 40), p.length ? m = requestAnimationFrame(_) : (v(), d("done"));
34
+ }
35
+ function v() {
36
+ cancelAnimationFrame(m), m = 0, p = [];
37
+ let e = f.value;
38
+ e?.getContext("2d")?.clearRect(0, 0, e.width, e.height);
39
+ }
40
+ function y(n, r = 270) {
41
+ let i = f.value;
42
+ if (!i || e()) return void d("done");
43
+ let a = window.devicePixelRatio || 1;
44
+ i.width = window.innerWidth * a, i.height = window.innerHeight * a;
45
+ let o = {
46
+ x: window.innerWidth / 2,
47
+ y: window.innerHeight * .65
48
+ };
49
+ if (n instanceof HTMLElement) {
50
+ let e = n.getBoundingClientRect();
51
+ o = {
52
+ x: e.left + e.width / 2,
53
+ y: e.top + e.height / 2
54
+ };
55
+ } else n && (o = n);
56
+ p.push(...t({
57
+ count: u.count,
58
+ origin: o,
59
+ angle: r,
60
+ spread: u.spread,
61
+ power: u.power,
62
+ colors: u.colors.map(g)
63
+ })), m ||= (h = performance.now(), requestAnimationFrame(_));
64
+ }
65
+ return a(v), c({
66
+ fire: y,
67
+ stop: v
68
+ }), (e, t) => (o(), r("canvas", {
69
+ ref_key: "canvas",
70
+ ref: f,
71
+ class: "bless-confetti",
72
+ "aria-hidden": "true"
73
+ }, null, 512));
74
+ }
75
+ });
76
+ //#endregion
77
+ export { c as default };
@@ -18,6 +18,14 @@ declare const __VLS_export: import('vue').DefineComponent<{
18
18
  /** show the rotate buttons */
19
19
  controls?: boolean;
20
20
  label?: string;
21
+ /** the crop readout said after a keystroke, the hint under the image and the rotate buttons */
22
+ labels?: Partial<{
23
+ size: (width: number, height: number, x: number, y: number) => string;
24
+ hint: string;
25
+ rotateLeft: string;
26
+ rotateRight: string;
27
+ loadError: string;
28
+ }>;
21
29
  } & {
22
30
  modelValue?: BlessCropRect | null;
23
31
  }, {
@@ -41,6 +49,14 @@ declare const __VLS_export: import('vue').DefineComponent<{
41
49
  /** show the rotate buttons */
42
50
  controls?: boolean;
43
51
  label?: string;
52
+ /** the crop readout said after a keystroke, the hint under the image and the rotate buttons */
53
+ labels?: Partial<{
54
+ size: (width: number, height: number, x: number, y: number) => string;
55
+ hint: string;
56
+ rotateLeft: string;
57
+ rotateRight: string;
58
+ loadError: string;
59
+ }>;
44
60
  } & {
45
61
  modelValue?: BlessCropRect | null;
46
62
  }> & Readonly<{