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.
Files changed (200) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +139 -105
  3. package/dist/blessing-ui.css +97 -1
  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.css +1 -0
  19. package/dist/components/BlessCodeBlock.js +6 -0
  20. package/dist/components/BlessCodeBlock.vue.d.ts +72 -0
  21. package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +140 -0
  22. package/dist/components/BlessCombobox.vue.d.ts +2 -0
  23. package/dist/components/BlessCombobox.vue_vue_type_script_setup_true_lang.js +3 -2
  24. package/dist/components/BlessCommand.css +1 -1
  25. package/dist/components/BlessCommand.vue.d.ts +26 -0
  26. package/dist/components/BlessCommand.vue_vue_type_script_setup_true_lang.js +137 -70
  27. package/dist/components/BlessConfetti.css +1 -0
  28. package/dist/components/BlessConfetti.js +6 -0
  29. package/dist/components/BlessConfetti.vue.d.ts +40 -0
  30. package/dist/components/BlessConfetti.vue_vue_type_script_setup_true_lang.js +77 -0
  31. package/dist/components/BlessCountUp.css +1 -0
  32. package/dist/components/BlessCountUp.js +6 -0
  33. package/dist/components/BlessCountUp.vue.d.ts +18 -0
  34. package/dist/components/BlessCountUp.vue_vue_type_script_setup_true_lang.js +49 -0
  35. package/dist/components/BlessCropper.css +1 -0
  36. package/dist/components/BlessCropper.js +6 -0
  37. package/dist/components/BlessCropper.vue.d.ts +70 -0
  38. package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +220 -0
  39. package/dist/components/BlessDataTable.vue.d.ts +6 -0
  40. package/dist/components/BlessDataTable.vue_vue_type_script_setup_true_lang.js +56 -42
  41. package/dist/components/BlessDataView.vue.d.ts +7 -0
  42. package/dist/components/BlessDataView.vue_vue_type_script_setup_true_lang.js +38 -31
  43. package/dist/components/BlessDatePicker.vue.d.ts +3 -0
  44. package/dist/components/BlessDatePicker.vue_vue_type_script_setup_true_lang.js +46 -45
  45. package/dist/components/BlessDiff.css +1 -0
  46. package/dist/components/BlessDiff.js +6 -0
  47. package/dist/components/BlessDiff.vue.d.ts +22 -0
  48. package/dist/components/BlessDiff.vue_vue_type_script_setup_true_lang.js +148 -0
  49. package/dist/components/BlessDock.css +1 -0
  50. package/dist/components/BlessDock.js +6 -0
  51. package/dist/components/BlessDock.vue.d.ts +55 -0
  52. package/dist/components/BlessDock.vue_vue_type_script_setup_true_lang.js +100 -0
  53. package/dist/components/BlessEditor.vue.d.ts +2 -0
  54. package/dist/components/BlessEditor.vue_vue_type_script_setup_true_lang.js +23 -22
  55. package/dist/components/BlessFileInput.vue.d.ts +2 -0
  56. package/dist/components/BlessFileInput.vue_vue_type_script_setup_true_lang.js +3 -2
  57. package/dist/components/BlessFormula.css +1 -0
  58. package/dist/components/BlessFormula.js +6 -0
  59. package/dist/components/BlessFormula.vue.d.ts +53 -0
  60. package/dist/components/BlessFormula.vue_vue_type_script_setup_true_lang.js +111 -0
  61. package/dist/components/BlessGantt.css +1 -0
  62. package/dist/components/BlessGantt.js +6 -0
  63. package/dist/components/BlessGantt.vue.d.ts +81 -0
  64. package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +276 -0
  65. package/dist/components/BlessGauge.css +1 -0
  66. package/dist/components/BlessGauge.js +6 -0
  67. package/dist/components/BlessGauge.vue.d.ts +36 -0
  68. package/dist/components/BlessGauge.vue_vue_type_script_setup_true_lang.js +100 -0
  69. package/dist/components/BlessHeatmapCalendar.css +1 -0
  70. package/dist/components/BlessHeatmapCalendar.js +6 -0
  71. package/dist/components/BlessHeatmapCalendar.vue.d.ts +38 -0
  72. package/dist/components/BlessHeatmapCalendar.vue_vue_type_script_setup_true_lang.js +146 -0
  73. package/dist/components/BlessHotspots.css +1 -0
  74. package/dist/components/BlessHotspots.js +6 -0
  75. package/dist/components/BlessHotspots.vue.d.ts +49 -0
  76. package/dist/components/BlessHotspots.vue_vue_type_script_setup_true_lang.js +127 -0
  77. package/dist/components/BlessInfiniteCanvas.css +1 -0
  78. package/dist/components/BlessInfiniteCanvas.js +6 -0
  79. package/dist/components/BlessInfiniteCanvas.vue.d.ts +91 -0
  80. package/dist/components/BlessInfiniteCanvas.vue_vue_type_script_setup_true_lang.js +232 -0
  81. package/dist/components/BlessInputNumber.vue.d.ts +5 -0
  82. package/dist/components/BlessInputNumber.vue_vue_type_script_setup_true_lang.js +39 -34
  83. package/dist/components/BlessKanban.css +1 -0
  84. package/dist/components/BlessKanban.js +6 -0
  85. package/dist/components/BlessKanban.vue.d.ts +67 -0
  86. package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +195 -0
  87. package/dist/components/BlessLoadingBar.vue.d.ts +2 -0
  88. package/dist/components/BlessLoadingBar.vue_vue_type_script_setup_true_lang.js +8 -3
  89. package/dist/components/BlessLoupe.css +1 -0
  90. package/dist/components/BlessLoupe.js +6 -0
  91. package/dist/components/BlessLoupe.vue.d.ts +16 -0
  92. package/dist/components/BlessLoupe.vue_vue_type_script_setup_true_lang.js +93 -0
  93. package/dist/components/BlessMarquee.css +1 -0
  94. package/dist/components/BlessMarquee.js +6 -0
  95. package/dist/components/BlessMarquee.vue.d.ts +44 -0
  96. package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +69 -0
  97. package/dist/components/BlessMasonry.css +1 -0
  98. package/dist/components/BlessMasonry.js +6 -0
  99. package/dist/components/BlessMasonry.vue.d.ts +33 -0
  100. package/dist/components/BlessMasonry.vue_vue_type_script_setup_true_lang.js +79 -0
  101. package/dist/components/BlessMention.css +1 -0
  102. package/dist/components/BlessMention.js +6 -0
  103. package/dist/components/BlessMention.vue.d.ts +32 -0
  104. package/dist/components/BlessMention.vue_vue_type_script_setup_true_lang.js +116 -0
  105. package/dist/components/BlessNodeGraph.css +1 -0
  106. package/dist/components/BlessNodeGraph.js +6 -0
  107. package/dist/components/BlessNodeGraph.vue.d.ts +110 -0
  108. package/dist/components/BlessNodeGraph.vue_vue_type_script_setup_true_lang.js +321 -0
  109. package/dist/components/BlessOnboardingChecklist.css +1 -0
  110. package/dist/components/BlessOnboardingChecklist.js +6 -0
  111. package/dist/components/BlessOnboardingChecklist.vue.d.ts +72 -0
  112. package/dist/components/BlessOnboardingChecklist.vue_vue_type_script_setup_true_lang.js +157 -0
  113. package/dist/components/BlessOrderList.vue.d.ts +5 -0
  114. package/dist/components/BlessOrderList.vue_vue_type_script_setup_true_lang.js +62 -56
  115. package/dist/components/BlessPagination.vue.d.ts +2 -0
  116. package/dist/components/BlessPagination.vue_vue_type_script_setup_true_lang.js +2 -1
  117. package/dist/components/BlessPickList.vue.d.ts +5 -0
  118. package/dist/components/BlessPickList.vue_vue_type_script_setup_true_lang.js +55 -49
  119. package/dist/components/BlessRadialMenu.css +1 -0
  120. package/dist/components/BlessRadialMenu.js +6 -0
  121. package/dist/components/BlessRadialMenu.vue.d.ts +45 -0
  122. package/dist/components/BlessRadialMenu.vue_vue_type_script_setup_true_lang.js +146 -0
  123. package/dist/components/BlessRangeCalendar.css +1 -0
  124. package/dist/components/BlessRangeCalendar.js +6 -0
  125. package/dist/components/BlessRangeCalendar.vue.d.ts +51 -0
  126. package/dist/components/BlessRangeCalendar.vue_vue_type_script_setup_true_lang.js +217 -0
  127. package/dist/components/BlessScheduler.css +1 -0
  128. package/dist/components/BlessScheduler.js +6 -0
  129. package/dist/components/BlessScheduler.vue.d.ts +95 -0
  130. package/dist/components/BlessScheduler.vue_vue_type_script_setup_true_lang.js +347 -0
  131. package/dist/components/BlessShortcutRecorder.css +1 -0
  132. package/dist/components/BlessShortcutRecorder.js +6 -0
  133. package/dist/components/BlessShortcutRecorder.vue.d.ts +39 -0
  134. package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +126 -0
  135. package/dist/components/BlessSignaturePad.vue.d.ts +1 -1
  136. package/dist/components/BlessSliderCaptcha.css +1 -0
  137. package/dist/components/BlessSliderCaptcha.js +6 -0
  138. package/dist/components/BlessSliderCaptcha.vue.d.ts +38 -0
  139. package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +146 -0
  140. package/dist/components/BlessSortable.css +1 -0
  141. package/dist/components/BlessSortable.js +6 -0
  142. package/dist/components/BlessSortable.vue.d.ts +51 -0
  143. package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +135 -0
  144. package/dist/components/BlessSparkline.css +1 -0
  145. package/dist/components/BlessSparkline.js +6 -0
  146. package/dist/components/BlessSparkline.vue.d.ts +28 -0
  147. package/dist/components/BlessSparkline.vue_vue_type_script_setup_true_lang.js +107 -0
  148. package/dist/components/BlessSplitView.css +1 -0
  149. package/dist/components/BlessSplitView.js +6 -0
  150. package/dist/components/BlessSplitView.vue.d.ts +61 -0
  151. package/dist/components/BlessSplitView.vue_vue_type_script_setup_true_lang.js +92 -0
  152. package/dist/components/BlessSteps.vue.d.ts +2 -0
  153. package/dist/components/BlessSteps.vue_vue_type_script_setup_true_lang.js +3 -2
  154. package/dist/components/BlessSwipeDeck.css +1 -0
  155. package/dist/components/BlessSwipeDeck.js +6 -0
  156. package/dist/components/BlessSwipeDeck.vue.d.ts +46 -0
  157. package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +200 -0
  158. package/dist/components/BlessTimer.css +1 -0
  159. package/dist/components/BlessTimer.js +6 -0
  160. package/dist/components/BlessTimer.vue.d.ts +74 -0
  161. package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +139 -0
  162. package/dist/components/BlessTour.vue.d.ts +1 -0
  163. package/dist/components/BlessTour.vue_vue_type_script_setup_true_lang.js +48 -42
  164. package/dist/components/BlessTreemap.css +1 -0
  165. package/dist/components/BlessTreemap.js +6 -0
  166. package/dist/components/BlessTreemap.vue.d.ts +46 -0
  167. package/dist/components/BlessTreemap.vue_vue_type_script_setup_true_lang.js +137 -0
  168. package/dist/components/BlessUploader.vue.d.ts +11 -0
  169. package/dist/components/BlessUploader.vue_vue_type_script_setup_true_lang.js +80 -69
  170. package/dist/composables/annotate.d.ts +35 -0
  171. package/dist/composables/annotate.js +33 -0
  172. package/dist/composables/canvasView.d.ts +21 -0
  173. package/dist/composables/canvasView.js +23 -0
  174. package/dist/composables/confetti.d.ts +32 -0
  175. package/dist/composables/confetti.js +23 -0
  176. package/dist/composables/cropBox.d.ts +22 -0
  177. package/dist/composables/cropBox.js +39 -0
  178. package/dist/composables/dayBlocks.d.ts +11 -0
  179. package/dist/composables/dayBlocks.js +26 -0
  180. package/dist/composables/diffLines.d.ts +10 -0
  181. package/dist/composables/diffLines.js +55 -0
  182. package/dist/composables/formula.d.ts +28 -0
  183. package/dist/composables/formula.js +161 -0
  184. package/dist/composables/graph.d.ts +19 -0
  185. package/dist/composables/graph.js +16 -0
  186. package/dist/composables/radial.d.ts +15 -0
  187. package/dist/composables/radial.js +22 -0
  188. package/dist/composables/schedule.d.ts +27 -0
  189. package/dist/composables/schedule.js +54 -0
  190. package/dist/composables/shortcut.d.ts +12 -0
  191. package/dist/composables/shortcut.js +35 -0
  192. package/dist/composables/treemap.d.ts +23 -0
  193. package/dist/composables/treemap.js +77 -0
  194. package/dist/composables/useAutoScroll.d.ts +15 -0
  195. package/dist/composables/useAutoScroll.js +32 -0
  196. package/dist/composables/useSortable.d.ts +58 -0
  197. package/dist/composables/useSortable.js +107 -0
  198. package/dist/index.d.ts +62 -1
  199. package/dist/index.js +93 -53
  200. package/package.json +22 -18
