blessing-ui 0.1.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 +69 -0
- package/README.md +139 -105
- package/dist/blessing-ui.css +97 -1
- 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.css +1 -0
- package/dist/components/BlessCodeBlock.js +6 -0
- package/dist/components/BlessCodeBlock.vue.d.ts +72 -0
- package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +140 -0
- 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/BlessCountUp.css +1 -0
- package/dist/components/BlessCountUp.js +6 -0
- package/dist/components/BlessCountUp.vue.d.ts +18 -0
- package/dist/components/BlessCountUp.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/components/BlessCropper.css +1 -0
- package/dist/components/BlessCropper.js +6 -0
- package/dist/components/BlessCropper.vue.d.ts +70 -0
- package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +220 -0
- 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/BlessDiff.css +1 -0
- package/dist/components/BlessDiff.js +6 -0
- package/dist/components/BlessDiff.vue.d.ts +22 -0
- package/dist/components/BlessDiff.vue_vue_type_script_setup_true_lang.js +148 -0
- 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.css +1 -0
- package/dist/components/BlessGantt.js +6 -0
- package/dist/components/BlessGantt.vue.d.ts +81 -0
- package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +276 -0
- package/dist/components/BlessGauge.css +1 -0
- package/dist/components/BlessGauge.js +6 -0
- package/dist/components/BlessGauge.vue.d.ts +36 -0
- package/dist/components/BlessGauge.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/BlessHeatmapCalendar.css +1 -0
- package/dist/components/BlessHeatmapCalendar.js +6 -0
- package/dist/components/BlessHeatmapCalendar.vue.d.ts +38 -0
- package/dist/components/BlessHeatmapCalendar.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/BlessHotspots.css +1 -0
- package/dist/components/BlessHotspots.js +6 -0
- package/dist/components/BlessHotspots.vue.d.ts +49 -0
- package/dist/components/BlessHotspots.vue_vue_type_script_setup_true_lang.js +127 -0
- 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.css +1 -0
- package/dist/components/BlessKanban.js +6 -0
- package/dist/components/BlessKanban.vue.d.ts +67 -0
- package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +195 -0
- 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/BlessLoupe.css +1 -0
- package/dist/components/BlessLoupe.js +6 -0
- package/dist/components/BlessLoupe.vue.d.ts +16 -0
- package/dist/components/BlessLoupe.vue_vue_type_script_setup_true_lang.js +93 -0
- package/dist/components/BlessMarquee.css +1 -0
- package/dist/components/BlessMarquee.js +6 -0
- package/dist/components/BlessMarquee.vue.d.ts +44 -0
- package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/components/BlessMasonry.css +1 -0
- package/dist/components/BlessMasonry.js +6 -0
- package/dist/components/BlessMasonry.vue.d.ts +33 -0
- package/dist/components/BlessMasonry.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/BlessMention.css +1 -0
- package/dist/components/BlessMention.js +6 -0
- package/dist/components/BlessMention.vue.d.ts +32 -0
- package/dist/components/BlessMention.vue_vue_type_script_setup_true_lang.js +116 -0
- 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/BlessRadialMenu.css +1 -0
- package/dist/components/BlessRadialMenu.js +6 -0
- package/dist/components/BlessRadialMenu.vue.d.ts +45 -0
- package/dist/components/BlessRadialMenu.vue_vue_type_script_setup_true_lang.js +146 -0
- 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.css +1 -0
- package/dist/components/BlessShortcutRecorder.js +6 -0
- package/dist/components/BlessShortcutRecorder.vue.d.ts +39 -0
- package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/components/BlessSignaturePad.vue.d.ts +1 -1
- package/dist/components/BlessSliderCaptcha.css +1 -0
- package/dist/components/BlessSliderCaptcha.js +6 -0
- package/dist/components/BlessSliderCaptcha.vue.d.ts +38 -0
- package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/BlessSortable.css +1 -0
- package/dist/components/BlessSortable.js +6 -0
- package/dist/components/BlessSortable.vue.d.ts +51 -0
- package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +135 -0
- 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/BlessSplitView.css +1 -0
- package/dist/components/BlessSplitView.js +6 -0
- package/dist/components/BlessSplitView.vue.d.ts +61 -0
- package/dist/components/BlessSplitView.vue_vue_type_script_setup_true_lang.js +92 -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.css +1 -0
- package/dist/components/BlessSwipeDeck.js +6 -0
- package/dist/components/BlessSwipeDeck.vue.d.ts +46 -0
- package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/BlessTimer.css +1 -0
- package/dist/components/BlessTimer.js +6 -0
- package/dist/components/BlessTimer.vue.d.ts +74 -0
- package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +139 -0
- 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/cropBox.d.ts +22 -0
- package/dist/composables/cropBox.js +39 -0
- package/dist/composables/dayBlocks.d.ts +11 -0
- package/dist/composables/dayBlocks.js +26 -0
- package/dist/composables/diffLines.d.ts +10 -0
- package/dist/composables/diffLines.js +55 -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/radial.d.ts +15 -0
- package/dist/composables/radial.js +22 -0
- package/dist/composables/schedule.d.ts +27 -0
- package/dist/composables/schedule.js +54 -0
- package/dist/composables/shortcut.d.ts +12 -0
- package/dist/composables/shortcut.js +35 -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 +58 -0
- package/dist/composables/useSortable.js +107 -0
- package/dist/index.d.ts +62 -1
- package/dist/index.js +93 -53
- package/package.json +22 -18
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { computed as e, createElementBlock as t, createElementVNode as n, defineComponent as r, mergeModels as i, normalizeClass as a, normalizeStyle as o, onBeforeUnmount as s, onMounted as c, openBlock as l, ref as u, toDisplayString as d, unref as f, useId as p, useModel as m } from "vue";
|
|
2
|
+
//#region src/components/BlessSliderCaptcha.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var h = ["id"], g = [
|
|
4
|
+
"aria-labelledby",
|
|
5
|
+
"aria-valuenow",
|
|
6
|
+
"aria-disabled"
|
|
7
|
+
], _ = { "aria-hidden": "true" }, v = {
|
|
8
|
+
class: "bless-captcha__live",
|
|
9
|
+
"aria-live": "polite"
|
|
10
|
+
}, y = .16, b = /*@__PURE__*/ r({
|
|
11
|
+
name: "BlessSliderCaptcha",
|
|
12
|
+
__name: "BlessSliderCaptcha",
|
|
13
|
+
props: /*@__PURE__*/ i({
|
|
14
|
+
src: {},
|
|
15
|
+
tolerance: { default: .03 },
|
|
16
|
+
label: { default: "Slide the piece into the gap" },
|
|
17
|
+
labels: {}
|
|
18
|
+
}, {
|
|
19
|
+
verified: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
verifiedModifiers: {}
|
|
24
|
+
}),
|
|
25
|
+
emits: /*@__PURE__*/ i(["verify", "fail"], ["update:verified"]),
|
|
26
|
+
setup(r, { expose: i, emit: b }) {
|
|
27
|
+
let x = r, S = e(() => ({
|
|
28
|
+
verified: "Verified",
|
|
29
|
+
failed: "Not quite, try again",
|
|
30
|
+
...x.labels
|
|
31
|
+
})), C = m(r, "verified"), w = b, T = p(), E = u(), D = u(), O = u(), k = u(320), A = () => Math.round(k.value / 2), j = u(0), M = u({
|
|
32
|
+
at: .6,
|
|
33
|
+
y: .3
|
|
34
|
+
}), N = u(!1), P = u(!1), F = u(""), I = 0;
|
|
35
|
+
function L() {
|
|
36
|
+
M.value = {
|
|
37
|
+
at: .35 + Math.random() * .55,
|
|
38
|
+
y: .1 + Math.random() * .5
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
let R;
|
|
42
|
+
c(() => {
|
|
43
|
+
L();
|
|
44
|
+
let e = E.value;
|
|
45
|
+
e && (k.value = e.clientWidth || 320, typeof ResizeObserver < "u" && (R = new ResizeObserver(() => k.value = e.clientWidth || 320), R.observe(e)));
|
|
46
|
+
}), s(() => R?.disconnect());
|
|
47
|
+
let z = () => k.value * y, B = () => M.value.at * k.value * .84, V = () => M.value.y * (A() - z()), H = () => x.src ? {
|
|
48
|
+
backgroundImage: `url(${x.src})`,
|
|
49
|
+
backgroundSize: `${k.value}px ${A()}px`
|
|
50
|
+
} : {};
|
|
51
|
+
function U() {
|
|
52
|
+
C.value || (Math.abs(j.value - M.value.at) <= x.tolerance ? (C.value = !0, j.value = M.value.at, F.value = S.value.verified, w("verify", { ms: Math.round(performance.now() - I) })) : (P.value = !0, F.value = S.value.failed, w("fail"), j.value = 0, L(), setTimeout(() => P.value = !1, 400)));
|
|
53
|
+
}
|
|
54
|
+
function W() {
|
|
55
|
+
C.value = !1, P.value = !1, j.value = 0, F.value = "", L();
|
|
56
|
+
}
|
|
57
|
+
i({ reset: W });
|
|
58
|
+
let G = {
|
|
59
|
+
x: 0,
|
|
60
|
+
f: 0
|
|
61
|
+
};
|
|
62
|
+
function K(e) {
|
|
63
|
+
C.value || e.button || (e.currentTarget.setPointerCapture?.(e.pointerId), G = {
|
|
64
|
+
x: e.clientX,
|
|
65
|
+
f: j.value
|
|
66
|
+
}, N.value = !0, (!I || j.value === 0) && (I = performance.now()));
|
|
67
|
+
}
|
|
68
|
+
function q(e) {
|
|
69
|
+
if (!N.value) return;
|
|
70
|
+
let t = D.value?.clientWidth || 0, n = O.value?.offsetWidth || 0, r = t && n ? t - n : (E.value?.clientWidth || k.value) - z();
|
|
71
|
+
j.value = Math.min(1, Math.max(0, G.f + (e.clientX - G.x) / r));
|
|
72
|
+
}
|
|
73
|
+
function J() {
|
|
74
|
+
N.value && (N.value = !1, U());
|
|
75
|
+
}
|
|
76
|
+
function Y(e) {
|
|
77
|
+
if (C.value) return;
|
|
78
|
+
let t = e.shiftKey ? .1 : .01;
|
|
79
|
+
e.key === "ArrowRight" || e.key === "ArrowLeft" ? (e.preventDefault(), j.value || (I = performance.now()), j.value = Math.min(1, Math.max(0, j.value + (e.key === "ArrowRight" ? t : -t)))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), U());
|
|
80
|
+
}
|
|
81
|
+
return (e, i) => (l(), t("div", { class: a(["bless-captcha", {
|
|
82
|
+
"bless-captcha--ok": C.value,
|
|
83
|
+
"bless-captcha--fail": P.value
|
|
84
|
+
}]) }, [
|
|
85
|
+
n("div", {
|
|
86
|
+
ref_key: "stage",
|
|
87
|
+
ref: E,
|
|
88
|
+
class: "bless-captcha__stage",
|
|
89
|
+
style: o({
|
|
90
|
+
height: `${A()}px`,
|
|
91
|
+
...H()
|
|
92
|
+
}),
|
|
93
|
+
"aria-hidden": "true"
|
|
94
|
+
}, [n("span", {
|
|
95
|
+
class: "bless-captcha__gap",
|
|
96
|
+
style: o({
|
|
97
|
+
width: `${z()}px`,
|
|
98
|
+
height: `${z()}px`,
|
|
99
|
+
left: `${B()}px`,
|
|
100
|
+
top: `${V()}px`
|
|
101
|
+
})
|
|
102
|
+
}, null, 4), n("span", {
|
|
103
|
+
class: a(["bless-captcha__piece", { "bless-captcha__piece--drag": N.value }]),
|
|
104
|
+
style: o({
|
|
105
|
+
width: `${z()}px`,
|
|
106
|
+
height: `${z()}px`,
|
|
107
|
+
top: `${V()}px`,
|
|
108
|
+
left: `${j.value * (k.value - z())}px`,
|
|
109
|
+
...H(),
|
|
110
|
+
backgroundPosition: `-${B()}px -${V()}px`
|
|
111
|
+
})
|
|
112
|
+
}, null, 6)], 4),
|
|
113
|
+
n("div", {
|
|
114
|
+
ref_key: "track",
|
|
115
|
+
ref: D,
|
|
116
|
+
class: "bless-captcha__track"
|
|
117
|
+
}, [n("span", {
|
|
118
|
+
id: `${f(T)}-l`,
|
|
119
|
+
class: "bless-captcha__label"
|
|
120
|
+
}, d(C.value ? S.value.verified : r.label), 9, h), n("button", {
|
|
121
|
+
ref_key: "handleEl",
|
|
122
|
+
ref: O,
|
|
123
|
+
type: "button",
|
|
124
|
+
class: a(["bless-captcha__handle", { "bless-captcha__handle--drag": N.value }]),
|
|
125
|
+
role: "slider",
|
|
126
|
+
"aria-labelledby": `${f(T)}-l`,
|
|
127
|
+
"aria-valuemin": "0",
|
|
128
|
+
"aria-valuemax": "100",
|
|
129
|
+
"aria-valuenow": Math.round(j.value * 100),
|
|
130
|
+
"aria-disabled": C.value || void 0,
|
|
131
|
+
style: o({
|
|
132
|
+
left: `${j.value * 100}%`,
|
|
133
|
+
translate: `${-j.value * 100}% 0`
|
|
134
|
+
}),
|
|
135
|
+
onPointerdown: K,
|
|
136
|
+
onPointermove: q,
|
|
137
|
+
onPointerup: J,
|
|
138
|
+
onPointercancel: J,
|
|
139
|
+
onKeydown: Y
|
|
140
|
+
}, [n("span", _, d(C.value ? "✓" : "→"), 1)], 46, g)], 512),
|
|
141
|
+
n("span", v, d(F.value), 1)
|
|
142
|
+
], 2));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
//#endregion
|
|
146
|
+
export { b as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-sortable{font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);position:relative}.bless-sortable--group{min-height:3rem}.bless-sortable--receiving{outline:2px dashed var(--bless-color-accent);outline-offset:-2px}.bless-sortable__list{gap:var(--bless-space-2);margin:0;padding:0;list-style:none;display:grid}.bless-sortable__list--grid{grid-template-columns:repeat(var(--bless-sortable-cols), minmax(0, 1fr))}.bless-sortable__item{align-items:center;gap:var(--bless-space-2);padding:var(--bless-space-2) var(--bless-space-3);border:var(--bless-border-width) solid var(--bless-color-border);background:var(--bless-color-bg);display:flex}.bless-sortable__item--drag{opacity:.4}.bless-sortable__item--held{border-color:var(--bless-color-accent)}.bless-sortable__item--before{box-shadow:inset 0 2px 0 var(--bless-color-accent)}.bless-sortable__item--after{box-shadow:inset 0 -2px 0 var(--bless-color-accent)}.bless-sortable__list--grid .bless-sortable__item--before{box-shadow:inset 2px 0 0 var(--bless-color-accent)}.bless-sortable__list--grid .bless-sortable__item--after,[dir=rtl] .bless-sortable__list--grid .bless-sortable__item--before{box-shadow:inset -2px 0 0 var(--bless-color-accent)}[dir=rtl] .bless-sortable__list--grid .bless-sortable__item--after{box-shadow:inset 2px 0 0 var(--bless-color-accent)}.bless-sortable__grip{padding:var(--bless-space-1) var(--bless-space-2);color:var(--bless-color-text-muted);font:inherit;letter-spacing:-3px;cursor:grab;touch-action:none;background:0 0;border:0;flex:none}.bless-sortable__grip:active{cursor:grabbing}.bless-sortable__grip:focus-visible{outline:2px solid var(--bless-color-accent)}.bless-sortable__body{flex:1;min-width:0}.bless-sortable__live{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<({
|
|
3
|
+
rowKey?: (item: T, index: number) => string | number;
|
|
4
|
+
label?: string;
|
|
5
|
+
/** lay the items out in this many equal columns (a grid); 1 is a list */
|
|
6
|
+
columns?: number;
|
|
7
|
+
/**
|
|
8
|
+
* lists that share a group name take each other's items: drag across, or hold an item and
|
|
9
|
+
* press Alt with ← / → to send it to the neighbouring list. Bind each list's own `v-model`.
|
|
10
|
+
*/
|
|
11
|
+
group?: string;
|
|
12
|
+
/** screen-reader wording; each message that carries numbers is a function of them */
|
|
13
|
+
labels?: Partial<{
|
|
14
|
+
grip: (index: number) => string;
|
|
15
|
+
grabbed: (index: number, total: number) => string;
|
|
16
|
+
moved: (position: number, total: number) => string;
|
|
17
|
+
sent: (list: string, position: number, total: number) => string;
|
|
18
|
+
dropped: (position: number, total: number) => string;
|
|
19
|
+
cancelled: string;
|
|
20
|
+
hint: string;
|
|
21
|
+
groupHint: string;
|
|
22
|
+
roleDescription: string;
|
|
23
|
+
}>;
|
|
24
|
+
} & {
|
|
25
|
+
modelValue?: T[];
|
|
26
|
+
}) & {
|
|
27
|
+
"onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
|
|
28
|
+
onMove?: ((from: number, to: number) => any) | undefined;
|
|
29
|
+
onTransfer?: ((item: T, from: number, to: number) => any) | undefined;
|
|
30
|
+
}> & (typeof globalThis extends {
|
|
31
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
32
|
+
} ? P : {});
|
|
33
|
+
expose: (exposed: {}) => void;
|
|
34
|
+
attrs: any;
|
|
35
|
+
slots: {
|
|
36
|
+
default?: (props: {
|
|
37
|
+
item: T;
|
|
38
|
+
index: number;
|
|
39
|
+
}) => any;
|
|
40
|
+
};
|
|
41
|
+
emit: (((evt: "move", from: number, to: number) => void) & ((evt: "transfer", item: T, from: number, to: number) => void)) & ((event: "update:modelValue", value: T[]) => void);
|
|
42
|
+
}>) => import('vue').VNode & {
|
|
43
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
44
|
+
};
|
|
45
|
+
declare const _default: typeof __VLS_export;
|
|
46
|
+
export default _default;
|
|
47
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
48
|
+
[K in keyof T]: T[K];
|
|
49
|
+
} : {
|
|
50
|
+
[K in keyof T as K]: T[K];
|
|
51
|
+
}) & {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { logicalKey as e } from "../composables/rtl.js";
|
|
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
|
+
//#region src/components/BlessSortable.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var D = ["aria-label"], O = [
|
|
6
|
+
"aria-label",
|
|
7
|
+
"aria-roledescription",
|
|
8
|
+
"aria-pressed",
|
|
9
|
+
"onPointerdown",
|
|
10
|
+
"onKeydown"
|
|
11
|
+
], k = { class: "bless-sortable__body" }, A = {
|
|
12
|
+
class: "bless-sortable__live",
|
|
13
|
+
"aria-live": "polite"
|
|
14
|
+
}, j = /*@__PURE__*/ p({
|
|
15
|
+
name: "BlessSortable",
|
|
16
|
+
__name: "BlessSortable",
|
|
17
|
+
props: /*@__PURE__*/ m({
|
|
18
|
+
rowKey: {},
|
|
19
|
+
label: { default: "Sortable" },
|
|
20
|
+
columns: { default: 1 },
|
|
21
|
+
group: {},
|
|
22
|
+
labels: {}
|
|
23
|
+
}, {
|
|
24
|
+
modelValue: { default: () => [] },
|
|
25
|
+
modelModifiers: {}
|
|
26
|
+
}),
|
|
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));
|
|
43
|
+
}
|
|
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");
|
|
82
|
+
if (!e) return;
|
|
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);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
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", {
|
|
90
|
+
ref_key: "root",
|
|
91
|
+
ref: F,
|
|
92
|
+
class: g(["bless-sortable", {
|
|
93
|
+
"bless-sortable--group": p.group,
|
|
94
|
+
"bless-sortable--receiving": W.value && !N.value.length
|
|
95
|
+
}])
|
|
96
|
+
}, [
|
|
97
|
+
d("ul", {
|
|
98
|
+
class: g(["bless-sortable__list", { "bless-sortable__list--grid": p.columns > 1 }]),
|
|
99
|
+
role: "list",
|
|
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,
|
|
104
|
+
"data-sortable-item": "",
|
|
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", {
|
|
110
|
+
type: "button",
|
|
111
|
+
class: "bless-sortable__grip",
|
|
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", {
|
|
123
|
+
item: n,
|
|
124
|
+
index: r
|
|
125
|
+
}, () => [f(w(n), 1)])])], 2))), 128))], 14, D),
|
|
126
|
+
d("span", {
|
|
127
|
+
id: L,
|
|
128
|
+
hidden: ""
|
|
129
|
+
}, w(M.value.hint) + w(p.group ? ` ${M.value.groupHint}` : ""), 1),
|
|
130
|
+
d("span", A, w(I.value), 1)
|
|
131
|
+
], 2));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
//#endregion
|
|
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-split{min-width:0;height:100%;font-family:var(--bless-font-sans);color:var(--bless-color-text)}.bless-split--stacked .bless-split__pane{height:100%;overflow:auto}.bless-split__pane:focus{outline:none}.bless-split__pane:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:-2px}.bless-split__back{gap:var(--bless-space-1);margin:var(--bless-space-2);padding:var(--bless-space-1) var(--bless-space-2);border:var(--bless-border-width) solid var(--bless-color-border);background:var(--bless-color-bg);color:inherit;font:inherit;cursor:pointer;display:inline-flex}.bless-split__back:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}[dir=rtl] .bless-split__back span{display:inline-block;transform:scaleX(-1)}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** under this width (px of the view itself) the panes stack: one at a time */
|
|
3
|
+
breakpoint?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
/** remember the divider in localStorage under this key */
|
|
7
|
+
storageKey?: string;
|
|
8
|
+
/** text of the button that goes back from the detail when stacked */
|
|
9
|
+
backLabel?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_ModelProps = {
|
|
13
|
+
/** master pane width in % */
|
|
14
|
+
modelValue?: number;
|
|
15
|
+
/** when stacked: is the detail showing (true) or the list (false)? */
|
|
16
|
+
"detail"?: boolean;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
19
|
+
declare var __VLS_1: {
|
|
20
|
+
open: () => boolean;
|
|
21
|
+
stacked: boolean;
|
|
22
|
+
}, __VLS_3: {
|
|
23
|
+
stacked: boolean;
|
|
24
|
+
}, __VLS_12: {
|
|
25
|
+
open: () => boolean;
|
|
26
|
+
stacked: boolean;
|
|
27
|
+
}, __VLS_15: {
|
|
28
|
+
stacked: boolean;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
master?: (props: typeof __VLS_1) => any;
|
|
32
|
+
} & {
|
|
33
|
+
detail?: (props: typeof __VLS_3) => any;
|
|
34
|
+
} & {
|
|
35
|
+
master?: (props: typeof __VLS_12) => any;
|
|
36
|
+
} & {
|
|
37
|
+
detail?: (props: typeof __VLS_15) => any;
|
|
38
|
+
};
|
|
39
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
40
|
+
"update:modelValue": (value: number) => any;
|
|
41
|
+
back: () => any;
|
|
42
|
+
"update:detail": (value: boolean) => any;
|
|
43
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
44
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
45
|
+
onBack?: (() => any) | undefined;
|
|
46
|
+
"onUpdate:detail"?: ((value: boolean) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
label: string;
|
|
49
|
+
min: number;
|
|
50
|
+
max: number;
|
|
51
|
+
breakpoint: number;
|
|
52
|
+
backLabel: string;
|
|
53
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
54
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
55
|
+
declare const _default: typeof __VLS_export;
|
|
56
|
+
export default _default;
|
|
57
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
58
|
+
new (): {
|
|
59
|
+
$slots: S;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import e from "./BlessResizable.js";
|
|
2
|
+
import { Fragment as t, createBlock as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, mergeModels as s, nextTick as c, normalizeClass as l, onBeforeUnmount as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, useModel as g, vShow as _, watch as v, withCtx as y, withDirectives as b } from "vue";
|
|
3
|
+
//#region src/components/BlessSplitView.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var x = /*@__PURE__*/ o({
|
|
5
|
+
name: "BlessSplitView",
|
|
6
|
+
__name: "BlessSplitView",
|
|
7
|
+
props: /*@__PURE__*/ s({
|
|
8
|
+
breakpoint: { default: 560 },
|
|
9
|
+
min: { default: 20 },
|
|
10
|
+
max: { default: 60 },
|
|
11
|
+
storageKey: {},
|
|
12
|
+
backLabel: { default: "Back" },
|
|
13
|
+
label: { default: "Resize list" }
|
|
14
|
+
}, {
|
|
15
|
+
modelValue: { default: 35 },
|
|
16
|
+
modelModifiers: {},
|
|
17
|
+
detail: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !1
|
|
20
|
+
},
|
|
21
|
+
detailModifiers: {}
|
|
22
|
+
}),
|
|
23
|
+
emits: /*@__PURE__*/ s(["back"], ["update:modelValue", "update:detail"]),
|
|
24
|
+
setup(o, { emit: s }) {
|
|
25
|
+
let x = o, S = g(o, "modelValue"), C = g(o, "detail"), w = s, T = p(), E = p(!1), D = p(), O = p();
|
|
26
|
+
function k() {
|
|
27
|
+
E.value = (T.value?.clientWidth ?? Infinity) < x.breakpoint;
|
|
28
|
+
}
|
|
29
|
+
let A;
|
|
30
|
+
d(() => {
|
|
31
|
+
if (x.storageKey) try {
|
|
32
|
+
let e = parseFloat(localStorage.getItem(x.storageKey) ?? "");
|
|
33
|
+
e >= x.min && e <= x.max && (S.value = e);
|
|
34
|
+
} catch {}
|
|
35
|
+
k(), typeof ResizeObserver < "u" && T.value && (A = new ResizeObserver(k), A.observe(T.value));
|
|
36
|
+
}), u(() => A?.disconnect()), v(S, (e) => {
|
|
37
|
+
if (x.storageKey) try {
|
|
38
|
+
localStorage.setItem(x.storageKey, String(e));
|
|
39
|
+
} catch {}
|
|
40
|
+
}), v(C, (e) => {
|
|
41
|
+
E.value && c(() => {
|
|
42
|
+
e ? D.value?.focus() : O.value?.focus();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
function j() {
|
|
46
|
+
C.value = !1, w("back");
|
|
47
|
+
}
|
|
48
|
+
return (s, c) => (f(), r("div", {
|
|
49
|
+
ref_key: "root",
|
|
50
|
+
ref: T,
|
|
51
|
+
class: l(["bless-split", { "bless-split--stacked": E.value }])
|
|
52
|
+
}, [E.value ? (f(), r(t, { key: 0 }, [b(i("div", {
|
|
53
|
+
ref_key: "masterEl",
|
|
54
|
+
ref: O,
|
|
55
|
+
class: "bless-split__pane",
|
|
56
|
+
tabindex: "-1"
|
|
57
|
+
}, [m(s.$slots, "master", {
|
|
58
|
+
open: () => C.value = !0,
|
|
59
|
+
stacked: !0
|
|
60
|
+
})], 512), [[_, !C.value]]), b(i("div", {
|
|
61
|
+
ref_key: "detailEl",
|
|
62
|
+
ref: D,
|
|
63
|
+
class: "bless-split__pane",
|
|
64
|
+
tabindex: "-1"
|
|
65
|
+
}, [i("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
class: "bless-split__back",
|
|
68
|
+
onClick: j
|
|
69
|
+
}, [c[1] ||= i("span", { "aria-hidden": "true" }, "←", -1), a(" " + h(o.backLabel), 1)]), m(s.$slots, "detail", { stacked: !0 })], 512), [[_, C.value]])], 64)) : (f(), n(e, {
|
|
70
|
+
key: 1,
|
|
71
|
+
modelValue: S.value,
|
|
72
|
+
"onUpdate:modelValue": c[0] ||= (e) => S.value = e,
|
|
73
|
+
min: o.min,
|
|
74
|
+
max: o.max,
|
|
75
|
+
label: o.label
|
|
76
|
+
}, {
|
|
77
|
+
a: y(() => [m(s.$slots, "master", {
|
|
78
|
+
open: () => C.value = !0,
|
|
79
|
+
stacked: !1
|
|
80
|
+
})]),
|
|
81
|
+
b: y(() => [m(s.$slots, "detail", { stacked: !1 })]),
|
|
82
|
+
_: 3
|
|
83
|
+
}, 8, [
|
|
84
|
+
"modelValue",
|
|
85
|
+
"min",
|
|
86
|
+
"max",
|
|
87
|
+
"label"
|
|
88
|
+
]))], 2));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
//#endregion
|
|
92
|
+
export { x 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;
|