blessing-ui 0.1.0 → 0.2.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 (96) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +65 -43
  3. package/dist/blessing-ui.css +60 -0
  4. package/dist/components/BlessCodeBlock.css +1 -0
  5. package/dist/components/BlessCodeBlock.js +6 -0
  6. package/dist/components/BlessCodeBlock.vue.d.ts +62 -0
  7. package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +134 -0
  8. package/dist/components/BlessCountUp.css +1 -0
  9. package/dist/components/BlessCountUp.js +6 -0
  10. package/dist/components/BlessCountUp.vue.d.ts +18 -0
  11. package/dist/components/BlessCountUp.vue_vue_type_script_setup_true_lang.js +49 -0
  12. package/dist/components/BlessCropper.css +1 -0
  13. package/dist/components/BlessCropper.js +6 -0
  14. package/dist/components/BlessCropper.vue.d.ts +54 -0
  15. package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +212 -0
  16. package/dist/components/BlessDiff.css +1 -0
  17. package/dist/components/BlessDiff.js +6 -0
  18. package/dist/components/BlessDiff.vue.d.ts +22 -0
  19. package/dist/components/BlessDiff.vue_vue_type_script_setup_true_lang.js +148 -0
  20. package/dist/components/BlessGantt.css +1 -0
  21. package/dist/components/BlessGantt.js +6 -0
  22. package/dist/components/BlessGantt.vue.d.ts +69 -0
  23. package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +270 -0
  24. package/dist/components/BlessGauge.css +1 -0
  25. package/dist/components/BlessGauge.js +6 -0
  26. package/dist/components/BlessGauge.vue.d.ts +36 -0
  27. package/dist/components/BlessGauge.vue_vue_type_script_setup_true_lang.js +100 -0
  28. package/dist/components/BlessHeatmapCalendar.css +1 -0
  29. package/dist/components/BlessHeatmapCalendar.js +6 -0
  30. package/dist/components/BlessHeatmapCalendar.vue.d.ts +38 -0
  31. package/dist/components/BlessHeatmapCalendar.vue_vue_type_script_setup_true_lang.js +146 -0
  32. package/dist/components/BlessHotspots.css +1 -0
  33. package/dist/components/BlessHotspots.js +6 -0
  34. package/dist/components/BlessHotspots.vue.d.ts +49 -0
  35. package/dist/components/BlessHotspots.vue_vue_type_script_setup_true_lang.js +127 -0
  36. package/dist/components/BlessKanban.css +1 -0
  37. package/dist/components/BlessKanban.js +6 -0
  38. package/dist/components/BlessKanban.vue.d.ts +55 -0
  39. package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +165 -0
  40. package/dist/components/BlessLoupe.css +1 -0
  41. package/dist/components/BlessLoupe.js +6 -0
  42. package/dist/components/BlessLoupe.vue.d.ts +16 -0
  43. package/dist/components/BlessLoupe.vue_vue_type_script_setup_true_lang.js +93 -0
  44. package/dist/components/BlessMarquee.css +1 -0
  45. package/dist/components/BlessMarquee.js +6 -0
  46. package/dist/components/BlessMarquee.vue.d.ts +40 -0
  47. package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +64 -0
  48. package/dist/components/BlessMasonry.css +1 -0
  49. package/dist/components/BlessMasonry.js +6 -0
  50. package/dist/components/BlessMasonry.vue.d.ts +33 -0
  51. package/dist/components/BlessMasonry.vue_vue_type_script_setup_true_lang.js +79 -0
  52. package/dist/components/BlessMention.css +1 -0
  53. package/dist/components/BlessMention.js +6 -0
  54. package/dist/components/BlessMention.vue.d.ts +32 -0
  55. package/dist/components/BlessMention.vue_vue_type_script_setup_true_lang.js +116 -0
  56. package/dist/components/BlessRadialMenu.css +1 -0
  57. package/dist/components/BlessRadialMenu.js +6 -0
  58. package/dist/components/BlessRadialMenu.vue.d.ts +45 -0
  59. package/dist/components/BlessRadialMenu.vue_vue_type_script_setup_true_lang.js +146 -0
  60. package/dist/components/BlessShortcutRecorder.css +1 -0
  61. package/dist/components/BlessShortcutRecorder.js +6 -0
  62. package/dist/components/BlessShortcutRecorder.vue.d.ts +29 -0
  63. package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +116 -0
  64. package/dist/components/BlessSliderCaptcha.css +1 -0
  65. package/dist/components/BlessSliderCaptcha.js +6 -0
  66. package/dist/components/BlessSliderCaptcha.vue.d.ts +33 -0
  67. package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +141 -0
  68. package/dist/components/BlessSortable.css +1 -0
  69. package/dist/components/BlessSortable.js +6 -0
  70. package/dist/components/BlessSortable.vue.d.ts +33 -0
  71. package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +87 -0
  72. package/dist/components/BlessSplitView.css +1 -0
  73. package/dist/components/BlessSplitView.js +6 -0
  74. package/dist/components/BlessSplitView.vue.d.ts +61 -0
  75. package/dist/components/BlessSplitView.vue_vue_type_script_setup_true_lang.js +92 -0
  76. package/dist/components/BlessSwipeDeck.css +1 -0
  77. package/dist/components/BlessSwipeDeck.js +6 -0
  78. package/dist/components/BlessSwipeDeck.vue.d.ts +46 -0
  79. package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +199 -0
  80. package/dist/components/BlessTimer.css +1 -0
  81. package/dist/components/BlessTimer.js +6 -0
  82. package/dist/components/BlessTimer.vue.d.ts +56 -0
  83. package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +130 -0
  84. package/dist/composables/cropBox.d.ts +22 -0
  85. package/dist/composables/cropBox.js +39 -0
  86. package/dist/composables/diffLines.d.ts +10 -0
  87. package/dist/composables/diffLines.js +55 -0
  88. package/dist/composables/radial.d.ts +15 -0
  89. package/dist/composables/radial.js +22 -0
  90. package/dist/composables/shortcut.d.ts +12 -0
  91. package/dist/composables/shortcut.js +35 -0
  92. package/dist/composables/useSortable.d.ts +18 -0
  93. package/dist/composables/useSortable.js +34 -0
  94. package/dist/index.d.ts +37 -0
  95. package/dist/index.js +78 -53
  96. package/package.json +20 -18
