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,12 +1,12 @@
|
|
|
1
1
|
import e from "./BlessButton.js";
|
|
2
2
|
import { scrollBehavior as t } from "../composables/useMedia.js";
|
|
3
3
|
import { useFloating as n } from "../composables/useFloating.js";
|
|
4
|
-
import { Fragment as r, Teleport as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as g,
|
|
4
|
+
import { Fragment as r, Teleport as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, ref as y, toDisplayString as b, unref as x, useModel as S, watch as C, withCtx as w, withKeys as T, withModifiers as E } from "vue";
|
|
5
5
|
//#region src/components/BlessTour.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var D = ["aria-label"], O = { class: "bless-tour__count" }, k = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "bless-tour__title"
|
|
9
|
-
},
|
|
9
|
+
}, A = { class: "bless-tour__text" }, j = { class: "bless-tour__actions" }, M = /*@__PURE__*/ f({
|
|
10
10
|
name: "BlessTour",
|
|
11
11
|
__name: "BlessTour",
|
|
12
12
|
props: /*@__PURE__*/ p({
|
|
@@ -27,34 +27,37 @@ var E = ["aria-label"], D = { class: "bless-tour__count" }, O = {
|
|
|
27
27
|
}),
|
|
28
28
|
emits: /*@__PURE__*/ p(["finish", "skip"], ["update:open", "update:step"]),
|
|
29
29
|
setup(f, { emit: p }) {
|
|
30
|
-
let
|
|
30
|
+
let M = f, N = S(f, "open"), P = S(f, "step"), F = p, I = a(() => ({
|
|
31
31
|
next: "Next",
|
|
32
32
|
prev: "Back",
|
|
33
33
|
done: "Done",
|
|
34
34
|
skip: "Skip",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
step: (e) => `Step ${e}`,
|
|
36
|
+
...M.labels
|
|
37
|
+
})), L = a(() => M.steps[P.value]), R = a(() => P.value >= M.steps.length - 1), z = y(null), B = y(), V = y(null), { x: H, y: U, side: W, update: G } = n(z, B, N, () => ({
|
|
38
|
+
placement: L.value?.placement ?? "bottom",
|
|
38
39
|
offset: 12
|
|
39
40
|
}));
|
|
40
|
-
function
|
|
41
|
-
let e =
|
|
42
|
-
|
|
41
|
+
function K() {
|
|
42
|
+
let e = L.value?.target ? document.querySelector(L.value.target) : null;
|
|
43
|
+
z.value = e, V.value = e?.getBoundingClientRect() ?? null, e?.scrollIntoView?.({
|
|
43
44
|
block: "center",
|
|
44
45
|
behavior: t()
|
|
45
46
|
}), m(() => {
|
|
46
|
-
|
|
47
|
+
G(), V.value = e?.getBoundingClientRect() ?? null, B.value?.focus();
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
e ?
|
|
52
|
-
}),
|
|
53
|
-
function
|
|
54
|
-
|
|
50
|
+
let q = null;
|
|
51
|
+
C(N, (e) => {
|
|
52
|
+
e ? q = document.activeElement : m(() => q?.focus?.());
|
|
53
|
+
}), C([N, P], ([e]) => e && K(), { immediate: !0 });
|
|
54
|
+
function J(e) {
|
|
55
|
+
N.value = !1, F(e ? "finish" : "skip");
|
|
55
56
|
}
|
|
56
|
-
let
|
|
57
|
-
|
|
57
|
+
let Y = y(!1);
|
|
58
|
+
_(() => Y.value = !0);
|
|
59
|
+
let X = a(() => {
|
|
60
|
+
let e = V.value;
|
|
58
61
|
return e ? {
|
|
59
62
|
top: `${e.top - 6}px`,
|
|
60
63
|
left: `${e.left - 6}px`,
|
|
@@ -62,57 +65,60 @@ var E = ["aria-label"], D = { class: "bless-tour__count" }, O = {
|
|
|
62
65
|
height: `${e.height + 12}px`
|
|
63
66
|
} : void 0;
|
|
64
67
|
});
|
|
65
|
-
return (t, n) =>
|
|
68
|
+
return (t, n) => Y.value ? (v(), o(i, {
|
|
66
69
|
key: 0,
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
to: "body"
|
|
71
|
+
}, [N.value && L.value ? (v(), c(r, { key: 0 }, [f.spotlight ? (v(), c("div", {
|
|
72
|
+
key: 0,
|
|
73
|
+
class: h(["bless-tour__spot", { "bless-tour__spot--none": !X.value }]),
|
|
74
|
+
style: g(X.value),
|
|
69
75
|
"aria-hidden": "true"
|
|
70
76
|
}, null, 6)) : s("", !0), l("div", {
|
|
71
77
|
ref_key: "panel",
|
|
72
|
-
ref:
|
|
73
|
-
class: h(["bless-tour", [`bless-tour--${
|
|
78
|
+
ref: B,
|
|
79
|
+
class: h(["bless-tour", [`bless-tour--${x(W)}`, { "bless-tour--centred": !z.value }]]),
|
|
74
80
|
role: "dialog",
|
|
75
81
|
"aria-modal": "false",
|
|
76
|
-
"aria-label":
|
|
82
|
+
"aria-label": L.value.title ?? I.value.step(P.value + 1),
|
|
77
83
|
tabindex: "-1",
|
|
78
|
-
style: g(
|
|
79
|
-
left: `${
|
|
80
|
-
top: `${
|
|
84
|
+
style: g(z.value ? {
|
|
85
|
+
left: `${x(H)}px`,
|
|
86
|
+
top: `${x(U)}px`
|
|
81
87
|
} : void 0),
|
|
82
|
-
onKeydown: n[3] ||=
|
|
88
|
+
onKeydown: n[3] ||= T(E((e) => J(!1), ["prevent"]), ["esc"])
|
|
83
89
|
}, [
|
|
84
|
-
l("span",
|
|
85
|
-
|
|
86
|
-
l("p",
|
|
87
|
-
l("div",
|
|
90
|
+
l("span", O, b(P.value + 1) + " / " + b(f.steps.length), 1),
|
|
91
|
+
L.value.title ? (v(), c("strong", k, b(L.value.title), 1)) : s("", !0),
|
|
92
|
+
l("p", A, b(L.value.text), 1),
|
|
93
|
+
l("div", j, [
|
|
88
94
|
d(e, {
|
|
89
95
|
size: "sm",
|
|
90
96
|
variant: "ghost",
|
|
91
|
-
onClick: n[0] ||= (e) =>
|
|
97
|
+
onClick: n[0] ||= (e) => J(!1)
|
|
92
98
|
}, {
|
|
93
|
-
default:
|
|
99
|
+
default: w(() => [u(b(I.value.skip), 1)]),
|
|
94
100
|
_: 1
|
|
95
101
|
}),
|
|
96
102
|
n[4] ||= l("span", { style: { flex: "1" } }, null, -1),
|
|
97
103
|
d(e, {
|
|
98
104
|
size: "sm",
|
|
99
105
|
variant: "outline",
|
|
100
|
-
disabled:
|
|
101
|
-
onClick: n[1] ||= (e) =>
|
|
106
|
+
disabled: P.value === 0,
|
|
107
|
+
onClick: n[1] ||= (e) => P.value--
|
|
102
108
|
}, {
|
|
103
|
-
default:
|
|
109
|
+
default: w(() => [u(b(I.value.prev), 1)]),
|
|
104
110
|
_: 1
|
|
105
111
|
}, 8, ["disabled"]),
|
|
106
112
|
d(e, {
|
|
107
113
|
size: "sm",
|
|
108
|
-
onClick: n[2] ||= (e) =>
|
|
114
|
+
onClick: n[2] ||= (e) => R.value ? J(!0) : P.value++
|
|
109
115
|
}, {
|
|
110
|
-
default:
|
|
116
|
+
default: w(() => [u(b(R.value ? I.value.done : I.value.next), 1)]),
|
|
111
117
|
_: 1
|
|
112
118
|
})
|
|
113
119
|
])
|
|
114
|
-
], 46,
|
|
120
|
+
], 46, D)], 64)) : s("", !0)])) : s("", !0);
|
|
115
121
|
}
|
|
116
122
|
});
|
|
117
123
|
//#endregion
|
|
118
|
-
export {
|
|
124
|
+
export { M as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-treemap{gap:var(--bless-space-2);width:100%;font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);flex-direction:column;display:flex}.bless-treemap__path{align-items:center;gap:var(--bless-space-2);display:flex}.bless-treemap__crumb{color:var(--bless-color-accent-text);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;text-decoration:underline}.bless-treemap__here{font-weight:var(--bless-font-weight-bold,700)}.bless-treemap__box{position:relative;overflow:hidden}.bless-treemap__tile{box-sizing:border-box;padding:var(--bless-space-2);border:1px solid var(--bless-color-bg);background:color-mix(in srgb, var(--_c) 24%, var(--bless-color-surface));color:var(--bless-color-text);font:inherit;text-align:start;cursor:default;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:2px;margin:0;display:flex;position:absolute;overflow:hidden}.bless-treemap__tile--group{cursor:pointer;box-shadow:inset 3px 0 0 var(--_c)}.bless-treemap__tile:hover{background:color-mix(in srgb, var(--_c) 38%, var(--bless-color-surface))}.bless-treemap__tile:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:-2px;z-index:1}.bless-treemap__name{text-overflow:ellipsis;white-space:nowrap;max-width:100%;font-weight:var(--bless-font-weight-bold,700);overflow:hidden}.bless-treemap__value{font-size:var(--bless-text-xs)}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TreemapNode } from '../composables/treemap';
|
|
2
|
+
export type { TreemapNode as BlessTreemapNode } from '../composables/treemap';
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
5
|
+
declare const __VLS_export: import('vue').DefineComponent<{
|
|
6
|
+
data: TreemapNode[];
|
|
7
|
+
height?: number;
|
|
8
|
+
/** text for a size, e.g. `(v) => v + " MB"` */
|
|
9
|
+
format?: (v: number) => string;
|
|
10
|
+
/** name of the top level in the path, and of the whole chart for screen readers */
|
|
11
|
+
label?: string;
|
|
12
|
+
labels?: Partial<{
|
|
13
|
+
tile: (label: string, value: string, share: string, children: number) => string;
|
|
14
|
+
path: string;
|
|
15
|
+
up: string;
|
|
16
|
+
hint: string;
|
|
17
|
+
}>;
|
|
18
|
+
} & {
|
|
19
|
+
/** ids from the top down to the level being shown */
|
|
20
|
+
path?: string[];
|
|
21
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
22
|
+
select: (node: TreemapNode, path: string[]) => any;
|
|
23
|
+
"update:path": (value: string[]) => any;
|
|
24
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
25
|
+
data: TreemapNode[];
|
|
26
|
+
height?: number;
|
|
27
|
+
/** text for a size, e.g. `(v) => v + " MB"` */
|
|
28
|
+
format?: (v: number) => string;
|
|
29
|
+
/** name of the top level in the path, and of the whole chart for screen readers */
|
|
30
|
+
label?: string;
|
|
31
|
+
labels?: Partial<{
|
|
32
|
+
tile: (label: string, value: string, share: string, children: number) => string;
|
|
33
|
+
path: string;
|
|
34
|
+
up: string;
|
|
35
|
+
hint: string;
|
|
36
|
+
}>;
|
|
37
|
+
} & {
|
|
38
|
+
/** ids from the top down to the level being shown */
|
|
39
|
+
path?: string[];
|
|
40
|
+
}> & Readonly<{
|
|
41
|
+
onSelect?: ((node: TreemapNode, path: string[]) => any) | undefined;
|
|
42
|
+
"onUpdate:path"?: ((value: string[]) => any) | undefined;
|
|
43
|
+
}>, {
|
|
44
|
+
label: string;
|
|
45
|
+
height: number;
|
|
46
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { neighbour as e, squarify as t, totalOf as n } from "../composables/treemap.js";
|
|
2
|
+
import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, useModel as y } from "vue";
|
|
3
|
+
//#region src/components/BlessTreemap.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var b = { class: "bless-treemap" }, x = ["aria-label"], S = ["onClick"], C = {
|
|
5
|
+
key: 1,
|
|
6
|
+
class: "bless-treemap__here",
|
|
7
|
+
"aria-current": "location"
|
|
8
|
+
}, w = ["aria-label"], T = [
|
|
9
|
+
"tabindex",
|
|
10
|
+
"aria-label",
|
|
11
|
+
"title",
|
|
12
|
+
"onClick",
|
|
13
|
+
"onFocus",
|
|
14
|
+
"onKeydown"
|
|
15
|
+
], E = { class: "bless-treemap__name" }, D = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "bless-treemap__value"
|
|
18
|
+
}, O = /*@__PURE__*/ c({
|
|
19
|
+
name: "BlessTreemap",
|
|
20
|
+
__name: "BlessTreemap",
|
|
21
|
+
props: /*@__PURE__*/ l({
|
|
22
|
+
data: {},
|
|
23
|
+
height: { default: 320 },
|
|
24
|
+
format: {},
|
|
25
|
+
label: { default: "All" },
|
|
26
|
+
labels: {}
|
|
27
|
+
}, {
|
|
28
|
+
path: { default: () => [] },
|
|
29
|
+
pathModifiers: {}
|
|
30
|
+
}),
|
|
31
|
+
emits: /*@__PURE__*/ l(["select"], ["update:path"]),
|
|
32
|
+
setup(c, { emit: l }) {
|
|
33
|
+
let O = c, k = y(c, "path"), A = l, j = i(() => ({
|
|
34
|
+
tile: (e, t, n, r) => `${e}, ${t}, ${n}${r ? `, contains ${r} items, Enter opens` : ""}`,
|
|
35
|
+
path: "Path",
|
|
36
|
+
up: "Up one level",
|
|
37
|
+
hint: "Arrow keys move between tiles, Enter opens or selects, Backspace goes up.",
|
|
38
|
+
...O.labels
|
|
39
|
+
})), M = i(() => O.format ?? ((e) => new Intl.NumberFormat().format(e))), N = (e) => `${e < .01 ? "<1" : Math.round(e * 100)}%`, P = g(), F = g(640), I;
|
|
40
|
+
m(() => {
|
|
41
|
+
let e = () => F.value = P.value?.clientWidth || F.value;
|
|
42
|
+
e(), typeof ResizeObserver == "function" && P.value && (I = new ResizeObserver(e), I.observe(P.value));
|
|
43
|
+
}), p(() => I?.disconnect());
|
|
44
|
+
let L = i(() => {
|
|
45
|
+
let e = [], t = O.data;
|
|
46
|
+
for (let n of k.value) {
|
|
47
|
+
let r = t.find((e) => e.id === n);
|
|
48
|
+
if (!r?.children) break;
|
|
49
|
+
e.push(r), t = r.children;
|
|
50
|
+
}
|
|
51
|
+
return e;
|
|
52
|
+
}), R = i(() => (L.value.at(-1)?.children ?? O.data).filter((e) => n(e) > 0)), z = i(() => R.value.reduce((e, t) => e + n(t), 0)), B = i(() => t(R.value.map(n), F.value, O.height)), V = (e, t) => {
|
|
53
|
+
let n = L.value[0], r = e.color ?? n?.color ?? `chart-${(n ? O.data.indexOf(n) : t) % 5 + 1}`;
|
|
54
|
+
return /^[a-z0-9-]+$/i.test(r) ? `var(--bless-color-${r})` : r;
|
|
55
|
+
}, H = i(() => R.value.map((e, t) => {
|
|
56
|
+
let r = B.value[t], i = n(e);
|
|
57
|
+
return {
|
|
58
|
+
node: e,
|
|
59
|
+
v: i,
|
|
60
|
+
r,
|
|
61
|
+
color: V(e, t),
|
|
62
|
+
big: r.w >= 64 && r.h >= 34,
|
|
63
|
+
tall: r.h >= 54,
|
|
64
|
+
name: j.value.tile(e.label, M.value(i), N(i / (z.value || 1)), e.children?.length ?? 0)
|
|
65
|
+
};
|
|
66
|
+
})), U = g(0), W = i(() => Math.min(U.value, Math.max(0, H.value.length - 1))), G = (e) => {
|
|
67
|
+
U.value = e, u(() => P.value?.querySelectorAll(".bless-treemap__tile")[e]?.focus());
|
|
68
|
+
};
|
|
69
|
+
function K(e) {
|
|
70
|
+
let t = H.value[e], n = [...k.value.slice(0, L.value.length), t.node.id];
|
|
71
|
+
t.node.children?.length && (k.value = n, U.value = 0), A("select", t.node, n);
|
|
72
|
+
}
|
|
73
|
+
function q(e = L.value.length - 1) {
|
|
74
|
+
if (e < 0) return;
|
|
75
|
+
let t = L.value[e]?.id;
|
|
76
|
+
k.value = k.value.slice(0, e), u(() => G(Math.max(0, R.value.findIndex((e) => e.id === t))));
|
|
77
|
+
}
|
|
78
|
+
function J(t, n) {
|
|
79
|
+
let r = {
|
|
80
|
+
ArrowLeft: "left",
|
|
81
|
+
ArrowRight: "right",
|
|
82
|
+
ArrowUp: "up",
|
|
83
|
+
ArrowDown: "down"
|
|
84
|
+
}[n.key];
|
|
85
|
+
r ? (n.preventDefault(), G(e(B.value, t, r))) : n.key === "Home" ? (n.preventDefault(), G(0)) : n.key === "End" ? (n.preventDefault(), G(H.value.length - 1)) : n.key === "Backspace" && L.value.length && (n.preventDefault(), q());
|
|
86
|
+
}
|
|
87
|
+
let Y = "bless-treemap-hint";
|
|
88
|
+
return (e, t) => (h(), o("div", b, [
|
|
89
|
+
L.value.length ? (h(), o("nav", {
|
|
90
|
+
key: 0,
|
|
91
|
+
class: "bless-treemap__path",
|
|
92
|
+
"aria-label": j.value.path
|
|
93
|
+
}, [s("button", {
|
|
94
|
+
type: "button",
|
|
95
|
+
class: "bless-treemap__crumb",
|
|
96
|
+
onClick: t[0] ||= (e) => q(0)
|
|
97
|
+
}, v(c.label), 1), (h(!0), o(r, null, _(L.value, (e, n) => (h(), o(r, { key: e.id }, [t[1] ||= s("span", { "aria-hidden": "true" }, "›", -1), n < L.value.length - 1 ? (h(), o("button", {
|
|
98
|
+
key: 0,
|
|
99
|
+
type: "button",
|
|
100
|
+
class: "bless-treemap__crumb",
|
|
101
|
+
onClick: (e) => q(n + 1)
|
|
102
|
+
}, v(e.label), 9, S)) : (h(), o("span", C, v(e.label), 1))], 64))), 128))], 8, x)) : a("", !0),
|
|
103
|
+
s("div", {
|
|
104
|
+
ref_key: "box",
|
|
105
|
+
ref: P,
|
|
106
|
+
class: "bless-treemap__box",
|
|
107
|
+
role: "group",
|
|
108
|
+
"aria-label": L.value.length ? L.value.at(-1).label : c.label,
|
|
109
|
+
style: f({ height: `${c.height}px` })
|
|
110
|
+
}, [(h(!0), o(r, null, _(H.value, (e, t) => (h(), o("button", {
|
|
111
|
+
key: e.node.id,
|
|
112
|
+
type: "button",
|
|
113
|
+
class: d(["bless-treemap__tile", { "bless-treemap__tile--group": e.node.children?.length }]),
|
|
114
|
+
style: f({
|
|
115
|
+
left: `${e.r.x}px`,
|
|
116
|
+
top: `${e.r.y}px`,
|
|
117
|
+
width: `${e.r.w}px`,
|
|
118
|
+
height: `${e.r.h}px`,
|
|
119
|
+
"--_c": e.color
|
|
120
|
+
}),
|
|
121
|
+
tabindex: W.value === t ? 0 : -1,
|
|
122
|
+
"aria-label": e.name,
|
|
123
|
+
"aria-describedby": Y,
|
|
124
|
+
title: e.big ? void 0 : e.name,
|
|
125
|
+
onClick: (e) => K(t),
|
|
126
|
+
onFocus: (e) => U.value = t,
|
|
127
|
+
onKeydown: (e) => J(t, e)
|
|
128
|
+
}, [e.big ? (h(), o(r, { key: 0 }, [s("span", E, v(e.node.label), 1), e.tall ? (h(), o("span", D, v(M.value(e.v)), 1)) : a("", !0)], 64)) : a("", !0)], 46, T))), 128))], 12, w),
|
|
129
|
+
s("span", {
|
|
130
|
+
id: Y,
|
|
131
|
+
hidden: ""
|
|
132
|
+
}, v(j.value.hint), 1)
|
|
133
|
+
]));
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
//#endregion
|
|
137
|
+
export { O as default };
|
|
@@ -19,6 +19,17 @@ type __VLS_Props = {
|
|
|
19
19
|
maxSize?: number;
|
|
20
20
|
label?: string;
|
|
21
21
|
hint?: string;
|
|
22
|
+
/** button text, item buttons and the messages said as files finish */
|
|
23
|
+
labels?: Partial<{
|
|
24
|
+
clear: string;
|
|
25
|
+
upload: string;
|
|
26
|
+
tooLarge: string;
|
|
27
|
+
failed: string;
|
|
28
|
+
uploaded: (name: string) => string;
|
|
29
|
+
failedFile: (name: string, why: string) => string;
|
|
30
|
+
cancel: (name: string) => string;
|
|
31
|
+
remove: (name: string) => string;
|
|
32
|
+
}>;
|
|
22
33
|
};
|
|
23
34
|
declare var __VLS_13: {
|
|
24
35
|
start: () => void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import e from "./BlessButton.js";
|
|
2
2
|
import t from "./BlessProgress.js";
|
|
3
3
|
import n from "./BlessFileInput.js";
|
|
4
|
-
import { Fragment as r,
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, nextTick as f, normalizeClass as p, onBeforeUnmount as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, withCtx as b } from "vue";
|
|
5
5
|
//#region src/components/BlessUploader.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var x = { class: "bless-uploader__name" }, S = { class: "bless-uploader__meta" }, C = ["aria-label", "onClick"], w = {
|
|
7
7
|
class: "bless-uploader__live",
|
|
8
8
|
"aria-live": "polite"
|
|
9
|
-
},
|
|
9
|
+
}, T = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "bless-uploader__actions"
|
|
12
|
-
},
|
|
12
|
+
}, E = /*@__PURE__*/ d({
|
|
13
13
|
name: "BlessUploader",
|
|
14
14
|
__name: "BlessUploader",
|
|
15
15
|
props: {
|
|
@@ -27,75 +27,86 @@ var b = { class: "bless-uploader__name" }, x = { class: "bless-uploader__meta" }
|
|
|
27
27
|
},
|
|
28
28
|
maxSize: {},
|
|
29
29
|
label: { default: "Drop files here or click to browse" },
|
|
30
|
-
hint: {}
|
|
30
|
+
hint: {},
|
|
31
|
+
labels: {}
|
|
31
32
|
},
|
|
32
33
|
emits: [
|
|
33
34
|
"upload",
|
|
34
35
|
"done",
|
|
35
36
|
"error"
|
|
36
37
|
],
|
|
37
|
-
setup(
|
|
38
|
-
let
|
|
39
|
-
|
|
38
|
+
setup(d, { expose: E, emit: D }) {
|
|
39
|
+
let O = d, k = i(() => ({
|
|
40
|
+
clear: "Clear",
|
|
41
|
+
upload: "Upload",
|
|
42
|
+
tooLarge: "Too large",
|
|
43
|
+
failed: "Upload failed",
|
|
44
|
+
uploaded: (e) => `${e} uploaded`,
|
|
45
|
+
failedFile: (e, t) => `${e}: ${t}`,
|
|
46
|
+
cancel: (e) => `Cancel ${e}`,
|
|
47
|
+
remove: (e) => `Remove ${e}`,
|
|
48
|
+
...O.labels
|
|
49
|
+
})), A = D, j = g([]), M = g([]), N = 0, P = g("");
|
|
50
|
+
function F(e) {
|
|
40
51
|
for (let t of e) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
id: ++
|
|
52
|
+
if (O.maxSize && t.size > O.maxSize) {
|
|
53
|
+
j.value.push({
|
|
54
|
+
id: ++N,
|
|
44
55
|
file: t,
|
|
45
56
|
progress: 0,
|
|
46
57
|
status: "error",
|
|
47
|
-
error:
|
|
58
|
+
error: k.value.tooLarge
|
|
48
59
|
});
|
|
49
60
|
continue;
|
|
50
61
|
}
|
|
51
|
-
|
|
52
|
-
id: ++
|
|
62
|
+
j.value.push({
|
|
63
|
+
id: ++N,
|
|
53
64
|
file: t,
|
|
54
65
|
progress: 0,
|
|
55
66
|
status: "queued"
|
|
56
67
|
});
|
|
57
68
|
}
|
|
58
|
-
|
|
69
|
+
M.value = [], O.auto && L();
|
|
59
70
|
}
|
|
60
|
-
function
|
|
71
|
+
function I(e) {
|
|
61
72
|
e.status = "uploading";
|
|
62
73
|
let t = (t) => e.progress = Math.max(0, Math.min(100, t)), n = () => {
|
|
63
|
-
e.status = "done", e.progress = 100,
|
|
74
|
+
e.status = "done", e.progress = 100, P.value = k.value.uploaded(e.file.name), A("done", e);
|
|
64
75
|
}, r = (t) => {
|
|
65
|
-
e.status = "error", e.error = t ??
|
|
76
|
+
e.status = "error", e.error = t ?? k.value.failed, P.value = k.value.failedFile(e.file.name, e.error), A("error", e);
|
|
66
77
|
};
|
|
67
|
-
if (!
|
|
78
|
+
if (!O.url) return void A("upload", e, t, n, r);
|
|
68
79
|
let i = new XMLHttpRequest();
|
|
69
|
-
e.xhr = i, i.open("POST",
|
|
70
|
-
for (let [e, t] of Object.entries(
|
|
80
|
+
e.xhr = i, i.open("POST", O.url);
|
|
81
|
+
for (let [e, t] of Object.entries(O.headers ?? {})) i.setRequestHeader(e, t);
|
|
71
82
|
i.upload.onprogress = (e) => e.lengthComputable && t(e.loaded / e.total * 100), i.onload = () => i.status < 400 ? n() : r(`HTTP ${i.status}`), i.onerror = () => r(), i.onabort = () => e.status = "cancelled";
|
|
72
83
|
let a = new FormData();
|
|
73
|
-
a.append(
|
|
84
|
+
a.append(O.field, e.file), i.send(a);
|
|
74
85
|
}
|
|
75
|
-
let
|
|
76
|
-
async function
|
|
77
|
-
let t =
|
|
78
|
-
e.status === "uploading" &&
|
|
79
|
-
let n =
|
|
80
|
-
(n[Math.min(t, n.length - 1)] ??
|
|
86
|
+
let L = () => j.value.filter((e) => e.status === "queued").forEach(I), R = (e) => e.xhr ? e.xhr.abort() : e.status = "cancelled", z = g(), B = g();
|
|
87
|
+
async function V(e) {
|
|
88
|
+
let t = j.value.indexOf(e);
|
|
89
|
+
e.status === "uploading" && R(e), j.value = j.value.filter((t) => t !== e), await f();
|
|
90
|
+
let n = B.value?.querySelectorAll(".bless-uploader__x") ?? [];
|
|
91
|
+
(n[Math.min(t, n.length - 1)] ?? z.value?.querySelector("input[type=file]"))?.focus();
|
|
81
92
|
}
|
|
82
|
-
let
|
|
83
|
-
return
|
|
84
|
-
start:
|
|
85
|
-
clear:
|
|
86
|
-
queue:
|
|
87
|
-
}), (
|
|
93
|
+
let H = () => j.value = j.value.filter((e) => e.status === "uploading"), U = (e) => e < 1048576 ? `${(e / 1024).toFixed(0)} KB` : `${(e / 1048576).toFixed(1)} MB`;
|
|
94
|
+
return m(() => j.value.forEach((e) => e.status === "uploading" && e.xhr?.abort())), E({
|
|
95
|
+
start: L,
|
|
96
|
+
clear: H,
|
|
97
|
+
queue: j
|
|
98
|
+
}), (i, f) => (h(), s("div", {
|
|
88
99
|
ref_key: "root",
|
|
89
|
-
ref:
|
|
100
|
+
ref: z,
|
|
90
101
|
class: "bless-uploader"
|
|
91
102
|
}, [
|
|
92
|
-
|
|
93
|
-
modelValue:
|
|
94
|
-
"onUpdate:modelValue": [
|
|
95
|
-
accept:
|
|
96
|
-
multiple:
|
|
97
|
-
label:
|
|
98
|
-
hint:
|
|
103
|
+
u(n, {
|
|
104
|
+
modelValue: M.value,
|
|
105
|
+
"onUpdate:modelValue": [f[0] ||= (e) => M.value = e, F],
|
|
106
|
+
accept: d.accept,
|
|
107
|
+
multiple: d.multiple,
|
|
108
|
+
label: d.label,
|
|
109
|
+
hint: d.hint,
|
|
99
110
|
list: !1
|
|
100
111
|
}, null, 8, [
|
|
101
112
|
"modelValue",
|
|
@@ -104,54 +115,54 @@ var b = { class: "bless-uploader__name" }, x = { class: "bless-uploader__meta" }
|
|
|
104
115
|
"label",
|
|
105
116
|
"hint"
|
|
106
117
|
]),
|
|
107
|
-
|
|
118
|
+
j.value.length ? (h(), s("ul", {
|
|
108
119
|
key: 0,
|
|
109
120
|
role: "list",
|
|
110
121
|
ref_key: "list",
|
|
111
|
-
ref:
|
|
122
|
+
ref: B,
|
|
112
123
|
class: "bless-uploader__list"
|
|
113
|
-
}, [(
|
|
124
|
+
}, [(h(!0), s(r, null, _(j.value, (e) => (h(), s("li", {
|
|
114
125
|
key: e.id,
|
|
115
|
-
class:
|
|
126
|
+
class: p(["bless-uploader__item", `bless-uploader__item--${e.status}`])
|
|
116
127
|
}, [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
e.status === "uploading" ? (
|
|
128
|
+
c("span", x, y(e.file.name), 1),
|
|
129
|
+
c("span", S, y(e.error ?? (e.status === "done" ? "done" : e.status === "uploading" ? `${Math.round(e.progress)}%` : U(e.file.size))), 1),
|
|
130
|
+
e.status === "uploading" ? (h(), a(t, {
|
|
120
131
|
key: 0,
|
|
121
132
|
value: e.progress,
|
|
122
133
|
size: "sm",
|
|
123
134
|
class: "bless-uploader__bar"
|
|
124
|
-
}, null, 8, ["value"])) :
|
|
125
|
-
|
|
135
|
+
}, null, 8, ["value"])) : o("", !0),
|
|
136
|
+
c("button", {
|
|
126
137
|
type: "button",
|
|
127
138
|
class: "bless-uploader__x",
|
|
128
|
-
"aria-label":
|
|
129
|
-
onClick: (t) => e.status === "uploading" ?
|
|
130
|
-
}, " × ", 8,
|
|
131
|
-
], 2))), 128))], 512)) :
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
start:
|
|
135
|
-
clear:
|
|
136
|
-
queue:
|
|
137
|
-
}, () => [
|
|
139
|
+
"aria-label": (e.status === "uploading" ? k.value.cancel : k.value.remove)(e.file.name),
|
|
140
|
+
onClick: (t) => e.status === "uploading" ? R(e) : V(e)
|
|
141
|
+
}, " × ", 8, C)
|
|
142
|
+
], 2))), 128))], 512)) : o("", !0),
|
|
143
|
+
c("span", w, y(P.value), 1),
|
|
144
|
+
j.value.length ? (h(), s("div", T, [v(i.$slots, "actions", {
|
|
145
|
+
start: L,
|
|
146
|
+
clear: H,
|
|
147
|
+
queue: j.value
|
|
148
|
+
}, () => [u(e, {
|
|
138
149
|
size: "sm",
|
|
139
150
|
variant: "outline",
|
|
140
|
-
onClick:
|
|
151
|
+
onClick: H
|
|
141
152
|
}, {
|
|
142
|
-
default:
|
|
153
|
+
default: b(() => [l(y(k.value.clear), 1)]),
|
|
143
154
|
_: 1
|
|
144
|
-
}),
|
|
155
|
+
}), d.auto ? o("", !0) : (h(), a(e, {
|
|
145
156
|
key: 0,
|
|
146
157
|
size: "sm",
|
|
147
|
-
disabled: !
|
|
148
|
-
onClick:
|
|
158
|
+
disabled: !j.value.some((e) => e.status === "queued"),
|
|
159
|
+
onClick: L
|
|
149
160
|
}, {
|
|
150
|
-
default:
|
|
161
|
+
default: b(() => [l(y(k.value.upload), 1)]),
|
|
151
162
|
_: 1
|
|
152
|
-
}, 8, ["disabled"]))])])) :
|
|
163
|
+
}, 8, ["disabled"]))])])) : o("", !0)
|
|
153
164
|
], 512));
|
|
154
165
|
}
|
|
155
166
|
});
|
|
156
167
|
//#endregion
|
|
157
|
-
export {
|
|
168
|
+
export { E as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A mark on an image. All numbers are fractions (0–1) of the image, so they survive any size. */
|
|
2
|
+
export interface Region {
|
|
3
|
+
id: string;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
/** present on a box, absent on a pin */
|
|
7
|
+
w?: number;
|
|
8
|
+
h?: number;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
/** the smallest side of a box, as a fraction of the image */
|
|
12
|
+
export declare const MIN_SIDE = 0.02;
|
|
13
|
+
export declare const isBox: (r: Region) => r is Region & {
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
/** The box between two points, kept inside the image. */
|
|
18
|
+
export declare function boxFrom(a: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}, b: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}): {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
w: number;
|
|
28
|
+
h: number;
|
|
29
|
+
};
|
|
30
|
+
/** `r` moved by (dx, dy), stopping at the image edges. */
|
|
31
|
+
export declare function moveRegion(r: Region, dx: number, dy: number): Region;
|
|
32
|
+
/** A box grown by (dw, dh) from its top-left corner; a pin is returned as it is. */
|
|
33
|
+
export declare function resizeRegion(r: Region, dw: number, dh: number): Region;
|
|
34
|
+
/** The first `r1`, `r2`… not already used. */
|
|
35
|
+
export declare function nextId(regions: readonly Region[]): string;
|