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.
- package/CHANGELOG.md +31 -0
- package/README.md +137 -125
- package/dist/blessing-ui.css +38 -2
- package/dist/components/BlessAnnotator.css +1 -0
- package/dist/components/BlessAnnotator.js +6 -0
- package/dist/components/BlessAnnotator.vue.d.ts +71 -0
- package/dist/components/BlessAnnotator.vue_vue_type_script_setup_true_lang.js +264 -0
- package/dist/components/BlessAttachment.vue.d.ts +4 -1
- package/dist/components/BlessAttachment.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessCalendar.vue.d.ts +4 -0
- package/dist/components/BlessCalendar.vue_vue_type_script_setup_true_lang.js +65 -60
- package/dist/components/BlessCarousel.vue.d.ts +3 -0
- package/dist/components/BlessCarousel.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/components/BlessCoachmark.css +1 -0
- package/dist/components/BlessCoachmark.js +6 -0
- package/dist/components/BlessCoachmark.vue.d.ts +40 -0
- package/dist/components/BlessCoachmark.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/components/BlessCodeBlock.vue.d.ts +10 -0
- package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +39 -33
- package/dist/components/BlessCombobox.vue.d.ts +2 -0
- package/dist/components/BlessCombobox.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessCommand.css +1 -1
- package/dist/components/BlessCommand.vue.d.ts +26 -0
- package/dist/components/BlessCommand.vue_vue_type_script_setup_true_lang.js +137 -70
- package/dist/components/BlessConfetti.css +1 -0
- package/dist/components/BlessConfetti.js +6 -0
- package/dist/components/BlessConfetti.vue.d.ts +40 -0
- package/dist/components/BlessConfetti.vue_vue_type_script_setup_true_lang.js +77 -0
- package/dist/components/BlessCropper.vue.d.ts +16 -0
- package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +47 -39
- package/dist/components/BlessDataTable.vue.d.ts +6 -0
- package/dist/components/BlessDataTable.vue_vue_type_script_setup_true_lang.js +56 -42
- package/dist/components/BlessDataView.vue.d.ts +7 -0
- package/dist/components/BlessDataView.vue_vue_type_script_setup_true_lang.js +38 -31
- package/dist/components/BlessDatePicker.vue.d.ts +3 -0
- package/dist/components/BlessDatePicker.vue_vue_type_script_setup_true_lang.js +46 -45
- package/dist/components/BlessDock.css +1 -0
- package/dist/components/BlessDock.js +6 -0
- package/dist/components/BlessDock.vue.d.ts +55 -0
- package/dist/components/BlessDock.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/BlessEditor.vue.d.ts +2 -0
- package/dist/components/BlessEditor.vue_vue_type_script_setup_true_lang.js +23 -22
- package/dist/components/BlessFileInput.vue.d.ts +2 -0
- package/dist/components/BlessFileInput.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessFormula.css +1 -0
- package/dist/components/BlessFormula.js +6 -0
- package/dist/components/BlessFormula.vue.d.ts +53 -0
- package/dist/components/BlessFormula.vue_vue_type_script_setup_true_lang.js +111 -0
- package/dist/components/BlessGantt.vue.d.ts +12 -0
- package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +74 -68
- package/dist/components/BlessInfiniteCanvas.css +1 -0
- package/dist/components/BlessInfiniteCanvas.js +6 -0
- package/dist/components/BlessInfiniteCanvas.vue.d.ts +91 -0
- package/dist/components/BlessInfiniteCanvas.vue_vue_type_script_setup_true_lang.js +232 -0
- package/dist/components/BlessInputNumber.vue.d.ts +5 -0
- package/dist/components/BlessInputNumber.vue_vue_type_script_setup_true_lang.js +39 -34
- package/dist/components/BlessKanban.vue.d.ts +12 -0
- package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +127 -97
- package/dist/components/BlessLoadingBar.vue.d.ts +2 -0
- package/dist/components/BlessLoadingBar.vue_vue_type_script_setup_true_lang.js +8 -3
- package/dist/components/BlessMarquee.vue.d.ts +4 -0
- package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/components/BlessNodeGraph.css +1 -0
- package/dist/components/BlessNodeGraph.js +6 -0
- package/dist/components/BlessNodeGraph.vue.d.ts +110 -0
- package/dist/components/BlessNodeGraph.vue_vue_type_script_setup_true_lang.js +321 -0
- package/dist/components/BlessOnboardingChecklist.css +1 -0
- package/dist/components/BlessOnboardingChecklist.js +6 -0
- package/dist/components/BlessOnboardingChecklist.vue.d.ts +72 -0
- package/dist/components/BlessOnboardingChecklist.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/BlessOrderList.vue.d.ts +5 -0
- package/dist/components/BlessOrderList.vue_vue_type_script_setup_true_lang.js +62 -56
- package/dist/components/BlessPagination.vue.d.ts +2 -0
- package/dist/components/BlessPagination.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BlessPickList.vue.d.ts +5 -0
- package/dist/components/BlessPickList.vue_vue_type_script_setup_true_lang.js +55 -49
- package/dist/components/BlessRangeCalendar.css +1 -0
- package/dist/components/BlessRangeCalendar.js +6 -0
- package/dist/components/BlessRangeCalendar.vue.d.ts +51 -0
- package/dist/components/BlessRangeCalendar.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/components/BlessScheduler.css +1 -0
- package/dist/components/BlessScheduler.js +6 -0
- package/dist/components/BlessScheduler.vue.d.ts +95 -0
- package/dist/components/BlessScheduler.vue_vue_type_script_setup_true_lang.js +347 -0
- package/dist/components/BlessShortcutRecorder.vue.d.ts +10 -0
- package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +50 -40
- package/dist/components/BlessSignaturePad.vue.d.ts +1 -1
- package/dist/components/BlessSliderCaptcha.vue.d.ts +5 -0
- package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +89 -84
- package/dist/components/BlessSortable.css +1 -1
- package/dist/components/BlessSortable.vue.d.ts +19 -1
- package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +103 -55
- package/dist/components/BlessSparkline.css +1 -0
- package/dist/components/BlessSparkline.js +6 -0
- package/dist/components/BlessSparkline.vue.d.ts +28 -0
- package/dist/components/BlessSparkline.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/BlessSteps.vue.d.ts +2 -0
- package/dist/components/BlessSteps.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessSwipeDeck.vue.d.ts +1 -1
- package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BlessTimer.vue.d.ts +18 -0
- package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +52 -43
- package/dist/components/BlessTour.vue.d.ts +1 -0
- package/dist/components/BlessTour.vue_vue_type_script_setup_true_lang.js +48 -42
- package/dist/components/BlessTreemap.css +1 -0
- package/dist/components/BlessTreemap.js +6 -0
- package/dist/components/BlessTreemap.vue.d.ts +46 -0
- package/dist/components/BlessTreemap.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/components/BlessUploader.vue.d.ts +11 -0
- package/dist/components/BlessUploader.vue_vue_type_script_setup_true_lang.js +80 -69
- package/dist/composables/annotate.d.ts +35 -0
- package/dist/composables/annotate.js +33 -0
- package/dist/composables/canvasView.d.ts +21 -0
- package/dist/composables/canvasView.js +23 -0
- package/dist/composables/confetti.d.ts +32 -0
- package/dist/composables/confetti.js +23 -0
- package/dist/composables/dayBlocks.d.ts +11 -0
- package/dist/composables/dayBlocks.js +26 -0
- package/dist/composables/formula.d.ts +28 -0
- package/dist/composables/formula.js +161 -0
- package/dist/composables/graph.d.ts +19 -0
- package/dist/composables/graph.js +16 -0
- package/dist/composables/schedule.d.ts +27 -0
- package/dist/composables/schedule.js +54 -0
- package/dist/composables/treemap.d.ts +23 -0
- package/dist/composables/treemap.js +77 -0
- package/dist/composables/useAutoScroll.d.ts +15 -0
- package/dist/composables/useAutoScroll.js +32 -0
- package/dist/composables/useSortable.d.ts +42 -2
- package/dist/composables/useSortable.js +87 -14
- package/dist/index.d.ts +25 -1
- package/dist/index.js +78 -63
- package/package.json +4 -2
|
@@ -1,87 +1,135 @@
|
|
|
1
1
|
import { logicalKey as e } from "../composables/rtl.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Fragment as
|
|
2
|
+
import { joinGroup as t, membersOf as n, moveItem as r, restoreGroup as i, snapshotGroup as a, transfer as o, useSortable as s } from "../composables/useSortable.js";
|
|
3
|
+
import { Fragment as c, computed as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, defineComponent as p, mergeModels as m, nextTick as h, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, openBlock as b, ref as x, renderList as S, renderSlot as C, toDisplayString as w, unref as T, useId as E, useModel as ee, watch as te } from "vue";
|
|
4
4
|
//#region src/components/BlessSortable.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
5
|
+
var D = ["aria-label"], O = [
|
|
6
6
|
"aria-label",
|
|
7
|
+
"aria-roledescription",
|
|
7
8
|
"aria-pressed",
|
|
8
9
|
"onPointerdown",
|
|
9
10
|
"onKeydown"
|
|
10
|
-
],
|
|
11
|
+
], k = { class: "bless-sortable__body" }, A = {
|
|
11
12
|
class: "bless-sortable__live",
|
|
12
13
|
"aria-live": "polite"
|
|
13
|
-
},
|
|
14
|
+
}, j = /*@__PURE__*/ p({
|
|
14
15
|
name: "BlessSortable",
|
|
15
16
|
__name: "BlessSortable",
|
|
16
|
-
props: /*@__PURE__*/
|
|
17
|
+
props: /*@__PURE__*/ m({
|
|
17
18
|
rowKey: {},
|
|
18
19
|
label: { default: "Sortable" },
|
|
19
|
-
columns: { default: 1 }
|
|
20
|
+
columns: { default: 1 },
|
|
21
|
+
group: {},
|
|
22
|
+
labels: {}
|
|
20
23
|
}, {
|
|
21
24
|
modelValue: { default: () => [] },
|
|
22
25
|
modelModifiers: {}
|
|
23
26
|
}),
|
|
24
|
-
emits: /*@__PURE__*/
|
|
25
|
-
setup(
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
e
|
|
27
|
+
emits: /*@__PURE__*/ m(["move", "transfer"], ["update:modelValue"]),
|
|
28
|
+
setup(p, { emit: m }) {
|
|
29
|
+
let j = p, M = l(() => ({
|
|
30
|
+
grip: (e) => `Reorder item ${e}`,
|
|
31
|
+
grabbed: (e, t) => `Grabbed item ${e} of ${t}. Arrow keys move it, Space drops it, Escape cancels.`,
|
|
32
|
+
moved: (e, t) => `Moved to position ${e} of ${t}`,
|
|
33
|
+
sent: (e, t, n) => `Moved to ${e}, position ${t} of ${n}`,
|
|
34
|
+
dropped: (e, t) => `Dropped at position ${e} of ${t}`,
|
|
35
|
+
cancelled: "Cancelled, order restored",
|
|
36
|
+
hint: "Press Space to grab, arrow keys to move, Space to drop, Escape to cancel.",
|
|
37
|
+
groupHint: "Alt with left or right arrow sends it to another list.",
|
|
38
|
+
roleDescription: "sortable item",
|
|
39
|
+
...j.labels
|
|
40
|
+
})), N = ee(p, "modelValue"), P = m, F = x(), I = x(""), L = `${E()}-hint`, R = x(null), z = [], B = 0;
|
|
41
|
+
function V(e, t) {
|
|
42
|
+
e === t || t < 0 || t >= N.value.length || (N.value = r(N.value, e, t), P("move", e, t), I.value = M.value.moved(t + 1, N.value.length));
|
|
29
43
|
}
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
let H = () => F.value?.querySelectorAll(".bless-sortable__grip") ?? [], U = (e) => h(() => H()[e]?.focus()), W = x(null), G = {
|
|
45
|
+
root: F,
|
|
46
|
+
list: () => N.value,
|
|
47
|
+
set: (e) => N.value = e,
|
|
48
|
+
drop: W,
|
|
49
|
+
vertical: () => j.columns === 1,
|
|
50
|
+
label: () => j.label,
|
|
51
|
+
adopt: (e) => {
|
|
52
|
+
R.value = e, U(e);
|
|
53
|
+
},
|
|
54
|
+
focus: U,
|
|
55
|
+
say: (e) => I.value = e
|
|
56
|
+
}, K, q = () => {
|
|
57
|
+
K?.(), K = j.group ? t(j.group, G) : void 0;
|
|
58
|
+
};
|
|
59
|
+
y(q), te(() => j.group, q), v(() => K?.());
|
|
60
|
+
let J = G;
|
|
61
|
+
function Y(e, t, n) {
|
|
62
|
+
let r = t.list().length + 1, i = o(G, e, t, n);
|
|
63
|
+
P("transfer", i, e, n), t.say(M.value.sent(t.label(), n + 1, r));
|
|
64
|
+
}
|
|
65
|
+
let X = s(F, V, void 0, {
|
|
66
|
+
name: () => j.group,
|
|
67
|
+
self: G,
|
|
68
|
+
onTransfer: Y
|
|
69
|
+
}), { drag: Z, over: ne } = X;
|
|
70
|
+
function re(t, r) {
|
|
71
|
+
let o = e(r);
|
|
72
|
+
if (r.key === " " || r.key === "Enter") r.preventDefault(), R.value == null ? (R.value = t, z = N.value.slice(), B = t, J = G, j.group && a(j.group), I.value = M.value.grabbed(t + 1, N.value.length)) : (I.value = M.value.dropped(R.value + 1, N.value.length), R.value = null);
|
|
73
|
+
else if (r.key === "Escape" && R.value != null) r.preventDefault(), j.group ? i() : N.value = z, R.value = null, I.value = M.value.cancelled, J.focus(B);
|
|
74
|
+
else if (R.value != null && j.group && r.altKey && /^Arrow(Left|Right)$/.test(r.key)) {
|
|
75
|
+
r.preventDefault();
|
|
76
|
+
let e = n(j.group), t = e[e.indexOf(G) + (o === "ArrowLeft" ? -1 : 1)];
|
|
77
|
+
if (!t) return;
|
|
78
|
+
let i = R.value, a = Math.min(i, t.list().length);
|
|
79
|
+
R.value = null, Y(i, t, a), t.adopt(a);
|
|
80
|
+
} else if (R.value != null) {
|
|
81
|
+
let e = o === "ArrowUp" || o === "ArrowLeft" ? -1 : +(o === "ArrowDown" || o === "ArrowRight");
|
|
37
82
|
if (!e) return;
|
|
38
|
-
|
|
83
|
+
r.preventDefault(), V(R.value, R.value + e), R.value = Math.min(Math.max(R.value + e, 0), N.value.length - 1), U(R.value);
|
|
39
84
|
}
|
|
40
85
|
}
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
}),
|
|
44
|
-
return (e, t) => (
|
|
86
|
+
let ie = () => requestAnimationFrame(() => {
|
|
87
|
+
R.value != null && !F.value?.contains(document.activeElement) && (R.value = null);
|
|
88
|
+
}), Q = (e) => W.value?.index === e ? W.value.after ? "after" : "before" : null, $ = (e) => ne.value === e && Z.value != null && Z.value !== e ? e > Z.value ? "after" : "before" : null;
|
|
89
|
+
return (e, t) => (b(), u("div", {
|
|
45
90
|
ref_key: "root",
|
|
46
|
-
ref:
|
|
47
|
-
class: "bless-sortable"
|
|
91
|
+
ref: F,
|
|
92
|
+
class: g(["bless-sortable", {
|
|
93
|
+
"bless-sortable--group": p.group,
|
|
94
|
+
"bless-sortable--receiving": W.value && !N.value.length
|
|
95
|
+
}])
|
|
48
96
|
}, [
|
|
49
|
-
|
|
50
|
-
class:
|
|
97
|
+
d("ul", {
|
|
98
|
+
class: g(["bless-sortable__list", { "bless-sortable__list--grid": p.columns > 1 }]),
|
|
51
99
|
role: "list",
|
|
52
|
-
"aria-label":
|
|
53
|
-
style:
|
|
54
|
-
}, [(
|
|
55
|
-
key:
|
|
100
|
+
"aria-label": p.label,
|
|
101
|
+
style: _(p.columns > 1 ? { "--bless-sortable-cols": p.columns } : void 0)
|
|
102
|
+
}, [(b(!0), u(c, null, S(N.value, (n, r) => (b(), u("li", {
|
|
103
|
+
key: p.rowKey ? p.rowKey(n, r) : r,
|
|
56
104
|
"data-sortable-item": "",
|
|
57
|
-
class:
|
|
58
|
-
"bless-sortable__item--drag":
|
|
59
|
-
"bless-sortable__item--held":
|
|
60
|
-
},
|
|
61
|
-
}, [
|
|
105
|
+
class: g(["bless-sortable__item", [{
|
|
106
|
+
"bless-sortable__item--drag": T(Z) === r,
|
|
107
|
+
"bless-sortable__item--held": R.value === r
|
|
108
|
+
}, ($(r) ?? Q(r)) && `bless-sortable__item--${$(r) ?? Q(r)}`]])
|
|
109
|
+
}, [d("button", {
|
|
62
110
|
type: "button",
|
|
63
111
|
class: "bless-sortable__grip",
|
|
64
|
-
"aria-label":
|
|
65
|
-
"aria-roledescription":
|
|
66
|
-
"aria-pressed":
|
|
67
|
-
"aria-describedby":
|
|
68
|
-
onPointerdown: (e) =>
|
|
69
|
-
onPointermove: t[0] ||= (...e) =>
|
|
70
|
-
onPointerup: t[1] ||= (...e) =>
|
|
71
|
-
onPointercancel: t[2] ||= (...e) =>
|
|
72
|
-
onKeydown: (e) =>
|
|
73
|
-
onBlur:
|
|
74
|
-
}, [...t[3] ||= [
|
|
112
|
+
"aria-label": M.value.grip(r + 1),
|
|
113
|
+
"aria-roledescription": M.value.roleDescription,
|
|
114
|
+
"aria-pressed": R.value === r,
|
|
115
|
+
"aria-describedby": L,
|
|
116
|
+
onPointerdown: (e) => T(X).grab(r, e),
|
|
117
|
+
onPointermove: t[0] ||= (...e) => T(X).track && T(X).track(...e),
|
|
118
|
+
onPointerup: t[1] ||= (...e) => T(X).drop && T(X).drop(...e),
|
|
119
|
+
onPointercancel: t[2] ||= (...e) => T(X).cancel && T(X).cancel(...e),
|
|
120
|
+
onKeydown: (e) => re(r, e),
|
|
121
|
+
onBlur: ie
|
|
122
|
+
}, [...t[3] ||= [d("span", { "aria-hidden": "true" }, "⋮⋮", -1)]], 40, O), d("span", k, [C(e.$slots, "default", {
|
|
75
123
|
item: n,
|
|
76
124
|
index: r
|
|
77
|
-
}, () => [
|
|
78
|
-
|
|
79
|
-
id:
|
|
125
|
+
}, () => [f(w(n), 1)])])], 2))), 128))], 14, D),
|
|
126
|
+
d("span", {
|
|
127
|
+
id: L,
|
|
80
128
|
hidden: ""
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
],
|
|
129
|
+
}, w(M.value.hint) + w(p.group ? ` ${M.value.groupHint}` : ""), 1),
|
|
130
|
+
d("span", A, w(I.value), 1)
|
|
131
|
+
], 2));
|
|
84
132
|
}
|
|
85
133
|
});
|
|
86
134
|
//#endregion
|
|
87
|
-
export {
|
|
135
|
+
export { j as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-sparkline{vertical-align:middle;color:var(--_c);display:inline-block;overflow:visible}.bless-sparkline__line{fill:none;stroke:var(--_c);stroke-width:1.5px;stroke-linejoin:round;stroke-linecap:round}.bless-sparkline__area{fill:color-mix(in srgb, var(--_c) 18%, transparent)}.bless-sparkline__dot,.bless-sparkline__bar{fill:var(--_c)}.bless-sparkline__bar--neg{fill:var(--_n)}.bless-sparkline__mid{stroke:var(--bless-color-border);stroke-width:1px}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
data: number[];
|
|
3
|
+
/** `line`, `bar`, or `winloss` (every value drawn as a same-height win above or loss below the middle) */
|
|
4
|
+
type?: "line" | "bar" | "winloss";
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
/** a token name (`chart-2`, `success`, `danger`…) or any CSS colour */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** colour of values below zero in `bar` and `winloss` */
|
|
10
|
+
negativeColor?: string;
|
|
11
|
+
/** line only: shade the area under the line */
|
|
12
|
+
fill?: boolean;
|
|
13
|
+
/** line only: a dot on the last value */
|
|
14
|
+
dot?: boolean;
|
|
15
|
+
/** what is plotted; read with the summary by screen readers */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** text for one value in the summary, e.g. `(v) => v + " ms"` */
|
|
18
|
+
format?: (v: number) => string;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
|
+
color: string;
|
|
22
|
+
type: "line" | "bar" | "winloss";
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
negativeColor: string;
|
|
26
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, defineComponent as i, normalizeClass as a, normalizeStyle as o, openBlock as s, renderList as c } from "vue";
|
|
2
|
+
//#region src/components/BlessSparkline.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var l = [
|
|
4
|
+
"aria-label",
|
|
5
|
+
"width",
|
|
6
|
+
"height",
|
|
7
|
+
"viewBox"
|
|
8
|
+
], u = ["d"], d = ["d"], f = ["cx", "cy"], p = [
|
|
9
|
+
"x2",
|
|
10
|
+
"y1",
|
|
11
|
+
"y2"
|
|
12
|
+
], m = [
|
|
13
|
+
"x",
|
|
14
|
+
"y",
|
|
15
|
+
"width",
|
|
16
|
+
"height"
|
|
17
|
+
], h = 2, g = /*@__PURE__*/ i({
|
|
18
|
+
name: "BlessSparkline",
|
|
19
|
+
__name: "BlessSparkline",
|
|
20
|
+
props: {
|
|
21
|
+
data: {},
|
|
22
|
+
type: { default: "line" },
|
|
23
|
+
width: { default: 120 },
|
|
24
|
+
height: { default: 28 },
|
|
25
|
+
color: { default: "chart-1" },
|
|
26
|
+
negativeColor: { default: "danger" },
|
|
27
|
+
fill: { type: Boolean },
|
|
28
|
+
dot: { type: Boolean },
|
|
29
|
+
label: {},
|
|
30
|
+
format: {}
|
|
31
|
+
},
|
|
32
|
+
setup(i) {
|
|
33
|
+
let g = i, _ = t(() => g.data.filter((e) => Number.isFinite(e))), v = t(() => Math.min(..._.value, g.type === "line" ? Infinity : 0)), y = t(() => Math.max(..._.value, g.type === "line" ? -Infinity : 0)), b = t(() => y.value - v.value || 1), x = (e) => +(g.height - h - (e - v.value) / b.value * (g.height - 4)).toFixed(2), S = (e) => /^[a-z0-9-]+$/i.test(e) ? `var(--bless-color-${e})` : e, C = t(() => {
|
|
34
|
+
let e = _.value.length, t = g.width - 4;
|
|
35
|
+
return _.value.map((n, r) => ({
|
|
36
|
+
x: +(h + (e === 1 ? t / 2 : r / (e - 1) * t)).toFixed(2),
|
|
37
|
+
y: x(n)
|
|
38
|
+
}));
|
|
39
|
+
}), w = t(() => C.value.map((e, t) => `${t ? "L" : "M"}${e.x} ${e.y}`).join("")), T = t(() => {
|
|
40
|
+
let e = C.value;
|
|
41
|
+
return e.length > 1 ? `${w.value}L${e.at(-1).x} ${g.height - h}L${e[0].x} ${g.height - h}Z` : "";
|
|
42
|
+
}), E = t(() => C.value.at(-1)), D = t(() => {
|
|
43
|
+
let e = _.value.length;
|
|
44
|
+
if (!e) return [];
|
|
45
|
+
let t = (g.width - 4) / e, n = Math.max(1, t - Math.min(2, t * .25)), r = g.type === "winloss" ? g.height / 2 : x(0);
|
|
46
|
+
return _.value.map((e, i) => {
|
|
47
|
+
let a = g.type === "winloss" ? e > 0 ? h : e < 0 ? r : r - .5 : Math.min(x(e), r), o = g.type === "winloss" ? e === 0 ? 1 : g.height / 2 - h : Math.max(1, Math.abs(x(e) - r));
|
|
48
|
+
return {
|
|
49
|
+
x: +(h + i * t + (t - n) / 2).toFixed(2),
|
|
50
|
+
y: +a.toFixed(2),
|
|
51
|
+
w: +n.toFixed(2),
|
|
52
|
+
h: +o.toFixed(2),
|
|
53
|
+
neg: e < 0
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}), O = t(() => g.format ?? ((e) => String(e))), k = t(() => {
|
|
57
|
+
let e = _.value, t = g.label ?? "Trend";
|
|
58
|
+
return e.length ? g.type === "winloss" ? `${t}: ${e.filter((e) => e > 0).length} up, ${e.filter((e) => e < 0).length} down of ${e.length}` : `${t}: ${e.length} values, from ${O.value(e[0])} to ${O.value(e.at(-1))}, low ${O.value(Math.min(...e))}, high ${O.value(Math.max(...e))}` : `${t}: no data`;
|
|
59
|
+
});
|
|
60
|
+
return (t, g) => (s(), r("svg", {
|
|
61
|
+
class: a(["bless-sparkline", `bless-sparkline--${i.type}`]),
|
|
62
|
+
role: "img",
|
|
63
|
+
"aria-label": k.value,
|
|
64
|
+
width: i.width,
|
|
65
|
+
height: i.height,
|
|
66
|
+
viewBox: `0 0 ${i.width} ${i.height}`,
|
|
67
|
+
style: o({
|
|
68
|
+
"--_c": S(i.color),
|
|
69
|
+
"--_n": S(i.negativeColor)
|
|
70
|
+
})
|
|
71
|
+
}, [i.type === "line" ? (s(), r(e, { key: 0 }, [
|
|
72
|
+
i.fill && T.value ? (s(), r("path", {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: "bless-sparkline__area",
|
|
75
|
+
d: T.value
|
|
76
|
+
}, null, 8, u)) : n("", !0),
|
|
77
|
+
C.value.length > 1 ? (s(), r("path", {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: "bless-sparkline__line",
|
|
80
|
+
d: w.value
|
|
81
|
+
}, null, 8, d)) : n("", !0),
|
|
82
|
+
(i.dot || C.value.length === 1) && E.value ? (s(), r("circle", {
|
|
83
|
+
key: 2,
|
|
84
|
+
class: "bless-sparkline__dot",
|
|
85
|
+
cx: E.value.x,
|
|
86
|
+
cy: E.value.y,
|
|
87
|
+
r: "2.5"
|
|
88
|
+
}, null, 8, f)) : n("", !0)
|
|
89
|
+
], 64)) : (s(), r(e, { key: 1 }, [i.type === "winloss" ? (s(), r("line", {
|
|
90
|
+
key: 0,
|
|
91
|
+
class: "bless-sparkline__mid",
|
|
92
|
+
x1: h,
|
|
93
|
+
x2: i.width - h,
|
|
94
|
+
y1: i.height / 2,
|
|
95
|
+
y2: i.height / 2
|
|
96
|
+
}, null, 8, p)) : n("", !0), (s(!0), r(e, null, c(D.value, (e, t) => (s(), r("rect", {
|
|
97
|
+
key: t,
|
|
98
|
+
class: a(["bless-sparkline__bar", { "bless-sparkline__bar--neg": e.neg }]),
|
|
99
|
+
x: e.x,
|
|
100
|
+
y: e.y,
|
|
101
|
+
width: e.w,
|
|
102
|
+
height: e.h
|
|
103
|
+
}, null, 10, m))), 128))], 64))], 14, l));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
//#endregion
|
|
107
|
+
export { g as default };
|
|
@@ -8,6 +8,8 @@ type __VLS_Props = {
|
|
|
8
8
|
/** completed steps are buttons that emit select; "all" makes every step one */
|
|
9
9
|
clickable?: boolean | "all";
|
|
10
10
|
label?: string;
|
|
11
|
+
/** name of a step you can go to, from its number and label */
|
|
12
|
+
goLabel?: (number: number, label: string) => string;
|
|
11
13
|
};
|
|
12
14
|
type __VLS_ModelProps = {
|
|
13
15
|
modelValue?: number;
|
|
@@ -10,7 +10,8 @@ var m = ["aria-label"], h = ["aria-current"], g = { "aria-hidden": "true" }, _ =
|
|
|
10
10
|
steps: {},
|
|
11
11
|
orientation: { default: "horizontal" },
|
|
12
12
|
clickable: { type: [Boolean, String] },
|
|
13
|
-
label: { default: "Progress" }
|
|
13
|
+
label: { default: "Progress" },
|
|
14
|
+
goLabel: {}
|
|
14
15
|
}, {
|
|
15
16
|
modelValue: { default: 0 },
|
|
16
17
|
modelModifiers: {}
|
|
@@ -32,7 +33,7 @@ var m = ["aria-label"], h = ["aria-current"], g = { "aria-hidden": "true" }, _ =
|
|
|
32
33
|
}, [(c(), t(u(S(o, a.clickable, b.value) ? "button" : "div"), {
|
|
33
34
|
type: S(o, a.clickable, b.value) ? "button" : void 0,
|
|
34
35
|
class: "bless-steps__marker",
|
|
35
|
-
"aria-label": S(o, a.clickable, b.value) ? `Go to step ${o + 1
|
|
36
|
+
"aria-label": S(o, a.clickable, b.value) ? (a.goLabel ?? ((e, t) => `Go to step ${e}: ${t}`))(o + 1, e.label) : void 0,
|
|
36
37
|
onClick: (e) => S(o, a.clickable, b.value) && (x("select", o), b.value = o)
|
|
37
38
|
}, {
|
|
38
39
|
default: p(() => [i("span", g, d(o < b.value ? "✓" : o + 1), 1)]),
|
|
@@ -9,7 +9,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
9
9
|
controls?: boolean;
|
|
10
10
|
/** how far (px) a drag must travel to count */
|
|
11
11
|
threshold?: number;
|
|
12
|
-
labels?: Partial<Record<BlessSwipeDecision | "undo", string>>;
|
|
12
|
+
labels?: Partial<Record<BlessSwipeDecision | "undo" | "empty", string>>;
|
|
13
13
|
} & {
|
|
14
14
|
/** the cards still to decide, top of the deck first */
|
|
15
15
|
modelValue?: T[];
|
|
@@ -40,6 +40,7 @@ var b = ["aria-label"], x = [
|
|
|
40
40
|
reject: "Reject",
|
|
41
41
|
skip: "Skip",
|
|
42
42
|
undo: "Undo",
|
|
43
|
+
empty: "No cards left",
|
|
43
44
|
...E.labels
|
|
44
45
|
})), A = [], j = m(0), M = m(""), N = {
|
|
45
46
|
accept: [1, 0],
|
|
@@ -157,7 +158,7 @@ var b = ["aria-label"], x = [
|
|
|
157
158
|
}, _(k.value.skip), 5)
|
|
158
159
|
], 64)) : i("", !0)], 46, x))), 128))]),
|
|
159
160
|
_: 3
|
|
160
|
-
}), D.value.length ? i("", !0) : (p(), a("div", S, [g(r.$slots, "empty", {}, () => [
|
|
161
|
+
}), D.value.length ? i("", !0) : (p(), a("div", S, [g(r.$slots, "empty", {}, () => [s(_(k.value.empty), 1)])]))], 40, b),
|
|
161
162
|
l.controls ? (p(), a("div", C, [
|
|
162
163
|
c(e, {
|
|
163
164
|
variant: "outline",
|
|
@@ -17,6 +17,15 @@ declare const __VLS_export: import('vue').DefineComponent<{
|
|
|
17
17
|
/** show Start / Pause / Reset */
|
|
18
18
|
controls?: boolean;
|
|
19
19
|
label?: string;
|
|
20
|
+
/** button text and the wording said when a phase changes or the time is up */
|
|
21
|
+
labels?: Partial<{
|
|
22
|
+
start: string;
|
|
23
|
+
resume: string;
|
|
24
|
+
pause: string;
|
|
25
|
+
reset: string;
|
|
26
|
+
finished: string;
|
|
27
|
+
round: (round: number, rounds: number) => string;
|
|
28
|
+
}>;
|
|
20
29
|
} & {
|
|
21
30
|
running?: boolean;
|
|
22
31
|
}, {
|
|
@@ -41,6 +50,15 @@ declare const __VLS_export: import('vue').DefineComponent<{
|
|
|
41
50
|
/** show Start / Pause / Reset */
|
|
42
51
|
controls?: boolean;
|
|
43
52
|
label?: string;
|
|
53
|
+
/** button text and the wording said when a phase changes or the time is up */
|
|
54
|
+
labels?: Partial<{
|
|
55
|
+
start: string;
|
|
56
|
+
resume: string;
|
|
57
|
+
pause: string;
|
|
58
|
+
reset: string;
|
|
59
|
+
finished: string;
|
|
60
|
+
round: (round: number, rounds: number) => string;
|
|
61
|
+
}>;
|
|
44
62
|
} & {
|
|
45
63
|
running?: boolean;
|
|
46
64
|
}> & Readonly<{
|
|
@@ -23,7 +23,8 @@ var v = ["aria-label"], y = {
|
|
|
23
23
|
type: Boolean,
|
|
24
24
|
default: !0
|
|
25
25
|
},
|
|
26
|
-
label: { default: "Timer" }
|
|
26
|
+
label: { default: "Timer" },
|
|
27
|
+
labels: {}
|
|
27
28
|
}, {
|
|
28
29
|
running: {
|
|
29
30
|
type: Boolean,
|
|
@@ -33,21 +34,29 @@ var v = ["aria-label"], y = {
|
|
|
33
34
|
}),
|
|
34
35
|
emits: /*@__PURE__*/ l(["finish", "phase"], ["update:running"]),
|
|
35
36
|
setup(c, { expose: l, emit: C }) {
|
|
36
|
-
let w = c, T =
|
|
37
|
+
let w = c, T = t(() => ({
|
|
38
|
+
start: "Start",
|
|
39
|
+
resume: "Resume",
|
|
40
|
+
pause: "Pause",
|
|
41
|
+
reset: "Reset",
|
|
42
|
+
finished: "Finished",
|
|
43
|
+
round: (e, t) => `round ${e} of ${t}`,
|
|
44
|
+
...w.labels
|
|
45
|
+
})), E = h(c, "running"), D = C, O = p(0), k = p(!1), A = p(""), j = 0, M = 0, N, P = t(() => w.mode === "interval" ? w.phases ?? [] : [{
|
|
37
46
|
label: "",
|
|
38
47
|
seconds: w.duration
|
|
39
|
-
}]),
|
|
48
|
+
}]), F = t(() => w.mode === "interval" ? w.rounds : 1), I = t(() => P.value.reduce((e, t) => e + t.seconds, 0) * 1e3), L = t(() => I.value * F.value), R = t(() => {
|
|
40
49
|
if (w.mode === "stopwatch") return {
|
|
41
50
|
i: 0,
|
|
42
51
|
round: 1,
|
|
43
|
-
left:
|
|
52
|
+
left: O.value
|
|
44
53
|
};
|
|
45
|
-
let e = Math.min(
|
|
46
|
-
for (let i = 0; i <
|
|
47
|
-
let a =
|
|
48
|
-
if (t < r + a || i ===
|
|
54
|
+
let e = Math.min(O.value, L.value), t = I.value ? e >= L.value ? I.value : e % I.value : 0, n = Math.min(F.value, Math.floor(e / (I.value || 1)) + 1), r = 0;
|
|
55
|
+
for (let i = 0; i < P.value.length; i++) {
|
|
56
|
+
let a = P.value[i].seconds * 1e3;
|
|
57
|
+
if (t < r + a || i === P.value.length - 1) return {
|
|
49
58
|
i,
|
|
50
|
-
round: e >=
|
|
59
|
+
round: e >= L.value ? F.value : n,
|
|
51
60
|
left: Math.max(0, r + a - t)
|
|
52
61
|
};
|
|
53
62
|
r += a;
|
|
@@ -57,72 +66,72 @@ var v = ["aria-label"], y = {
|
|
|
57
66
|
round: 1,
|
|
58
67
|
left: 0
|
|
59
68
|
};
|
|
60
|
-
}),
|
|
69
|
+
}), z = (e) => String(e).padStart(2, "0"), B = (e, t) => {
|
|
61
70
|
let n = t ? Math.floor(e / 1e3) : Math.ceil(e / 1e3), r = Math.floor(n / 3600), i = Math.floor(n % 3600 / 60);
|
|
62
|
-
return `${r ? `${r}:${
|
|
63
|
-
},
|
|
64
|
-
function U() {
|
|
65
|
-
D.value = A + (performance.now() - j), w.mode !== "stopwatch" && D.value >= I.value && (D.value = I.value, W(), O.value = !0, T.value = !1, k.value = "Finished", E("finish"));
|
|
66
|
-
}
|
|
71
|
+
return `${r ? `${r}:${z(i)}` : z(i)}:${z(n % 60)}`;
|
|
72
|
+
}, V = t(() => B(R.value.left, w.mode === "stopwatch")), H = t(() => w.mode === "interval" ? P.value[R.value.i] : void 0), U = t(() => H.value ? `${H.value.label} · ${T.value.round(R.value.round, F.value)}` : "");
|
|
67
73
|
function W() {
|
|
68
|
-
|
|
74
|
+
O.value = j + (performance.now() - M), w.mode !== "stopwatch" && O.value >= L.value && (O.value = L.value, G(), k.value = !0, E.value = !1, A.value = T.value.finished, D("finish"));
|
|
69
75
|
}
|
|
70
76
|
function G() {
|
|
71
|
-
|
|
77
|
+
clearInterval(N), N = void 0;
|
|
72
78
|
}
|
|
73
79
|
function K() {
|
|
74
|
-
|
|
80
|
+
N || w.mode !== "stopwatch" && !L.value || (k.value && Y(), j = O.value, M = performance.now(), N = setInterval(W, 100));
|
|
75
81
|
}
|
|
76
82
|
function q() {
|
|
77
|
-
|
|
83
|
+
E.value = !0;
|
|
78
84
|
}
|
|
79
85
|
function J() {
|
|
80
|
-
|
|
86
|
+
E.value = !1;
|
|
87
|
+
}
|
|
88
|
+
function Y() {
|
|
89
|
+
G(), O.value = 0, j = 0, k.value = !1, A.value = "", E.value && K();
|
|
81
90
|
}
|
|
82
|
-
return g(
|
|
83
|
-
e ?
|
|
84
|
-
}, { immediate: !1 }), w.autostart && (
|
|
91
|
+
return g(E, (e) => {
|
|
92
|
+
e ? K() : N && (W(), G());
|
|
93
|
+
}, { immediate: !1 }), w.autostart && (E.value = !0), g(() => [
|
|
85
94
|
w.mode,
|
|
86
95
|
w.duration,
|
|
87
96
|
w.phases,
|
|
88
97
|
w.rounds
|
|
89
|
-
], () =>
|
|
90
|
-
let n =
|
|
91
|
-
t !== void 0 && n && w.mode === "interval" &&
|
|
92
|
-
}), d(
|
|
93
|
-
start:
|
|
94
|
-
pause:
|
|
95
|
-
reset:
|
|
96
|
-
toggle: () =>
|
|
98
|
+
], () => Y()), g(() => `${R.value.i}:${R.value.round}`, (e, t) => {
|
|
99
|
+
let n = P.value[R.value.i];
|
|
100
|
+
t !== void 0 && n && w.mode === "interval" && E.value && (A.value = `${n.label}, ${T.value.round(R.value.round, F.value)}`, D("phase", n, R.value.i, R.value.round));
|
|
101
|
+
}), d(G), l({
|
|
102
|
+
start: q,
|
|
103
|
+
pause: J,
|
|
104
|
+
reset: Y,
|
|
105
|
+
toggle: () => E.value = !E.value
|
|
97
106
|
}), (t, l) => (f(), i("div", {
|
|
98
|
-
class: u(["bless-timer", { "bless-timer--done":
|
|
107
|
+
class: u(["bless-timer", { "bless-timer--done": k.value }]),
|
|
99
108
|
role: "timer",
|
|
100
109
|
"aria-label": c.label
|
|
101
110
|
}, [
|
|
102
|
-
|
|
103
|
-
a("span", b, m(
|
|
104
|
-
c.controls ? (f(), i("span", x, [
|
|
111
|
+
U.value ? (f(), i("span", y, m(U.value), 1)) : r("", !0),
|
|
112
|
+
a("span", b, m(V.value), 1),
|
|
113
|
+
c.controls ? (f(), i("span", x, [E.value ? (f(), n(e, {
|
|
105
114
|
key: 1,
|
|
106
115
|
variant: "outline",
|
|
107
|
-
onClick:
|
|
116
|
+
onClick: J
|
|
108
117
|
}, {
|
|
109
|
-
default: _(() => [
|
|
118
|
+
default: _(() => [o(m(T.value.pause), 1)]),
|
|
110
119
|
_: 1
|
|
111
120
|
})) : (f(), n(e, {
|
|
112
121
|
key: 0,
|
|
113
|
-
onClick:
|
|
122
|
+
onClick: q
|
|
114
123
|
}, {
|
|
115
|
-
default: _(() => [o(m(
|
|
124
|
+
default: _(() => [o(m(O.value && !k.value ? T.value.resume : T.value.start), 1)]),
|
|
116
125
|
_: 1
|
|
117
126
|
})), s(e, {
|
|
118
127
|
variant: "ghost",
|
|
119
|
-
disabled: !
|
|
120
|
-
onClick:
|
|
128
|
+
disabled: !O.value,
|
|
129
|
+
onClick: Y
|
|
121
130
|
}, {
|
|
122
|
-
default: _(() => [
|
|
131
|
+
default: _(() => [o(m(T.value.reset), 1)]),
|
|
123
132
|
_: 1
|
|
124
133
|
}, 8, ["disabled"])])) : r("", !0),
|
|
125
|
-
a("span", S, m(
|
|
134
|
+
a("span", S, m(A.value), 1)
|
|
126
135
|
], 10, v));
|
|
127
136
|
}
|
|
128
137
|
});
|