@@ -0,0 +1,38 @@
1
+ type __VLS_Props = {
2
+ /** counts by ISO date: `{ "2026-09-27": 4 }`; missing days are 0 */
3
+ data?: Record<string, number>;
4
+ /** last day shown, ISO; defaults to today */
5
+ end?: string;
6
+ weeks?: number;
7
+ /** first row of each column: 0 Sunday, 1 Monday */
8
+ weekStart?: 0 | 1;
9
+ /** intensity steps above zero */
10
+ levels?: number;
11
+ /** the count that fills the darkest step; defaults to the largest value in `data` */
12
+ max?: number;
13
+ locale?: string;
14
+ /** what is counted, singular: "contribution" */
15
+ unit?: string;
16
+ legend?: boolean;
17
+ label?: string;
18
+ };
19
+ type __VLS_ModelProps = {
20
+ /** the picked day */
21
+ modelValue?: string | null;
22
+ };
23
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
24
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
25
+ "update:modelValue": (value: string | null) => any;
26
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
+ "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
28
+ }>, {
29
+ label: string;
30
+ data: Record<string, number>;
31
+ legend: boolean;
32
+ weekStart: 0 | 1;
33
+ unit: string;
34
+ weeks: number;
35
+ levels: number;
36
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
@@ -0,0 +1,146 @@
1
+ import { logicalKey as e } from "../composables/rtl.js";
2
+ import { addDays as t, fromISO as n, isoToday as r, toISO as i } from "../composables/date.js";
3
+ import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, mergeModels as f, nextTick as p, normalizeClass as m, normalizeStyle as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, useModel as b } from "vue";
4
+ //#region src/components/BlessHeatmapCalendar.vue?vue&type=script&setup=true&lang.ts
5
+ var x = ["aria-label"], S = { class: "bless-heat__scroll" }, C = [
6
+ "data-date",
7
+ "data-level",
8
+ "tabindex",
9
+ "aria-label",
10
+ "aria-pressed",
11
+ "onClick",
12
+ "onKeydown",
13
+ "onFocus",
14
+ "onMouseenter"
15
+ ], w = { class: "bless-heat__foot" }, T = {
16
+ class: "bless-heat__readout",
17
+ "aria-live": "polite"
18
+ }, E = {
19
+ key: 0,
20
+ class: "bless-heat__legend",
21
+ "aria-hidden": "true"
22
+ }, D = /*@__PURE__*/ d({
23
+ name: "BlessHeatmapCalendar",
24
+ __name: "BlessHeatmapCalendar",
25
+ props: /*@__PURE__*/ f({
26
+ data: { default: () => ({}) },
27
+ end: {},
28
+ weeks: { default: 53 },
29
+ weekStart: { default: 1 },
30
+ levels: { default: 4 },
31
+ max: {},
32
+ locale: {},
33
+ unit: { default: "contribution" },
34
+ legend: {
35
+ type: Boolean,
36
+ default: !0
37
+ },
38
+ label: { default: "Activity" }
39
+ }, {
40
+ modelValue: { default: null },
41
+ modelModifiers: {}
42
+ }),
43
+ emits: ["update:modelValue"],
44
+ setup(d) {
45
+ let f = d, D = b(d, "modelValue"), O = o(() => n(f.end ?? r())), k = o(() => {
46
+ let e = (O.value.getDay() - f.weekStart + 7) % 7;
47
+ return t(O.value, -e - (f.weeks - 1) * 7);
48
+ }), A = o(() => f.max ?? Math.max(1, ...Object.values(f.data))), j = o(() => new Intl.DateTimeFormat(f.locale, {
49
+ weekday: "short",
50
+ year: "numeric",
51
+ month: "short",
52
+ day: "numeric"
53
+ })), M = o(() => new Intl.DateTimeFormat(f.locale, { month: "short" })), N = (e) => `${e} ${f.unit}${e === 1 ? "" : "s"}`, P = o(() => {
54
+ let e = [];
55
+ for (let n = 0; n < f.weeks * 7; n++) {
56
+ let r = t(k.value, n), a = i(r), o = f.data[a] ?? 0;
57
+ e.push({
58
+ iso: a,
59
+ v: o,
60
+ level: o > 0 ? Math.min(f.levels, Math.max(1, Math.ceil(o / A.value * f.levels))) : 0,
61
+ text: `${N(o)} on ${j.value.format(r)}`,
62
+ shown: r <= O.value
63
+ });
64
+ }
65
+ return e;
66
+ }), F = o(() => P.value.reduce((e, t) => e + (t.shown ? t.v : 0), 0)), I = o(() => Array.from({ length: f.weeks }, (e, n) => {
67
+ let r = t(k.value, n * 7), i = t(r, -7);
68
+ return n === 0 || r.getMonth() !== i.getMonth() ? M.value.format(r) : "";
69
+ })), L = o(() => Array.from({ length: 7 }, (e, n) => n % 2 ? new Intl.DateTimeFormat(f.locale, { weekday: "short" }).format(t(k.value, n)) : "")), R = _(""), z = _(), B = o(() => i(O.value)), V = _(null), H = o(() => D.value ?? V.value ?? B.value), U = o(() => i(k.value));
70
+ function W(e) {
71
+ e < U.value || e > B.value || (V.value = e, p(() => z.value?.querySelector(`[data-date="${e}"]`)?.focus()));
72
+ }
73
+ function G(r, a) {
74
+ let o = e(a), s = n(r), c = {
75
+ ArrowUp: -1,
76
+ ArrowDown: 1,
77
+ ArrowLeft: -7,
78
+ ArrowRight: 7
79
+ };
80
+ o in c ? (a.preventDefault(), W(i(t(s, c[o])))) : o === "Home" ? (a.preventDefault(), W(U.value)) : o === "End" && (a.preventDefault(), W(B.value));
81
+ }
82
+ return (e, t) => (g(), c("div", {
83
+ ref_key: "root",
84
+ ref: z,
85
+ class: "bless-heat",
86
+ role: "group",
87
+ "aria-label": d.label
88
+ }, [l("div", S, [l("div", {
89
+ class: "bless-heat__grid",
90
+ style: h({
91
+ "--bless-heat-weeks": d.weeks,
92
+ "--bless-heat-levels": d.levels
93
+ })
94
+ }, [
95
+ (g(!0), c(a, null, v(I.value, (e, t) => (g(), c("span", {
96
+ key: `m${t}`,
97
+ class: "bless-heat__month",
98
+ "aria-hidden": "true",
99
+ style: h({
100
+ gridColumn: t + 2,
101
+ gridRow: 1
102
+ })
103
+ }, y(e), 5))), 128)),
104
+ (g(!0), c(a, null, v(L.value, (e, t) => (g(), c("span", {
105
+ key: `d${t}`,
106
+ class: "bless-heat__weekday",
107
+ "aria-hidden": "true",
108
+ style: h({
109
+ gridColumn: 1,
110
+ gridRow: t + 2
111
+ })
112
+ }, y(e), 5))), 128)),
113
+ (g(!0), c(a, null, v(P.value, (e, n) => (g(), c(a, { key: e.iso }, [e.shown ? (g(), c("button", {
114
+ key: 0,
115
+ type: "button",
116
+ class: m(["bless-heat__cell", { "bless-heat__cell--on": D.value === e.iso }]),
117
+ style: h({
118
+ gridColumn: Math.floor(n / 7) + 2,
119
+ gridRow: n % 7 + 2,
120
+ "--bless-heat-l": e.level / d.levels
121
+ }),
122
+ "data-date": e.iso,
123
+ "data-level": e.level,
124
+ tabindex: H.value === e.iso ? 0 : -1,
125
+ "aria-label": e.text,
126
+ "aria-pressed": D.value === e.iso,
127
+ onClick: (t) => D.value = D.value === e.iso ? null : e.iso,
128
+ onKeydown: (t) => G(e.iso, t),
129
+ onFocus: (t) => (V.value = e.iso, R.value = e.text),
130
+ onMouseenter: (t) => R.value = e.text,
131
+ onMouseleave: t[0] ||= (e) => R.value = "",
132
+ onBlur: t[1] ||= (e) => R.value = ""
133
+ }, null, 46, C)) : s("", !0)], 64))), 128))
134
+ ], 4)]), l("div", w, [l("span", T, y(R.value || `${N(F.value)} in ${d.weeks} weeks`), 1), d.legend ? (g(), c("span", E, [
135
+ t[2] ||= u(" Less ", -1),
136
+ (g(!0), c(a, null, v(d.levels + 1, (e) => (g(), c("i", {
137
+ key: e,
138
+ class: "bless-heat__cell bless-heat__swatch",
139
+ style: h({ "--bless-heat-l": (e - 1) / d.levels })
140
+ }, null, 4))), 128)),
141
+ t[3] ||= u(" More ", -1)
142
+ ])) : s("", !0)])], 8, x));
143
+ }
144
+ });
145
+ //#endregion
146
+ export { D as default };
@@ -0,0 +1 @@
1
+ .bless-hotspots{line-height:0;display:block;position:relative}.bless-hotspots--edit{cursor:crosshair}.bless-hotspots__img{width:100%;height:auto;display:block}.bless-hotspots__spot{line-height:normal;position:absolute;transform:translate(-50%,-50%)}.bless-hotspots__pin{box-sizing:border-box;min-width:24px;height:24px;padding:0 var(--bless-space-1);border:2px solid var(--bless-color-bg);background:var(--bless-color-text);color:var(--bless-color-on-text);font:inherit;font-size:var(--bless-text-xs);cursor:pointer;touch-action:none;font-weight:600}.bless-hotspots--edit .bless-hotspots__pin{cursor:grab}.bless-hotspots__pin--on{background:var(--bless-color-accent);color:var(--bless-color-on-accent)}.bless-hotspots__pin:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}
@@ -0,0 +1,6 @@
1
+ import "./BlessHotspots.css";
2
+ import e from "./BlessHotspots.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessHotspots.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,49 @@
1
+ export interface BlessHotspot {
2
+ id: string | number;
3
+ /** position in percent of the stage, 0 to 100 */
4
+ x: number;
5
+ y: number;
6
+ /** names the pin for screen readers, and is the popover's text without a `#spot` slot */
7
+ label: string;
8
+ }
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
11
+ declare const __VLS_export: <S extends BlessHotspot = BlessHotspot>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
12
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<({
13
+ /** an image to pin onto; leave out and use the default slot for a diagram or anything else */
14
+ src?: string;
15
+ alt?: string;
16
+ /** click the stage to add a pin, drag to move one, Delete to remove it, arrows to nudge it */
17
+ editable?: boolean;
18
+ placement?: "top" | "bottom" | "left" | "right";
19
+ } & {
20
+ modelValue?: S[];
21
+ /** id of the pin whose popover is open */
22
+ active?: S["id"] | null;
23
+ }) & {
24
+ onAdd?: ((spot: S) => any) | undefined;
25
+ "onUpdate:modelValue"?: ((value: S[]) => any) | undefined;
26
+ onRemove?: ((spot: S) => any) | undefined;
27
+ "onUpdate:active"?: ((value: S["id"] | null) => any) | undefined;
28
+ }> & (typeof globalThis extends {
29
+ __VLS_PROPS_FALLBACK: infer P;
30
+ } ? P : {});
31
+ expose: (exposed: {}) => void;
32
+ attrs: any;
33
+ slots: {
34
+ default?: (props: {}) => any;
35
+ } & {
36
+ spot?: (props: {
37
+ spot: S;
38
+ index: number;
39
+ }) => any;
40
+ };
41
+ emit: (((evt: "add", spot: S) => void) & ((evt: "remove", spot: S) => void)) & (((event: "update:modelValue", value: S[]) => void) & ((event: "update:active", value: S["id"] | null) => void));
42
+ }>) => import('vue').VNode & {
43
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
44
+ };
45
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
46
+ [K in keyof T]: T[K];
47
+ } : {
48
+ [K in keyof T as K]: T[K];
49
+ }) & {};
@@ -0,0 +1,127 @@
1
+ import e from "./BlessPopover.js";
2
+ import { Fragment as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, mergeModels as c, normalizeClass as l, normalizeStyle as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, useModel as g, withCtx as _ } from "vue";
3
+ //#region src/components/BlessHotspots.vue?vue&type=script&setup=true&lang.ts
4
+ var v = ["src", "alt"], y = [
5
+ "aria-label",
6
+ "aria-keyshortcuts",
7
+ "onPointerdown",
8
+ "onKeydown"
9
+ ], b = /*@__PURE__*/ s({
10
+ name: "BlessHotspots",
11
+ __name: "BlessHotspots",
12
+ props: /*@__PURE__*/ c({
13
+ src: {},
14
+ alt: { default: "" },
15
+ editable: { type: Boolean },
16
+ placement: { default: "top" }
17
+ }, {
18
+ modelValue: { default: () => [] },
19
+ modelModifiers: {},
20
+ active: { default: null },
21
+ activeModifiers: {}
22
+ }),
23
+ emits: /*@__PURE__*/ c(["add", "remove"], ["update:modelValue", "update:active"]),
24
+ setup(s, { emit: c }) {
25
+ let b = s, x = g(s, "modelValue"), S = g(s, "active"), C = c, w = f(), T = (e) => Math.min(100, Math.max(0, e)), E = (e) => {
26
+ let t = w.value.getBoundingClientRect();
27
+ return {
28
+ x: T((e.clientX - t.left) / t.width * 100),
29
+ y: T((e.clientY - t.top) / t.height * 100)
30
+ };
31
+ }, D = (e, t) => {
32
+ let n = x.value.slice();
33
+ n[e] = {
34
+ ...n[e],
35
+ ...t
36
+ }, x.value = n;
37
+ }, O = 0;
38
+ function k(e) {
39
+ if (!b.editable || e.target.closest(".bless-hotspots__spot")) return;
40
+ let t = {
41
+ id: `spot-${Date.now()}-${O++}`,
42
+ ...E(e),
43
+ label: `Spot ${x.value.length + 1}`
44
+ };
45
+ x.value = [...x.value, t], S.value = t.id, C("add", t);
46
+ }
47
+ let A = null, j = !1;
48
+ function M(e, t) {
49
+ b.editable && !t.button && (t.currentTarget.setPointerCapture?.(t.pointerId), A = {
50
+ i: e,
51
+ x: t.clientX,
52
+ y: t.clientY,
53
+ moved: !1
54
+ });
55
+ }
56
+ function N(e) {
57
+ A && (!A.moved && Math.hypot(e.clientX - A.x, e.clientY - A.y) < 4 || (A.moved = !0, D(A.i, E(e))));
58
+ }
59
+ function P() {
60
+ j = !!A?.moved, A = null;
61
+ }
62
+ function F(e) {
63
+ j && (j = !1, e.stopPropagation());
64
+ }
65
+ function I(e, t) {
66
+ if (!b.editable) return;
67
+ let n = t.shiftKey ? 5 : 1, r = {
68
+ ArrowLeft: [-n, 0],
69
+ ArrowRight: [n, 0],
70
+ ArrowUp: [0, -n],
71
+ ArrowDown: [0, n]
72
+ }, i = x.value[e];
73
+ r[t.key] ? (t.preventDefault(), D(e, {
74
+ x: T(i.x + r[t.key][0]),
75
+ y: T(i.y + r[t.key][1])
76
+ })) : (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), x.value = x.value.filter((t, n) => n !== e), S.value === i.id && (S.value = null), C("remove", i));
77
+ }
78
+ return (c, f) => (d(), r("div", {
79
+ ref_key: "stage",
80
+ ref: w,
81
+ class: l(["bless-hotspots", { "bless-hotspots--edit": s.editable }]),
82
+ onClick: k
83
+ }, [m(c.$slots, "default", {}, () => [s.src ? (d(), r("img", {
84
+ key: 0,
85
+ src: s.src,
86
+ alt: s.alt,
87
+ class: "bless-hotspots__img",
88
+ draggable: "false"
89
+ }, null, 8, v)) : n("", !0)]), (d(!0), r(t, null, p(x.value, (t, n) => (d(), r("span", {
90
+ key: t.id,
91
+ class: "bless-hotspots__spot",
92
+ style: u({
93
+ left: `${t.x}%`,
94
+ top: `${t.y}%`
95
+ }),
96
+ onClickCapture: F
97
+ }, [o(e, {
98
+ arrow: "",
99
+ placement: s.placement,
100
+ open: S.value === t.id,
101
+ "onUpdate:open": (e) => S.value = e ? t.id : S.value === t.id ? null : S.value
102
+ }, {
103
+ trigger: _(() => [i("button", {
104
+ type: "button",
105
+ class: l(["bless-hotspots__pin", { "bless-hotspots__pin--on": S.value === t.id }]),
106
+ "aria-label": t.label,
107
+ "aria-keyshortcuts": s.editable ? "Delete" : void 0,
108
+ onPointerdown: (e) => M(n, e),
109
+ onPointermove: N,
110
+ onPointerup: P,
111
+ onPointercancel: P,
112
+ onKeydown: (e) => I(n, e)
113
+ }, h(n + 1), 43, y)]),
114
+ default: _(() => [m(c.$slots, "spot", {
115
+ spot: t,
116
+ index: n
117
+ }, () => [a(h(t.label), 1)])]),
118
+ _: 2
119
+ }, 1032, [
120
+ "placement",
121
+ "open",
122
+ "onUpdate:open"
123
+ ])], 36))), 128))], 2));
124
+ }
125
+ });
126
+ //#endregion
127
+ export { b as default };
@@ -0,0 +1 @@
1
+ .bless-kanban{gap:var(--bless-space-3);font-family:var(--bless-font-sans);font-size:var(--bless-text-sm);color:var(--bless-color-text);grid-auto-columns:minmax(220px,1fr);grid-auto-flow:column;align-items:start;display:grid;position:relative;overflow-x:auto}.bless-kanban__col{min-width:0;padding:var(--bless-space-2);background:var(--bless-color-surface);border:var(--bless-border-width) solid var(--bless-color-border)}.bless-kanban__head{justify-content:space-between;align-items:baseline;gap:var(--bless-space-2);padding:var(--bless-space-1) var(--bless-space-1) var(--bless-space-2);display:flex}.bless-kanban__title{font-size:var(--bless-text-sm);margin:0;font-weight:600}.bless-kanban__count{color:var(--bless-color-text-muted);font-size:var(--bless-text-xs)}.bless-kanban__col--full .bless-kanban__count{color:var(--bless-color-danger-text)}.bless-kanban__list{gap:var(--bless-space-2);padding:0 0 var(--bless-space-3);min-height:2rem;margin:0;list-style:none;display:grid}.bless-kanban__list--end{box-shadow:inset 0 -2px 0 var(--bless-color-accent)}.bless-kanban__card{align-items:flex-start;gap:var(--bless-space-2);padding:var(--bless-space-2);background:var(--bless-color-bg);border:var(--bless-border-width) solid var(--bless-color-border);display:flex}.bless-kanban__card--drag{opacity:.4}.bless-kanban__card--held{border-color:var(--bless-color-accent)}.bless-kanban__card--before{box-shadow:0 -5px 0 -3px var(--bless-color-accent);border-top-color:var(--bless-color-accent)}.bless-kanban__grip{padding:0 var(--bless-space-1);color:var(--bless-color-text-muted);font:inherit;letter-spacing:-3px;cursor:grab;touch-action:none;background:0 0;border:0;flex:none}.bless-kanban__grip:active{cursor:grabbing}.bless-kanban__grip:focus-visible{outline:2px solid var(--bless-color-accent)}.bless-kanban__body{flex:1;min-width:0}.bless-kanban__live{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}
@@ -0,0 +1,6 @@
1
+ import "./BlessKanban.css";
2
+ import e from "./BlessKanban.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessKanban.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,55 @@
1
+ export interface BlessKanbanColumn<T = unknown> {
2
+ id: string;
3
+ title: string;
4
+ items: T[];
5
+ /** most cards the column takes; a full column refuses drops */
6
+ limit?: number;
7
+ }
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
10
+ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
11
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<({
12
+ rowKey?: (item: T) => string | number;
13
+ label?: string;
14
+ } & {
15
+ modelValue?: BlessKanbanColumn<T>[];
16
+ }) & {
17
+ "onUpdate:modelValue"?: ((value: BlessKanbanColumn<T>[]) => any) | undefined;
18
+ onMove?: ((item: T, from: {
19
+ column: string;
20
+ index: number;
21
+ }, to: {
22
+ column: string;
23
+ index: number;
24
+ }) => any) | undefined;
25
+ }> & (typeof globalThis extends {
26
+ __VLS_PROPS_FALLBACK: infer P;
27
+ } ? P : {});
28
+ expose: (exposed: {}) => void;
29
+ attrs: any;
30
+ slots: {
31
+ header?: (props: {
32
+ column: BlessKanbanColumn<T>;
33
+ }) => any;
34
+ } & {
35
+ card?: (props: {
36
+ item: T;
37
+ column: BlessKanbanColumn<T>;
38
+ index: number;
39
+ }) => any;
40
+ };
41
+ emit: ((evt: "move", item: T, from: {
42
+ column: string;
43
+ index: number;
44
+ }, to: {
45
+ column: string;
46
+ index: number;
47
+ }) => void) & ((event: "update:modelValue", value: BlessKanbanColumn<T>[]) => void);
48
+ }>) => import('vue').VNode & {
49
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
50
+ };
51
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
52
+ [K in keyof T]: T[K];
53
+ } : {
54
+ [K in keyof T as K]: T[K];
55
+ }) & {};
@@ -0,0 +1,165 @@
1
+ import { logicalKey as e } from "../composables/rtl.js";
2
+ import { Fragment as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, mergeModels as s, nextTick as c, normalizeClass as l, openBlock as u, ref as d, renderList as f, renderSlot as p, toDisplayString as m, useId as h, useModel as g } from "vue";
3
+ //#region src/components/BlessKanban.vue?vue&type=script&setup=true&lang.ts
4
+ var _ = ["aria-label"], v = ["data-kanban-col", "aria-label"], y = { class: "bless-kanban__head" }, b = { class: "bless-kanban__title" }, x = { class: "bless-kanban__count" }, S = [
5
+ "data-grip",
6
+ "aria-label",
7
+ "aria-pressed",
8
+ "onPointerdown",
9
+ "onKeydown"
10
+ ], C = { class: "bless-kanban__body" }, w = {
11
+ class: "bless-kanban__live",
12
+ "aria-live": "polite"
13
+ }, T = /*@__PURE__*/ o({
14
+ name: "BlessKanban",
15
+ __name: "BlessKanban",
16
+ props: /*@__PURE__*/ s({
17
+ rowKey: { type: Function },
18
+ label: {}
19
+ }, {
20
+ modelValue: { default: () => [] },
21
+ modelModifiers: {}
22
+ }),
23
+ emits: /*@__PURE__*/ s(["move"], ["update:modelValue"]),
24
+ setup(o, { emit: s }) {
25
+ let T = g(o, "modelValue"), E = s, D = d(), O = d(""), k = `${h()}-hint`, A = d(null), j = d(null), M = d(null), N = [], P = {
26
+ col: 0,
27
+ index: 0
28
+ }, F = (e, t) => {
29
+ let n = T.value[e];
30
+ return e !== t && n.limit != null && n.items.length >= n.limit;
31
+ };
32
+ function I(e, t, n, r) {
33
+ let i = T.value.map((e) => ({
34
+ ...e,
35
+ items: e.items.slice()
36
+ })), [a] = i[e].items.splice(t, 1);
37
+ i[n].items.splice(r, 0, a), T.value = i, E("move", a, {
38
+ column: T.value[e].id,
39
+ index: t
40
+ }, {
41
+ column: T.value[n].id,
42
+ index: r
43
+ });
44
+ }
45
+ function L(e, t) {
46
+ for (let n of document.elementsFromPoint(e, t)) {
47
+ let e = n.closest?.("[data-kanban-col]");
48
+ if (e && D.value?.contains(e)) return e;
49
+ }
50
+ return null;
51
+ }
52
+ function R(e) {
53
+ if (!A.value) return;
54
+ let t = L(e.clientX, e.clientY);
55
+ if (!t) return void (j.value = null);
56
+ let n = Number(t.dataset.kanbanCol);
57
+ if (F(n, A.value.col)) return void (j.value = null);
58
+ let r = Array.from(t.querySelectorAll("[data-kanban-card]")).filter((t) => {
59
+ let n = t.getBoundingClientRect();
60
+ return n.top + n.height / 2 < e.clientY;
61
+ }).length;
62
+ j.value = {
63
+ col: n,
64
+ index: r
65
+ };
66
+ }
67
+ function z(e, t, n) {
68
+ n.button || (n.currentTarget.setPointerCapture?.(n.pointerId), A.value = {
69
+ col: e,
70
+ index: t
71
+ }, j.value = {
72
+ col: e,
73
+ index: t
74
+ });
75
+ }
76
+ function B() {
77
+ let e = A.value, t = j.value;
78
+ if (A.value = j.value = null, !e || !t) return;
79
+ let n = t.col === e.col && t.index > e.index ? t.index - 1 : t.index;
80
+ (t.col !== e.col || n !== e.index) && (I(e.col, e.index, t.col, n), O.value = `Moved to ${T.value[t.col].title}, position ${n + 1} of ${T.value[t.col].items.length}`);
81
+ }
82
+ let V = () => A.value = j.value = null, H = (e, t) => c(() => D.value?.querySelector(`[data-grip="${e}:${t}"]`)?.focus());
83
+ function U(e, t, n, r) {
84
+ let i = T.value.length;
85
+ if (n < 0 || n >= i) return;
86
+ if (F(n, e)) {
87
+ O.value = `${T.value[n].title} is full`;
88
+ return;
89
+ }
90
+ let a = T.value[n].items.length - +(n === e);
91
+ r = Math.min(Math.max(r, 0), a), (n !== e || r !== t) && (I(e, t, n, r), M.value = {
92
+ col: n,
93
+ index: r
94
+ }, O.value = `${T.value[n].title}, position ${r + 1} of ${T.value[n].items.length}`, H(n, r));
95
+ }
96
+ function W(t, n, r) {
97
+ let i = e(r), a = M.value;
98
+ r.key === " " || r.key === "Enter" ? (r.preventDefault(), a ? (M.value = null, O.value = `Dropped in ${T.value[t].title}, position ${n + 1}`) : (M.value = {
99
+ col: t,
100
+ index: n
101
+ }, P = {
102
+ col: t,
103
+ index: n
104
+ }, N = T.value.map((e) => ({
105
+ ...e,
106
+ items: e.items.slice()
107
+ })), O.value = "Grabbed. Up and down move it in the column, left and right to another column, Space drops it, Escape cancels.")) : r.key === "Escape" && a ? (r.preventDefault(), T.value = N, M.value = null, O.value = "Cancelled, order restored", H(P.col, P.index)) : a && (i === "ArrowUp" ? (r.preventDefault(), U(t, n, t, n - 1)) : i === "ArrowDown" ? (r.preventDefault(), U(t, n, t, n + 1)) : i === "ArrowLeft" ? (r.preventDefault(), U(t, n, t - 1, n)) : i === "ArrowRight" && (r.preventDefault(), U(t, n, t + 1, n)));
108
+ }
109
+ let G = () => requestAnimationFrame(() => {
110
+ M.value && !D.value?.contains(document.activeElement) && (M.value = null);
111
+ }), K = (e, t) => {
112
+ let n = j.value;
113
+ return !n || n.col !== e || !A.value ? null : n.index === t ? "before" : null;
114
+ }, q = (e) => j.value?.col === e && A.value && j.value.index >= T.value[e].items.length;
115
+ return (e, s) => (u(), r("div", {
116
+ ref_key: "root",
117
+ ref: D,
118
+ class: "bless-kanban",
119
+ role: "group",
120
+ "aria-label": o.label ?? "Board"
121
+ }, [
122
+ (u(!0), r(t, null, f(T.value, (c, d) => (u(), r("section", {
123
+ key: c.id,
124
+ class: l(["bless-kanban__col", { "bless-kanban__col--full": c.limit != null && c.items.length >= c.limit }]),
125
+ "data-kanban-col": d,
126
+ "aria-label": c.title
127
+ }, [i("header", y, [p(e.$slots, "header", { column: c }, () => [i("h3", b, m(c.title), 1)]), i("span", x, [a(m(c.items.length), 1), c.limit == null ? n("", !0) : (u(), r(t, { key: 0 }, [a(" / " + m(c.limit), 1)], 64))])]), i("ul", {
128
+ class: l(["bless-kanban__list", { "bless-kanban__list--end": q(d) }]),
129
+ role: "list"
130
+ }, [(u(!0), r(t, null, f(c.items, (t, n) => (u(), r("li", {
131
+ key: o.rowKey ? o.rowKey(t) : n,
132
+ "data-kanban-card": "",
133
+ class: l(["bless-kanban__card", [{
134
+ "bless-kanban__card--drag": A.value?.col === d && A.value.index === n,
135
+ "bless-kanban__card--held": M.value?.col === d && M.value.index === n
136
+ }, K(d, n) && `bless-kanban__card--${K(d, n)}`]])
137
+ }, [i("button", {
138
+ type: "button",
139
+ class: "bless-kanban__grip",
140
+ "data-grip": `${d}:${n}`,
141
+ "aria-label": `Move card ${n + 1} of ${c.title}`,
142
+ "aria-roledescription": "sortable card",
143
+ "aria-pressed": M.value?.col === d && M.value.index === n,
144
+ "aria-describedby": k,
145
+ onPointerdown: (e) => z(d, n, e),
146
+ onPointermove: R,
147
+ onPointerup: B,
148
+ onPointercancel: V,
149
+ onKeydown: (e) => W(d, n, e),
150
+ onBlur: G
151
+ }, [...s[0] ||= [i("span", { "aria-hidden": "true" }, "⋮⋮", -1)]], 40, S), i("div", C, [p(e.$slots, "card", {
152
+ item: t,
153
+ column: c,
154
+ index: n
155
+ }, () => [a(m(t), 1)])])], 2))), 128))], 2)], 10, v))), 128)),
156
+ i("span", {
157
+ id: k,
158
+ hidden: ""
159
+ }, "Press Space to grab a card. Up and down move it in its column, left and right to another column. Space drops it, Escape cancels."),
160
+ i("span", w, m(O.value), 1)
161
+ ], 8, _));
162
+ }
163
+ });
164
+ //#endregion
165
+ export { T as default };
@@ -0,0 +1 @@
1
+ .bless-loupe{cursor:zoom-in;touch-action:pan-y pinch-zoom;-webkit-user-select:none;user-select:none;max-width:100%;line-height:0;display:inline-block;position:relative}.bless-loupe:focus-visible{outline:2px solid var(--bless-color-accent);outline-offset:2px}.bless-loupe__img{max-width:100%;height:auto;display:block}.bless-loupe__lens{z-index:1;pointer-events:none;background-repeat:no-repeat;background-color:var(--bless-color-surface);border:2px solid var(--bless-color-bg);outline:1px solid var(--bless-color-text);box-shadow:var(--bless-shadow-plate);position:absolute}
@@ -0,0 +1,6 @@
1
+ import "./BlessLoupe.css";
2
+ import e from "./BlessLoupe.vue_vue_type_script_setup_true_lang.js";
3
+ //#region src/components/BlessLoupe.vue
4
+ var t = e;
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ src: string;
3
+ alt: string;
4
+ /** a larger version of the same picture for the lens; defaults to `src` */
5
+ zoomSrc?: string;
6
+ /** magnification */
7
+ zoom?: number;
8
+ /** side of the square lens, in px */
9
+ size?: number;
10
+ };
11
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ size: number;
13
+ zoom: number;
14
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;