blessing-ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +137 -125
  3. package/dist/blessing-ui.css +38 -2
  4. package/dist/components/BlessAnnotator.css +1 -0
  5. package/dist/components/BlessAnnotator.js +6 -0
  6. package/dist/components/BlessAnnotator.vue.d.ts +71 -0
  7. package/dist/components/BlessAnnotator.vue_vue_type_script_setup_true_lang.js +264 -0
  8. package/dist/components/BlessAttachment.vue.d.ts +4 -1
  9. package/dist/components/BlessAttachment.vue_vue_type_script_setup_true_lang.js +3 -2
  10. package/dist/components/BlessCalendar.vue.d.ts +4 -0
  11. package/dist/components/BlessCalendar.vue_vue_type_script_setup_true_lang.js +65 -60
  12. package/dist/components/BlessCarousel.vue.d.ts +3 -0
  13. package/dist/components/BlessCarousel.vue_vue_type_script_setup_true_lang.js +10 -9
  14. package/dist/components/BlessCoachmark.css +1 -0
  15. package/dist/components/BlessCoachmark.js +6 -0
  16. package/dist/components/BlessCoachmark.vue.d.ts +40 -0
  17. package/dist/components/BlessCoachmark.vue_vue_type_script_setup_true_lang.js +74 -0
  18. package/dist/components/BlessCodeBlock.vue.d.ts +10 -0
  19. package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +39 -33
  20. package/dist/components/BlessCombobox.vue.d.ts +2 -0
  21. package/dist/components/BlessCombobox.vue_vue_type_script_setup_true_lang.js +3 -2
  22. package/dist/components/BlessCommand.css +1 -1
  23. package/dist/components/BlessCommand.vue.d.ts +26 -0
  24. package/dist/components/BlessCommand.vue_vue_type_script_setup_true_lang.js +137 -70
  25. package/dist/components/BlessConfetti.css +1 -0
  26. package/dist/components/BlessConfetti.js +6 -0
  27. package/dist/components/BlessConfetti.vue.d.ts +40 -0
  28. package/dist/components/BlessConfetti.vue_vue_type_script_setup_true_lang.js +77 -0
  29. package/dist/components/BlessCropper.vue.d.ts +16 -0
  30. package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +47 -39
  31. package/dist/components/BlessDataTable.vue.d.ts +6 -0
  32. package/dist/components/BlessDataTable.vue_vue_type_script_setup_true_lang.js +56 -42
  33. package/dist/components/BlessDataView.vue.d.ts +7 -0
  34. package/dist/components/BlessDataView.vue_vue_type_script_setup_true_lang.js +38 -31
  35. package/dist/components/BlessDatePicker.vue.d.ts +3 -0
  36. package/dist/components/BlessDatePicker.vue_vue_type_script_setup_true_lang.js +46 -45
  37. package/dist/components/BlessDock.css +1 -0
  38. package/dist/components/BlessDock.js +6 -0
  39. package/dist/components/BlessDock.vue.d.ts +55 -0
  40. package/dist/components/BlessDock.vue_vue_type_script_setup_true_lang.js +100 -0
  41. package/dist/components/BlessEditor.vue.d.ts +2 -0
  42. package/dist/components/BlessEditor.vue_vue_type_script_setup_true_lang.js +23 -22
  43. package/dist/components/BlessFileInput.vue.d.ts +2 -0
  44. package/dist/components/BlessFileInput.vue_vue_type_script_setup_true_lang.js +3 -2
  45. package/dist/components/BlessFormula.css +1 -0
  46. package/dist/components/BlessFormula.js +6 -0
  47. package/dist/components/BlessFormula.vue.d.ts +53 -0
  48. package/dist/components/BlessFormula.vue_vue_type_script_setup_true_lang.js +111 -0
  49. package/dist/components/BlessGantt.vue.d.ts +12 -0
  50. package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +74 -68
  51. package/dist/components/BlessInfiniteCanvas.css +1 -0
  52. package/dist/components/BlessInfiniteCanvas.js +6 -0
  53. package/dist/components/BlessInfiniteCanvas.vue.d.ts +91 -0
  54. package/dist/components/BlessInfiniteCanvas.vue_vue_type_script_setup_true_lang.js +232 -0
  55. package/dist/components/BlessInputNumber.vue.d.ts +5 -0
  56. package/dist/components/BlessInputNumber.vue_vue_type_script_setup_true_lang.js +39 -34
  57. package/dist/components/BlessKanban.vue.d.ts +12 -0
  58. package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +127 -97
  59. package/dist/components/BlessLoadingBar.vue.d.ts +2 -0
  60. package/dist/components/BlessLoadingBar.vue_vue_type_script_setup_true_lang.js +8 -3
  61. package/dist/components/BlessMarquee.vue.d.ts +4 -0
  62. package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +32 -27
  63. package/dist/components/BlessNodeGraph.css +1 -0
  64. package/dist/components/BlessNodeGraph.js +6 -0
  65. package/dist/components/BlessNodeGraph.vue.d.ts +110 -0
  66. package/dist/components/BlessNodeGraph.vue_vue_type_script_setup_true_lang.js +321 -0
  67. package/dist/components/BlessOnboardingChecklist.css +1 -0
  68. package/dist/components/BlessOnboardingChecklist.js +6 -0
  69. package/dist/components/BlessOnboardingChecklist.vue.d.ts +72 -0
  70. package/dist/components/BlessOnboardingChecklist.vue_vue_type_script_setup_true_lang.js +157 -0
  71. package/dist/components/BlessOrderList.vue.d.ts +5 -0
  72. package/dist/components/BlessOrderList.vue_vue_type_script_setup_true_lang.js +62 -56
  73. package/dist/components/BlessPagination.vue.d.ts +2 -0
  74. package/dist/components/BlessPagination.vue_vue_type_script_setup_true_lang.js +2 -1
  75. package/dist/components/BlessPickList.vue.d.ts +5 -0
  76. package/dist/components/BlessPickList.vue_vue_type_script_setup_true_lang.js +55 -49
  77. package/dist/components/BlessRangeCalendar.css +1 -0
  78. package/dist/components/BlessRangeCalendar.js +6 -0
  79. package/dist/components/BlessRangeCalendar.vue.d.ts +51 -0
  80. package/dist/components/BlessRangeCalendar.vue_vue_type_script_setup_true_lang.js +217 -0
  81. package/dist/components/BlessScheduler.css +1 -0
  82. package/dist/components/BlessScheduler.js +6 -0
  83. package/dist/components/BlessScheduler.vue.d.ts +95 -0
  84. package/dist/components/BlessScheduler.vue_vue_type_script_setup_true_lang.js +347 -0
  85. package/dist/components/BlessShortcutRecorder.vue.d.ts +10 -0
  86. package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +50 -40
  87. package/dist/components/BlessSignaturePad.vue.d.ts +1 -1
  88. package/dist/components/BlessSliderCaptcha.vue.d.ts +5 -0
  89. package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +89 -84
  90. package/dist/components/BlessSortable.css +1 -1
  91. package/dist/components/BlessSortable.vue.d.ts +19 -1
  92. package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +103 -55
  93. package/dist/components/BlessSparkline.css +1 -0
  94. package/dist/components/BlessSparkline.js +6 -0
  95. package/dist/components/BlessSparkline.vue.d.ts +28 -0
  96. package/dist/components/BlessSparkline.vue_vue_type_script_setup_true_lang.js +107 -0
  97. package/dist/components/BlessSteps.vue.d.ts +2 -0
  98. package/dist/components/BlessSteps.vue_vue_type_script_setup_true_lang.js +3 -2
  99. package/dist/components/BlessSwipeDeck.vue.d.ts +1 -1
  100. package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +2 -1
  101. package/dist/components/BlessTimer.vue.d.ts +18 -0
  102. package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +52 -43
  103. package/dist/components/BlessTour.vue.d.ts +1 -0
  104. package/dist/components/BlessTour.vue_vue_type_script_setup_true_lang.js +48 -42
  105. package/dist/components/BlessTreemap.css +1 -0
  106. package/dist/components/BlessTreemap.js +6 -0
  107. package/dist/components/BlessTreemap.vue.d.ts +46 -0
  108. package/dist/components/BlessTreemap.vue_vue_type_script_setup_true_lang.js +137 -0
  109. package/dist/components/BlessUploader.vue.d.ts +11 -0
  110. package/dist/components/BlessUploader.vue_vue_type_script_setup_true_lang.js +80 -69
  111. package/dist/composables/annotate.d.ts +35 -0
  112. package/dist/composables/annotate.js +33 -0
  113. package/dist/composables/canvasView.d.ts +21 -0
  114. package/dist/composables/canvasView.js +23 -0
  115. package/dist/composables/confetti.d.ts +32 -0
  116. package/dist/composables/confetti.js +23 -0
  117. package/dist/composables/dayBlocks.d.ts +11 -0
  118. package/dist/composables/dayBlocks.js +26 -0
  119. package/dist/composables/formula.d.ts +28 -0
  120. package/dist/composables/formula.js +161 -0
  121. package/dist/composables/graph.d.ts +19 -0
  122. package/dist/composables/graph.js +16 -0
  123. package/dist/composables/schedule.d.ts +27 -0
  124. package/dist/composables/schedule.js +54 -0
  125. package/dist/composables/treemap.d.ts +23 -0
  126. package/dist/composables/treemap.js +77 -0
  127. package/dist/composables/useAutoScroll.d.ts +15 -0
  128. package/dist/composables/useAutoScroll.js +32 -0
  129. package/dist/composables/useSortable.d.ts +42 -2
  130. package/dist/composables/useSortable.js +87 -14
  131. package/dist/index.d.ts +25 -1
  132. package/dist/index.js +78 -63
  133. package/package.json +4 -2
