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,110 @@
|
|
|
1
|
+
import { CanvasView } from './BlessInfiniteCanvas.vue';
|
|
2
|
+
import { GraphEdge as Edge } from '../composables/graph';
|
|
3
|
+
export interface BlessGraphNode {
|
|
4
|
+
id: string;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
export type { GraphEdge as BlessGraphEdge } from '../composables/graph';
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
|
|
13
|
+
/** size used for ports and links; put content that fits it in the `#node` slot */
|
|
14
|
+
nodeWidth?: number;
|
|
15
|
+
nodeHeight?: number;
|
|
16
|
+
/** snap dragged nodes to this grid, px; 0 is free */
|
|
17
|
+
snap?: number;
|
|
18
|
+
/** refuse a link that would close a loop */
|
|
19
|
+
acyclic?: boolean;
|
|
20
|
+
/** off: nodes can be selected and the view moved, nothing is dragged, linked or removed */
|
|
21
|
+
editable?: boolean;
|
|
22
|
+
grid?: boolean;
|
|
23
|
+
controls?: boolean;
|
|
24
|
+
minZoom?: number;
|
|
25
|
+
maxZoom?: number;
|
|
26
|
+
label?: string;
|
|
27
|
+
labels?: Partial<{
|
|
28
|
+
node: (label: string, to: string[], from: string[]) => string;
|
|
29
|
+
linkFrom: (from: string) => string;
|
|
30
|
+
linkTo: (from: string, to: string, exists: boolean) => string;
|
|
31
|
+
linked: (from: string, to: string) => string;
|
|
32
|
+
unlinked: (from: string, to: string) => string;
|
|
33
|
+
refused: (from: string, to: string, why: "self" | "exists" | "cycle") => string;
|
|
34
|
+
cancelled: string;
|
|
35
|
+
removed: (label: string) => string;
|
|
36
|
+
hint: string;
|
|
37
|
+
}>;
|
|
38
|
+
} & {
|
|
39
|
+
nodes?: BlessGraphNode[];
|
|
40
|
+
edges?: Edge[];
|
|
41
|
+
selected?: string | null;
|
|
42
|
+
view?: CanvasView;
|
|
43
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
44
|
+
disconnect: (edge: Edge) => any;
|
|
45
|
+
remove: (id: string) => any;
|
|
46
|
+
"update:selected": (value: string | null) => any;
|
|
47
|
+
move: (id: string, x: number, y: number) => any;
|
|
48
|
+
"update:view": (value: CanvasView) => any;
|
|
49
|
+
"update:nodes": (value: BlessGraphNode[]) => any;
|
|
50
|
+
"update:edges": (value: Edge[]) => any;
|
|
51
|
+
connect: (edge: Edge) => any;
|
|
52
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
53
|
+
/** size used for ports and links; put content that fits it in the `#node` slot */
|
|
54
|
+
nodeWidth?: number;
|
|
55
|
+
nodeHeight?: number;
|
|
56
|
+
/** snap dragged nodes to this grid, px; 0 is free */
|
|
57
|
+
snap?: number;
|
|
58
|
+
/** refuse a link that would close a loop */
|
|
59
|
+
acyclic?: boolean;
|
|
60
|
+
/** off: nodes can be selected and the view moved, nothing is dragged, linked or removed */
|
|
61
|
+
editable?: boolean;
|
|
62
|
+
grid?: boolean;
|
|
63
|
+
controls?: boolean;
|
|
64
|
+
minZoom?: number;
|
|
65
|
+
maxZoom?: number;
|
|
66
|
+
label?: string;
|
|
67
|
+
labels?: Partial<{
|
|
68
|
+
node: (label: string, to: string[], from: string[]) => string;
|
|
69
|
+
linkFrom: (from: string) => string;
|
|
70
|
+
linkTo: (from: string, to: string, exists: boolean) => string;
|
|
71
|
+
linked: (from: string, to: string) => string;
|
|
72
|
+
unlinked: (from: string, to: string) => string;
|
|
73
|
+
refused: (from: string, to: string, why: "self" | "exists" | "cycle") => string;
|
|
74
|
+
cancelled: string;
|
|
75
|
+
removed: (label: string) => string;
|
|
76
|
+
hint: string;
|
|
77
|
+
}>;
|
|
78
|
+
} & {
|
|
79
|
+
nodes?: BlessGraphNode[];
|
|
80
|
+
edges?: Edge[];
|
|
81
|
+
selected?: string | null;
|
|
82
|
+
view?: CanvasView;
|
|
83
|
+
}> & Readonly<{
|
|
84
|
+
onDisconnect?: ((edge: Edge) => any) | undefined;
|
|
85
|
+
onRemove?: ((id: string) => any) | undefined;
|
|
86
|
+
"onUpdate:selected"?: ((value: string | null) => any) | undefined;
|
|
87
|
+
onMove?: ((id: string, x: number, y: number) => any) | undefined;
|
|
88
|
+
"onUpdate:view"?: ((value: CanvasView) => any) | undefined;
|
|
89
|
+
"onUpdate:nodes"?: ((value: BlessGraphNode[]) => any) | undefined;
|
|
90
|
+
"onUpdate:edges"?: ((value: Edge[]) => any) | undefined;
|
|
91
|
+
onConnect?: ((edge: Edge) => any) | undefined;
|
|
92
|
+
}>, {
|
|
93
|
+
label: string;
|
|
94
|
+
grid: boolean;
|
|
95
|
+
controls: boolean;
|
|
96
|
+
editable: boolean;
|
|
97
|
+
nodeWidth: number;
|
|
98
|
+
nodeHeight: number;
|
|
99
|
+
snap: number;
|
|
100
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
101
|
+
node?: (props: {
|
|
102
|
+
node: BlessGraphNode;
|
|
103
|
+
selected: boolean;
|
|
104
|
+
}) => any;
|
|
105
|
+
}>;
|
|
106
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
107
|
+
new (): {
|
|
108
|
+
$slots: S;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import e from "./BlessInfiniteCanvas.js";
|
|
2
|
+
import { edgeKey as t, edgePath as n, linkProblem as r, snapTo as i } from "../composables/graph.js";
|
|
3
|
+
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeModels as f, nextTick as ee, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, useId as b, useModel as x, withCtx as S, withModifiers as C } from "vue";
|
|
4
|
+
//#region src/components/BlessNodeGraph.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var w = {
|
|
6
|
+
class: "bless-graph__edges",
|
|
7
|
+
"aria-hidden": "true"
|
|
8
|
+
}, te = ["d", "marker-end"], ne = ["d", "onPointerdown"], re = ["d"], ie = [
|
|
9
|
+
"data-node-id",
|
|
10
|
+
"aria-label",
|
|
11
|
+
"tabindex",
|
|
12
|
+
"onPointerdown",
|
|
13
|
+
"onPointermove",
|
|
14
|
+
"onPointerup",
|
|
15
|
+
"onPointercancel",
|
|
16
|
+
"onKeydown"
|
|
17
|
+
], T = { class: "bless-graph__label" }, E = ["onPointerdown"], D = {
|
|
18
|
+
class: "bless-graph__live",
|
|
19
|
+
"aria-live": "polite"
|
|
20
|
+
}, O = /*@__PURE__*/ d({
|
|
21
|
+
name: "BlessNodeGraph",
|
|
22
|
+
__name: "BlessNodeGraph",
|
|
23
|
+
props: /*@__PURE__*/ f({
|
|
24
|
+
nodeWidth: { default: 160 },
|
|
25
|
+
nodeHeight: { default: 56 },
|
|
26
|
+
snap: { default: 0 },
|
|
27
|
+
acyclic: { type: Boolean },
|
|
28
|
+
editable: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !0
|
|
31
|
+
},
|
|
32
|
+
grid: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !0
|
|
35
|
+
},
|
|
36
|
+
controls: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !0
|
|
39
|
+
},
|
|
40
|
+
minZoom: {},
|
|
41
|
+
maxZoom: {},
|
|
42
|
+
label: { default: "Graph" },
|
|
43
|
+
labels: {}
|
|
44
|
+
}, {
|
|
45
|
+
nodes: { default: () => [] },
|
|
46
|
+
nodesModifiers: {},
|
|
47
|
+
edges: { default: () => [] },
|
|
48
|
+
edgesModifiers: {},
|
|
49
|
+
selected: { default: null },
|
|
50
|
+
selectedModifiers: {},
|
|
51
|
+
view: { default: () => ({
|
|
52
|
+
x: 0,
|
|
53
|
+
y: 0,
|
|
54
|
+
zoom: 1
|
|
55
|
+
}) },
|
|
56
|
+
viewModifiers: {}
|
|
57
|
+
}),
|
|
58
|
+
emits: /*@__PURE__*/ f([
|
|
59
|
+
"connect",
|
|
60
|
+
"disconnect",
|
|
61
|
+
"move",
|
|
62
|
+
"remove"
|
|
63
|
+
], [
|
|
64
|
+
"update:nodes",
|
|
65
|
+
"update:edges",
|
|
66
|
+
"update:selected",
|
|
67
|
+
"update:view"
|
|
68
|
+
]),
|
|
69
|
+
setup(d, { emit: f }) {
|
|
70
|
+
let O = d, k = x(d, "nodes"), A = x(d, "edges"), j = x(d, "selected"), M = x(d, "view"), N = f, P = o(() => ({
|
|
71
|
+
node: (e, t, n) => e + (t.length ? `. Links to ${t.join(", ")}` : "") + (n.length ? `. Linked from ${n.join(", ")}` : ""),
|
|
72
|
+
linkFrom: (e) => `Linking from ${e}. Arrow keys choose the target, Enter links or unlinks, Escape cancels.`,
|
|
73
|
+
linkTo: (e, t, n) => e === t ? `${e}: choose another node` : `${n ? "Unlink" : "Link"} ${e} to ${t}? Enter`,
|
|
74
|
+
linked: (e, t) => `Linked ${e} to ${t}`,
|
|
75
|
+
unlinked: (e, t) => `Unlinked ${e} from ${t}`,
|
|
76
|
+
refused: (e, t, n) => n === "cycle" ? `Not linked: ${t} already leads to ${e}` : `Not linked: ${e} to ${t}`,
|
|
77
|
+
cancelled: "Cancelled",
|
|
78
|
+
removed: (e) => `Removed ${e}`,
|
|
79
|
+
hint: "Arrow keys move the node, L starts a link, Delete removes it.",
|
|
80
|
+
...O.labels
|
|
81
|
+
})), F = g(), I = g(), L = g(""), R = `${b()}-hint`, z = `${b()}-arrow`, B = o(() => new Map(k.value.map((e) => [e.id, e]))), V = (e) => ({
|
|
82
|
+
x: e.x + O.nodeWidth,
|
|
83
|
+
y: e.y + O.nodeHeight / 2
|
|
84
|
+
}), H = (e) => ({
|
|
85
|
+
x: e.x,
|
|
86
|
+
y: e.y + O.nodeHeight / 2
|
|
87
|
+
}), U = o(() => A.value.flatMap((e) => {
|
|
88
|
+
let r = B.value.get(e.from), i = B.value.get(e.to);
|
|
89
|
+
return r && i ? [{
|
|
90
|
+
edge: e,
|
|
91
|
+
key: t(e),
|
|
92
|
+
d: n(V(r), H(i))
|
|
93
|
+
}] : [];
|
|
94
|
+
})), W = (e) => B.value.get(e)?.label ?? e, G = (e) => P.value.node(e.label, A.value.filter((t) => t.from === e.id).map((e) => W(e.to)), A.value.filter((t) => t.to === e.id).map((e) => W(e.from))), K = g(null);
|
|
95
|
+
function q(e, t) {
|
|
96
|
+
let n = r(A.value, e, t, O.acyclic);
|
|
97
|
+
if (n === "exists") {
|
|
98
|
+
let n = A.value.find((n) => n.from === e && n.to === t);
|
|
99
|
+
A.value = A.value.filter((e) => e !== n), N("disconnect", n), L.value = P.value.unlinked(W(e), W(t));
|
|
100
|
+
} else if (n) L.value = P.value.refused(W(e), W(t), n);
|
|
101
|
+
else {
|
|
102
|
+
let n = {
|
|
103
|
+
from: e,
|
|
104
|
+
to: t
|
|
105
|
+
};
|
|
106
|
+
A.value = [...A.value, n], N("connect", n), L.value = P.value.linked(W(e), W(t));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
let J = g(null), Y = g(null), ae = (e) => F.value?.querySelector(`[data-node-id="${CSS.escape(e)}"]`);
|
|
110
|
+
function oe(e, t) {
|
|
111
|
+
j.value = e.id, K.value = null, O.editable && !t.button && (t.currentTarget.setPointerCapture?.(t.pointerId), J.value = {
|
|
112
|
+
id: e.id,
|
|
113
|
+
cx: t.clientX,
|
|
114
|
+
cy: t.clientY,
|
|
115
|
+
x: e.x,
|
|
116
|
+
y: e.y,
|
|
117
|
+
moved: !1
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function se(e, t) {
|
|
121
|
+
let n = J.value;
|
|
122
|
+
if (!n || n.id !== e.id) return;
|
|
123
|
+
let r = M.value.zoom, a = i(n.x + (t.clientX - n.cx) / r, O.snap), o = i(n.y + (t.clientY - n.cy) / r, O.snap);
|
|
124
|
+
(a !== e.x || o !== e.y) && (n.moved = !0, k.value = k.value.map((t) => t.id === e.id ? {
|
|
125
|
+
...t,
|
|
126
|
+
x: a,
|
|
127
|
+
y: o
|
|
128
|
+
} : t));
|
|
129
|
+
}
|
|
130
|
+
function X(e) {
|
|
131
|
+
let t = J.value;
|
|
132
|
+
if (J.value = null, t?.moved) {
|
|
133
|
+
let t = B.value.get(e.id);
|
|
134
|
+
N("move", e.id, t.x, t.y);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function ce(e, t) {
|
|
138
|
+
if (!O.editable || t.button) return;
|
|
139
|
+
t.stopPropagation(), t.currentTarget.setPointerCapture?.(t.pointerId);
|
|
140
|
+
let n = I.value.toWorld(t.clientX, t.clientY);
|
|
141
|
+
Y.value = {
|
|
142
|
+
from: e.id,
|
|
143
|
+
...n
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function le(e) {
|
|
147
|
+
Y.value &&= {
|
|
148
|
+
...Y.value,
|
|
149
|
+
...I.value.toWorld(e.clientX, e.clientY)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function ue(e) {
|
|
153
|
+
let t = Y.value;
|
|
154
|
+
if (Y.value = null, t) for (let n of document.elementsFromPoint(e.clientX, e.clientY)) {
|
|
155
|
+
let e = n.closest?.("[data-node-id]")?.getAttribute("data-node-id");
|
|
156
|
+
if (e && F.value?.contains(n)) return void q(t.from, e);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
let Z = o(() => {
|
|
160
|
+
let e = Y.value && B.value.get(Y.value.from);
|
|
161
|
+
if (e && Y.value) return n(V(e), Y.value);
|
|
162
|
+
let t = Q.value, r = t && B.value.get(t.from), i = t && B.value.get(t.target);
|
|
163
|
+
return r && i && r !== i ? n(V(r), H(i)) : null;
|
|
164
|
+
}), Q = g(null), $ = (e) => ee(() => ae(e)?.focus());
|
|
165
|
+
function de(e, t) {
|
|
166
|
+
let n = Q.value;
|
|
167
|
+
if (n) {
|
|
168
|
+
let e = k.value, r = e.findIndex((e) => e.id === n.target), i = /^Arrow(Right|Down)$/.test(t.key) ? 1 : /^Arrow(Left|Up)$/.test(t.key) ? -1 : 0;
|
|
169
|
+
if (i) {
|
|
170
|
+
t.preventDefault();
|
|
171
|
+
let a = e[(r + i + e.length) % e.length];
|
|
172
|
+
Q.value = {
|
|
173
|
+
from: n.from,
|
|
174
|
+
target: a.id
|
|
175
|
+
}, L.value = P.value.linkTo(W(n.from), a.label, A.value.some((e) => e.from === n.from && e.to === a.id)), $(a.id);
|
|
176
|
+
} else t.key === "Enter" || t.key === " " ? (t.preventDefault(), Q.value = null, n.target !== n.from && q(n.from, n.target), $(n.from)) : t.key === "Escape" && (t.preventDefault(), Q.value = null, L.value = P.value.cancelled, $(n.from));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
180
|
+
t.preventDefault(), j.value = e.id;
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (!O.editable) return;
|
|
184
|
+
let r = t.shiftKey ? 32 : 8, i = {
|
|
185
|
+
ArrowLeft: [-r, 0],
|
|
186
|
+
ArrowRight: [r, 0],
|
|
187
|
+
ArrowUp: [0, -r],
|
|
188
|
+
ArrowDown: [0, r]
|
|
189
|
+
}[t.key];
|
|
190
|
+
if (i) {
|
|
191
|
+
t.preventDefault();
|
|
192
|
+
let n = e.x + i[0], r = e.y + i[1];
|
|
193
|
+
k.value = k.value.map((t) => t.id === e.id ? {
|
|
194
|
+
...t,
|
|
195
|
+
x: n,
|
|
196
|
+
y: r
|
|
197
|
+
} : t), N("move", e.id, n, r);
|
|
198
|
+
} else if (t.key === "l" || t.key === "L") t.preventDefault(), Q.value = {
|
|
199
|
+
from: e.id,
|
|
200
|
+
target: e.id
|
|
201
|
+
}, L.value = P.value.linkFrom(e.label);
|
|
202
|
+
else if (t.key === "Delete" || t.key === "Backspace") {
|
|
203
|
+
t.preventDefault();
|
|
204
|
+
let n = k.value.findIndex((t) => t.id === e.id);
|
|
205
|
+
k.value = k.value.filter((t) => t.id !== e.id), A.value = A.value.filter((t) => t.from !== e.id && t.to !== e.id), j.value === e.id && (j.value = null), N("remove", e.id), L.value = P.value.removed(e.label);
|
|
206
|
+
let r = k.value[Math.min(n, k.value.length - 1)];
|
|
207
|
+
r ? $(r.id) : F.value?.querySelector(".bless-canvas")?.focus();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function fe(e) {
|
|
211
|
+
if (!O.editable || !K.value || !/^(Delete|Backspace)$/.test(e.key) || e.target.closest?.("[data-node-id]")) return;
|
|
212
|
+
let t = U.value.find((e) => e.key === K.value);
|
|
213
|
+
t && (e.preventDefault(), A.value = A.value.filter((e) => e !== t.edge), N("disconnect", t.edge), L.value = P.value.unlinked(W(t.edge.from), W(t.edge.to)), K.value = null);
|
|
214
|
+
}
|
|
215
|
+
let pe = o(() => j.value && B.value.has(j.value) ? j.value : k.value[0]?.id);
|
|
216
|
+
return (t, n) => (h(), c("div", {
|
|
217
|
+
ref_key: "root",
|
|
218
|
+
ref: F,
|
|
219
|
+
class: "bless-graph",
|
|
220
|
+
onKeydown: fe
|
|
221
|
+
}, [
|
|
222
|
+
u(e, {
|
|
223
|
+
ref_key: "canvas",
|
|
224
|
+
ref: I,
|
|
225
|
+
view: M.value,
|
|
226
|
+
"onUpdate:view": n[1] ||= (e) => M.value = e,
|
|
227
|
+
grid: d.grid,
|
|
228
|
+
controls: d.controls,
|
|
229
|
+
"min-zoom": d.minZoom,
|
|
230
|
+
"max-zoom": d.maxZoom,
|
|
231
|
+
label: d.label
|
|
232
|
+
}, {
|
|
233
|
+
default: S(() => [(h(), c("svg", w, [
|
|
234
|
+
l("defs", null, [l("marker", {
|
|
235
|
+
id: z,
|
|
236
|
+
viewBox: "0 0 8 8",
|
|
237
|
+
refX: "7",
|
|
238
|
+
refY: "4",
|
|
239
|
+
markerWidth: "8",
|
|
240
|
+
markerHeight: "8",
|
|
241
|
+
orient: "auto"
|
|
242
|
+
}, [...n[2] ||= [l("path", {
|
|
243
|
+
d: "M0 0L8 4L0 8z",
|
|
244
|
+
class: "bless-graph__arrow"
|
|
245
|
+
}, null, -1)]])]),
|
|
246
|
+
(h(!0), c(a, null, _(U.value, (e) => (h(), c("g", { key: e.key }, [l("path", {
|
|
247
|
+
class: p(["bless-graph__edge", { "bless-graph__edge--sel": K.value === e.key }]),
|
|
248
|
+
d: e.d,
|
|
249
|
+
"marker-end": `url(#${z})`
|
|
250
|
+
}, null, 10, te), l("path", {
|
|
251
|
+
class: "bless-graph__edge-hit",
|
|
252
|
+
d: e.d,
|
|
253
|
+
onPointerdown: C((t) => (K.value = e.key, j.value = null), ["stop"])
|
|
254
|
+
}, null, 40, ne)]))), 128)),
|
|
255
|
+
Z.value ? (h(), c("path", {
|
|
256
|
+
key: 0,
|
|
257
|
+
class: "bless-graph__edge bless-graph__edge--preview",
|
|
258
|
+
d: Z.value
|
|
259
|
+
}, null, 8, re)) : s("", !0)
|
|
260
|
+
])), (h(!0), c(a, null, _(k.value, (e) => (h(), c("div", {
|
|
261
|
+
key: e.id,
|
|
262
|
+
class: p(["bless-graph__node", {
|
|
263
|
+
"bless-graph__node--sel": j.value === e.id,
|
|
264
|
+
"bless-graph__node--target": Q.value?.target === e.id && Q.value.from !== e.id,
|
|
265
|
+
"bless-graph__node--drag": J.value?.id === e.id
|
|
266
|
+
}]),
|
|
267
|
+
"data-node-id": e.id,
|
|
268
|
+
role: "group",
|
|
269
|
+
"aria-roledescription": "node",
|
|
270
|
+
"aria-label": G(e),
|
|
271
|
+
"aria-describedby": R,
|
|
272
|
+
tabindex: pe.value === e.id ? 0 : -1,
|
|
273
|
+
style: m({
|
|
274
|
+
left: `${e.x}px`,
|
|
275
|
+
top: `${e.y}px`,
|
|
276
|
+
width: `${d.nodeWidth}px`,
|
|
277
|
+
height: `${d.nodeHeight}px`
|
|
278
|
+
}),
|
|
279
|
+
onPointerdown: (t) => oe(e, t),
|
|
280
|
+
onPointermove: (t) => se(e, t),
|
|
281
|
+
onPointerup: (t) => X(e),
|
|
282
|
+
onPointercancel: (t) => X(e),
|
|
283
|
+
onKeydown: C((t) => de(e, t), ["self"])
|
|
284
|
+
}, [
|
|
285
|
+
n[3] ||= l("span", {
|
|
286
|
+
class: "bless-graph__port bless-graph__port--in",
|
|
287
|
+
"aria-hidden": "true"
|
|
288
|
+
}, null, -1),
|
|
289
|
+
v(t.$slots, "node", {
|
|
290
|
+
node: e,
|
|
291
|
+
selected: j.value === e.id
|
|
292
|
+
}, () => [l("span", T, y(e.label), 1)]),
|
|
293
|
+
d.editable ? (h(), c("span", {
|
|
294
|
+
key: 0,
|
|
295
|
+
class: "bless-graph__port bless-graph__port--out",
|
|
296
|
+
"aria-hidden": "true",
|
|
297
|
+
onPointerdown: (t) => ce(e, t),
|
|
298
|
+
onPointermove: le,
|
|
299
|
+
onPointerup: ue,
|
|
300
|
+
onPointercancel: n[0] ||= (e) => Y.value = null
|
|
301
|
+
}, null, 40, E)) : s("", !0)
|
|
302
|
+
], 46, ie))), 128))]),
|
|
303
|
+
_: 3
|
|
304
|
+
}, 8, [
|
|
305
|
+
"view",
|
|
306
|
+
"grid",
|
|
307
|
+
"controls",
|
|
308
|
+
"min-zoom",
|
|
309
|
+
"max-zoom",
|
|
310
|
+
"label"
|
|
311
|
+
]),
|
|
312
|
+
l("span", {
|
|
313
|
+
id: R,
|
|
314
|
+
hidden: ""
|
|
315
|
+
}, y(P.value.hint), 1),
|
|
316
|
+
l("span", D, y(L.value), 1)
|
|
317
|
+
], 544));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
//#endregion
|
|
321
|
+
export { O as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-checklist{gap:var(--bless-space-2);box-sizing:border-box;width:min(100%,360px);padding:var(--bless-space-3);background:var(--bless-color-bg);border:var(--bless-border-width) solid var(--bless-color-border);font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);display:grid}.bless-checklist--floating{z-index:var(--bless-z-nav);box-shadow:var(--bless-shadow-plate);position:fixed;inset-block-end:var(--bless-space-4);inset-inline-end:var(--bless-space-4)}.bless-checklist__head{align-items:center;gap:var(--bless-space-2);display:flex}.bless-checklist__toggle{align-items:center;gap:var(--bless-space-2);color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:0;flex:1;padding:0;display:flex}.bless-checklist__toggle:focus-visible,.bless-checklist__close:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}.bless-checklist__title{font-weight:var(--bless-font-weight-bold,700)}.bless-checklist__count{color:var(--bless-color-text-muted);margin-inline-start:auto}.bless-checklist__close{padding:0 var(--bless-space-2);color:var(--bless-color-text-muted);font:inherit;font-size:var(--bless-text-lg);cursor:pointer;background:0 0;border:0;line-height:1}.bless-checklist__list{gap:var(--bless-space-2);margin:0;padding:0;list-style:none;display:grid}.bless-checklist__item{justify-content:space-between;align-items:flex-start;gap:var(--bless-space-2);display:flex}.bless-checklist__all{margin:var(--bless-space-2) 0 0;color:var(--bless-color-text);font-weight:var(--bless-font-weight-bold,700)}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface BlessChecklistItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
/** text of a button that takes the person to the step; it emits `select` */
|
|
6
|
+
action?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
|
|
11
|
+
items: BlessChecklistItem[];
|
|
12
|
+
title?: string;
|
|
13
|
+
/** remember progress, collapsed state and dismissal under this key (localStorage) */
|
|
14
|
+
persist?: string;
|
|
15
|
+
/** pin it to the bottom corner of the window */
|
|
16
|
+
floating?: boolean;
|
|
17
|
+
/** a close button that dismisses it for good */
|
|
18
|
+
dismissible?: boolean;
|
|
19
|
+
labels?: Partial<{
|
|
20
|
+
progress: (done: number, total: number) => string;
|
|
21
|
+
complete: string;
|
|
22
|
+
dismiss: string;
|
|
23
|
+
}>;
|
|
24
|
+
} & {
|
|
25
|
+
/** ids of the finished steps */
|
|
26
|
+
done?: string[];
|
|
27
|
+
collapsed?: boolean;
|
|
28
|
+
dismissed?: boolean;
|
|
29
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
select: (item: BlessChecklistItem) => any;
|
|
31
|
+
dismiss: () => any;
|
|
32
|
+
complete: () => any;
|
|
33
|
+
"update:dismissed": (value: boolean) => any;
|
|
34
|
+
"update:done": (value: string[]) => any;
|
|
35
|
+
"update:collapsed": (value: boolean) => any;
|
|
36
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
37
|
+
items: BlessChecklistItem[];
|
|
38
|
+
title?: string;
|
|
39
|
+
/** remember progress, collapsed state and dismissal under this key (localStorage) */
|
|
40
|
+
persist?: string;
|
|
41
|
+
/** pin it to the bottom corner of the window */
|
|
42
|
+
floating?: boolean;
|
|
43
|
+
/** a close button that dismisses it for good */
|
|
44
|
+
dismissible?: boolean;
|
|
45
|
+
labels?: Partial<{
|
|
46
|
+
progress: (done: number, total: number) => string;
|
|
47
|
+
complete: string;
|
|
48
|
+
dismiss: string;
|
|
49
|
+
}>;
|
|
50
|
+
} & {
|
|
51
|
+
/** ids of the finished steps */
|
|
52
|
+
done?: string[];
|
|
53
|
+
collapsed?: boolean;
|
|
54
|
+
dismissed?: boolean;
|
|
55
|
+
}> & Readonly<{
|
|
56
|
+
onSelect?: ((item: BlessChecklistItem) => any) | undefined;
|
|
57
|
+
onDismiss?: (() => any) | undefined;
|
|
58
|
+
onComplete?: (() => any) | undefined;
|
|
59
|
+
"onUpdate:dismissed"?: ((value: boolean) => any) | undefined;
|
|
60
|
+
"onUpdate:done"?: ((value: string[]) => any) | undefined;
|
|
61
|
+
"onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
title: string;
|
|
64
|
+
dismissible: boolean;
|
|
65
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
66
|
+
complete?: (props: {}) => any;
|
|
67
|
+
}>;
|
|
68
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
69
|
+
new (): {
|
|
70
|
+
$slots: S;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import e from "./BlessButton.js";
|
|
2
|
+
import t from "./BlessCheckbox.js";
|
|
3
|
+
import n from "./BlessProgress.js";
|
|
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, mergeModels as f, normalizeClass as p, onMounted as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useId as x, useModel as S, vShow as C, watch as w, withCtx as T, withDirectives as E } from "vue";
|
|
5
|
+
//#region src/components/BlessOnboardingChecklist.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var D = ["aria-labelledby"], O = { class: "bless-checklist__head" }, k = ["aria-expanded", "aria-controls"], A = ["id"], j = { class: "bless-checklist__count" }, M = {
|
|
7
|
+
class: "bless-checklist__chev",
|
|
8
|
+
"aria-hidden": "true"
|
|
9
|
+
}, N = ["aria-label"], P = ["id"], F = {
|
|
10
|
+
class: "bless-checklist__list",
|
|
11
|
+
role: "list"
|
|
12
|
+
}, I = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "bless-checklist__all",
|
|
15
|
+
role: "status"
|
|
16
|
+
}, L = /*@__PURE__*/ d({
|
|
17
|
+
name: "BlessOnboardingChecklist",
|
|
18
|
+
__name: "BlessOnboardingChecklist",
|
|
19
|
+
props: /*@__PURE__*/ f({
|
|
20
|
+
items: {},
|
|
21
|
+
title: { default: "Getting started" },
|
|
22
|
+
persist: {},
|
|
23
|
+
floating: { type: Boolean },
|
|
24
|
+
dismissible: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !0
|
|
27
|
+
},
|
|
28
|
+
labels: {}
|
|
29
|
+
}, {
|
|
30
|
+
done: { default: () => [] },
|
|
31
|
+
doneModifiers: {},
|
|
32
|
+
collapsed: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
collapsedModifiers: {},
|
|
37
|
+
dismissed: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: !1
|
|
40
|
+
},
|
|
41
|
+
dismissedModifiers: {}
|
|
42
|
+
}),
|
|
43
|
+
emits: /*@__PURE__*/ f([
|
|
44
|
+
"select",
|
|
45
|
+
"complete",
|
|
46
|
+
"dismiss"
|
|
47
|
+
], [
|
|
48
|
+
"update:done",
|
|
49
|
+
"update:collapsed",
|
|
50
|
+
"update:dismissed"
|
|
51
|
+
]),
|
|
52
|
+
setup(d, { emit: f }) {
|
|
53
|
+
let L = d, R = S(d, "done"), z = S(d, "collapsed"), B = S(d, "dismissed"), V = f, H = i(() => ({
|
|
54
|
+
progress: (e, t) => `${e} of ${t} done`,
|
|
55
|
+
complete: "All done — nicely finished.",
|
|
56
|
+
dismiss: "Dismiss",
|
|
57
|
+
...L.labels
|
|
58
|
+
})), U = x(), W = i(() => L.items.filter((e) => R.value.includes(e.id)).length), G = i(() => L.items.length), K = i(() => G.value > 0 && W.value === G.value), q = i(() => L.persist ? `bless-checklist:${L.persist}` : null), J = g(!1);
|
|
59
|
+
m(() => {
|
|
60
|
+
try {
|
|
61
|
+
let e = q.value && localStorage.getItem(q.value);
|
|
62
|
+
if (e) {
|
|
63
|
+
let t = JSON.parse(e);
|
|
64
|
+
t.done && (R.value = t.done), typeof t.collapsed == "boolean" && (z.value = t.collapsed), t.dismissed && (B.value = !0);
|
|
65
|
+
}
|
|
66
|
+
} catch {}
|
|
67
|
+
J.value = !0;
|
|
68
|
+
}), w([
|
|
69
|
+
R,
|
|
70
|
+
z,
|
|
71
|
+
B
|
|
72
|
+
], () => {
|
|
73
|
+
if (J.value && q.value) try {
|
|
74
|
+
localStorage.setItem(q.value, JSON.stringify({
|
|
75
|
+
done: R.value,
|
|
76
|
+
collapsed: z.value,
|
|
77
|
+
dismissed: B.value
|
|
78
|
+
}));
|
|
79
|
+
} catch {}
|
|
80
|
+
});
|
|
81
|
+
let Y = !1;
|
|
82
|
+
w(K, (e) => {
|
|
83
|
+
e && !Y && (Y = !0, V("complete")), e || (Y = !1);
|
|
84
|
+
});
|
|
85
|
+
function X() {
|
|
86
|
+
B.value = !0, V("dismiss");
|
|
87
|
+
}
|
|
88
|
+
return (i, f) => B.value ? o("", !0) : (h(), s("section", {
|
|
89
|
+
key: 0,
|
|
90
|
+
class: p(["bless-checklist", {
|
|
91
|
+
"bless-checklist--floating": d.floating,
|
|
92
|
+
"bless-checklist--done": K.value
|
|
93
|
+
}]),
|
|
94
|
+
"aria-labelledby": `${b(U)}-t`
|
|
95
|
+
}, [
|
|
96
|
+
c("header", O, [c("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
class: "bless-checklist__toggle",
|
|
99
|
+
"aria-expanded": !z.value,
|
|
100
|
+
"aria-controls": `${b(U)}-b`,
|
|
101
|
+
onClick: f[0] ||= (e) => z.value = !z.value
|
|
102
|
+
}, [
|
|
103
|
+
c("span", {
|
|
104
|
+
id: `${b(U)}-t`,
|
|
105
|
+
class: "bless-checklist__title"
|
|
106
|
+
}, y(d.title), 9, A),
|
|
107
|
+
c("span", j, y(W.value) + "/" + y(G.value), 1),
|
|
108
|
+
c("span", M, y(z.value ? "▸" : "▾"), 1)
|
|
109
|
+
], 8, k), d.dismissible ? (h(), s("button", {
|
|
110
|
+
key: 0,
|
|
111
|
+
type: "button",
|
|
112
|
+
class: "bless-checklist__close",
|
|
113
|
+
"aria-label": H.value.dismiss,
|
|
114
|
+
onClick: X
|
|
115
|
+
}, " × ", 8, N)) : o("", !0)]),
|
|
116
|
+
u(n, {
|
|
117
|
+
value: W.value,
|
|
118
|
+
max: Math.max(1, G.value),
|
|
119
|
+
size: "sm",
|
|
120
|
+
label: H.value.progress(W.value, G.value)
|
|
121
|
+
}, null, 8, [
|
|
122
|
+
"value",
|
|
123
|
+
"max",
|
|
124
|
+
"label"
|
|
125
|
+
]),
|
|
126
|
+
E(c("div", {
|
|
127
|
+
id: `${b(U)}-b`,
|
|
128
|
+
class: "bless-checklist__body"
|
|
129
|
+
}, [c("ul", F, [(h(!0), s(r, null, _(d.items, (n) => (h(), s("li", {
|
|
130
|
+
key: n.id,
|
|
131
|
+
class: "bless-checklist__item"
|
|
132
|
+
}, [u(t, {
|
|
133
|
+
modelValue: R.value,
|
|
134
|
+
"onUpdate:modelValue": f[1] ||= (e) => R.value = e,
|
|
135
|
+
value: n.id,
|
|
136
|
+
description: n.description
|
|
137
|
+
}, {
|
|
138
|
+
default: T(() => [l(y(n.label), 1)]),
|
|
139
|
+
_: 2
|
|
140
|
+
}, 1032, [
|
|
141
|
+
"modelValue",
|
|
142
|
+
"value",
|
|
143
|
+
"description"
|
|
144
|
+
]), n.action && !R.value.includes(n.id) ? (h(), a(e, {
|
|
145
|
+
key: 0,
|
|
146
|
+
size: "sm",
|
|
147
|
+
variant: "outline",
|
|
148
|
+
onClick: (e) => V("select", n)
|
|
149
|
+
}, {
|
|
150
|
+
default: T(() => [l(y(n.action), 1)]),
|
|
151
|
+
_: 2
|
|
152
|
+
}, 1032, ["onClick"])) : o("", !0)]))), 128))]), K.value ? (h(), s("p", I, [v(i.$slots, "complete", {}, () => [l(y(H.value.complete), 1)])])) : o("", !0)], 8, P), [[C, !z.value]])
|
|
153
|
+
], 10, D));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
//#endregion
|
|
157
|
+
export { L as default };
|
|
@@ -4,6 +4,11 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
4
4
|
label?: string;
|
|
5
5
|
/** hide the ↑ ↓ buttons (drag only) */
|
|
6
6
|
buttons?: boolean;
|
|
7
|
+
labels?: Partial<{
|
|
8
|
+
up: (position: number) => string;
|
|
9
|
+
down: (position: number) => string;
|
|
10
|
+
moved: (position: number, total: number) => string;
|
|
11
|
+
}>;
|
|
7
12
|
} & {
|
|
8
13
|
modelValue?: T[];
|
|
9
14
|
}) & {
|