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
|
@@ -20,7 +20,7 @@ var D = {
|
|
|
20
20
|
"aria-expanded",
|
|
21
21
|
"aria-invalid",
|
|
22
22
|
"aria-describedby"
|
|
23
|
-
], A = ["aria-label", "onKeydown"],
|
|
23
|
+
], A = ["aria-label"], j = ["aria-label", "onKeydown"], M = /*@__PURE__*/ d({
|
|
24
24
|
name: "BlessDatePicker",
|
|
25
25
|
__name: "BlessDatePicker",
|
|
26
26
|
props: /*@__PURE__*/ f({
|
|
@@ -36,89 +36,90 @@ var D = {
|
|
|
36
36
|
type: Boolean,
|
|
37
37
|
default: !0
|
|
38
38
|
},
|
|
39
|
-
size: { default: "md" }
|
|
39
|
+
size: { default: "md" },
|
|
40
|
+
clearLabel: { default: "Clear date" }
|
|
40
41
|
}, {
|
|
41
42
|
modelValue: {},
|
|
42
43
|
modelModifiers: {}
|
|
43
44
|
}),
|
|
44
45
|
emits: ["update:modelValue"],
|
|
45
46
|
setup(d) {
|
|
46
|
-
let f = d,
|
|
47
|
+
let f = d, M = x(d, "modelValue"), N = e(f)(), P = t(), F = v(!1), I = v(), L = v(), { x: R, y: z } = n(I, L, F, {
|
|
47
48
|
placement: "bottom-start",
|
|
48
49
|
offset: 4
|
|
49
|
-
}),
|
|
50
|
-
g(() =>
|
|
51
|
-
let
|
|
52
|
-
if (!
|
|
53
|
-
let e =
|
|
54
|
-
return Array.isArray(
|
|
50
|
+
}), B = v(!1);
|
|
51
|
+
g(() => B.value = matchMedia("(pointer: coarse)").matches);
|
|
52
|
+
let V = o(() => f.nativeOnTouch && !f.range && B.value), H = o(() => new Intl.DateTimeFormat(f.locale, { dateStyle: "medium" })), U = o(() => {
|
|
53
|
+
if (!M.value) return "";
|
|
54
|
+
let e = H.value;
|
|
55
|
+
return Array.isArray(M.value) ? `${e.format(r(M.value[0]))} – ${e.format(r(M.value[1]))}` : e.format(r(M.value));
|
|
55
56
|
});
|
|
56
|
-
function
|
|
57
|
-
|
|
57
|
+
function W() {
|
|
58
|
+
F.value = !1, I.value?.focus();
|
|
58
59
|
}
|
|
59
|
-
C(
|
|
60
|
-
let t =
|
|
60
|
+
C(F, (e) => p(() => {
|
|
61
|
+
let t = L.value;
|
|
61
62
|
t && typeof t.showPopover == "function" && (e && !t.matches(":popover-open") ? t.showPopover() : !e && t.matches(":popover-open") && t.hidePopover(), e && p(() => t.querySelector("[tabindex=\"0\"]")?.focus()));
|
|
62
|
-
})), C(
|
|
63
|
-
|
|
63
|
+
})), C(M, (e) => {
|
|
64
|
+
F.value && (!f.range || Array.isArray(e)) && W();
|
|
64
65
|
});
|
|
65
|
-
function
|
|
66
|
-
|
|
66
|
+
function G() {
|
|
67
|
+
M.value = void 0, I.value?.focus();
|
|
67
68
|
}
|
|
68
69
|
return (e, t) => (_(), c("div", { class: m(["bless-datepicker", [`bless-datepicker--${d.size}`, {
|
|
69
|
-
"bless-datepicker--invalid": d.invalid || b(
|
|
70
|
+
"bless-datepicker--invalid": d.invalid || b(P).invalid.value,
|
|
70
71
|
"bless-datepicker--disabled": d.disabled
|
|
71
|
-
}]]) }, [
|
|
72
|
-
id: b(
|
|
73
|
-
"onUpdate:modelValue": t[0] ||= (e) =>
|
|
72
|
+
}]]) }, [V.value ? (_(), c("span", D, [w(l("input", {
|
|
73
|
+
id: b(N),
|
|
74
|
+
"onUpdate:modelValue": t[0] ||= (e) => M.value = e,
|
|
74
75
|
type: "date",
|
|
75
76
|
min: d.min,
|
|
76
77
|
max: d.max,
|
|
77
78
|
disabled: d.disabled,
|
|
78
79
|
class: "bless-datepicker__native",
|
|
79
|
-
"aria-invalid": d.invalid || b(
|
|
80
|
-
"aria-describedby": b(
|
|
81
|
-
}, null, 8, O), [[S,
|
|
80
|
+
"aria-invalid": d.invalid || b(P).invalid.value || void 0,
|
|
81
|
+
"aria-describedby": b(P).describedby.value
|
|
82
|
+
}, null, 8, O), [[S, M.value]])])) : (_(), c(a, { key: 1 }, [
|
|
82
83
|
l("button", {
|
|
83
84
|
ref_key: "anchor",
|
|
84
|
-
ref:
|
|
85
|
-
id: b(
|
|
85
|
+
ref: I,
|
|
86
|
+
id: b(N),
|
|
86
87
|
type: "button",
|
|
87
88
|
class: "bless-datepicker__trigger",
|
|
88
89
|
disabled: d.disabled,
|
|
89
90
|
"aria-haspopup": "dialog",
|
|
90
|
-
"aria-expanded":
|
|
91
|
-
"aria-invalid": d.invalid || b(
|
|
92
|
-
"aria-describedby": b(
|
|
93
|
-
onClick: t[1] ||= (e) =>
|
|
94
|
-
onKeydown: t[2] ||= T((e) =>
|
|
91
|
+
"aria-expanded": F.value,
|
|
92
|
+
"aria-invalid": d.invalid || b(P).invalid.value || void 0,
|
|
93
|
+
"aria-describedby": b(P).describedby.value,
|
|
94
|
+
onClick: t[1] ||= (e) => F.value = !F.value,
|
|
95
|
+
onKeydown: t[2] ||= T((e) => F.value &&= (e.preventDefault(), !1), ["esc"])
|
|
95
96
|
}, [t[5] ||= l("span", {
|
|
96
97
|
class: "bless-datepicker__icon",
|
|
97
98
|
"aria-hidden": "true"
|
|
98
|
-
}, "▦", -1), l("span", { class: m(["bless-datepicker__text", { "bless-datepicker__text--placeholder": !
|
|
99
|
-
|
|
99
|
+
}, "▦", -1), l("span", { class: m(["bless-datepicker__text", { "bless-datepicker__text--placeholder": !U.value }]) }, y(U.value || d.placeholder), 3)], 40, k),
|
|
100
|
+
U.value && !d.disabled ? (_(), c("button", {
|
|
100
101
|
key: 0,
|
|
101
102
|
type: "button",
|
|
102
103
|
class: "bless-datepicker__clear",
|
|
103
|
-
"aria-label":
|
|
104
|
-
onClick:
|
|
105
|
-
}, " × ")) : s("", !0),
|
|
104
|
+
"aria-label": d.clearLabel,
|
|
105
|
+
onClick: G
|
|
106
|
+
}, " × ", 8, A)) : s("", !0),
|
|
106
107
|
l("div", {
|
|
107
108
|
ref_key: "panel",
|
|
108
|
-
ref:
|
|
109
|
+
ref: L,
|
|
109
110
|
popover: "auto",
|
|
110
111
|
class: "bless-datepicker__panel",
|
|
111
112
|
style: h({
|
|
112
|
-
left: `${b(
|
|
113
|
-
top: `${b(
|
|
113
|
+
left: `${b(R)}px`,
|
|
114
|
+
top: `${b(z)}px`
|
|
114
115
|
}),
|
|
115
116
|
role: "dialog",
|
|
116
117
|
"aria-label": d.placeholder,
|
|
117
|
-
onToggle: t[4] ||= (e) =>
|
|
118
|
-
onKeydown: T(E(
|
|
118
|
+
onToggle: t[4] ||= (e) => F.value = e.newState === "open",
|
|
119
|
+
onKeydown: T(E(W, ["stop", "prevent"]), ["esc"])
|
|
119
120
|
}, [u(i, {
|
|
120
|
-
modelValue:
|
|
121
|
-
"onUpdate:modelValue": t[3] ||= (e) =>
|
|
121
|
+
modelValue: M.value,
|
|
122
|
+
"onUpdate:modelValue": t[3] ||= (e) => M.value = e,
|
|
122
123
|
range: d.range,
|
|
123
124
|
min: d.min,
|
|
124
125
|
max: d.max,
|
|
@@ -129,9 +130,9 @@ var D = {
|
|
|
129
130
|
"min",
|
|
130
131
|
"max",
|
|
131
132
|
"locale"
|
|
132
|
-
])], 44,
|
|
133
|
+
])], 44, j)
|
|
133
134
|
], 64))], 2));
|
|
134
135
|
}
|
|
135
136
|
});
|
|
136
137
|
//#endregion
|
|
137
|
-
export {
|
|
138
|
+
export { M as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-diff{min-width:0;max-width:100%;font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);border:var(--bless-border-width) solid var(--bless-color-border);margin:0}.bless-diff__head{justify-content:space-between;gap:var(--bless-space-3);padding:var(--bless-space-2) var(--bless-space-3);background:var(--bless-color-surface);border-bottom:var(--bless-border-width) solid var(--bless-color-border);display:flex}.bless-diff__count{gap:var(--bless-space-2);font-variant-numeric:tabular-nums;display:inline-flex}.bless-diff__plus{color:var(--bless-color-text);font-weight:600}.bless-diff__minus{color:var(--bless-color-danger-text);font-weight:600}.bless-diff__sr{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}.bless-diff__scroll{overflow:auto}.bless-diff__scroll:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:-2px}.bless-diff__table{border-collapse:collapse;width:100%;font-family:var(--bless-font-mono,ui-monospace, monospace);font-size:var(--bless-text-sm)}.bless-diff .bless-diff__cols th{padding:var(--bless-space-1) var(--bless-space-3);text-align:start;font-family:var(--bless-font-sans);color:var(--bless-color-text-muted);font-weight:600}.bless-diff .bless-diff__table :is(td,th){padding:0 var(--bless-space-2);vertical-align:top;background:0 0;border:0}.bless-diff .bless-diff__table tr{background:0 0}.bless-diff__no{text-align:end;width:1%;min-width:3ch;color:var(--bless-color-text-muted);-webkit-user-select:none;user-select:none}.bless-diff__sign{-webkit-user-select:none;user-select:none;width:1%;font-weight:700}.bless-diff__text{white-space:pre}.bless-diff .bless-diff__row--add>td,.bless-diff .bless-diff__table td.bless-diff__cell--add{background:color-mix(in srgb, var(--bless-color-success) 24%, var(--bless-color-bg))}.bless-diff .bless-diff__row--del>td,.bless-diff .bless-diff__table td.bless-diff__cell--del{background:color-mix(in srgb, var(--bless-color-danger) 18%, var(--bless-color-bg))}.bless-diff .bless-diff__row--add>.bless-diff__no,.bless-diff .bless-diff__row--del>.bless-diff__no,.bless-diff .bless-diff__table td.bless-diff__cell--add+.bless-diff__no{color:var(--bless-color-text)}.bless-diff .bless-diff__table td.bless-diff__cell--empty{background:var(--bless-color-surface)}.bless-diff--split .bless-diff__text{border-inline-start:var(--bless-border-width) solid var(--bless-color-border);width:50%}.bless-diff .bless-diff__table .bless-diff__fold td{padding:var(--bless-space-1) var(--bless-space-3);background:var(--bless-color-surface);border-block:var(--bless-border-width) solid var(--bless-color-border)}.bless-diff__fold button{color:var(--bless-color-text-muted);font:inherit;font-family:var(--bless-font-sans);cursor:pointer;background:0 0;border:0;text-decoration:underline}.bless-diff__fold button:focus-visible{outline:2px solid var(--bless-color-accent)}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** the old text */
|
|
3
|
+
a: string;
|
|
4
|
+
/** the new text */
|
|
5
|
+
b: string;
|
|
6
|
+
mode?: "inline" | "split";
|
|
7
|
+
/** unchanged lines kept around each change; the rest fold away. Leave out to show everything */
|
|
8
|
+
context?: number;
|
|
9
|
+
lineNumbers?: boolean;
|
|
10
|
+
labelA?: string;
|
|
11
|
+
labelB?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
15
|
+
label: string;
|
|
16
|
+
mode: "inline" | "split";
|
|
17
|
+
lineNumbers: boolean;
|
|
18
|
+
labelA: string;
|
|
19
|
+
labelB: string;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { diffLines as e } from "../composables/diffLines.js";
|
|
2
|
+
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, normalizeClass as s, openBlock as c, ref as l, renderList as u, toDisplayString as d } from "vue";
|
|
3
|
+
//#region src/components/BlessDiff.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var f = { class: "bless-diff__head" }, p = { class: "bless-diff__title" }, m = { class: "bless-diff__count" }, h = { class: "bless-diff__plus" }, g = { class: "bless-diff__minus" }, _ = { class: "bless-diff__sr" }, v = ["aria-label"], y = { class: "bless-diff__table" }, b = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "bless-diff__cols"
|
|
7
|
+
}, x = {
|
|
8
|
+
key: 0,
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
}, S = { scope: "col" }, C = {
|
|
11
|
+
key: 1,
|
|
12
|
+
"aria-hidden": "true"
|
|
13
|
+
}, w = { scope: "col" }, T = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "bless-diff__fold"
|
|
16
|
+
}, E = ["colspan"], D = ["onClick"], O = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "bless-diff__no",
|
|
19
|
+
"aria-hidden": "true"
|
|
20
|
+
}, k = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "bless-diff__no",
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
}, A = ["aria-label"], j = { class: "bless-diff__text" }, M = {
|
|
25
|
+
key: 2,
|
|
26
|
+
class: "bless-diff__row"
|
|
27
|
+
}, N = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "bless-diff__no",
|
|
30
|
+
"aria-hidden": "true"
|
|
31
|
+
}, P = ["aria-label"], F = /*@__PURE__*/ o({
|
|
32
|
+
name: "BlessDiff",
|
|
33
|
+
__name: "BlessDiff",
|
|
34
|
+
props: {
|
|
35
|
+
a: {},
|
|
36
|
+
b: {},
|
|
37
|
+
mode: { default: "inline" },
|
|
38
|
+
context: {},
|
|
39
|
+
lineNumbers: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !0
|
|
42
|
+
},
|
|
43
|
+
labelA: { default: "Before" },
|
|
44
|
+
labelB: { default: "After" },
|
|
45
|
+
label: { default: "Changes" }
|
|
46
|
+
},
|
|
47
|
+
setup(o) {
|
|
48
|
+
let F = o, I = n(() => e(F.a, F.b)), L = n(() => I.value.filter((e) => e.type === "add").length), R = n(() => I.value.filter((e) => e.type === "del").length), z = l(/* @__PURE__ */ new Set()), B = n(() => {
|
|
49
|
+
let e = F.context;
|
|
50
|
+
if (e == null) return I.value.map((e) => ({
|
|
51
|
+
row: e,
|
|
52
|
+
hide: !1,
|
|
53
|
+
id: -1
|
|
54
|
+
}));
|
|
55
|
+
let t = I.value.map((e) => ({
|
|
56
|
+
row: e,
|
|
57
|
+
hide: !1,
|
|
58
|
+
id: -1
|
|
59
|
+
})), n = 0, r = 0;
|
|
60
|
+
for (; n < t.length;) {
|
|
61
|
+
if (t[n].row.type !== "same") {
|
|
62
|
+
n++;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let i = n;
|
|
66
|
+
for (; i < t.length && t[i].row.type === "same";) i++;
|
|
67
|
+
let a = n === 0 ? n : n + e, o = i === t.length ? i : i - e;
|
|
68
|
+
if (o - a > 1 && !z.value.has(r)) for (let e = a; e < o; e++) t[e].hide = !0, t[e].id = r;
|
|
69
|
+
r++, n = i;
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
}), V = n(() => {
|
|
73
|
+
let e = [], t = /* @__PURE__ */ new Set(), n = {
|
|
74
|
+
del: [],
|
|
75
|
+
add: []
|
|
76
|
+
}, r = () => {
|
|
77
|
+
if (F.mode === "inline") for (let t of [...n.del, ...n.add]) e.push({
|
|
78
|
+
kind: "row",
|
|
79
|
+
row: t
|
|
80
|
+
});
|
|
81
|
+
else {
|
|
82
|
+
let t = Math.max(n.del.length, n.add.length);
|
|
83
|
+
for (let r = 0; r < t; r++) e.push({
|
|
84
|
+
kind: "pair",
|
|
85
|
+
left: n.del[r],
|
|
86
|
+
right: n.add[r]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
n.del = [], n.add = [];
|
|
90
|
+
};
|
|
91
|
+
for (let { row: i, hide: a, id: o } of B.value) a ? (r(), t.has(o) || (t.add(o), e.push({
|
|
92
|
+
kind: "fold",
|
|
93
|
+
id: o,
|
|
94
|
+
count: B.value.filter((e) => e.id === o && e.hide).length
|
|
95
|
+
}))) : i.type === "del" ? n.del.push(i) : i.type === "add" ? n.add.push(i) : (r(), e.push(F.mode === "inline" ? {
|
|
96
|
+
kind: "row",
|
|
97
|
+
row: i
|
|
98
|
+
} : {
|
|
99
|
+
kind: "pair",
|
|
100
|
+
left: i,
|
|
101
|
+
right: i
|
|
102
|
+
}));
|
|
103
|
+
return r(), e;
|
|
104
|
+
}), H = {
|
|
105
|
+
same: "",
|
|
106
|
+
add: "+",
|
|
107
|
+
del: "−"
|
|
108
|
+
}, U = {
|
|
109
|
+
same: "",
|
|
110
|
+
add: "added",
|
|
111
|
+
del: "removed"
|
|
112
|
+
}, W = (e) => z.value = new Set(z.value).add(e), G = n(() => (F.mode, 4));
|
|
113
|
+
return (e, n) => (c(), i("figure", { class: s(["bless-diff", `bless-diff--${o.mode}`]) }, [a("figcaption", f, [a("span", p, d(o.label), 1), a("span", m, [
|
|
114
|
+
a("span", h, "+" + d(L.value), 1),
|
|
115
|
+
a("span", g, "−" + d(R.value), 1),
|
|
116
|
+
a("span", _, d(L.value) + " lines added, " + d(R.value) + " removed", 1)
|
|
117
|
+
])]), a("div", {
|
|
118
|
+
class: "bless-diff__scroll",
|
|
119
|
+
tabindex: "0",
|
|
120
|
+
role: "region",
|
|
121
|
+
"aria-label": o.label
|
|
122
|
+
}, [a("table", y, [o.mode === "split" ? (c(), i("thead", b, [a("tr", null, [
|
|
123
|
+
o.lineNumbers ? (c(), i("th", x)) : r("", !0),
|
|
124
|
+
a("th", S, d(o.labelA), 1),
|
|
125
|
+
o.lineNumbers ? (c(), i("th", C)) : r("", !0),
|
|
126
|
+
a("th", w, d(o.labelB), 1)
|
|
127
|
+
])])) : r("", !0), a("tbody", null, [(c(!0), i(t, null, u(V.value, (e, n) => (c(), i(t, { key: n }, [e.kind === "fold" ? (c(), i("tr", T, [a("td", { colspan: G.value }, [a("button", {
|
|
128
|
+
type: "button",
|
|
129
|
+
onClick: (t) => W(e.id)
|
|
130
|
+
}, d(e.count) + " unchanged " + d(e.count === 1 ? "line" : "lines"), 9, D)], 8, E)])) : e.kind === "row" ? (c(), i("tr", {
|
|
131
|
+
key: 1,
|
|
132
|
+
class: s(`bless-diff__row bless-diff__row--${e.row.type}`)
|
|
133
|
+
}, [
|
|
134
|
+
o.lineNumbers ? (c(), i("td", O, d(e.row.a), 1)) : r("", !0),
|
|
135
|
+
o.lineNumbers ? (c(), i("td", k, d(e.row.b), 1)) : r("", !0),
|
|
136
|
+
a("td", {
|
|
137
|
+
class: "bless-diff__sign",
|
|
138
|
+
"aria-label": U[e.row.type] || void 0
|
|
139
|
+
}, d(H[e.row.type]), 9, A),
|
|
140
|
+
a("td", j, d(e.row.text), 1)
|
|
141
|
+
], 2)) : (c(), i("tr", M, [(c(!0), i(t, null, u([e.left, e.right], (e, n) => (c(), i(t, { key: n }, [o.lineNumbers ? (c(), i("td", N, d(n ? e?.b : e?.a), 1)) : r("", !0), a("td", {
|
|
142
|
+
class: s(["bless-diff__text", e && e.type !== "same" ? `bless-diff__cell--${e.type}` : e ? "" : "bless-diff__cell--empty"]),
|
|
143
|
+
"aria-label": e && e.type !== "same" ? `${U[e.type]}: ${e.text}` : void 0
|
|
144
|
+
}, d(e?.text), 11, P)], 64))), 128))]))], 64))), 128))])])], 8, v)], 2));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
//#endregion
|
|
148
|
+
export { F as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-dock{align-items:flex-end;gap:var(--bless-space-2);padding:var(--bless-space-2);background:var(--bless-color-surface);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:inline-flex}.bless-dock--left,.bless-dock--right{flex-direction:column}.bless-dock--left{align-items:flex-start}.bless-dock--right{align-items:flex-end}.bless-dock__item{width:var(--_size);height:var(--_size);color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;place-items:center;padding:0;text-decoration:none;display:grid;position:relative}.bless-dock__item:disabled,.bless-dock__item[aria-disabled=true]{opacity:.45;cursor:not-allowed}.bless-dock__item:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}.bless-dock__icon{background:var(--bless-color-bg);border:var(--bless-border-width) solid var(--bless-color-border);width:100%;height:100%;font-size:calc(var(--_size) * .5);transform:scale(var(--_s,1));transform-origin:50% 100%;transition:transform var(--bless-duration-fast) var(--bless-ease-out);place-items:center;display:grid}.bless-dock--left .bless-dock__icon{transform-origin:0}.bless-dock--right .bless-dock__icon{transform-origin:100%}.bless-dock__item:hover .bless-dock__icon{border-color:var(--bless-color-accent)}.bless-dock__badge{top:-4px;background:var(--bless-color-badge);min-width:16px;color:var(--bless-color-on-accent);font-size:var(--bless-text-2xs);text-align:center;padding:0 4px;line-height:16px;position:absolute;inset-inline-end:-4px}.bless-dock__tip{inset-inline-start:50%;bottom:calc(100% + 6px + (var(--_s,1) - 1) * var(--_size));padding:2px var(--bless-space-2);background:var(--bless-color-text);color:var(--bless-color-bg);font-size:var(--bless-text-xs);white-space:nowrap;opacity:0;pointer-events:none;position:absolute;translate:-50%}.bless-dock--left .bless-dock__tip,.bless-dock--right .bless-dock__tip{top:50%;bottom:auto;translate:0 -50%}.bless-dock--left .bless-dock__tip{inset-inline-start:calc(100% + 6px + (var(--_s,1) - 1) * var(--_size))}.bless-dock--right .bless-dock__tip{inset-inline-start:auto;inset-inline-end:calc(100% + 6px + (var(--_s,1) - 1) * var(--_size))}.bless-dock__item:hover .bless-dock__tip,.bless-dock__item:focus-visible .bless-dock__tip{opacity:1}@media (prefers-reduced-motion:reduce){.bless-dock__icon{transition:none}}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface BlessDockItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
/** a character, emoji or short text drawn big; use the `#item` slot for an image or icon */
|
|
5
|
+
icon?: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
badge?: string | number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Scale for an item whose centre is `distance` px from the pointer: `max` at 0, 1 beyond `radius`. */
|
|
11
|
+
export declare function magnify(distance: number, radius: number, max: number): number;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<{
|
|
15
|
+
items: BlessDockItem[];
|
|
16
|
+
/** the screen edge it sits on: sets the direction it lays out, grows and is navigated in */
|
|
17
|
+
position?: "bottom" | "left" | "right";
|
|
18
|
+
/** px, the resting size of an icon */
|
|
19
|
+
size?: number;
|
|
20
|
+
/** how much the icon under the pointer grows; 1 turns the effect off */
|
|
21
|
+
magnification?: number;
|
|
22
|
+
/** px of reach either side of the pointer */
|
|
23
|
+
radius?: number;
|
|
24
|
+
label?: string;
|
|
25
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
26
|
+
select: (item: BlessDockItem) => any;
|
|
27
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
28
|
+
items: BlessDockItem[];
|
|
29
|
+
/** the screen edge it sits on: sets the direction it lays out, grows and is navigated in */
|
|
30
|
+
position?: "bottom" | "left" | "right";
|
|
31
|
+
/** px, the resting size of an icon */
|
|
32
|
+
size?: number;
|
|
33
|
+
/** how much the icon under the pointer grows; 1 turns the effect off */
|
|
34
|
+
magnification?: number;
|
|
35
|
+
/** px of reach either side of the pointer */
|
|
36
|
+
radius?: number;
|
|
37
|
+
label?: string;
|
|
38
|
+
}> & Readonly<{
|
|
39
|
+
onSelect?: ((item: BlessDockItem) => any) | undefined;
|
|
40
|
+
}>, {
|
|
41
|
+
label: string;
|
|
42
|
+
size: number;
|
|
43
|
+
position: "bottom" | "left" | "right";
|
|
44
|
+
radius: number;
|
|
45
|
+
magnification: number;
|
|
46
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
47
|
+
item?: (props: {
|
|
48
|
+
item: BlessDockItem;
|
|
49
|
+
}) => any;
|
|
50
|
+
}>;
|
|
51
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
52
|
+
new (): {
|
|
53
|
+
$slots: S;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { reducedMotion as e } from "../composables/useMedia.js";
|
|
2
|
+
import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, ref as f, renderList as p, renderSlot as m, resolveDynamicComponent as h, toDisplayString as g, withCtx as _ } from "vue";
|
|
3
|
+
//#region src/components/BlessDock.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var v = ["aria-label", "aria-orientation"], y = {
|
|
5
|
+
class: "bless-dock__icon",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, b = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "bless-dock__badge",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
}, x = {
|
|
12
|
+
class: "bless-dock__tip",
|
|
13
|
+
"aria-hidden": "true"
|
|
14
|
+
};
|
|
15
|
+
function S(e, t, n) {
|
|
16
|
+
let r = Math.abs(e);
|
|
17
|
+
return r >= t ? 1 : 1 + (n - 1) * (.5 + .5 * Math.cos(Math.PI * r / t));
|
|
18
|
+
}
|
|
19
|
+
var C = /*@__PURE__*/ c({
|
|
20
|
+
name: "BlessDock",
|
|
21
|
+
__name: "BlessDock",
|
|
22
|
+
props: {
|
|
23
|
+
items: {},
|
|
24
|
+
position: { default: "bottom" },
|
|
25
|
+
size: { default: 44 },
|
|
26
|
+
magnification: { default: 1.6 },
|
|
27
|
+
radius: { default: 110 },
|
|
28
|
+
label: { default: "Dock" }
|
|
29
|
+
},
|
|
30
|
+
emits: ["select"],
|
|
31
|
+
setup(c, { emit: C }) {
|
|
32
|
+
let w = c, T = C, E = n(() => w.position !== "bottom"), D = f(), O = f([]), k = f(0), A = (e) => O.value[e] ?? 1, j = () => w.magnification > 1 && !e(), M = () => Array.from(D.value?.querySelectorAll(".bless-dock__item") ?? [], (e) => {
|
|
33
|
+
let t = e.getBoundingClientRect();
|
|
34
|
+
return E.value ? t.top + t.height / 2 : t.left + t.width / 2;
|
|
35
|
+
});
|
|
36
|
+
function N(e) {
|
|
37
|
+
O.value = M().map((t) => S(t - e, w.radius, w.magnification));
|
|
38
|
+
}
|
|
39
|
+
let P = () => O.value = [];
|
|
40
|
+
function F(e) {
|
|
41
|
+
e.pointerType !== "touch" && j() && N(E.value ? e.clientY : e.clientX);
|
|
42
|
+
}
|
|
43
|
+
function I(e) {
|
|
44
|
+
let t = e.target, n = Array.from(D.value?.querySelectorAll(".bless-dock__item") ?? []).indexOf(t);
|
|
45
|
+
if (!(n < 0) && (k.value = n, j() && t.matches(":focus-visible"))) {
|
|
46
|
+
let e = t.getBoundingClientRect();
|
|
47
|
+
N(E.value ? e.top + e.height / 2 : e.left + e.width / 2);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function L(e) {
|
|
51
|
+
let t = Array.from(D.value?.querySelectorAll(".bless-dock__item:not(:disabled)") ?? []), n = t.indexOf(document.activeElement);
|
|
52
|
+
if (n < 0) return;
|
|
53
|
+
let [r, i] = E.value ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"], a = getComputedStyle(D.value).direction === "rtl" && !E.value ? -1 : 1, o = e.key === i ? n + a : e.key === r ? n - a : e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : null;
|
|
54
|
+
o !== null && (e.preventDefault(), t[(o + t.length) % t.length].focus());
|
|
55
|
+
}
|
|
56
|
+
return (e, n) => (d(), a("div", {
|
|
57
|
+
ref_key: "root",
|
|
58
|
+
ref: D,
|
|
59
|
+
class: l(["bless-dock", `bless-dock--${c.position}`]),
|
|
60
|
+
role: "toolbar",
|
|
61
|
+
"aria-label": c.label,
|
|
62
|
+
"aria-orientation": E.value ? "vertical" : "horizontal",
|
|
63
|
+
style: u({ "--_size": `${c.size}px` }),
|
|
64
|
+
onPointermove: F,
|
|
65
|
+
onPointerleave: P,
|
|
66
|
+
onFocusin: I,
|
|
67
|
+
onFocusout: P,
|
|
68
|
+
onKeydown: L
|
|
69
|
+
}, [(d(!0), a(t, null, p(c.items, (t, n) => (d(), r(h(t.href ? "a" : "button"), {
|
|
70
|
+
key: t.id,
|
|
71
|
+
class: "bless-dock__item",
|
|
72
|
+
href: t.href,
|
|
73
|
+
type: t.href ? void 0 : "button",
|
|
74
|
+
disabled: t.href ? void 0 : t.disabled,
|
|
75
|
+
"aria-disabled": t.href && t.disabled ? !0 : void 0,
|
|
76
|
+
"aria-label": t.label,
|
|
77
|
+
tabindex: k.value === n ? 0 : -1,
|
|
78
|
+
style: u({ "--_s": A(n) }),
|
|
79
|
+
onClick: (e) => !t.disabled && T("select", t)
|
|
80
|
+
}, {
|
|
81
|
+
default: _(() => [
|
|
82
|
+
o("span", y, [m(e.$slots, "item", { item: t }, () => [s(g(t.icon), 1)])]),
|
|
83
|
+
t.badge == null ? i("", !0) : (d(), a("span", b, g(t.badge), 1)),
|
|
84
|
+
o("span", x, g(t.label), 1)
|
|
85
|
+
]),
|
|
86
|
+
_: 2
|
|
87
|
+
}, 1032, [
|
|
88
|
+
"href",
|
|
89
|
+
"type",
|
|
90
|
+
"disabled",
|
|
91
|
+
"aria-disabled",
|
|
92
|
+
"aria-label",
|
|
93
|
+
"tabindex",
|
|
94
|
+
"style",
|
|
95
|
+
"onClick"
|
|
96
|
+
]))), 128))], 46, v));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
//#endregion
|
|
100
|
+
export { C as default, S as magnify };
|
|
@@ -19,6 +19,8 @@ type __VLS_Props = {
|
|
|
19
19
|
editor: Editor | null | undefined;
|
|
20
20
|
tools?: BlessEditorTool[];
|
|
21
21
|
label?: string;
|
|
22
|
+
/** rename tools by key: `{ bold: "Tebal", h1: "Judul 1" }` */
|
|
23
|
+
labels?: Partial<Record<Exclude<BlessEditorTool, "|">, string>>;
|
|
22
24
|
disabled?: boolean;
|
|
23
25
|
/** min height of the writing area */
|
|
24
26
|
minHeight?: string;
|
|
@@ -38,94 +38,95 @@ var m = ["aria-label"], h = {
|
|
|
38
38
|
"redo"
|
|
39
39
|
] },
|
|
40
40
|
label: { default: "Formatting" },
|
|
41
|
+
labels: {},
|
|
41
42
|
disabled: { type: Boolean },
|
|
42
43
|
minHeight: { default: "160px" }
|
|
43
44
|
},
|
|
44
45
|
setup(a) {
|
|
45
46
|
let b = l();
|
|
46
47
|
e(b);
|
|
47
|
-
let x = (e) => e.chain().focus(),
|
|
48
|
+
let x = a, S = (e) => x.labels?.[e] ?? w[e].title, C = (e) => e.chain().focus(), w = {
|
|
48
49
|
bold: {
|
|
49
50
|
title: "Bold",
|
|
50
51
|
icon: "B",
|
|
51
|
-
run: (e) =>
|
|
52
|
+
run: (e) => C(e).toggleBold().run(),
|
|
52
53
|
active: (e) => e.isActive("bold")
|
|
53
54
|
},
|
|
54
55
|
italic: {
|
|
55
56
|
title: "Italic",
|
|
56
57
|
icon: "I",
|
|
57
|
-
run: (e) =>
|
|
58
|
+
run: (e) => C(e).toggleItalic().run(),
|
|
58
59
|
active: (e) => e.isActive("italic")
|
|
59
60
|
},
|
|
60
61
|
strike: {
|
|
61
62
|
title: "Strikethrough",
|
|
62
63
|
icon: "S",
|
|
63
|
-
run: (e) =>
|
|
64
|
+
run: (e) => C(e).toggleStrike().run(),
|
|
64
65
|
active: (e) => e.isActive("strike")
|
|
65
66
|
},
|
|
66
67
|
code: {
|
|
67
68
|
title: "Inline code",
|
|
68
69
|
icon: "‹›",
|
|
69
|
-
run: (e) =>
|
|
70
|
+
run: (e) => C(e).toggleCode().run(),
|
|
70
71
|
active: (e) => e.isActive("code")
|
|
71
72
|
},
|
|
72
73
|
h1: {
|
|
73
74
|
title: "Heading 1",
|
|
74
75
|
icon: "H1",
|
|
75
|
-
run: (e) =>
|
|
76
|
+
run: (e) => C(e).toggleHeading({ level: 1 }).run(),
|
|
76
77
|
active: (e) => e.isActive("heading", { level: 1 })
|
|
77
78
|
},
|
|
78
79
|
h2: {
|
|
79
80
|
title: "Heading 2",
|
|
80
81
|
icon: "H2",
|
|
81
|
-
run: (e) =>
|
|
82
|
+
run: (e) => C(e).toggleHeading({ level: 2 }).run(),
|
|
82
83
|
active: (e) => e.isActive("heading", { level: 2 })
|
|
83
84
|
},
|
|
84
85
|
h3: {
|
|
85
86
|
title: "Heading 3",
|
|
86
87
|
icon: "H3",
|
|
87
|
-
run: (e) =>
|
|
88
|
+
run: (e) => C(e).toggleHeading({ level: 3 }).run(),
|
|
88
89
|
active: (e) => e.isActive("heading", { level: 3 })
|
|
89
90
|
},
|
|
90
91
|
bulletList: {
|
|
91
92
|
title: "Bullet list",
|
|
92
93
|
icon: "•",
|
|
93
|
-
run: (e) =>
|
|
94
|
+
run: (e) => C(e).toggleBulletList().run(),
|
|
94
95
|
active: (e) => e.isActive("bulletList")
|
|
95
96
|
},
|
|
96
97
|
orderedList: {
|
|
97
98
|
title: "Numbered list",
|
|
98
99
|
icon: "1.",
|
|
99
|
-
run: (e) =>
|
|
100
|
+
run: (e) => C(e).toggleOrderedList().run(),
|
|
100
101
|
active: (e) => e.isActive("orderedList")
|
|
101
102
|
},
|
|
102
103
|
blockquote: {
|
|
103
104
|
title: "Quote",
|
|
104
105
|
icon: "❝",
|
|
105
|
-
run: (e) =>
|
|
106
|
+
run: (e) => C(e).toggleBlockquote().run(),
|
|
106
107
|
active: (e) => e.isActive("blockquote")
|
|
107
108
|
},
|
|
108
109
|
codeBlock: {
|
|
109
110
|
title: "Code block",
|
|
110
111
|
icon: "{ }",
|
|
111
|
-
run: (e) =>
|
|
112
|
+
run: (e) => C(e).toggleCodeBlock().run(),
|
|
112
113
|
active: (e) => e.isActive("codeBlock")
|
|
113
114
|
},
|
|
114
115
|
hr: {
|
|
115
116
|
title: "Rule",
|
|
116
117
|
icon: "―",
|
|
117
|
-
run: (e) =>
|
|
118
|
+
run: (e) => C(e).setHorizontalRule().run()
|
|
118
119
|
},
|
|
119
120
|
undo: {
|
|
120
121
|
title: "Undo",
|
|
121
122
|
icon: "↶",
|
|
122
|
-
run: (e) =>
|
|
123
|
+
run: (e) => C(e).undo().run(),
|
|
123
124
|
can: (e) => e.can().undo()
|
|
124
125
|
},
|
|
125
126
|
redo: {
|
|
126
127
|
title: "Redo",
|
|
127
128
|
icon: "↷",
|
|
128
|
-
run: (e) =>
|
|
129
|
+
run: (e) => C(e).redo().run(),
|
|
129
130
|
can: (e) => e.can().redo()
|
|
130
131
|
}
|
|
131
132
|
};
|
|
@@ -142,14 +143,14 @@ var m = ["aria-label"], h = {
|
|
|
142
143
|
}, [d(e.$slots, "toolbar", { editor: a.editor }, () => [(c(!0), r(t, null, u(a.tools, (e, n) => (c(), r(t, { key: n }, [e === "|" ? (c(), r("span", h)) : (c(), r("button", {
|
|
143
144
|
key: 1,
|
|
144
145
|
type: "button",
|
|
145
|
-
class: o(["bless-editor__tool", { "bless-editor__tool--on": a.editor &&
|
|
146
|
-
title: S
|
|
147
|
-
"aria-label": S
|
|
148
|
-
"aria-pressed":
|
|
149
|
-
disabled: a.disabled || !a.editor || (
|
|
146
|
+
class: o(["bless-editor__tool", { "bless-editor__tool--on": a.editor && w[e].active?.(a.editor) }]),
|
|
147
|
+
title: S(e),
|
|
148
|
+
"aria-label": S(e),
|
|
149
|
+
"aria-pressed": w[e].active ? !!(a.editor && w[e].active(a.editor)) : void 0,
|
|
150
|
+
disabled: a.disabled || !a.editor || (w[e].can ? !w[e].can(a.editor) : !1),
|
|
150
151
|
onMousedown: l[0] ||= p(() => {}, ["prevent"]),
|
|
151
|
-
onClick: (t) => a.editor &&
|
|
152
|
-
}, [i("span", _, f(
|
|
152
|
+
onClick: (t) => a.editor && w[e].run(a.editor)
|
|
153
|
+
}, [i("span", _, f(w[e].icon), 1)], 42, g))], 64))), 128))])], 8, m),
|
|
153
154
|
i("div", v, [d(e.$slots, "default")]),
|
|
154
155
|
e.$slots.footer ? (c(), r("div", y, [d(e.$slots, "footer", { editor: a.editor })])) : n("", !0)
|
|
155
156
|
], 6));
|