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
|
@@ -29,7 +29,8 @@ var x = ["for"], S = [
|
|
|
29
29
|
list: {
|
|
30
30
|
type: Boolean,
|
|
31
31
|
default: !0
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
|
+
removeLabel: {}
|
|
33
34
|
}, {
|
|
34
35
|
modelValue: { default: () => [] },
|
|
35
36
|
modelModifiers: {}
|
|
@@ -97,7 +98,7 @@ var x = ["for"], S = [
|
|
|
97
98
|
o("button", {
|
|
98
99
|
type: "button",
|
|
99
100
|
class: "bless-file__remove",
|
|
100
|
-
"aria-label": `Remove ${e.name
|
|
101
|
+
"aria-label": (c.removeLabel ?? ((e) => `Remove ${e}`))(e.name),
|
|
101
102
|
onClick: (e) => R(t)
|
|
102
103
|
}, " × ", 8, O)
|
|
103
104
|
]))), 128))], 512)) : i("", !0)], 2));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-formula{gap:var(--bless-space-2);max-width:480px;font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);display:grid}.bless-formula__label{font-weight:var(--bless-font-weight-bold,700)}.bless-formula__input{box-sizing:border-box;width:100%;min-height:36px;padding:var(--bless-space-1) var(--bless-space-3);background:var(--bless-color-bg);border:var(--bless-border-width) solid var(--bless-color-border);color:var(--bless-color-text);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.bless-formula__input:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:1px}.bless-formula--bad .bless-formula__input{border-color:var(--bless-color-danger)}.bless-formula__vars{gap:var(--bless-space-1);flex-wrap:wrap;display:flex}.bless-formula__chip{padding:2px var(--bless-space-2);background:var(--bless-color-surface);border:var(--bless-border-width) solid var(--bless-color-border);color:inherit;font:inherit;font-size:var(--bless-text-xs);cursor:pointer}.bless-formula__chip[aria-pressed=true]{border-color:var(--bless-color-accent);color:var(--bless-color-accent-text)}.bless-formula__chip:focus-visible,.bless-formula__fix:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}.bless-formula__out{min-height:1.6em;margin:0}.bless-formula__value{font-weight:var(--bless-font-weight-bold,700)}.bless-formula__error{color:var(--bless-color-danger-text)}.bless-formula__fix{color:var(--bless-color-accent-text);font:inherit;cursor:pointer;background:0 0;border:0;margin-inline-start:var(--bless-space-2);padding:0;text-decoration:underline}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FormulaError, FormulaFns } from '../composables/formula';
|
|
2
|
+
export interface BlessFormulaVariable {
|
|
3
|
+
name: string;
|
|
4
|
+
/** what the chip says instead of the name */
|
|
5
|
+
label?: string;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
export type { FormulaError as BlessFormulaError } from '../composables/formula';
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
declare const __VLS_export: import('vue').DefineComponent<{
|
|
12
|
+
variables?: BlessFormulaVariable[];
|
|
13
|
+
/** extra functions: `{ vat: (x) => x * 0.11 }` */
|
|
14
|
+
functions?: FormulaFns;
|
|
15
|
+
label?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
locale?: string;
|
|
19
|
+
labels?: Partial<{
|
|
20
|
+
insert: string;
|
|
21
|
+
result: (value: string) => string;
|
|
22
|
+
error: (e: FormulaError) => string;
|
|
23
|
+
use: (name: string) => string;
|
|
24
|
+
}>;
|
|
25
|
+
} & {
|
|
26
|
+
modelValue?: string;
|
|
27
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
28
|
+
"update:modelValue": (value: string) => any;
|
|
29
|
+
result: (value: number | null) => any;
|
|
30
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
31
|
+
variables?: BlessFormulaVariable[];
|
|
32
|
+
/** extra functions: `{ vat: (x) => x * 0.11 }` */
|
|
33
|
+
functions?: FormulaFns;
|
|
34
|
+
label?: string;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
locale?: string;
|
|
38
|
+
labels?: Partial<{
|
|
39
|
+
insert: string;
|
|
40
|
+
result: (value: string) => string;
|
|
41
|
+
error: (e: FormulaError) => string;
|
|
42
|
+
use: (name: string) => string;
|
|
43
|
+
}>;
|
|
44
|
+
} & {
|
|
45
|
+
modelValue?: string;
|
|
46
|
+
}> & Readonly<{
|
|
47
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
48
|
+
onResult?: ((value: number | null) => any) | undefined;
|
|
49
|
+
}>, {
|
|
50
|
+
label: string;
|
|
51
|
+
placeholder: string;
|
|
52
|
+
variables: BlessFormulaVariable[];
|
|
53
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { evaluate as e, usedNames as t } from "../composables/formula.js";
|
|
2
|
+
import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, mergeModels as c, nextTick as l, normalizeClass as u, onMounted as d, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, useId as _, useModel as v, vModelText as y, watch as b, withDirectives as x } from "vue";
|
|
3
|
+
//#region src/components/BlessFormula.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var S = ["for"], C = [
|
|
5
|
+
"id",
|
|
6
|
+
"placeholder",
|
|
7
|
+
"disabled",
|
|
8
|
+
"aria-invalid",
|
|
9
|
+
"aria-describedby"
|
|
10
|
+
], w = ["aria-label"], T = [
|
|
11
|
+
"aria-pressed",
|
|
12
|
+
"title",
|
|
13
|
+
"disabled",
|
|
14
|
+
"onClick"
|
|
15
|
+
], E = ["id"], D = { class: "bless-formula__error" }, O = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "bless-formula__value"
|
|
18
|
+
}, k = /*@__PURE__*/ s({
|
|
19
|
+
name: "BlessFormula",
|
|
20
|
+
__name: "BlessFormula",
|
|
21
|
+
props: /*@__PURE__*/ c({
|
|
22
|
+
variables: { default: () => [] },
|
|
23
|
+
functions: {},
|
|
24
|
+
label: { default: "Formula" },
|
|
25
|
+
placeholder: { default: "price * qty" },
|
|
26
|
+
disabled: { type: Boolean },
|
|
27
|
+
locale: {},
|
|
28
|
+
labels: {}
|
|
29
|
+
}, {
|
|
30
|
+
modelValue: { default: "" },
|
|
31
|
+
modelModifiers: {}
|
|
32
|
+
}),
|
|
33
|
+
emits: /*@__PURE__*/ c(["result"], ["update:modelValue"]),
|
|
34
|
+
setup(s, { emit: c }) {
|
|
35
|
+
let k = s, A = v(s, "modelValue"), j = c, M = r(() => ({
|
|
36
|
+
insert: "Insert a value",
|
|
37
|
+
result: (e) => `= ${e}`,
|
|
38
|
+
use: (e) => `Use “${e}”`,
|
|
39
|
+
error: (e) => {
|
|
40
|
+
switch (e.code) {
|
|
41
|
+
case "unexpected": return e.name ? `Unexpected “${e.name}” at position ${e.pos + 1}` : "The formula ends too soon";
|
|
42
|
+
case "unclosed": return "A bracket is not closed";
|
|
43
|
+
case "unknown-variable": return `Unknown value “${e.name}”${e.suggestion ? ` — did you mean “${e.suggestion}”?` : ""}`;
|
|
44
|
+
case "unknown-function": return `Unknown function “${e.name}”${e.suggestion ? ` — did you mean “${e.suggestion}”?` : ""}`;
|
|
45
|
+
case "arity": return `${e.name} needs a value to work on`;
|
|
46
|
+
case "divide-by-zero": return "Division by zero";
|
|
47
|
+
default: return "The result is not a number";
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
...k.labels
|
|
51
|
+
})), N = _(), P = p(), F = r(() => Object.fromEntries(k.variables.map((e) => [e.name, e.value]))), I = r(() => e(A.value, F.value, k.functions)), L = r(() => !I.value.ok && I.value.error.code === "empty"), R = r(() => I.value.ok || L.value ? null : I.value.error), z = r(() => I.value.ok ? new Intl.NumberFormat(k.locale, { maximumFractionDigits: 6 }).format(I.value.value) : ""), B = r(() => new Set(t(A.value))), V = () => j("result", I.value.ok ? I.value.value : null);
|
|
52
|
+
d(V), b(I, V);
|
|
53
|
+
async function H(e) {
|
|
54
|
+
let t = P.value, n = A.value, r = t?.selectionStart ?? n.length, i = t?.selectionEnd ?? n.length, a = /[A-Za-z0-9_.)]/, o = r > 0 && a.test(n[r - 1]) ? " " : "", s = i < n.length && a.test(n[i]) ? " " : "";
|
|
55
|
+
A.value = n.slice(0, r) + o + e + s + n.slice(i);
|
|
56
|
+
let c = r + o.length + e.length;
|
|
57
|
+
await l(), t?.focus(), t?.setSelectionRange(c, c);
|
|
58
|
+
}
|
|
59
|
+
function U(e) {
|
|
60
|
+
A.value = A.value.slice(0, e.pos) + e.suggestion + A.value.slice(e.pos + e.length), l(() => P.value?.focus());
|
|
61
|
+
}
|
|
62
|
+
return (e, t) => (f(), a("div", { class: u(["bless-formula", { "bless-formula--bad": R.value }]) }, [
|
|
63
|
+
o("label", {
|
|
64
|
+
class: "bless-formula__label",
|
|
65
|
+
for: `${g(N)}-in`
|
|
66
|
+
}, h(s.label), 9, S),
|
|
67
|
+
x(o("input", {
|
|
68
|
+
id: `${g(N)}-in`,
|
|
69
|
+
ref_key: "input",
|
|
70
|
+
ref: P,
|
|
71
|
+
"onUpdate:modelValue": t[0] ||= (e) => A.value = e,
|
|
72
|
+
class: "bless-formula__input",
|
|
73
|
+
type: "text",
|
|
74
|
+
spellcheck: "false",
|
|
75
|
+
autocomplete: "off",
|
|
76
|
+
autocapitalize: "off",
|
|
77
|
+
placeholder: s.placeholder,
|
|
78
|
+
disabled: s.disabled,
|
|
79
|
+
"aria-invalid": R.value ? !0 : void 0,
|
|
80
|
+
"aria-describedby": `${g(N)}-out`
|
|
81
|
+
}, null, 8, C), [[y, A.value]]),
|
|
82
|
+
s.variables.length ? (f(), a("div", {
|
|
83
|
+
key: 0,
|
|
84
|
+
class: "bless-formula__vars",
|
|
85
|
+
role: "group",
|
|
86
|
+
"aria-label": M.value.insert
|
|
87
|
+
}, [(f(!0), a(n, null, m(s.variables, (e) => (f(), a("button", {
|
|
88
|
+
key: e.name,
|
|
89
|
+
type: "button",
|
|
90
|
+
class: "bless-formula__chip",
|
|
91
|
+
"aria-pressed": B.value.has(e.name),
|
|
92
|
+
title: `${e.name} = ${e.value}`,
|
|
93
|
+
disabled: s.disabled,
|
|
94
|
+
onClick: (t) => H(e.name)
|
|
95
|
+
}, h(e.label ?? e.name), 9, T))), 128))], 8, w)) : i("", !0),
|
|
96
|
+
o("p", {
|
|
97
|
+
id: `${g(N)}-out`,
|
|
98
|
+
class: "bless-formula__out",
|
|
99
|
+
role: "status",
|
|
100
|
+
"aria-live": "polite"
|
|
101
|
+
}, [R.value ? (f(), a(n, { key: 0 }, [o("span", D, h(M.value.error(R.value)), 1), R.value.suggestion ? (f(), a("button", {
|
|
102
|
+
key: 0,
|
|
103
|
+
type: "button",
|
|
104
|
+
class: "bless-formula__fix",
|
|
105
|
+
onClick: t[1] ||= (e) => U(R.value)
|
|
106
|
+
}, h(M.value.use(R.value.suggestion)), 1)) : i("", !0)], 64)) : I.value.ok ? (f(), a("span", O, h(M.value.result(z.value)), 1)) : i("", !0)], 8, E)
|
|
107
|
+
], 2));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
//#endregion
|
|
111
|
+
export { k as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-gantt{min-width:0;max-width:100%;font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);position:relative}.bless-gantt__scroll{border:var(--bless-border-width) solid var(--bless-color-border);overflow:auto}.bless-gantt__body{width:max-content;min-width:100%;display:flex}.bless-gantt__labels{z-index:2;width:var(--bless-gantt-label);background:var(--bless-color-bg);border-inline-end:var(--bless-border-width) solid var(--bless-color-border);flex:none;position:sticky;inset-inline-start:0}.bless-gantt__label{box-sizing:border-box;padding:0 var(--bless-space-3);white-space:nowrap;text-overflow:ellipsis;border-top:var(--bless-border-width) solid var(--bless-color-border);align-items:center;display:flex;overflow:hidden}.bless-gantt__plot{flex:none;position:relative}.bless-gantt__head{height:56px;color:var(--bless-color-text-muted);font-size:var(--bless-text-xs)}.bless-gantt__months{height:28px;position:relative}.bless-gantt__month{box-sizing:border-box;padding:var(--bless-space-2) var(--bless-space-2) 0;white-space:nowrap;border-inline-start:var(--bless-border-width) solid var(--bless-color-border);height:100%;position:absolute;top:0;overflow:hidden}.bless-gantt__days{height:28px;display:flex}.bless-gantt__day{box-sizing:border-box;padding-top:var(--bless-space-2);text-align:center;font-variant-numeric:tabular-nums;flex:none}.bless-gantt__day--weekend{background:var(--bless-color-surface)}.bless-gantt__rows{border-top:var(--bless-border-width) solid var(--bless-color-border);background-image:linear-gradient(to right, var(--bless-color-border) 1px, transparent 1px);position:relative}.bless-gantt__today{background:var(--bless-color-accent);pointer-events:none;width:2px;position:absolute;inset-block:0}.bless-gantt__bar{box-sizing:border-box;border:var(--bless-border-width) solid var(--bless-color-text);background:var(--bless-color-bg);cursor:pointer;padding:0;position:absolute;overflow:hidden}.bless-gantt__done{background:var(--bless-color-text);height:100%;display:block}.bless-gantt__arrows{pointer-events:none;color:var(--bless-color-text);position:absolute;inset:0}.bless-gantt__arrows>path{fill:none;stroke:currentColor;stroke-width:1.5px}.bless-gantt__bar--edit{cursor:grab;touch-action:none}.bless-gantt__bar--drag{cursor:grabbing;opacity:.85}.bless-gantt__grip{cursor:ew-resize;background:color-mix(in srgb, var(--bless-color-text) 25%, transparent);width:8px;position:absolute;inset-block:0}.bless-gantt__grip--start{inset-inline-start:0}.bless-gantt__grip--end{inset-inline-end:0}.bless-gantt__live{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}.bless-gantt__bar:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}.bless-gantt__bar--on{border-color:var(--bless-color-accent);outline:2px solid var(--bless-color-accent)}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface BlessGanttTask {
|
|
2
|
+
id: string | number;
|
|
3
|
+
label: string;
|
|
4
|
+
/** ISO dates, `YYYY-MM-DD`; the task covers both days */
|
|
5
|
+
start: string;
|
|
6
|
+
end: string;
|
|
7
|
+
/** 0 to 100 */
|
|
8
|
+
progress?: number;
|
|
9
|
+
/** ids of tasks that must finish first; an arrow runs from each to this one */
|
|
10
|
+
after?: (string | number)[];
|
|
11
|
+
}
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
declare const __VLS_export: import('vue').DefineComponent<{
|
|
15
|
+
/** width of one day in px; under 12 the day numbers are left out */
|
|
16
|
+
dayWidth?: number;
|
|
17
|
+
rowHeight?: number;
|
|
18
|
+
/** first and last day shown; defaults to the span of the tasks */
|
|
19
|
+
from?: string;
|
|
20
|
+
to?: string;
|
|
21
|
+
locale?: string;
|
|
22
|
+
/** width of the label column in px */
|
|
23
|
+
labelWidth?: number;
|
|
24
|
+
/** drag a bar to move it and its ends to resize it; Alt + arrows from the keyboard */
|
|
25
|
+
editable?: boolean;
|
|
26
|
+
label?: string;
|
|
27
|
+
/** the sentence read for a bar and the one announced after an edit; dates arrive formatted */
|
|
28
|
+
labels?: Partial<{
|
|
29
|
+
span: (task: string, from: string, to: string) => string;
|
|
30
|
+
done: (percent: number) => string;
|
|
31
|
+
after: (names: string[]) => string;
|
|
32
|
+
}>;
|
|
33
|
+
} & {
|
|
34
|
+
/** the schedule; with `editable`, moves and resizes come back through here */
|
|
35
|
+
tasks: BlessGanttTask[];
|
|
36
|
+
selected?: BlessGanttTask["id"] | null;
|
|
37
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
38
|
+
select: (task: BlessGanttTask) => any;
|
|
39
|
+
change: (task: BlessGanttTask, dates: {
|
|
40
|
+
start: string;
|
|
41
|
+
end: string;
|
|
42
|
+
}) => any;
|
|
43
|
+
"update:selected": (value: string | number | null) => any;
|
|
44
|
+
"update:tasks": (value: BlessGanttTask[]) => any;
|
|
45
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
46
|
+
/** width of one day in px; under 12 the day numbers are left out */
|
|
47
|
+
dayWidth?: number;
|
|
48
|
+
rowHeight?: number;
|
|
49
|
+
/** first and last day shown; defaults to the span of the tasks */
|
|
50
|
+
from?: string;
|
|
51
|
+
to?: string;
|
|
52
|
+
locale?: string;
|
|
53
|
+
/** width of the label column in px */
|
|
54
|
+
labelWidth?: number;
|
|
55
|
+
/** drag a bar to move it and its ends to resize it; Alt + arrows from the keyboard */
|
|
56
|
+
editable?: boolean;
|
|
57
|
+
label?: string;
|
|
58
|
+
/** the sentence read for a bar and the one announced after an edit; dates arrive formatted */
|
|
59
|
+
labels?: Partial<{
|
|
60
|
+
span: (task: string, from: string, to: string) => string;
|
|
61
|
+
done: (percent: number) => string;
|
|
62
|
+
after: (names: string[]) => string;
|
|
63
|
+
}>;
|
|
64
|
+
} & {
|
|
65
|
+
/** the schedule; with `editable`, moves and resizes come back through here */
|
|
66
|
+
tasks: BlessGanttTask[];
|
|
67
|
+
selected?: BlessGanttTask["id"] | null;
|
|
68
|
+
}> & Readonly<{
|
|
69
|
+
onSelect?: ((task: BlessGanttTask) => any) | undefined;
|
|
70
|
+
onChange?: ((task: BlessGanttTask, dates: {
|
|
71
|
+
start: string;
|
|
72
|
+
end: string;
|
|
73
|
+
}) => any) | undefined;
|
|
74
|
+
"onUpdate:selected"?: ((value: string | number | null) => any) | undefined;
|
|
75
|
+
"onUpdate:tasks"?: ((value: BlessGanttTask[]) => any) | undefined;
|
|
76
|
+
}>, {
|
|
77
|
+
label: string;
|
|
78
|
+
dayWidth: number;
|
|
79
|
+
rowHeight: number;
|
|
80
|
+
labelWidth: number;
|
|
81
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { isoToday as e } from "../composables/date.js";
|
|
2
|
+
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeModels as s, normalizeClass as c, normalizeStyle as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, useModel as m } from "vue";
|
|
3
|
+
//#region src/components/BlessGantt.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var ee = ["aria-label"], h = { class: "bless-gantt__scroll" }, g = { class: "bless-gantt__labels" }, _ = ["title"], te = {
|
|
5
|
+
class: "bless-gantt__head",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, v = { class: "bless-gantt__months" }, y = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "bless-gantt__days"
|
|
10
|
+
}, b = ["width", "height"], x = ["d"], ne = [
|
|
11
|
+
"tabindex",
|
|
12
|
+
"aria-label",
|
|
13
|
+
"aria-pressed",
|
|
14
|
+
"onClick",
|
|
15
|
+
"onFocus",
|
|
16
|
+
"onKeydown",
|
|
17
|
+
"onPointerdown"
|
|
18
|
+
], S = ["onPointerdown"], re = ["onPointerdown"], ie = {
|
|
19
|
+
class: "bless-gantt__live",
|
|
20
|
+
"aria-live": "polite"
|
|
21
|
+
}, C = /*@__PURE__*/ o({
|
|
22
|
+
name: "BlessGantt",
|
|
23
|
+
__name: "BlessGantt",
|
|
24
|
+
props: /*@__PURE__*/ s({
|
|
25
|
+
dayWidth: { default: 28 },
|
|
26
|
+
rowHeight: { default: 36 },
|
|
27
|
+
from: {},
|
|
28
|
+
to: {},
|
|
29
|
+
locale: {},
|
|
30
|
+
labelWidth: { default: 160 },
|
|
31
|
+
editable: { type: Boolean },
|
|
32
|
+
label: { default: "Schedule" },
|
|
33
|
+
labels: {}
|
|
34
|
+
}, {
|
|
35
|
+
tasks: { required: !0 },
|
|
36
|
+
tasksModifiers: {},
|
|
37
|
+
selected: { default: null },
|
|
38
|
+
selectedModifiers: {}
|
|
39
|
+
}),
|
|
40
|
+
emits: /*@__PURE__*/ s(["select", "change"], ["update:tasks", "update:selected"]),
|
|
41
|
+
setup(o, { emit: s }) {
|
|
42
|
+
let C = o, w = n(() => ({
|
|
43
|
+
span: (e, t, n) => `${e}: ${t} to ${n}`,
|
|
44
|
+
done: (e) => `${e}% done`,
|
|
45
|
+
after: (e) => `after ${e.join(" and ")}`,
|
|
46
|
+
...C.labels
|
|
47
|
+
})), T = m(o, "tasks"), E = m(o, "selected"), D = s, O = 864e5, k = (e) => {
|
|
48
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
49
|
+
return Date.UTC(t, (n ?? 1) - 1, r ?? 1) / O;
|
|
50
|
+
}, A = (e) => /* @__PURE__ */ new Date(e * O), j = (e) => A(e).toISOString().slice(0, 10), M = d(null), N = (e) => {
|
|
51
|
+
let t = k(e.start), n = k(e.end), r = M.value;
|
|
52
|
+
return r && r.id === e.id && (r.mode === "move" ? (t = r.s + r.delta, n = r.e + r.delta) : r.mode === "start" ? t = Math.min(r.s + r.delta, r.e) : n = Math.max(r.e + r.delta, r.s)), {
|
|
53
|
+
s: t,
|
|
54
|
+
e: n
|
|
55
|
+
};
|
|
56
|
+
}, P = n(() => C.from ? k(C.from) : Math.min(...T.value.map((e) => N(e).s), k(e()))), F = n(() => C.to ? k(C.to) : Math.max(...T.value.map((e) => N(e).e), P.value)), I = n(() => Math.max(1, F.value - P.value + 1)), L = n(() => I.value * C.dayWidth), R = (e) => new Intl.DateTimeFormat(C.locale, {
|
|
57
|
+
...e,
|
|
58
|
+
timeZone: "UTC"
|
|
59
|
+
}), ae = n(() => R({
|
|
60
|
+
month: "long",
|
|
61
|
+
year: "numeric"
|
|
62
|
+
})), z = n(() => R({
|
|
63
|
+
month: "short",
|
|
64
|
+
day: "numeric"
|
|
65
|
+
})), oe = n(() => {
|
|
66
|
+
let e = [];
|
|
67
|
+
for (let t = 0; t < I.value; t++) {
|
|
68
|
+
let n = A(P.value + t);
|
|
69
|
+
(!e.length || n.getUTCDate() === 1) && e.push({
|
|
70
|
+
text: ae.value.format(n),
|
|
71
|
+
left: t * C.dayWidth,
|
|
72
|
+
width: 0
|
|
73
|
+
}), e.at(-1).width += C.dayWidth;
|
|
74
|
+
}
|
|
75
|
+
return e;
|
|
76
|
+
}), B = n(() => C.dayWidth < 12 ? [] : Array.from({ length: I.value }, (e, t) => {
|
|
77
|
+
let n = A(P.value + t), r = n.getUTCDay();
|
|
78
|
+
return {
|
|
79
|
+
n: n.getUTCDate(),
|
|
80
|
+
weekend: r === 0 || r === 6
|
|
81
|
+
};
|
|
82
|
+
})), V = (e) => {
|
|
83
|
+
let t = N(e), n = Math.max(t.s, P.value), r = Math.min(t.e, F.value);
|
|
84
|
+
return {
|
|
85
|
+
left: `${(n - P.value) * C.dayWidth}px`,
|
|
86
|
+
width: `${Math.max(1, r - n + 1) * C.dayWidth}px`
|
|
87
|
+
};
|
|
88
|
+
}, H = n(() => {
|
|
89
|
+
let t = k(e());
|
|
90
|
+
return t >= P.value && t <= F.value ? (t - P.value + .5) * C.dayWidth : null;
|
|
91
|
+
}), U = (e) => Math.min(100, Math.max(0, e.progress ?? 0)), se = (e) => {
|
|
92
|
+
let t = N(e), n = (e.after ?? []).map((e) => T.value.find((t) => t.id === e)?.label).filter(Boolean);
|
|
93
|
+
return w.value.span(e.label, z.value.format(A(t.s)), z.value.format(A(t.e))) + (e.progress == null ? "" : `, ${w.value.done(U(e))}`) + (n.length ? `, ${w.value.after(n)}` : "");
|
|
94
|
+
}, W = n(() => {
|
|
95
|
+
let e = [], t = C.rowHeight;
|
|
96
|
+
return T.value.forEach((n, r) => {
|
|
97
|
+
for (let i of n.after ?? []) {
|
|
98
|
+
let a = T.value.findIndex((e) => e.id === i);
|
|
99
|
+
if (a < 0) continue;
|
|
100
|
+
let o = V(T.value[a]), s = V(n), c = parseFloat(o.left) + parseFloat(o.width), l = parseFloat(s.left), u = a * t + t / 2, d = r * t + t / 2, f = u + (d > u ? t / 2 : -t / 2);
|
|
101
|
+
e.push(l >= c + 12 ? `M${c} ${u}H${c + 6}V${d}H${l - 1}` : `M${c} ${u}H${c + 6}V${f}H${l - 8}V${d}H${l - 1}`);
|
|
102
|
+
}
|
|
103
|
+
}), e;
|
|
104
|
+
}), G = d(""), K = !1;
|
|
105
|
+
function q(e, t, n) {
|
|
106
|
+
C.editable && !n.button && (n.stopPropagation(), n.currentTarget.setPointerCapture?.(n.pointerId), M.value = {
|
|
107
|
+
id: e.id,
|
|
108
|
+
mode: t,
|
|
109
|
+
x0: n.clientX,
|
|
110
|
+
s: k(e.start),
|
|
111
|
+
e: k(e.end),
|
|
112
|
+
delta: 0
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function J(e) {
|
|
116
|
+
let t = M.value;
|
|
117
|
+
t && (t.delta = Math.round((e.clientX - t.x0) / C.dayWidth));
|
|
118
|
+
}
|
|
119
|
+
function Y() {
|
|
120
|
+
let e = M.value;
|
|
121
|
+
if (!e || (M.value = null, K = e.delta !== 0, e.delta === 0)) return;
|
|
122
|
+
let t = T.value.find((t) => t.id === e.id), n = e.mode === "move" ? {
|
|
123
|
+
s: e.s + e.delta,
|
|
124
|
+
e: e.e + e.delta
|
|
125
|
+
} : e.mode === "start" ? {
|
|
126
|
+
s: Math.min(e.s + e.delta, e.e),
|
|
127
|
+
e: e.e
|
|
128
|
+
} : {
|
|
129
|
+
s: e.s,
|
|
130
|
+
e: Math.max(e.e + e.delta, e.s)
|
|
131
|
+
};
|
|
132
|
+
X(t, n.s, n.e);
|
|
133
|
+
}
|
|
134
|
+
function X(e, t, n) {
|
|
135
|
+
let r = {
|
|
136
|
+
start: j(t),
|
|
137
|
+
end: j(n)
|
|
138
|
+
};
|
|
139
|
+
T.value = T.value.map((t) => t.id === e.id ? {
|
|
140
|
+
...t,
|
|
141
|
+
...r
|
|
142
|
+
} : t), D("change", {
|
|
143
|
+
...e,
|
|
144
|
+
...r
|
|
145
|
+
}, r), G.value = w.value.span(e.label, z.value.format(A(t)), z.value.format(A(n)));
|
|
146
|
+
}
|
|
147
|
+
let Z = d(), Q = d(0);
|
|
148
|
+
function ce(e, t) {
|
|
149
|
+
let n = t.key === "ArrowDown" ? e + 1 : t.key === "ArrowUp" ? e - 1 : t.key === "Home" ? 0 : t.key === "End" ? T.value.length - 1 : null;
|
|
150
|
+
if (n != null) {
|
|
151
|
+
t.preventDefault();
|
|
152
|
+
let e = Math.min(T.value.length - 1, Math.max(0, n));
|
|
153
|
+
Q.value = e, Z.value?.querySelectorAll(".bless-gantt__bar")[e]?.focus();
|
|
154
|
+
} else if (C.editable && t.altKey && (t.key === "ArrowLeft" || t.key === "ArrowRight")) {
|
|
155
|
+
t.preventDefault();
|
|
156
|
+
let n = T.value[e], r = t.key === "ArrowRight" ? 1 : -1;
|
|
157
|
+
t.shiftKey ? X(n, k(n.start), Math.max(k(n.start), k(n.end) + r)) : X(n, k(n.start) + r, k(n.end) + r);
|
|
158
|
+
} else (t.key === "Enter" || t.key === " ") && (t.preventDefault(), $(T.value[e]));
|
|
159
|
+
}
|
|
160
|
+
function $(e) {
|
|
161
|
+
if (K) return void (K = !1);
|
|
162
|
+
E.value = E.value === e.id ? null : e.id, D("select", e);
|
|
163
|
+
}
|
|
164
|
+
return (e, n) => (u(), i("div", {
|
|
165
|
+
ref_key: "root",
|
|
166
|
+
ref: Z,
|
|
167
|
+
class: "bless-gantt",
|
|
168
|
+
role: "group",
|
|
169
|
+
"aria-label": o.label
|
|
170
|
+
}, [a("div", h, [a("div", {
|
|
171
|
+
class: "bless-gantt__body",
|
|
172
|
+
style: l({ "--bless-gantt-label": `${o.labelWidth}px` })
|
|
173
|
+
}, [a("div", g, [n[0] ||= a("div", {
|
|
174
|
+
class: "bless-gantt__corner",
|
|
175
|
+
style: { height: "56px" }
|
|
176
|
+
}, null, -1), (u(!0), i(t, null, f(T.value, (e) => (u(), i("div", {
|
|
177
|
+
key: e.id,
|
|
178
|
+
class: "bless-gantt__label",
|
|
179
|
+
style: l({ height: `${o.rowHeight}px` }),
|
|
180
|
+
title: e.label
|
|
181
|
+
}, p(e.label), 13, _))), 128))]), a("div", {
|
|
182
|
+
class: "bless-gantt__plot",
|
|
183
|
+
style: l({ width: `${L.value}px` })
|
|
184
|
+
}, [a("div", te, [a("div", v, [(u(!0), i(t, null, f(oe.value, (e) => (u(), i("span", {
|
|
185
|
+
key: e.left,
|
|
186
|
+
class: "bless-gantt__month",
|
|
187
|
+
style: l({
|
|
188
|
+
left: `${e.left}px`,
|
|
189
|
+
width: `${e.width}px`
|
|
190
|
+
})
|
|
191
|
+
}, p(e.text), 5))), 128))]), B.value.length ? (u(), i("div", y, [(u(!0), i(t, null, f(B.value, (e, t) => (u(), i("span", {
|
|
192
|
+
key: t,
|
|
193
|
+
class: c(["bless-gantt__day", { "bless-gantt__day--weekend": e.weekend }]),
|
|
194
|
+
style: l({ width: `${o.dayWidth}px` })
|
|
195
|
+
}, p(e.n), 7))), 128))])) : r("", !0)]), a("div", {
|
|
196
|
+
class: "bless-gantt__rows",
|
|
197
|
+
style: l({
|
|
198
|
+
height: `${T.value.length * o.rowHeight}px`,
|
|
199
|
+
backgroundSize: `${o.dayWidth}px 100%`
|
|
200
|
+
})
|
|
201
|
+
}, [
|
|
202
|
+
H.value == null ? r("", !0) : (u(), i("span", {
|
|
203
|
+
key: 0,
|
|
204
|
+
class: "bless-gantt__today",
|
|
205
|
+
"aria-hidden": "true",
|
|
206
|
+
style: l({ left: `${H.value}px` })
|
|
207
|
+
}, null, 4)),
|
|
208
|
+
W.value.length ? (u(), i("svg", {
|
|
209
|
+
key: 1,
|
|
210
|
+
class: "bless-gantt__arrows",
|
|
211
|
+
width: L.value,
|
|
212
|
+
height: T.value.length * o.rowHeight,
|
|
213
|
+
"aria-hidden": "true"
|
|
214
|
+
}, [n[1] ||= a("defs", null, [a("marker", {
|
|
215
|
+
id: "bless-gantt-head",
|
|
216
|
+
viewBox: "0 0 8 8",
|
|
217
|
+
refX: "7",
|
|
218
|
+
refY: "4",
|
|
219
|
+
markerWidth: "7",
|
|
220
|
+
markerHeight: "7",
|
|
221
|
+
orient: "auto"
|
|
222
|
+
}, [a("path", {
|
|
223
|
+
d: "M0 0L8 4L0 8z",
|
|
224
|
+
fill: "currentColor"
|
|
225
|
+
})])], -1), (u(!0), i(t, null, f(W.value, (e, t) => (u(), i("path", {
|
|
226
|
+
key: t,
|
|
227
|
+
d: e,
|
|
228
|
+
"marker-end": "url(#bless-gantt-head)"
|
|
229
|
+
}, null, 8, x))), 128))], 8, b)) : r("", !0),
|
|
230
|
+
(u(!0), i(t, null, f(T.value, (e, n) => (u(), i("button", {
|
|
231
|
+
key: e.id,
|
|
232
|
+
type: "button",
|
|
233
|
+
class: c(["bless-gantt__bar", {
|
|
234
|
+
"bless-gantt__bar--on": E.value === e.id,
|
|
235
|
+
"bless-gantt__bar--edit": o.editable,
|
|
236
|
+
"bless-gantt__bar--drag": M.value?.id === e.id
|
|
237
|
+
}]),
|
|
238
|
+
style: l({
|
|
239
|
+
...V(e),
|
|
240
|
+
top: `${n * o.rowHeight + 6}px`,
|
|
241
|
+
height: `${o.rowHeight - 12}px`
|
|
242
|
+
}),
|
|
243
|
+
tabindex: n === Q.value ? 0 : -1,
|
|
244
|
+
"aria-label": se(e),
|
|
245
|
+
"aria-pressed": E.value === e.id,
|
|
246
|
+
onClick: (t) => (Q.value = n, $(e)),
|
|
247
|
+
onFocus: (e) => Q.value = n,
|
|
248
|
+
onKeydown: (e) => ce(n, e),
|
|
249
|
+
onPointerdown: (t) => q(e, "move", t),
|
|
250
|
+
onPointermove: J,
|
|
251
|
+
onPointerup: Y,
|
|
252
|
+
onPointercancel: Y
|
|
253
|
+
}, [o.editable ? (u(), i(t, { key: 0 }, [a("span", {
|
|
254
|
+
class: "bless-gantt__grip bless-gantt__grip--start",
|
|
255
|
+
"aria-hidden": "true",
|
|
256
|
+
onPointerdown: (t) => q(e, "start", t),
|
|
257
|
+
onPointermove: J,
|
|
258
|
+
onPointerup: Y,
|
|
259
|
+
onPointercancel: Y
|
|
260
|
+
}, null, 40, S), a("span", {
|
|
261
|
+
class: "bless-gantt__grip bless-gantt__grip--end",
|
|
262
|
+
"aria-hidden": "true",
|
|
263
|
+
onPointerdown: (t) => q(e, "end", t),
|
|
264
|
+
onPointermove: J,
|
|
265
|
+
onPointerup: Y,
|
|
266
|
+
onPointercancel: Y
|
|
267
|
+
}, null, 40, re)], 64)) : r("", !0), e.progress == null ? r("", !0) : (u(), i("span", {
|
|
268
|
+
key: 1,
|
|
269
|
+
class: "bless-gantt__done",
|
|
270
|
+
style: l({ width: `${U(e)}%` })
|
|
271
|
+
}, null, 4))], 46, ne))), 128))
|
|
272
|
+
], 4)], 4)], 4)]), a("span", ie, p(G.value), 1)], 8, ee));
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
//#endregion
|
|
276
|
+
export { C as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bless-gauge{align-items:center;gap:var(--bless-space-1);width:100%;max-width:240px;font-family:var(--bless-font-sans);color:var(--bless-color-text);flex-direction:column;display:inline-flex}.bless-gauge--linear{align-items:stretch;max-width:320px}.bless-gauge__svg{width:100%;height:auto;overflow:visible}.bless-gauge__track,.bless-gauge__band{fill:none;stroke-width:14px}.bless-gauge__track{stroke:var(--bless-color-border)}.bless-gauge__band{opacity:.85}.bless-gauge__needle{stroke:var(--bless-color-text);stroke-width:5px;stroke-linecap:butt}.bless-gauge__bar{background:var(--bless-color-border);height:14px;position:relative}.bless-gauge__seg{opacity:.85;position:absolute;inset-block:0}.bless-gauge__mark{background:var(--bless-color-text);outline:1px solid var(--bless-color-bg);width:4px;position:absolute;inset-block:-4px;translate:-50%}.bless-gauge__read{flex-direction:column;align-items:center;line-height:1.2;display:flex}.bless-gauge--arc .bless-gauge__read{margin-top:calc(var(--bless-space-8) * -1)}.bless-gauge__value{font-size:var(--bless-text-xl);font-variant-numeric:tabular-nums}.bless-gauge__label{font-size:var(--bless-text-xs);color:var(--bless-color-text-muted)}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface BlessGaugeZone {
|
|
2
|
+
/** the zone runs up to this value; zones are sorted by it */
|
|
3
|
+
to: number;
|
|
4
|
+
/** a token name (`success`, `warning`, `danger`, `chart-1`…) or any CSS colour */
|
|
5
|
+
color?: string;
|
|
6
|
+
/** said after the value when the needle is in this zone: "Normal", "Too hot" */
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
declare const __VLS_export: import('vue').DefineComponent<{
|
|
12
|
+
value: number;
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
zones?: BlessGaugeZone[];
|
|
16
|
+
variant?: "arc" | "linear";
|
|
17
|
+
/** what is measured: names the meter for screen readers and shows under the number */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** text for the value, e.g. `(v) => v + " °C"` */
|
|
20
|
+
format?: (v: number) => string;
|
|
21
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
22
|
+
value: number;
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
zones?: BlessGaugeZone[];
|
|
26
|
+
variant?: "arc" | "linear";
|
|
27
|
+
/** what is measured: names the meter for screen readers and shows under the number */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** text for the value, e.g. `(v) => v + " °C"` */
|
|
30
|
+
format?: (v: number) => string;
|
|
31
|
+
}> & Readonly<{}>, {
|
|
32
|
+
label: string;
|
|
33
|
+
variant: "arc" | "linear";
|
|
34
|
+
min: number;
|
|
35
|
+
max: number;
|
|
36
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|