@@ -0,0 +1,220 @@
1
+ import e from "./BlessButton.js";
2
+ import { initialBox as t, moveBox as n, resizeBox as r, scaleBox as i } from "../composables/cropBox.js";
3
+ import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as ee, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, openBlock as _, ref as v, renderList as te, toDisplayString as y, unref as b, useId as x, useModel as ne, watch as S, withCtx as C } from "vue";
4
+ //#region src/components/BlessCropper.vue?vue&type=script&setup=true&lang.ts
5
+ var w = { class: "bless-cropper" }, T = {
6
+ key: 0,
7
+ class: "bless-cropper__error",
8
+ role: "alert"
9
+ }, E = ["aria-busy"], re = ["aria-label", "aria-describedby"], ie = ["onPointerdown"], D = {
10
+ key: 2,
11
+ class: "bless-cropper__foot"
12
+ }, ae = ["id"], O = {
13
+ key: 0,
14
+ class: "bless-cropper__controls"
15
+ }, oe = {
16
+ class: "bless-cropper__live",
17
+ "aria-live": "polite"
18
+ }, k = /*@__PURE__*/ f({
19
+ name: "BlessCropper",
20
+ __name: "BlessCropper",
21
+ props: /*@__PURE__*/ p({
22
+ src: {},
23
+ aspect: {},
24
+ crossorigin: { default: "anonymous" },
25
+ controls: {
26
+ type: Boolean,
27
+ default: !0
28
+ },
29
+ label: { default: "Crop area" },
30
+ labels: {}
31
+ }, {
32
+ modelValue: { default: null },
33
+ modelModifiers: {}
34
+ }),
35
+ emits: /*@__PURE__*/ p(["ready", "error"], ["update:modelValue"]),
36
+ setup(f, { expose: p, emit: k }) {
37
+ let A = f, j = o(() => ({
38
+ size: (e, t, n, r) => `${e} by ${t} pixels, from ${n}, ${r}`,
39
+ hint: "arrows move, + − resize",
40
+ rotateLeft: "Rotate left",
41
+ rotateRight: "Rotate right",
42
+ loadError: "The image could not be loaded.",
43
+ ...A.labels
44
+ })), M = ne(f, "modelValue"), N = k, P = x(), F = v(), I = v(), L = v(null), R = v(!1), z = v(0), B = v({
45
+ l: 0,
46
+ t: 0,
47
+ r: 1,
48
+ b: 1
49
+ }), V = v(""), H = o(() => {
50
+ let e = L.value;
51
+ return e ? z.value % 180 ? {
52
+ w: e.naturalHeight,
53
+ h: e.naturalWidth
54
+ } : {
55
+ w: e.naturalWidth,
56
+ h: e.naturalHeight
57
+ } : {
58
+ w: 0,
59
+ h: 0
60
+ };
61
+ }), U = o(() => A.aspect && H.value.w ? A.aspect * H.value.h / H.value.w : 0), W = o(() => {
62
+ let { w: e, h: t } = H.value;
63
+ if (!e) return null;
64
+ let n = B.value;
65
+ return {
66
+ x: Math.round(n.l * e),
67
+ y: Math.round(n.t * t),
68
+ width: Math.round((n.r - n.l) * e),
69
+ height: Math.round((n.b - n.t) * t),
70
+ rotation: z.value
71
+ };
72
+ });
73
+ S(W, (e) => e && (M.value = e));
74
+ function G(e, t) {
75
+ let n = L.value, r = e.getContext("2d");
76
+ n && r && (e.width = Math.max(1, Math.round(H.value.w * t)), e.height = Math.max(1, Math.round(H.value.h * t)), r.translate(e.width / 2, e.height / 2), r.rotate(z.value * Math.PI / 180), r.drawImage(n, -n.naturalWidth * t / 2, -n.naturalHeight * t / 2, n.naturalWidth * t, n.naturalHeight * t));
77
+ }
78
+ let K = () => B.value = t(U.value);
79
+ S(() => [L.value, z.value], () => ee(() => I.value && G(I.value, Math.min(1, 1024 / Math.max(H.value.w, H.value.h))))), S(() => [
80
+ L.value,
81
+ z.value,
82
+ A.aspect
83
+ ], K);
84
+ let q;
85
+ S(() => [A.src, A.crossorigin], ([e, t]) => {
86
+ L.value = null, R.value = !1;
87
+ let n = new Image();
88
+ q = n, n.crossOrigin = t, n.onload = () => {
89
+ q === n && (L.value = n, N("ready"));
90
+ }, n.onerror = () => {
91
+ q === n && (R.value = !0, N("error"));
92
+ }, n.src = e;
93
+ }, { immediate: !0 }), g(() => q = void 0);
94
+ let J = (e) => z.value = (z.value + e + 360) % 360, Y = null, X = (e) => {
95
+ let t = F.value.getBoundingClientRect();
96
+ return {
97
+ x: (e.clientX - t.left) / t.width,
98
+ y: (e.clientY - t.top) / t.height
99
+ };
100
+ };
101
+ function Z(e, t) {
102
+ t.button || (t.currentTarget.setPointerCapture?.(t.pointerId), t.stopPropagation(), Y = {
103
+ h: e,
104
+ box: B.value,
105
+ ...X(t)
106
+ });
107
+ }
108
+ function Q(e) {
109
+ if (!Y) return;
110
+ let t = X(e);
111
+ B.value = Y.h ? r(Y.box, Y.h, t.x, t.y, U.value) : n(Y.box, t.x - Y.x, t.y - Y.y);
112
+ }
113
+ let $ = () => Y = null;
114
+ function se(e) {
115
+ let t = e.shiftKey ? .1 : .01, r = {
116
+ ArrowLeft: [-t, 0],
117
+ ArrowRight: [t, 0],
118
+ ArrowUp: [0, -t],
119
+ ArrowDown: [0, t]
120
+ };
121
+ if (r[e.key]) B.value = n(B.value, ...r[e.key]);
122
+ else if (e.key === "+" || e.key === "=") B.value = i(B.value, t * 2);
123
+ else if (e.key === "-" || e.key === "_") B.value = i(B.value, -t * 2);
124
+ else return;
125
+ e.preventDefault();
126
+ let a = W.value;
127
+ V.value = j.value.size(a.width, a.height, a.x, a.y);
128
+ }
129
+ let ce = o(() => U.value ? [
130
+ "nw",
131
+ "ne",
132
+ "se",
133
+ "sw"
134
+ ] : [
135
+ "nw",
136
+ "n",
137
+ "ne",
138
+ "e",
139
+ "se",
140
+ "s",
141
+ "sw",
142
+ "w"
143
+ ]), le = o(() => ({
144
+ left: `${B.value.l * 100}%`,
145
+ top: `${B.value.t * 100}%`,
146
+ width: `${(B.value.r - B.value.l) * 100}%`,
147
+ height: `${(B.value.b - B.value.t) * 100}%`
148
+ }));
149
+ function ue(e = {}) {
150
+ let t = W.value;
151
+ if (!t || !L.value) return Promise.resolve(null);
152
+ let n = document.createElement("canvas");
153
+ G(n, 1);
154
+ let r = e.maxWidth && t.width > e.maxWidth ? e.maxWidth / t.width : 1, i = document.createElement("canvas");
155
+ return i.width = Math.max(1, Math.round(t.width * r)), i.height = Math.max(1, Math.round(t.height * r)), i.getContext("2d")?.drawImage(n, t.x, t.y, t.width, t.height, 0, 0, i.width, i.height), new Promise((t) => i.toBlob(t, e.type ?? "image/png", e.quality));
156
+ }
157
+ return p({
158
+ toBlob: ue,
159
+ rotate: J,
160
+ reset: K
161
+ }), (t, n) => (_(), c("div", w, [
162
+ R.value ? (_(), c("p", T, y(j.value.loadError), 1)) : (_(), c("div", {
163
+ key: 1,
164
+ ref_key: "stage",
165
+ ref: F,
166
+ class: "bless-cropper__stage",
167
+ "aria-busy": !L.value
168
+ }, [l("canvas", {
169
+ ref_key: "canvas",
170
+ ref: I,
171
+ class: "bless-cropper__canvas",
172
+ "aria-hidden": "true"
173
+ }, null, 512), L.value ? (_(), c("div", {
174
+ key: 0,
175
+ class: "bless-cropper__frame",
176
+ tabindex: "0",
177
+ role: "group",
178
+ "aria-label": f.label,
179
+ "aria-describedby": `${b(P)}-hint`,
180
+ style: h(le.value),
181
+ onPointerdown: n[0] ||= (e) => Z(null, e),
182
+ onPointermove: Q,
183
+ onPointerup: $,
184
+ onPointercancel: $,
185
+ onKeydown: se
186
+ }, [(_(!0), c(a, null, te(ce.value, (e) => (_(), c("span", {
187
+ key: e,
188
+ class: m(["bless-cropper__handle", `bless-cropper__handle--${e}`]),
189
+ "aria-hidden": "true",
190
+ onPointerdown: (t) => Z(e, t),
191
+ onPointermove: Q,
192
+ onPointerup: $,
193
+ onPointercancel: $
194
+ }, null, 42, ie))), 128))], 44, re)) : s("", !0)], 8, E)),
195
+ L.value ? (_(), c("div", D, [l("span", {
196
+ id: `${b(P)}-hint`,
197
+ class: "bless-cropper__readout"
198
+ }, y(W.value?.width) + " × " + y(W.value?.height) + " px · " + y(j.value.hint), 9, ae), f.controls ? (_(), c("span", O, [d(e, {
199
+ size: "sm",
200
+ variant: "ghost",
201
+ "aria-label": j.value.rotateLeft,
202
+ onClick: n[1] ||= (e) => J(-90)
203
+ }, {
204
+ default: C(() => [...n[3] ||= [u("↺", -1)]]),
205
+ _: 1
206
+ }, 8, ["aria-label"]), d(e, {
207
+ size: "sm",
208
+ variant: "ghost",
209
+ "aria-label": j.value.rotateRight,
210
+ onClick: n[2] ||= (e) => J(90)
211
+ }, {
212
+ default: C(() => [...n[4] ||= [u("↻", -1)]]),
213
+ _: 1
214
+ }, 8, ["aria-label"])])) : s("", !0)])) : s("", !0),
215
+ l("span", oe, y(V.value), 1)
216
+ ]));
217
+ }
218
+ });
219
+ //#endregion
220
+ export { k as default };
@@ -12,6 +12,12 @@ declare const __VLS_export: <T extends Record<string, unknown>>(__VLS_props: Non
12
12
  searchPlaceholder?: string;
13
13
  /** accessible name of the search box */
14
14
  searchLabel?: string;
15
+ /** names of the select-page checkbox and the page-size select */
16
+ labels?: Partial<{
17
+ selectPage: string;
18
+ rowsPerPage: string;
19
+ selectRow: (name: string) => string;
20
+ }>;
15
21
  emptyText?: string;
16
22
  caption?: string;
17
23
  /** rows are one server page; sort / query / page are yours to fetch with (see `state` event) */
@@ -5,19 +5,19 @@ import r from "./BlessSelect.js";
5
5
  import i from "./BlessPagination.js";
6
6
  import ee from "./BlessDropdownMenu.js";
7
7
  import { useDataTable as a } from "../composables/useDataTable.js";
8
- import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, toDisplayString as C, toRef as w, unref as T, watch as E, withCtx as D, withModifiers as O } from "vue";
8
+ import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, toDisplayString as C, toRef as w, unref as T, watch as E, withCtx as D, withModifiers as te } from "vue";
9
9
  //#region src/components/BlessDataTable.vue?vue&type=script&setup=true&lang.ts