@@ -20,7 +20,7 @@ var D = {
20
20
  "aria-expanded",
21
21
  "aria-invalid",
22
22
  "aria-describedby"
23
- ], A = ["aria-label", "onKeydown"], j = /*@__PURE__*/ d({
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, j = x(d, "modelValue"), M = e(f)(), N = t(), P = v(!1), F = v(), I = v(), { x: L, y: R } = n(F, I, P, {
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
- }), z = v(!1);
50
- g(() => z.value = matchMedia("(pointer: coarse)").matches);
51
- let B = o(() => f.nativeOnTouch && !f.range && z.value), V = o(() => new Intl.DateTimeFormat(f.locale, { dateStyle: "medium" })), H = o(() => {
52
- if (!j.value) return "";
53
- let e = V.value;
54
- return Array.isArray(j.value) ? `${e.format(r(j.value[0]))} – ${e.format(r(j.value[1]))}` : e.format(r(j.value));
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 U() {
57
- P.value = !1, F.value?.focus();
57
+ function W() {
58
+ F.value = !1, I.value?.focus();
58
59
  }
59
- C(P, (e) => p(() => {
60
- let t = I.value;
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(j, (e) => {
63
- P.value && (!f.range || Array.isArray(e)) && U();
63
+ })), C(M, (e) => {
64
+ F.value && (!f.range || Array.isArray(e)) && W();
64
65
  });
65
- function W() {
66
- j.value = void 0, F.value?.focus();
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(N).invalid.value,
70
+ "bless-datepicker--invalid": d.invalid || b(P).invalid.value,
70
71
  "bless-datepicker--disabled": d.disabled
71
- }]]) }, [B.value ? (_(), c("span", D, [w(l("input", {
72
- id: b(M),
73
- "onUpdate:modelValue": t[0] ||= (e) => j.value = 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(N).invalid.value || void 0,
80
- "aria-describedby": b(N).describedby.value
81
- }, null, 8, O), [[S, j.value]])])) : (_(), c(a, { key: 1 }, [
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: F,
85
- id: b(M),
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": P.value,
91
- "aria-invalid": d.invalid || b(N).invalid.value || void 0,
92
- "aria-describedby": b(N).describedby.value,
93
- onClick: t[1] ||= (e) => P.value = !P.value,
94
- onKeydown: t[2] ||= T((e) => P.value &&= (e.preventDefault(), !1), ["esc"])
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": !H.value }]) }, y(H.value || d.placeholder), 3)], 40, k),
99
- H.value && !d.disabled ? (_(), c("button", {
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": "Clear date",
104
- onClick: W
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: I,
109
+ ref: L,
109
110
  popover: "auto",
110
111
  class: "bless-datepicker__panel",
111
112
  style: h({
112
- left: `${b(L)}px`,
113
- top: `${b(R)}px`
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) => P.value = e.newState === "open",
118
- onKeydown: T(E(U, ["stop", "prevent"]), ["esc"])
118
+ onToggle: t[4] ||= (e) => F.value = e.newState === "open",
119
+ onKeydown: T(E(W, ["stop", "prevent"]), ["esc"])
119
120
  }, [u(i, {
120
- modelValue: j.value,
121
- "onUpdate:modelValue": t[3] ||= (e) => j.value = 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, A)
133
+ ])], 44, j)
133
134
  ], 64))], 2));
134
135
  }
135
136
  });
