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
@@ -0,0 +1,217 @@
1
+ import e from "./BlessButton.js";
2
+ import { addDays as t, addMonths as n, fromISO as r, isoToday as i, toISO as a } from "../composables/date.js";
3
+ import { applyRange as o, blocks as s, rangeBetween as c } from "../composables/dayBlocks.js";
4
+ import { Fragment as l, computed as u, createCommentVNode as ee, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, nextTick as te, normalizeClass as ne, onMounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, toDisplayString as S, unref as C, useId as re, useModel as ie, withCtx as w } from "vue";
5
+ //#region src/components/BlessRangeCalendar.vue?vue&type=script&setup=true&lang.ts
6
+ var T = ["aria-label"], ae = { class: "bless-range__bar" }, oe = {
7
+ class: "bless-range__title",
8
+ "aria-live": "polite"
9
+ }, se = ["aria-label"], ce = {
10
+ class: "bless-range__row",
11
+ role: "row"
12
+ }, le = {
13
+ key: 0,
14
+ class: "bless-range__gap",
15
+ role: "gridcell",
16
+ "aria-hidden": "true"
17
+ }, ue = [
18
+ "id",
19
+ "data-day",
20
+ "aria-selected",
21
+ "aria-disabled",
22
+ "aria-label",
23
+ "aria-current",
24
+ "tabindex",
25
+ "onPointerdown",
26
+ "onKeydown",
27
+ "onFocus"
28
+ ], E = { class: "bless-range__foot" }, D = { class: "bless-range__summary" }, O = {
29
+ class: "bless-range__live",
30
+ "aria-live": "polite"
31
+ }, k = /*@__PURE__*/ h({
32
+ name: "BlessRangeCalendar",
33
+ __name: "BlessRangeCalendar",
34
+ props: /*@__PURE__*/ g({
35
+ weekStart: { default: 1 },
36
+ locale: { default: "en" },
37
+ min: {},
38
+ max: {},
39
+ disabledDates: {},
40
+ month: {},
41
+ label: { default: "Days" },
42
+ labels: {}
43
+ }, {
44
+ modelValue: { default: () => [] },
45
+ modelModifiers: {}
46
+ }),
47
+ emits: /*@__PURE__*/ g(["change"], ["update:modelValue"]),
48
+ setup(h, { emit: g }) {
49
+ let k = h, A = ie(h, "modelValue"), j = g, M = u(() => ({
50
+ prev: "Previous month",
51
+ next: "Next month",
52
+ clear: "Clear all",
53
+ summary: (e, t) => e ? `${e} day${e === 1 ? "" : "s"} in ${t} block${t === 1 ? "" : "s"}` : "No days chosen",
54
+ selected: (e) => `${e} chosen`,
55
+ cleared: (e) => `${e} cleared`,
56
+ hint: "Arrow keys move, Space toggles a day, hold Shift and press arrows to paint, Page Up and Down change month.",
57
+ ...k.labels
58
+ })), N = re(), P = `${N}-hint`, F = y(k.month ? r(`${k.month}-01`) : A.value[0] ? r(`${A.value[0].slice(0, 7)}-01`) : null), I = y(""), L = y("");
59
+ _(() => {
60
+ I.value = i(), F.value ??= r(`${I.value.slice(0, 7)}-01`), L.value = R(F.value);
61
+ });
62
+ let R = (e) => a(new Date(e.getFullYear(), e.getMonth(), 1)), z = u(() => new Intl.DateTimeFormat(k.locale, {
63
+ month: "long",
64
+ year: "numeric"
65
+ })), B = u(() => new Intl.DateTimeFormat(k.locale, {
66
+ weekday: "long",
67
+ day: "numeric",
68
+ month: "long",
69
+ year: "numeric"
70
+ })), V = u(() => new Intl.DateTimeFormat(k.locale, { weekday: "short" })), H = u(() => Array.from({ length: 7 }, (e, n) => V.value.format(t(new Date(2023, 0, 1 + k.weekStart + n), 0)))), U = (e) => k.min != null && e < k.min || k.max != null && e > k.max || !!k.disabledDates?.(e), W = u(() => new Set(A.value)), G = u(() => {
71
+ let e = F.value;
72
+ if (!e) return [];
73
+ let t = (new Date(e.getFullYear(), e.getMonth(), 1).getDay() - k.weekStart + 7) % 7, n = new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate(), r = [...Array(t).fill(null), ...Array.from({ length: n }, (t, n) => a(new Date(e.getFullYear(), e.getMonth(), n + 1)))];
74
+ for (; r.length % 7;) r.push(null);
75
+ return Array.from({ length: r.length / 7 }, (e, t) => r.slice(t * 7, t * 7 + 7));
76
+ }), K = y(null), q = u(() => K.value ? new Set(c(K.value.from, K.value.to)) : null), J = y("");
77
+ function Y(e, t) {
78
+ let n = o(A.value, e, t, (e) => !U(e));
79
+ n.join() !== A.value.join() && (A.value = n, j("change", s(n)));
80
+ }
81
+ let de = (e, t) => document.elementFromPoint(e, t)?.closest("[data-day]")?.dataset.day;
82
+ function fe(e, t) {
83
+ t.button || U(e) || (t.currentTarget.setPointerCapture?.(t.pointerId), L.value = e, K.value = {
84
+ from: e,
85
+ to: e,
86
+ mode: W.value.has(e) ? "clear" : "set"
87
+ });
88
+ }
89
+ function pe(e) {
90
+ let t = K.value, n = t && de(e.clientX, e.clientY);
91
+ t && n && (K.value = {
92
+ ...t,
93
+ to: n
94
+ });
95
+ }
96
+ function me() {
97
+ let e = K.value;
98
+ K.value = null, e && (Y(c(e.from, e.to), e.mode), J.value = (e.mode === "set" ? M.value.selected : M.value.cleared)(e.from === e.to ? B.value.format(r(e.from)) : `${e.from} – ${e.to}`));
99
+ }
100
+ let X = null, he = (e) => te(() => document.getElementById(`${N}-${e}`)?.focus());
101
+ function Z(e) {
102
+ let t = r(e);
103
+ (!F.value || t.getMonth() !== F.value.getMonth() || t.getFullYear() !== F.value.getFullYear()) && (F.value = new Date(t.getFullYear(), t.getMonth(), 1)), L.value = e, he(e);
104
+ }
105
+ function ge(e, i) {
106
+ let o = {
107
+ ArrowLeft: -1,
108
+ ArrowRight: 1,
109
+ ArrowUp: -7,
110
+ ArrowDown: 7
111
+ }[i.key];
112
+ if (o) {
113
+ i.preventDefault();
114
+ let n = a(t(r(e), o));
115
+ i.shiftKey ? (X ??= W.value.has(e) ? "clear" : "set", Y([e, n], X)) : X = null, Z(n);
116
+ } else if (i.key === " " || i.key === "Enter") {
117
+ if (i.preventDefault(), U(e)) return;
118
+ let t = W.value.has(e) ? "clear" : "set";
119
+ Y([e], t), J.value = (t === "set" ? M.value.selected : M.value.cleared)(B.value.format(r(e)));
120
+ } else if (i.key === "PageDown" || i.key === "PageUp") {
121
+ i.preventDefault();
122
+ let t = n(r(e), i.key === "PageDown" ? 1 : -1), o = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
123
+ Z(a(new Date(t.getFullYear(), t.getMonth(), Math.min(r(e).getDate(), o))));
124
+ } else if (i.key === "Home" || i.key === "End") {
125
+ i.preventDefault();
126
+ let n = (r(e).getDay() - k.weekStart + 7) % 7;
127
+ Z(a(t(r(e), i.key === "Home" ? -n : 6 - n)));
128
+ }
129
+ }
130
+ let _e = (e) => e.key === "Shift" && (X = null), Q = (e) => {
131
+ F.value && (F.value = n(F.value, e), L.value = R(F.value));
132
+ }, $ = u(() => s(A.value)), ve = u(() => M.value.summary(A.value.length, $.value.length)), ye = u(() => G.value.flat().includes(L.value) ? L.value : R(F.value ?? /* @__PURE__ */ new Date()));
133
+ return (t, n) => (v(), d("div", {
134
+ class: "bless-range",
135
+ role: "group",
136
+ "aria-label": h.label
137
+ }, [
138
+ f("div", ae, [
139
+ m(e, {
140
+ size: "sm",
141
+ variant: "ghost",
142
+ "aria-label": M.value.prev,
143
+ onClick: n[0] ||= (e) => Q(-1)
144
+ }, {
145
+ default: w(() => [...n[4] ||= [p("‹", -1)]]),
146
+ _: 1
147
+ }, 8, ["aria-label"]),
148
+ f("strong", oe, S(F.value ? z.value.format(F.value) : ""), 1),
149
+ m(e, {
150
+ size: "sm",
151
+ variant: "ghost",
152
+ "aria-label": M.value.next,
153
+ onClick: n[1] ||= (e) => Q(1)
154
+ }, {
155
+ default: w(() => [...n[5] ||= [p("›", -1)]]),
156
+ _: 1
157
+ }, 8, ["aria-label"])
158
+ ]),
159
+ F.value ? (v(), d("div", {
160
+ key: 0,
161
+ class: "bless-range__grid",
162
+ role: "grid",
163
+ "aria-label": `${h.label}, ${z.value.format(F.value)}`,
164
+ "aria-describedby": P,
165
+ "aria-multiselectable": "true",
166
+ onKeyup: _e
167
+ }, [f("div", ce, [(v(!0), d(l, null, b(H.value, (e) => (v(), d("span", {
168
+ key: e,
169
+ class: "bless-range__head",
170
+ role: "columnheader"
171
+ }, S(e), 1))), 128))]), (v(!0), d(l, null, b(G.value, (e, t) => (v(), d("div", {
172
+ key: t,
173
+ class: "bless-range__row",
174
+ role: "row"
175
+ }, [(v(!0), d(l, null, b(e, (e, t) => (v(), d(l, { key: t }, [e ? (v(), d("button", {
176
+ key: 1,
177
+ id: `${C(N)}-${e}`,
178
+ type: "button",
179
+ role: "gridcell",
180
+ class: ne(["bless-range__day", {
181
+ "bless-range__day--on": W.value.has(e),
182
+ "bless-range__day--set": K.value?.mode === "set" && q.value?.has(e),
183
+ "bless-range__day--clear": K.value?.mode === "clear" && q.value?.has(e),
184
+ "bless-range__day--today": e === I.value
185
+ }]),
186
+ "data-day": e,
187
+ "aria-selected": W.value.has(e),
188
+ "aria-disabled": U(e) || void 0,
189
+ "aria-label": B.value.format(C(r)(e)),
190
+ "aria-current": e === I.value ? "date" : void 0,
191
+ tabindex: ye.value === e ? 0 : -1,
192
+ onPointerdown: (t) => fe(e, t),
193
+ onPointermove: pe,
194
+ onPointerup: me,
195
+ onPointercancel: n[2] ||= (e) => K.value = null,
196
+ onKeydown: (t) => ge(e, t),
197
+ onFocus: (t) => L.value = e
198
+ }, S(Number(e.slice(8))), 43, ue)) : (v(), d("span", le))], 64))), 128))]))), 128))], 40, se)) : ee("", !0),
199
+ f("div", E, [f("span", D, [x(t.$slots, "summary", { blocks: $.value }, () => [p(S(ve.value), 1)])]), m(e, {
200
+ size: "sm",
201
+ variant: "outline",
202
+ disabled: !A.value.length,
203
+ onClick: n[3] ||= (e) => (A.value = [], j("change", []))
204
+ }, {
205
+ default: w(() => [p(S(M.value.clear), 1)]),
206
+ _: 1
207
+ }, 8, ["disabled"])]),
208
+ f("span", {
209
+ id: P,
210
+ hidden: ""
211
+ }, S(M.value.hint), 1),
212
+ f("span", O, S(J.value), 1)
213
+ ], 8, T));
214
+ }
215
+ });
216
+ //#endregion
217
+ export { k as default };
@@ -0,0 +1 @@
1
+ .bless-sched{gap:var(--bless-space-2);font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);display:grid;position:relative}.bless-sched__bar{align-items:center;gap:var(--bless-space-2);flex-wrap:wrap;display:flex}.bless-sched__title{margin-inline-start:var(--bless-space-2)}.bless-sched__add{margin-inline-start:auto}.bless-sched__scroll{border:var(--bless-border-width) solid var(--bless-color-border);max-height:560px;overflow:auto}.bless-sched__head,.bless-sched__body{grid-template-columns:56px 1fr;min-width:560px;display:grid}.bless-sched__head{z-index:3;background:var(--bless-color-bg);border-bottom:var(--bless-border-width) solid var(--bless-color-border);grid-template-columns:56px repeat(var(--_n), minmax(0, 1fr));position:sticky;top:0}.bless-sched__day{padding:var(--bless-space-1) var(--bless-space-2);text-align:center;font-weight:var(--bless-font-weight-bold,700)}.bless-sched__day--today{color:var(--bless-color-accent-text)}.bless-sched__gutter{border-inline-end:var(--bless-border-width) solid var(--bless-color-border);color:var(--bless-color-text-muted);font-size:var(--bless-text-xs);position:relative}.bless-sched__hour{position:absolute;inset-inline-end:var(--bless-space-2);translate:0 -50%}.bless-sched__cols{grid-template-columns:repeat(var(--_n), minmax(0, 1fr));background-image:repeating-linear-gradient(to bottom, var(--bless-color-border) 0 1px, transparent 1px var(--_h));outline:none;display:grid;position:relative}.bless-sched__col{border-inline-start:var(--bless-border-width) solid var(--bless-color-border);touch-action:pan-y;cursor:crosshair;position:relative}.bless-sched__event{box-sizing:border-box;padding:2px var(--bless-space-2);background:color-mix(in srgb, var(--bless-color-accent) 20%, var(--bless-color-bg));border:var(--bless-border-width) solid var(--bless-color-accent);cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;border-inline-start-width:4px;flex-direction:column;display:flex;position:absolute;overflow:hidden}.bless-sched__event--sel{outline:2px solid var(--bless-color-text);outline-offset:1px;z-index:2}.bless-sched__event:focus-visible{outline:3px solid var(--bless-color-text);outline-offset:1px;z-index:2}.bless-sched__event--draft{pointer-events:none;border-style:dashed;left:1px;right:1px}.bless-sched__etitle{text-overflow:ellipsis;white-space:nowrap;font-weight:var(--bless-font-weight-bold,700);overflow:hidden}.bless-sched__etime{font-size:var(--bless-text-xs)}.bless-sched__foot{inset-inline:0;cursor:ns-resize;height:8px;position:absolute;bottom:0}.bless-sched__edit{align-items:center;gap:var(--bless-space-3);flex-wrap:wrap;display:flex}.bless-sched__field{align-items:center;gap:var(--bless-space-2);display:flex}.bless-sched__input{min-height:32px;padding:var(--bless-space-1) var(--bless-space-2);background:var(--bless-color-bg);border:var(--bless-border-width) solid var(--bless-color-border);color:inherit;font:inherit}.bless-sched__input:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:1px}.bless-sched__live{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}
@@ -0,0 +1,6 @@
1
+ import "./BlessScheduler.css";
2
+ import e from "./BlessScheduler.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessScheduler.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,95 @@
1
+ import { ScheduleEvent } from '../composables/schedule';
2
+ export type { ScheduleEvent as BlessScheduleEvent } from '../composables/schedule';
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
5
+ declare const __VLS_export: import('vue').DefineComponent<{
6
+ view?: "day" | "week";
7
+ /** 0 = Sunday, 1 = Monday */
8
+ weekStart?: 0 | 1;
9
+ /** first and last hour shown (0–24) */
10
+ dayStart?: number;
11
+ dayEnd?: number;
12
+ /** minutes events snap to */
13
+ snap?: number;
14
+ /** px per hour */
15
+ hourHeight?: number;
16
+ locale?: string;
17
+ editable?: boolean;
18
+ label?: string;
19
+ labels?: Partial<{
20
+ prev: string;
21
+ next: string;
22
+ today: string;
23
+ add: string;
24
+ remove: string;
25
+ title: string;
26
+ newEvent: string;
27
+ eventName: (title: string, day: string, from: string, to: string) => string;
28
+ moved: (title: string, day: string, from: string, to: string) => string;
29
+ added: (title: string) => string;
30
+ removed: (title: string) => string;
31
+ hint: string;
32
+ }>;
33
+ } & {
34
+ modelValue?: ScheduleEvent[];
35
+ /** any day in the period shown */
36
+ date?: string | null;
37
+ selected?: string | null;
38
+ }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
39
+ change: (event: ScheduleEvent) => any;
40
+ "update:modelValue": (value: ScheduleEvent[]) => any;
41
+ create: (event: ScheduleEvent) => any;
42
+ remove: (event: ScheduleEvent) => any;
43
+ "update:selected": (value: string | null) => any;
44
+ "update:date": (value: string | null) => any;
45
+ }, string, import('vue').PublicProps, Readonly<{
46
+ view?: "day" | "week";
47
+ /** 0 = Sunday, 1 = Monday */
48
+ weekStart?: 0 | 1;
49
+ /** first and last hour shown (0–24) */
50
+ dayStart?: number;
51
+ dayEnd?: number;
52
+ /** minutes events snap to */
53
+ snap?: number;
54
+ /** px per hour */
55
+ hourHeight?: number;
56
+ locale?: string;
57
+ editable?: boolean;
58
+ label?: string;
59
+ labels?: Partial<{
60
+ prev: string;
61
+ next: string;
62
+ today: string;
63
+ add: string;
64
+ remove: string;
65
+ title: string;
66
+ newEvent: string;
67
+ eventName: (title: string, day: string, from: string, to: string) => string;
68
+ moved: (title: string, day: string, from: string, to: string) => string;
69
+ added: (title: string) => string;
70
+ removed: (title: string) => string;
71
+ hint: string;
72
+ }>;
73
+ } & {
74
+ modelValue?: ScheduleEvent[];
75
+ /** any day in the period shown */
76
+ date?: string | null;
77
+ selected?: string | null;
78
+ }> & Readonly<{
79
+ onChange?: ((event: ScheduleEvent) => any) | undefined;
80
+ "onUpdate:modelValue"?: ((value: ScheduleEvent[]) => any) | undefined;
81
+ onCreate?: ((event: ScheduleEvent) => any) | undefined;
82
+ onRemove?: ((event: ScheduleEvent) => any) | undefined;
83
+ "onUpdate:selected"?: ((value: string | null) => any) | undefined;
84
+ "onUpdate:date"?: ((value: string | null) => any) | undefined;
85
+ }>, {
86
+ label: string;
87
+ view: "day" | "week";
88
+ weekStart: 0 | 1;
89
+ locale: string;
90
+ editable: boolean;
91
+ snap: number;
92
+ dayStart: number;
93
+ dayEnd: number;
94
+ hourHeight: number;
95
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,347 @@
1
+ import e from "./BlessButton.js";
2
+ import { addDays as t, fromISO as n, isoToday as r, toISO as i } from "../composables/date.js";
3
+ import { fmtTime as ee, layoutDay as te, moveEvent as a, nextEventId as ne, resizeEvent as o, snapTo as s, weekOf as re } from "../composables/schedule.js";
4
+ import { Fragment as c, computed as l, createBlock as ie, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, nextTick as _, normalizeClass as v, normalizeStyle as y, onMounted as ae, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, useId as oe, useModel as T, withCtx as E } from "vue";
5
+ //#region src/components/BlessScheduler.vue?vue&type=script&setup=true&lang.ts
6
+ var se = ["aria-label"], ce = { class: "bless-sched__bar" }, le = {
7
+ class: "bless-sched__title",
8
+ "aria-live": "polite"
9
+ }, ue = {
10
+ key: 0,
11
+ class: "bless-sched__scroll"
12
+ }, de = { class: "bless-sched__body" }, fe = ["aria-label", "onPointerdown"], pe = [
13
+ "data-event",
14
+ "aria-pressed",
15
+ "aria-label",
16
+ "tabindex",
17
+ "onPointerdown",
18
+ "onKeydown",
19
+ "onFocus"
20
+ ], me = { class: "bless-sched__etitle" }, he = { class: "bless-sched__etime" }, ge = ["onPointerdown"], _e = {
21
+ key: 1,
22
+ class: "bless-sched__edit"
23
+ }, ve = { class: "bless-sched__field" }, ye = ["value"], be = { class: "bless-sched__when" }, xe = {
24
+ class: "bless-sched__live",
25
+ "aria-live": "polite"
26
+ }, D = /*@__PURE__*/ h({
27
+ name: "BlessScheduler",
28
+ __name: "BlessScheduler",
29
+ props: /*@__PURE__*/ g({
30
+ view: { default: "week" },
31
+ weekStart: { default: 1 },
32
+ dayStart: { default: 7 },
33
+ dayEnd: { default: 20 },
34
+ snap: { default: 15 },
35
+ hourHeight: { default: 48 },
36
+ locale: { default: "en" },
37
+ editable: {
38
+ type: Boolean,
39
+ default: !0
40
+ },
41
+ label: { default: "Schedule" },
42
+ labels: {}
43
+ }, {
44
+ modelValue: { default: () => [] },
45
+ modelModifiers: {},
46
+ date: { default: null },
47
+ dateModifiers: {},
48
+ selected: { default: null },
49
+ selectedModifiers: {}
50
+ }),
51
+ emits: /*@__PURE__*/ g([
52
+ "create",
53
+ "change",
54
+ "remove"
55
+ ], [
56
+ "update:modelValue",
57
+ "update:date",
58
+ "update:selected"
59
+ ]),
60
+ setup(h, { emit: g }) {
61
+ let D = h, O = T(h, "modelValue"), k = T(h, "date"), A = T(h, "selected"), j = g, M = l(() => ({
62
+ prev: "Previous",
63
+ next: "Next",
64
+ today: "Today",
65
+ add: "Add event",
66
+ remove: "Remove",
67
+ title: "Title",
68
+ newEvent: "New event",
69
+ eventName: (e, t, n, r) => `${e}, ${t}, ${n} to ${r}`,
70
+ moved: (e, t, n, r) => `${e}: ${t}, ${n} to ${r}`,
71
+ added: (e) => `${e} added`,
72
+ removed: (e) => `${e} removed`,
73
+ hint: "Arrow keys move the event, Alt with up or down changes its length, Delete removes it.",
74
+ ...D.labels
75
+ })), N = `${oe()}-hint`, P = x(""), F = x(), I = x(), L = l(() => k.value ?? O.value[0]?.date ?? null), R = x("");
76
+ ae(() => {
77
+ R.value = r(), L.value || (k.value = R.value);
78
+ });
79
+ let z = l(() => D.dayStart * 60), B = l(() => D.dayEnd * 60), V = (e) => (e - z.value) / 60 * D.hourHeight, H = l(() => (D.dayEnd - D.dayStart) * D.hourHeight), Se = l(() => Array.from({ length: D.dayEnd - D.dayStart }, (e, t) => D.dayStart + t)), U = l(() => {
80
+ if (!L.value) return [];
81
+ if (D.view === "day") return [L.value];
82
+ let e = n(re(L.value, D.weekStart));
83
+ return Array.from({ length: 7 }, (n, r) => i(t(e, r)));
84
+ }), Ce = l(() => new Intl.DateTimeFormat(D.locale, {
85
+ weekday: "short",
86
+ day: "numeric"
87
+ })), we = l(() => new Intl.DateTimeFormat(D.locale, {
88
+ weekday: "long",
89
+ day: "numeric",
90
+ month: "long"
91
+ })), W = l(() => new Intl.DateTimeFormat(D.locale, {
92
+ day: "numeric",
93
+ month: "short",
94
+ year: "numeric"
95
+ })), Te = l(() => {
96
+ let e = U.value;
97
+ return e.length ? e.length === 1 ? W.value.format(n(e[0])) : `${W.value.format(n(e[0]))} – ${W.value.format(n(e.at(-1)))}` : "";
98
+ }), G = (e) => ee(e, D.locale), K = (e) => we.value.format(n(e)), Ee = (e) => O.value.filter((t) => t.date === e), De = l(() => new Map(U.value.map((e) => [e, te(Ee(e))]))), Oe = (e) => M.value.eventName(e.title, K(e.date), G(e.start), G(e.end)), q = l(() => O.value.find((e) => e.id === A.value)), J = (e) => {
99
+ O.value = O.value.map((t) => t.id === e.id ? e : t), j("change", e);
100
+ }, ke = (e) => P.value = M.value.moved(e.title, K(e.date), G(e.start), G(e.end));
101
+ function Ae(e) {
102
+ let t = {
103
+ id: ne(O.value),
104
+ title: M.value.newEvent,
105
+ ...e
106
+ };
107
+ O.value = [...O.value, t], A.value = t.id, j("create", t), P.value = M.value.added(t.title), _(() => F.value?.select());
108
+ }
109
+ function je() {
110
+ let e = U.value[0];
111
+ if (!e) return;
112
+ let t = Math.min(z.value + 60, B.value - 60);
113
+ Ae({
114
+ date: e,
115
+ start: t,
116
+ end: Math.min(t + 60, B.value)
117
+ });
118
+ }
119
+ function Me(e) {
120
+ let t = O.value.indexOf(e), n = O.value.filter((t) => t !== e);
121
+ O.value = n, j("remove", e), P.value = M.value.removed(e.title), A.value = n[Math.min(t, n.length - 1)]?.id ?? null, _(() => A.value ? Ne(A.value) : I.value?.focus());
122
+ }
123
+ let Ne = (e) => I.value?.querySelector(`[data-event="${CSS.escape(e)}"]`)?.focus(), Pe = (e) => {
124
+ let t = I.value.getBoundingClientRect();
125
+ return Math.min(B.value, Math.max(z.value, s(z.value + (e - t.top) / D.hourHeight * 60, D.snap)));
126
+ }, Y = (e) => {
127
+ let t = I.value.getBoundingClientRect(), n = U.value.length;
128
+ return Math.min(n - 1, Math.max(0, Math.floor((e - t.left) / (t.width || 1) * n)));
129
+ }, X = null, Z = x(null);
130
+ function Fe(e, t) {
131
+ if (t.button || !D.editable || t.target !== t.currentTarget) return;
132
+ A.value = null, t.currentTarget.setPointerCapture?.(t.pointerId);
133
+ let n = Pe(t.clientY);
134
+ X = {
135
+ kind: "make",
136
+ date: e,
137
+ a: n
138
+ }, Z.value = {
139
+ date: e,
140
+ start: n,
141
+ end: n
142
+ };
143
+ }
144
+ function Ie(e, t, n) {
145
+ t.button || (t.stopPropagation(), A.value = e.id, D.editable && (t.currentTarget.setPointerCapture?.(t.pointerId), X = n === "move" ? {
146
+ kind: n,
147
+ e,
148
+ y: t.clientY,
149
+ col: Y(t.clientX)
150
+ } : {
151
+ kind: n,
152
+ e,
153
+ y: t.clientY
154
+ }));
155
+ }
156
+ function Le(e) {
157
+ let t = X;
158
+ if (t) {
159
+ if (t.kind === "make") {
160
+ let n = Pe(e.clientY);
161
+ Z.value = {
162
+ date: t.date,
163
+ start: Math.min(t.a, n),
164
+ end: Math.max(t.a, n)
165
+ };
166
+ } else if (t.kind === "move") {
167
+ let n = s((e.clientY - t.y) / D.hourHeight * 60, D.snap);
168
+ J(a(t.e, n, Y(e.clientX) - t.col, z.value, B.value));
169
+ } else {
170
+ let n = s((e.clientY - t.y) / D.hourHeight * 60, D.snap);
171
+ J(o(t.e, n, D.snap, B.value));
172
+ }
173
+ }
174
+ }
175
+ function Re() {
176
+ let e = X, t = Z.value;
177
+ if (X = null, Z.value = null, e?.kind === "make" && t && t.end - t.start >= D.snap) Ae(t);
178
+ else if (e && e.kind !== "make") {
179
+ let t = O.value.find((t) => t.id === e.e.id);
180
+ t && ke(t);
181
+ }
182
+ }
183
+ function ze(e, t) {
184
+ if (t.target.closest("input")) return;
185
+ let n = {
186
+ ArrowUp: [-1, 0],
187
+ ArrowDown: [1, 0],
188
+ ArrowLeft: [0, -1],
189
+ ArrowRight: [0, 1]
190
+ }[t.key];
191
+ if (n && D.editable) {
192
+ t.preventDefault();
193
+ let r;
194
+ r = t.altKey ? o(e, n[0] * D.snap, D.snap, B.value) : a(e, n[0] * D.snap, D.view === "week" ? n[1] : 0, z.value, B.value), U.value.includes(r.date) || (r = {
195
+ ...r,
196
+ date: e.date
197
+ }), J(r), ke(r), r.date !== e.date && _(() => Ne(e.id));
198
+ } else (t.key === "Delete" || t.key === "Backspace") && D.editable ? (t.preventDefault(), Me(e)) : (t.key === "Enter" || t.key === " ") && (t.preventDefault(), A.value = e.id, _(() => F.value?.focus()));
199
+ }
200
+ let Be = (e) => {
201
+ L.value && (k.value = i(t(n(L.value), e * (D.view === "week" ? 7 : 1))));
202
+ }, Ve = l(() => A.value ?? O.value.find((e) => U.value.includes(e.date))?.id), Q = (e) => ({
203
+ top: `${V(e.start)}px`,
204
+ height: `${V(e.end) - V(e.start)}px`
205
+ }), $ = (e, t) => De.value.get(e)?.get(t) ?? {
206
+ lane: 0,
207
+ lanes: 1
208
+ };
209
+ return (t, i) => (b(), d("div", {
210
+ class: "bless-sched",
211
+ role: "group",
212
+ "aria-label": h.label
213
+ }, [
214
+ f("div", ce, [
215
+ m(e, {
216
+ size: "sm",
217
+ variant: "outline",
218
+ "aria-label": M.value.prev,
219
+ onClick: i[0] ||= (e) => Be(-1)
220
+ }, {
221
+ default: E(() => [...i[5] ||= [p("‹", -1)]]),
222
+ _: 1
223
+ }, 8, ["aria-label"]),
224
+ m(e, {
225
+ size: "sm",
226
+ variant: "outline",
227
+ onClick: i[1] ||= (e) => k.value = w(r)()
228
+ }, {
229
+ default: E(() => [p(C(M.value.today), 1)]),
230
+ _: 1
231
+ }),
232
+ m(e, {
233
+ size: "sm",
234
+ variant: "outline",
235
+ "aria-label": M.value.next,
236
+ onClick: i[2] ||= (e) => Be(1)
237
+ }, {
238
+ default: E(() => [...i[6] ||= [p("›", -1)]]),
239
+ _: 1
240
+ }, 8, ["aria-label"]),
241
+ f("strong", le, C(Te.value), 1),
242
+ h.editable ? (b(), ie(e, {
243
+ key: 0,
244
+ size: "sm",
245
+ class: "bless-sched__add",
246
+ onClick: je
247
+ }, {
248
+ default: E(() => [p(C(M.value.add), 1)]),
249
+ _: 1
250
+ })) : u("", !0)
251
+ ]),
252
+ U.value.length ? (b(), d("div", ue, [f("div", {
253
+ class: "bless-sched__head",
254
+ style: y({ "--_n": U.value.length })
255
+ }, [i[7] ||= f("span", { class: "bless-sched__corner" }, null, -1), (b(!0), d(c, null, S(U.value, (e) => (b(), d("span", {
256
+ key: e,
257
+ class: v(["bless-sched__day", { "bless-sched__day--today": e === R.value }])
258
+ }, C(Ce.value.format(w(n)(e))), 3))), 128))], 4), f("div", de, [f("div", {
259
+ class: "bless-sched__gutter",
260
+ "aria-hidden": "true",
261
+ style: y({ height: `${H.value}px` })
262
+ }, [(b(!0), d(c, null, S(Se.value, (e) => (b(), d("span", {
263
+ key: e,
264
+ class: "bless-sched__hour",
265
+ style: y({ top: `${V(e * 60)}px` })
266
+ }, C(G(e * 60)), 5))), 128))], 4), f("div", {
267
+ ref_key: "cols",
268
+ ref: I,
269
+ class: "bless-sched__cols",
270
+ style: y({
271
+ height: `${H.value}px`,
272
+ "--_n": U.value.length,
273
+ "--_h": `${h.hourHeight}px`
274
+ }),
275
+ tabindex: "-1",
276
+ "aria-describedby": N,
277
+ onPointermove: Le,
278
+ onPointerup: Re,
279
+ onPointercancel: Re
280
+ }, [(b(!0), d(c, null, S(U.value, (e) => (b(), d("div", {
281
+ key: e,
282
+ class: "bless-sched__col",
283
+ role: "group",
284
+ "aria-label": K(e),
285
+ onPointerdown: (t) => Fe(e, t)
286
+ }, [(b(!0), d(c, null, S(Ee(e), (t) => (b(), d("div", {
287
+ key: t.id,
288
+ class: v(["bless-sched__event", { "bless-sched__event--sel": A.value === t.id }]),
289
+ style: y({
290
+ ...Q(t),
291
+ left: `calc(${$(e, t.id).lane / $(e, t.id).lanes * 100}% + 1px)`,
292
+ width: `calc(${100 / $(e, t.id).lanes}% - 3px)`
293
+ }),
294
+ "data-event": t.id,
295
+ role: "button",
296
+ "aria-pressed": A.value === t.id,
297
+ "aria-label": Oe(t),
298
+ tabindex: Ve.value === t.id ? 0 : -1,
299
+ onPointerdown: (e) => Ie(t, e, "move"),
300
+ onKeydown: (e) => ze(t, e),
301
+ onFocus: (e) => A.value = t.id
302
+ }, [
303
+ f("span", me, C(t.title), 1),
304
+ f("span", he, C(G(t.start)) + "–" + C(G(t.end)), 1),
305
+ h.editable ? (b(), d("span", {
306
+ key: 0,
307
+ class: "bless-sched__foot",
308
+ "aria-hidden": "true",
309
+ onPointerdown: (e) => Ie(t, e, "size")
310
+ }, null, 40, ge)) : u("", !0)
311
+ ], 46, pe))), 128)), Z.value && Z.value.date === e ? (b(), d("div", {
312
+ key: 0,
313
+ class: "bless-sched__event bless-sched__event--draft",
314
+ style: y(Q(Z.value))
315
+ }, null, 4)) : u("", !0)], 40, fe))), 128))], 36)])])) : u("", !0),
316
+ q.value && h.editable ? (b(), d("div", _e, [
317
+ f("label", ve, [f("span", null, C(M.value.title), 1), f("input", {
318
+ ref_key: "titleInput",
319
+ ref: F,
320
+ class: "bless-sched__input",
321
+ type: "text",
322
+ value: q.value.title,
323
+ onInput: i[3] ||= (e) => J({
324
+ ...q.value,
325
+ title: e.target.value
326
+ })
327
+ }, null, 40, ye)]),
328
+ f("span", be, C(K(q.value.date)) + ", " + C(G(q.value.start)) + "–" + C(G(q.value.end)), 1),
329
+ m(e, {
330
+ size: "sm",
331
+ variant: "outline",
332
+ onClick: i[4] ||= (e) => Me(q.value)
333
+ }, {
334
+ default: E(() => [p(C(M.value.remove), 1)]),
335
+ _: 1
336
+ })
337
+ ])) : u("", !0),
338
+ f("span", {
339
+ id: N,
340
+ hidden: ""
341
+ }, C(M.value.hint), 1),
342
+ f("span", xe, C(P.value), 1)
343
+ ], 8, se));
344
+ }
345
+ });
346
+ //#endregion
347
+ export { D as default };
@@ -6,6 +6,16 @@ type __VLS_Props = {
6
6
  disabled?: boolean;
7
7
  label?: string;
8
8
  placeholder?: string;
9
+ /** button wording and the messages said while recording or on a refusal */
10
+ labels?: Partial<{
11
+ button: (label: string, combo: string) => string;
12
+ pressKeys: string;
13
+ recording: string;
14
+ set: (combo: string) => string;
15
+ needsModifier: (combo: string) => string;
16
+ usedBy: (combo: string, by: string) => string;
17
+ taken: (combo: string) => string;
18
+ }>;
9
19
  };
10
20
  declare function start(): void;
11
21
  type __VLS_ModelProps = {