10
- var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__scroll" }, j = ["aria-busy"], M = {
10
+ var O = { class: "bless-datatable__toolbar" }, k = { class: "bless-datatable__scroll" }, A = ["aria-busy"], j = {
11
11
  key: 0,
12
12
  class: "bless-table__caption"
13
- }, N = { class: "bless-table__head" }, P = {
13
+ }, M = { class: "bless-table__head" }, N = {
14
14
  key: 0,
15
15
  scope: "col",
16
16
  class: "bless-table__th bless-datatable__check"
17
- }, F = ["aria-sort"], I = ["onClick"], L = {
17
+ }, P = ["aria-sort"], F = ["onClick"], I = {
18
18
  class: "bless-datatable__sort-icon",
19
19
  "aria-hidden": "true"
20
- }, R = { key: 0 }, z = ["colspan"], B = ["aria-selected", "onClick"], V = { class: "bless-datatable__foot" }, H = { class: "bless-datatable__pager" }, U = /*@__PURE__*/ m({
20
+ }, L = { key: 0 }, R = ["colspan"], z = ["aria-selected", "onClick"], B = { class: "bless-datatable__foot" }, V = { class: "bless-datatable__pager" }, H = /*@__PURE__*/ m({
21
21
  name: "BlessDataTable",
22
22
  __name: "BlessDataTable",
23
23
  props: {
@@ -35,6 +35,7 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
35
35
  searchKeys: {},
36
36
  searchPlaceholder: { default: "Search…" },
37
37
  searchLabel: { default: "Search rows" },
38
+ labels: {},
38
39
  emptyText: { default: "No rows." },
39
40
  caption: {},
40
41
  server: { type: Boolean },
@@ -46,16 +47,21 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
46
47
  "rowClick",
47
48
  "state"
48
49
  ],
49
- setup(m, { expose: U, emit: W }) {
50
- let G = m, K = W, q = s(() => G.rows), J = s(() => [.../* @__PURE__ */ new Set([G.pageSize, ...G.pageSizes])].sort((e, t) => e - t).map((e) => ({
50
+ setup(m, { expose: H, emit: U }) {
51
+ let W = m, G = s(() => ({
52
+ selectPage: "Select page",
53
+ rowsPerPage: "Rows per page",
54
+ selectRow: (e) => `Select ${e}`,
55
+ ...W.labels
56
+ })), K = U, q = s(() => W.rows), J = s(() => [.../* @__PURE__ */ new Set([W.pageSize, ...W.pageSizes])].sort((e, t) => e - t).map((e) => ({
51
57
  value: e,
52
58
  label: `${e} / page`
53
59
  }))), Y = a(q, {
54
- rowKey: G.rowKey,
55
- pageSize: G.pageSize,
56
- searchKeys: G.searchKeys,
57
- server: G.server,
58
- total: w(() => G.total ?? 0)
60
+ rowKey: W.rowKey,
61
+ pageSize: W.pageSize,
62
+ searchKeys: W.searchKeys,
63
+ server: W.server,
64
+ total: w(() => W.total ?? 0)
59
65
  }), { state: X } = Y, Z = () => ({
60
66
  sortKey: X.sortKey,
61
67
  sortDir: X.sortDir,
@@ -69,26 +75,26 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
69
75
  X.query,
70
76
  X.page,
71
77
  X.pageSize
72
- ], () => G.server && K("state", Z())), _(() => G.server && K("state", Z()));
73
- let Q = s(() => G.columns.filter((e) => !X.hidden.has(e.key))), te = s(() => [{
78
+ ], () => W.server && K("state", Z())), _(() => W.server && K("state", Z()));
79
+ let Q = s(() => W.columns.filter((e) => !X.hidden.has(e.key))), ne = s(() => [{
74
80
  type: "label",
75
81
  label: "Columns"
76
- }, ...G.columns.filter((e) => e.hideable !== !1).map((e) => ({
82
+ }, ...W.columns.filter((e) => e.hideable !== !1).map((e) => ({
77
83
  type: "checkbox",
78
84
  label: e.label,
79
85
  value: e.key
80
- }))]), ne = s(() => Object.fromEntries(G.columns.map((e) => [e.key, !X.hidden.has(e.key)]))), re = y(), $ = s(() => G.columns.find((e) => e.header)?.key), ie = (e, t) => $.value ? String(e[$.value]) : `row ${(X.page - 1) * X.pageSize + t + 1}`;
81
- function ae(e) {
86
+ }))]), re = s(() => Object.fromEntries(W.columns.map((e) => [e.key, !X.hidden.has(e.key)]))), ie = y(), $ = s(() => W.columns.find((e) => e.header)?.key), ae = (e, t) => $.value ? String(e[$.value]) : `row ${(X.page - 1) * X.pageSize + t + 1}`;
87
+ function oe(e) {
82
88
  Y.toggle(e), K("update:selected", Y.selectedRows.value);
83
89
  }
84
- function oe() {
90
+ function se() {
85
91
  Y.togglePage(), K("update:selected", Y.selectedRows.value);
86
92
  }
87
- return U({
93
+ return H({
88
94
  state: X,
89
95
  selectedRows: Y.selectedRows
90
96
  }), (a, s) => (v(), u("div", { class: h(["bless-datatable", { "bless-datatable--loading": m.loading }]) }, [
91
- d("div", k, [
97
+ d("div", O, [
92
98
  m.searchable ? (v(), c(t, {
93
99
  key: 0,
94
100
  modelValue: T(X).query,
@@ -108,8 +114,8 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
108
114
  selected: T(Y).selectedRows.value
109
115
  }),
110
116
  p(ee, {
111
- items: te.value,
112
- checked: ne.value,
117
+ items: ne.value,
118
+ checked: re.value,
113
119
  placement: "bottom-end",
114
120
  class: "bless-datatable__cols",
115
121
  onSelect: s[2] ||= (e) => e.type === "checkbox" && T(Y).toggleColumn(e.value)
@@ -121,19 +127,23 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
121
127
  _: 1
122
128
  }, 8, ["items", "checked"])
123
129
  ]),
124
- d("div", A, [d("table", {
130
+ d("div", k, [d("table", {
125
131
  class: "bless-table bless-datatable__table",
126
132
  "aria-busy": m.loading || void 0
127
133
  }, [
128
- m.caption ? (v(), u("caption", M, C(m.caption), 1)) : l("", !0),
129
- d("thead", N, [d("tr", null, [m.selectable ? (v(), u("th", P, [p(n, {
134
+ m.caption ? (v(), u("caption", j, C(m.caption), 1)) : l("", !0),
135
+ d("thead", M, [d("tr", null, [m.selectable ? (v(), u("th", N, [p(n, {
130
136
  ref_key: "selectAllRef",
131
- ref: re,
137
+ ref: ie,
132
138
  "model-value": T(Y).allPageSelected.value,
133
139
  indeterminate: !T(Y).allPageSelected.value && T(Y).somePageSelected.value,
134
- "aria-label": "Select page",
135
- "onUpdate:modelValue": oe
136
- }, null, 8, ["model-value", "indeterminate"])])) : l("", !0), (v(!0), u(o, null, b(Q.value, (e) => (v(), u("th", {
140
+ "aria-label": G.value.selectPage,
141
+ "onUpdate:modelValue": se
142
+ }, null, 8, [
143
+ "model-value",
144
+ "indeterminate",
145
+ "aria-label"
146
+ ])])) : l("", !0), (v(!0), u(o, null, b(Q.value, (e) => (v(), u("th", {
137
147
  key: e.key,
138
148
  scope: "col",
139
149
  class: h(["bless-table__th", [e.align && `bless-table__cell--${e.align}`, { "bless-datatable__th--sortable": e.sortable }]]),
@@ -144,11 +154,11 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
144
154
  type: "button",
145
155
  class: "bless-datatable__sort",
146
156
  onClick: (t) => T(Y).sortBy(e.key)
147
- }, [f(C(e.label) + " ", 1), d("span", L, C(T(X).sortKey === e.key ? T(X).sortDir === "asc" ? "↑" : "↓" : "↕"), 1)], 8, I)) : (v(), u(o, { key: 1 }, [f(C(e.label), 1)], 64))], 14, F))), 128))])]),
148
- d("tbody", null, [T(Y).pageRows.value.length ? l("", !0) : (v(), u("tr", R, [d("td", {
157
+ }, [f(C(e.label) + " ", 1), d("span", I, C(T(X).sortKey === e.key ? T(X).sortDir === "asc" ? "↑" : "↓" : "↕"), 1)], 8, F)) : (v(), u(o, { key: 1 }, [f(C(e.label), 1)], 64))], 14, P))), 128))])]),
158
+ d("tbody", null, [T(Y).pageRows.value.length ? l("", !0) : (v(), u("tr", L, [d("td", {
149
159
  colspan: Q.value.length + +!!m.selectable,
150
160
  class: "bless-table__cell bless-datatable__empty"
151
- }, C(m.emptyText), 9, z)])), (v(!0), u(o, null, b(T(Y).pageRows.value, (e, t) => (v(), u("tr", {
161
+ }, C(m.emptyText), 9, R)])), (v(!0), u(o, null, b(T(Y).pageRows.value, (e, t) => (v(), u("tr", {
152
162
  key: String(T(Y).keyOf(e)),
153
163
  class: h(["bless-table__row bless-datatable__row", { "bless-datatable__row--selected": T(X).selected.has(T(Y).keyOf(e)) }]),
154
164
  "aria-selected": m.selectable ? T(X).selected.has(T(Y).keyOf(e)) : void 0,
@@ -156,11 +166,11 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
156
166
  }, [m.selectable ? (v(), u("td", {
157
167
  key: 0,
158
168
  class: "bless-table__cell bless-datatable__check",
159
- onClick: s[3] ||= O(() => {}, ["stop"])
169
+ onClick: s[3] ||= te(() => {}, ["stop"])
160
170
  }, [p(n, {
161
171
  "model-value": T(X).selected.has(T(Y).keyOf(e)),
162
- "aria-label": `Select ${ie(e, t)}`,
163
- "onUpdate:modelValue": (t) => ae(e)
172
+ "aria-label": G.value.selectRow(ae(e, t)),
173
+ "onUpdate:modelValue": (t) => oe(e)
164
174
  }, null, 8, [
165
175
  "model-value",
166
176
  "aria-label",
@@ -181,25 +191,29 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
181
191
  "scope",
182
192
  "class",
183
193
  "data-label"
184
- ]))), 128))], 10, B))), 128))])
185
- ], 8, j)]),
186
- d("div", V, [p(e, {
194
+ ]))), 128))], 10, z))), 128))])
195
+ ], 8, A)]),
196
+ d("div", B, [p(e, {
187
197
  size: "xs",
188
198
  muted: "",
189
199
  role: "status"
190
200
  }, {
191
201
  default: D(() => [m.selectable && T(X).selected.size ? (v(), u(o, { key: 0 }, [f(C(T(X).selected.size) + " selected · ", 1)], 64)) : l("", !0), f(" " + C(T(Y).sorted.value.length) + " rows ", 1)]),
192
202
  _: 1
193
- }), d("div", H, [p(r, {
203
+ }), d("div", V, [p(r, {
194
204
  "model-value": T(X).pageSize,
195
205
  size: "sm",
196
- "aria-label": "Rows per page",
206
+ "aria-label": G.value.rowsPerPage,
197
207
  options: J.value,
198
208
  class: "bless-datatable__size",
199
209
  "onUpdate:modelValue": s[4] ||= (e) => {
200
210
  T(X).pageSize = Number(e), T(X).page = 1;
201
211
  }
202
- }, null, 8, ["model-value", "options"]), p(i, {
212
+ }, null, 8, [
213
+ "model-value",
214
+ "aria-label",
215
+ "options"
216
+ ]), p(i, {
203
217
  modelValue: T(X).page,
204
218
  "onUpdate:modelValue": s[5] ||= (e) => T(X).page = e,
205
219
  total: T(Y).pageCount.value,
@@ -209,4 +223,4 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
209
223
  }
210
224
  });
211
225
  //#endregion
212
- export { U as default };
226
+ export { H as default };
@@ -8,6 +8,13 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
8
8
  label?: string;
9
9
  /** hide the list/grid switch */
10
10
  switchable?: boolean;
11
+ /** names of the layout switch and its two buttons */
12
+ labels?: Partial<{
13
+ layout: string;
14
+ list: string;
15
+ grid: string;
16
+ empty: string;
17
+ }>;
11
18
  } & {
12
19
  layout?: "list" | "grid";
13
20
  }) & {
@@ -1,15 +1,15 @@
1
1
  import e from "./BlessToggle.js";
2
2
  import t from "./BlessToggleGroup.js";
3
3
  import n from "./BlessPagination.js";
4
- import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, renderSlot as v, useModel as y, watch as b, withCtx as x } from "vue";
4
+ import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, useModel as b, watch as x, withCtx as S } from "vue";
5
5
  //#region src/components/BlessDataView.vue?vue&type=script&setup=true&lang.ts
6
- var S = {
6
+ var C = {
7
7
  key: 0,
8
8
  class: "bless-dataview__bar"
9
- }, C = { class: "bless-dataview__header" }, w = ["aria-label"], T = {
9
+ }, w = { class: "bless-dataview__header" }, T = ["aria-label"], E = {
10
10
  key: 2,
11
11
  class: "bless-dataview__empty"
12
- }, E = /*@__PURE__*/ d({
12
+ }, D = /*@__PURE__*/ d({
13
13
  name: "BlessDataView",
14
14
  __name: "BlessDataView",
15
15
  props: /*@__PURE__*/ f({
@@ -21,66 +21,73 @@ var S = {
21
21
  switchable: {
22
22
  type: Boolean,
23
23
  default: !0
24
- }
24
+ },
25
+ labels: {}
25
26
  }, {
26
27
  layout: { default: "list" },
27
28
  layoutModifiers: {}
28
29
  }),
29
30
  emits: ["update:layout"],
30
31
  setup(d) {
31
- let f = d, E = y(d, "layout"), D = g(1), O = i(() => f.pageSize ? Math.max(1, Math.ceil(f.items.length / f.pageSize)) : 1);
32
- b(O, (e) => D.value > e && (D.value = e));
33
- let k = i(() => f.pageSize ? f.items.slice((D.value - 1) * f.pageSize, D.value * f.pageSize) : f.items);
32
+ let f = d, D = i(() => ({
33
+ layout: "Layout",
34
+ list: "List",
35
+ grid: "Grid",
36
+ empty: "No items",
37
+ ...f.labels
38
+ })), O = b(d, "layout"), k = g(1), A = i(() => f.pageSize ? Math.max(1, Math.ceil(f.items.length / f.pageSize)) : 1);
39
+ x(A, (e) => k.value > e && (k.value = e));
40
+ let j = i(() => f.pageSize ? f.items.slice((k.value - 1) * f.pageSize, k.value * f.pageSize) : f.items);
34
41
  return (i, f) => (h(), s("div", {
35
- class: p(["bless-dataview", `bless-dataview--${E.value}`]),
42
+ class: p(["bless-dataview", `bless-dataview--${O.value}`]),
36
43
  style: m({ "--_col": d.columns })
37
44
  }, [
38
- i.$slots.header || d.switchable ? (h(), s("div", S, [c("div", C, [v(i.$slots, "header", { layout: E.value })]), d.switchable ? (h(), a(t, {
45
+ i.$slots.header || d.switchable ? (h(), s("div", C, [c("div", w, [v(i.$slots, "header", { layout: O.value })]), d.switchable ? (h(), a(t, {
39
46
  key: 0,
40
- "model-value": E.value,
41
- label: "Layout",
42
- "onUpdate:modelValue": f[0] ||= (e) => E.value = e ?? "list"
47
+ "model-value": O.value,
48
+ label: D.value.layout,
49
+ "onUpdate:modelValue": f[0] ||= (e) => O.value = e ?? "list"
43
50
  }, {
44
- default: x(() => [u(e, {
51
+ default: S(() => [u(e, {
45
52
  value: "list",
46
53
  size: "sm",
47
- label: "List"
54
+ label: D.value.list
48
55
  }, {
49
- default: x(() => [...f[2] ||= [l("☰", -1)]]),
56
+ default: S(() => [...f[2] ||= [l("☰", -1)]]),
50
57
  _: 1
51
- }), u(e, {
58
+ }, 8, ["label"]), u(e, {
52
59
  value: "grid",
53
60
  size: "sm",
54
- label: "Grid"
61
+ label: D.value.grid
55
62
  }, {
56
- default: x(() => [...f[3] ||= [l("▦", -1)]]),
63
+ default: S(() => [...f[3] ||= [l("▦", -1)]]),
57
64
  _: 1
58
- })]),
65
+ }, 8, ["label"])]),
59
66
  _: 1
60
- }, 8, ["model-value"])) : o("", !0)])) : o("", !0),
61
- k.value.length ? (h(), s("div", {
67
+ }, 8, ["model-value", "label"])) : o("", !0)])) : o("", !0),
68
+ j.value.length ? (h(), s("div", {
62
69
  key: 1,
63
70
  class: "bless-dataview__items",
64
71
  role: "list",
65
72
  "aria-label": d.label
66
- }, [(h(!0), s(r, null, _(k.value, (e, t) => (h(), s("div", {
73
+ }, [(h(!0), s(r, null, _(j.value, (e, t) => (h(), s("div", {
67
74
  key: d.rowKey ? d.rowKey(e, t) : t,
68
75
  class: "bless-dataview__item",
69
76
  role: "listitem"
70
77
  }, [v(i.$slots, "default", {
71
78
  item: e,
72
- index: (D.value - 1) * d.pageSize + t,
73
- layout: E.value
74
- })]))), 128))], 8, w)) : (h(), s("div", T, [v(i.$slots, "empty", {}, () => [f[4] ||= l("No items", -1)])])),
75
- O.value > 1 ? (h(), a(n, {
79
+ index: (k.value - 1) * d.pageSize + t,
80
+ layout: O.value
81
+ })]))), 128))], 8, T)) : (h(), s("div", E, [v(i.$slots, "empty", {}, () => [l(y(D.value.empty), 1)])])),
82
+ A.value > 1 ? (h(), a(n, {
76
83
  key: 3,
77
- modelValue: D.value,
78
- "onUpdate:modelValue": f[1] ||= (e) => D.value = e,
79
- total: O.value,
84
+ modelValue: k.value,
85
+ "onUpdate:modelValue": f[1] ||= (e) => k.value = e,
86
+ total: A.value,
80
87
  class: "bless-dataview__pager"
81
88
  }, null, 8, ["modelValue", "total"])) : o("", !0)
82
89
  ], 6));
83
90
  }
84
91
  });
85
92
  //#endregion
86
- export { E as default };
93
+ export { D as default };
@@ -10,6 +10,8 @@ type __VLS_Props = {
10
10
  /** prefer native <input type=date> on coarse pointers (touch) */
11
11
  nativeOnTouch?: boolean;
12
12
  size?: "sm" | "md" | "lg";
13
+ /** accessible name of the clear button */
14
+ clearLabel?: string;
13
15
  };
14
16
  type __VLS_ModelProps = {
15
17
  modelValue?: string | [string, string] | undefined;
@@ -24,6 +26,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
24
26
  placeholder: string;
25
27
  locale: string;
26
28
  nativeOnTouch: boolean;
29
+ clearLabel: string;
27
30
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
31
  declare const _default: typeof __VLS_export;
29
32
  export default _default;