136
137
  //#endregion
137
- export { j as default };
138
+ export { M 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,6 @@
1
+ import "./BlessDock.css";
2
+ import e, { magnify as t } from "./BlessDock.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessDock.vue
4
+ var n = e;
5
+ //#endregion
6
+ export { n as default, t as magnify };
@@ -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(), S = {
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) => x(e).toggleBold().run(),
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) => x(e).toggleItalic().run(),
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) => x(e).toggleStrike().run(),
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) => x(e).toggleCode().run(),
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) => x(e).toggleHeading({ level: 1 }).run(),
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) => x(e).toggleHeading({ level: 2 }).run(),
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) => x(e).toggleHeading({ level: 3 }).run(),
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) => x(e).toggleBulletList().run(),
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) => x(e).toggleOrderedList().run(),
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) => x(e).toggleBlockquote().run(),
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) => x(e).toggleCodeBlock().run(),
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) => x(e).setHorizontalRule().run()
118
+ run: (e) => C(e).setHorizontalRule().run()
118
119
  },
119
120
  undo: {
120
121
  title: "Undo",
121
122
  icon: "↶",
122
- run: (e) => x(e).undo().run(),
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) => x(e).redo().run(),
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 && S[e].active?.(a.editor) }]),
146
- title: S[e].title,
147
- "aria-label": S[e].title,
148
- "aria-pressed": S[e].active ? !!(a.editor && S[e].active(a.editor)) : void 0,
149
- disabled: a.disabled || !a.editor || (S[e].can ? !S[e].can(a.editor) : !1),
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 && S[e].run(a.editor)
152
- }, [i("span", _, f(S[e].icon), 1)], 42, g))], 64))), 128))])], 8, m),
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));
@@ -9,6 +9,8 @@ type __VLS_Props = {
9
9
  hint?: string;
10
10
  /** show the chosen files under the zone */
11
11
  list?: boolean;
12
+ /** name of a file's remove button */
13
+ removeLabel?: (name: string) => string;
12
14
  };
13
15
  type __VLS_ModelProps = {
14
16
  modelValue?: File[];
@@ -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,6 @@
1
+ import "./BlessFormula.css";
2
+ import e from "./BlessFormula.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessFormula.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -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>;