bitboss-ui 2.0.162 → 2.0.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BbPagination/BbPagination.vue.d.ts +19 -7
- package/dist/index100.js +9 -9
- package/dist/index111.js +12 -12
- package/dist/index119.js +2 -2
- package/dist/index121.js +5 -5
- package/dist/index123.js +1 -1
- package/dist/index125.js +1 -1
- package/dist/index127.js +1 -1
- package/dist/index128.js +1 -1
- package/dist/index129.js +1 -1
- package/dist/index13.js +1 -1
- package/dist/index131.js +1 -1
- package/dist/index132.js +2 -2
- package/dist/index133.js +1 -1
- package/dist/index134.js +2 -2
- package/dist/index15.js +8 -8
- package/dist/index17.js +3 -3
- package/dist/index19.js +8 -8
- package/dist/index206.js +2 -115
- package/dist/index207.js +4 -2
- package/dist/index208.js +41 -2
- package/dist/index209.js +19 -85
- package/dist/index21.js +16 -16
- package/dist/index210.js +96 -0
- package/dist/index212.js +199 -16
- package/dist/index214.js +66 -15
- package/dist/index216.js +13 -12
- package/dist/index217.js +13 -16
- package/dist/index218.js +3 -4
- package/dist/index219.js +6 -41
- package/dist/index220.js +7 -20
- package/dist/index221.js +11 -90
- package/dist/index222.js +88 -0
- package/dist/{index211.js → index224.js} +1 -1
- package/dist/index225.js +17 -66
- package/dist/{index213.js → index226.js} +4 -4
- package/dist/index227.js +15 -13
- package/dist/index228.js +3 -13
- package/dist/index229.js +12 -3
- package/dist/index23.js +17 -17
- package/dist/index230.js +16 -5
- package/dist/index231.js +2 -16
- package/dist/index232.js +4 -16
- package/dist/index233.js +2 -19
- package/dist/index234.js +5 -15
- package/dist/index235.js +13 -16
- package/dist/index236.js +13 -24
- package/dist/index237.js +19 -2
- package/dist/index238.js +15 -8
- package/dist/index239.js +17 -248
- package/dist/index240.js +26 -51
- package/dist/index241.js +2 -44
- package/dist/index242.js +8 -5
- package/dist/index243.js +243 -53
- package/dist/index244.js +52 -2
- package/dist/index245.js +44 -4
- package/dist/index246.js +5 -2
- package/dist/index247.js +59 -124
- package/dist/index248.js +34 -2
- package/dist/index249.js +2 -6
- package/dist/index25.js +5 -5
- package/dist/index250.js +125 -2
- package/dist/index251.js +2 -9
- package/dist/index252.js +2 -34
- package/dist/index253.js +9 -7
- package/dist/index254.js +114 -14
- package/dist/index255.js +2 -106
- package/dist/index256.js +4 -0
- package/dist/index257.js +17 -99
- package/dist/{index262.js → index258.js} +2 -2
- package/dist/index259.js +106 -2
- package/dist/index261.js +99 -17
- package/dist/index264.js +3 -3
- package/dist/index265.js +3 -3
- package/dist/index269.js +6 -9
- package/dist/index27.js +1 -1
- package/dist/index270.js +16 -23
- package/dist/index271.js +9 -3
- package/dist/index272.js +23 -6
- package/dist/index273.js +3 -16
- package/dist/index274.js +224 -3
- package/dist/index275.js +429 -15
- package/dist/index276.js +3 -9
- package/dist/index277.js +3 -28
- package/dist/index278.js +3 -431
- package/dist/index280.js +7 -3
- package/dist/index281.js +7 -3
- package/dist/index282.js +13 -0
- package/dist/index283.js +2 -7
- package/dist/index284.js +199 -6
- package/dist/index285.js +3 -11
- package/dist/index286.js +17 -224
- package/dist/index287.js +9 -281
- package/dist/index288.js +27 -5
- package/dist/index289.js +4 -2
- package/dist/index29.js +3 -3
- package/dist/index290.js +281 -2
- package/dist/index291.js +6 -2
- package/dist/index292.js +2 -2
- package/dist/index296.js +2 -2
- package/dist/index297.js +2 -2
- package/dist/index298.js +2 -2
- package/dist/index300.js +1 -21
- package/dist/index301.js +4 -0
- package/dist/index302.js +2 -200
- package/dist/index303.js +22 -4
- package/dist/index305.js +2 -8
- package/dist/index306.js +8 -2
- package/dist/index307.js +5 -2
- package/dist/index308.js +2 -3
- package/dist/index309.js +66 -2
- package/dist/index31.js +2 -2
- package/dist/index310.js +2 -126
- package/dist/index311.js +126 -2
- package/dist/index312.js +3 -436
- package/dist/index313.js +3 -127
- package/dist/index314.js +2 -67
- package/dist/index315.js +436 -2
- package/dist/index316.js +125 -87
- package/dist/index317.js +3 -5
- package/dist/index318.js +3 -3
- package/dist/index319.js +58 -3
- package/dist/index320.js +86 -55
- package/dist/index321.js +7 -6
- package/dist/index322.js +5 -18
- package/dist/index323.js +7 -32
- package/dist/index324.js +480 -28
- package/dist/index325.js +7 -0
- package/dist/index326.js +8 -58
- package/dist/index327.js +32 -57
- package/dist/index328.js +28 -480
- package/dist/index33.js +8 -8
- package/dist/index330.js +58 -6
- package/dist/index331.js +57 -7
- package/dist/index332.js +3 -4
- package/dist/index333.js +6 -7
- package/dist/index334.js +6 -6
- package/dist/index335.js +18 -3
- package/dist/index337.js +1 -1
- package/dist/index339.js +1 -1
- package/dist/index35.js +4 -4
- package/dist/index37.js +19 -19
- package/dist/index39.js +5 -5
- package/dist/index41.js +2 -2
- package/dist/index43.js +8 -8
- package/dist/index45.js +8 -8
- package/dist/index47.js +2 -2
- package/dist/index49.js +2 -2
- package/dist/index53.js +1 -1
- package/dist/index55.js +1 -1
- package/dist/index57.js +2 -2
- package/dist/index61.js +1 -1
- package/dist/index75.js +3 -3
- package/dist/index77.js +1 -1
- package/dist/index79.js +2 -2
- package/dist/index81.js +1 -1
- package/dist/index84.js +4 -4
- package/dist/index86.js +145 -91
- package/dist/index88.js +5 -5
- package/dist/index90.js +1 -1
- package/package.json +1 -1
- package/dist/index215.js +0 -5
- package/dist/index223.js +0 -202
- package/dist/index260.js +0 -4
- package/dist/index279.js +0 -5
- package/dist/index304.js +0 -4
- package/dist/index329.js +0 -10
package/dist/index86.js
CHANGED
@@ -1,117 +1,182 @@
|
|
1
|
-
import { defineComponent as
|
2
|
-
import { debounce as T } from "./index251.js";
|
1
|
+
import { defineComponent as U, mergeModels as F, useModel as D, getCurrentInstance as G, computed as d, ref as f, onMounted as O, onBeforeUnmount as j, openBlock as w, createElementBlock as x, normalizeClass as X, createElementVNode as r, createVNode as P, unref as m, normalizeProps as R, guardReactiveProps as $, withCtx as q, renderSlot as _, toDisplayString as h, Fragment as H, renderList as J, mergeProps as K, nextTick as N } from "vue";
|
3
2
|
/* empty css */
|
4
3
|
/* empty css */
|
5
|
-
import
|
4
|
+
import M from "./index13.js";
|
6
5
|
/* empty css */
|
7
|
-
import {
|
8
|
-
|
6
|
+
import { debounce as Q } from "./index253.js";
|
7
|
+
import { useLocale as Y } from "./index217.js";
|
8
|
+
import { useRoute as Z } from "./index137.js";
|
9
|
+
const ee = ["aria-label"], ae = { class: "bb-pagination__page-label sr-only" }, le = { class: "bb-pagination__page-label" }, te = { class: "bb-pagination__page-label" }, ne = { class: "bb-pagination__page-label sr-only" }, ge = /* @__PURE__ */ U({
|
9
10
|
__name: "BbPagination",
|
10
|
-
props: {
|
11
|
+
props: /* @__PURE__ */ F({
|
11
12
|
disabled: { type: Boolean },
|
12
13
|
loading: { type: Boolean },
|
13
14
|
align: { default: "right" },
|
14
15
|
ellipsis: { default: "..." },
|
15
16
|
label: { default: "Paginazione" },
|
16
17
|
maxSize: { default: 6 },
|
17
|
-
|
18
|
+
navigation: { type: Boolean },
|
19
|
+
replace: { type: Boolean },
|
20
|
+
querykey: { default: "page" },
|
18
21
|
totalPages: { default: 1 }
|
19
|
-
},
|
22
|
+
}, {
|
23
|
+
modelValue: { default: 1 },
|
24
|
+
modelModifiers: {}
|
25
|
+
}),
|
20
26
|
emits: ["update:modelValue"],
|
21
|
-
setup(
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
setup(z) {
|
28
|
+
var C, A;
|
29
|
+
const a = z, { t: L } = Y(), n = D(z, "modelValue"), k = !!((A = (C = G()) == null ? void 0 : C.proxy) != null && A.$inertia), u = Z(), p = d(() => +a.totalPages), g = f(1), s = f(+a.maxSize), c = f(), b = f(), B = f(1 / 0), S = () => {
|
30
|
+
c.value && b.value && (c.value.clientWidth < b.value.clientWidth ? s.value - 1 > 3 ? (s.value--, N(S)) : s.value = 3 : s.value < +a.maxSize && /* If there is enough space to fit one */
|
31
|
+
c.value.clientWidth - b.value.clientWidth > B.value && (s.value = Math.min(s.value + 1, +a.maxSize), N(S)));
|
25
32
|
};
|
26
33
|
if (globalThis.ResizeObserver) {
|
27
|
-
const e = new ResizeObserver(
|
28
|
-
|
29
|
-
if (
|
30
|
-
const l =
|
34
|
+
const e = new ResizeObserver(Q(S, 200));
|
35
|
+
O(() => {
|
36
|
+
if (c.value && b.value) {
|
37
|
+
const l = c.value.querySelectorAll(
|
31
38
|
".bb-pagination__page"
|
32
39
|
)[1];
|
33
40
|
if (l) {
|
34
|
-
const
|
35
|
-
|
41
|
+
const o = getComputedStyle(b.value).columnGap.replaceAll(/\D/g, ""), i = Number(o);
|
42
|
+
B.value = l.clientWidth + i;
|
36
43
|
}
|
37
|
-
e.observe(
|
44
|
+
e.observe(c.value);
|
38
45
|
}
|
39
|
-
}),
|
46
|
+
}), j(() => {
|
40
47
|
e.disconnect();
|
41
48
|
});
|
42
49
|
}
|
43
|
-
const
|
44
|
-
if (
|
50
|
+
const E = d(() => {
|
51
|
+
if (p.value <= 0 || isNaN(p.value) || p.value > Number.MAX_SAFE_INTEGER)
|
45
52
|
return [];
|
46
|
-
if (
|
47
|
-
if (
|
48
|
-
return
|
49
|
-
const e =
|
50
|
-
if (
|
53
|
+
if (s.value <= 1) return [n.value];
|
54
|
+
if (p.value <= s.value)
|
55
|
+
return y(p.value, g.value);
|
56
|
+
const e = s.value % 2 === 0, l = e ? s.value / 2 : Math.floor(s.value / 2), t = e ? l : l + 1, o = p.value - l;
|
57
|
+
if (t - n.value >= 0)
|
51
58
|
return [
|
52
|
-
...
|
59
|
+
...y(Math.max(1, s.value - 1), g.value),
|
53
60
|
a.ellipsis,
|
54
|
-
|
61
|
+
p.value
|
55
62
|
];
|
56
|
-
if (
|
57
|
-
const
|
63
|
+
if (n.value - o >= (e ? 1 : 0)) {
|
64
|
+
const i = s.value - 1, v = p.value - i + g.value;
|
58
65
|
return [
|
59
|
-
|
66
|
+
g.value,
|
60
67
|
a.ellipsis,
|
61
|
-
...
|
68
|
+
...y(i, v)
|
62
69
|
];
|
63
70
|
} else {
|
64
|
-
const
|
71
|
+
const i = Math.max(1, s.value - 3), v = i === 1 ? n.value : n.value - Math.ceil(i / 2) + g.value;
|
65
72
|
return [
|
66
|
-
|
73
|
+
g.value,
|
67
74
|
a.ellipsis,
|
68
|
-
...
|
75
|
+
...y(i, v),
|
69
76
|
a.ellipsis,
|
70
|
-
|
77
|
+
p.value
|
71
78
|
];
|
72
79
|
}
|
73
|
-
}),
|
80
|
+
}), T = d(() => E.value.map((e, l) => typeof e == "string" ? {
|
74
81
|
active: !1,
|
75
82
|
key: `ellipsis-${l}`,
|
76
83
|
page: e,
|
77
84
|
ellipsis: !0,
|
78
85
|
disabled: !0
|
79
86
|
} : {
|
80
|
-
active: e ===
|
87
|
+
active: e === n.value,
|
81
88
|
key: e,
|
82
89
|
page: e,
|
83
90
|
ellipsis: !1,
|
84
91
|
disabled: !!a.disabled || +a.totalPages < 2 || a.loading
|
85
|
-
})),
|
86
|
-
|
92
|
+
})), y = (e, l = 0) => Array.from({ length: e }, (t, o) => l + o), V = d(() => {
|
93
|
+
var l, t, o;
|
94
|
+
const e = {
|
95
|
+
disabled: n.value <= 1 || a.loading || a.disabled,
|
96
|
+
onClick: () => {
|
97
|
+
n.value > 1 && (n.value = n.value - 1);
|
98
|
+
},
|
99
|
+
class: "bb-pagination__page bb-pagination__page--previous"
|
100
|
+
};
|
101
|
+
if (a.navigation) {
|
102
|
+
const i = (n.value - 1).toString();
|
103
|
+
if (k) {
|
104
|
+
const v = new URL(globalThis.location.href);
|
105
|
+
v.searchParams.set(a.querykey, i), e.href = v.toString();
|
106
|
+
} else u.value && (e.to = {
|
107
|
+
path: (l = u.value) == null ? void 0 : l.path,
|
108
|
+
params: (t = u.value) == null ? void 0 : t.params,
|
109
|
+
query: { ...(o = u.value) == null ? void 0 : o.query, [a.querykey]: i }
|
110
|
+
}, e.replace = a.replace);
|
111
|
+
}
|
112
|
+
return e;
|
113
|
+
}), W = (e) => {
|
114
|
+
var t;
|
115
|
+
const l = {
|
116
|
+
class: ["bb-pagination__page"],
|
117
|
+
disabled: e.disabled,
|
118
|
+
onClick: () => {
|
119
|
+
typeof e.key == "number" && (n.value = e.key);
|
120
|
+
}
|
121
|
+
};
|
122
|
+
if (e.active && l.class.push("bb-pagination__page--active"), e.ellipsis && l.class.push("bb-pagination__page--ellipsis"), a.navigation) {
|
123
|
+
const o = e.key.toString();
|
124
|
+
if (k) {
|
125
|
+
const i = new URL(globalThis.location.href);
|
126
|
+
i.searchParams.set(a.querykey, o), l.href = i.toString();
|
127
|
+
} else u.value && (l.to = {
|
128
|
+
...u.value,
|
129
|
+
query: { ...(t = u.value) == null ? void 0 : t.query, [a.querykey]: o }
|
130
|
+
}, l.replace = a.replace);
|
131
|
+
}
|
132
|
+
return l;
|
133
|
+
}, I = d(() => {
|
134
|
+
var l, t, o;
|
135
|
+
const e = {
|
136
|
+
disabled: n.value >= p.value || a.loading || a.disabled,
|
137
|
+
onClick: () => {
|
138
|
+
n.value < p.value && (n.value = n.value + 1);
|
139
|
+
},
|
140
|
+
class: "bb-pagination__page bb-pagination__page--next"
|
141
|
+
};
|
142
|
+
if (a.navigation) {
|
143
|
+
const i = (n.value + 1).toString();
|
144
|
+
if (k) {
|
145
|
+
const v = new URL(globalThis.location.href);
|
146
|
+
v.searchParams.set(a.querykey, i), e.href = v.toString();
|
147
|
+
} else u.value && (e.to = {
|
148
|
+
path: (l = u.value) == null ? void 0 : l.path,
|
149
|
+
params: (t = u.value) == null ? void 0 : t.params,
|
150
|
+
query: { ...(o = u.value) == null ? void 0 : o.query, [a.querykey]: i }
|
151
|
+
}, e.replace = a.replace);
|
152
|
+
}
|
153
|
+
return e;
|
154
|
+
});
|
155
|
+
return (e, l) => (w(), x("div", {
|
87
156
|
ref_key: "outercontainer",
|
88
|
-
ref:
|
89
|
-
class:
|
157
|
+
ref: c,
|
158
|
+
class: X(["bb-pagination", {
|
90
159
|
[`bb-pagination--${e.align}`]: !0,
|
91
160
|
"bb-pagination--disabled": e.disabled
|
92
161
|
}])
|
93
162
|
}, [
|
94
|
-
|
95
|
-
|
163
|
+
r("nav", { "aria-label": e.label }, [
|
164
|
+
r("ul", {
|
96
165
|
ref_key: "innercontainer",
|
97
|
-
ref:
|
166
|
+
ref: b,
|
98
167
|
class: "bb-pagination__pages"
|
99
168
|
}, [
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
default: w(() => [
|
107
|
-
c(e.$slots, "previous", {}, () => [
|
108
|
-
i("span", I, m(v(C)("pagination.previous").value), 1),
|
109
|
-
l[2] || (l[2] = i("svg", {
|
169
|
+
r("li", null, [
|
170
|
+
P(m(M), R($(V.value)), {
|
171
|
+
default: q(() => [
|
172
|
+
_(e.$slots, "previous", {}, () => [
|
173
|
+
r("span", ae, h(m(L)("pagination.previous").value), 1),
|
174
|
+
l[0] || (l[0] = r("svg", {
|
110
175
|
class: "bb-pagination__page-chevron",
|
111
176
|
viewBox: "0 0 24 24",
|
112
177
|
xmlns: "http://www.w3.org/2000/svg"
|
113
178
|
}, [
|
114
|
-
|
179
|
+
r("path", {
|
115
180
|
d: "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z",
|
116
181
|
fill: "currentColor"
|
117
182
|
})
|
@@ -119,49 +184,38 @@ const G = ["aria-label"], I = { class: "bb-pagination__page-label sr-only" }, O
|
|
119
184
|
])
|
120
185
|
]),
|
121
186
|
_: 3
|
122
|
-
},
|
187
|
+
}, 16)
|
123
188
|
]),
|
124
|
-
(
|
125
|
-
key:
|
189
|
+
(w(!0), x(H, null, J(T.value, (t) => (w(), x("li", {
|
190
|
+
key: t.key
|
126
191
|
}, [
|
127
|
-
|
128
|
-
|
129
|
-
"
|
130
|
-
|
131
|
-
|
132
|
-
disabled: n.disabled,
|
133
|
-
onClick: (p) => f("update:modelValue", n.key)
|
134
|
-
}, {
|
135
|
-
default: w(() => [
|
136
|
-
n.ellipsis === !0 ? c(e.$slots, "ellipsis", { key: 0 }, () => [
|
137
|
-
i("span", O, m(a.ellipsis), 1)
|
138
|
-
]) : c(e.$slots, "item", {
|
192
|
+
P(m(M), K({ ref_for: !0 }, W(t)), {
|
193
|
+
default: q(() => [
|
194
|
+
t.ellipsis === !0 ? _(e.$slots, "ellipsis", { key: 0 }, () => [
|
195
|
+
r("span", le, h(a.ellipsis), 1)
|
196
|
+
]) : _(e.$slots, "item", {
|
139
197
|
key: 1,
|
140
|
-
active:
|
141
|
-
disabled:
|
142
|
-
item:
|
198
|
+
active: t.active,
|
199
|
+
disabled: t.disabled,
|
200
|
+
item: t.key
|
143
201
|
}, () => [
|
144
|
-
|
202
|
+
r("span", te, h(t.key), 1)
|
145
203
|
])
|
146
204
|
]),
|
147
205
|
_: 2
|
148
|
-
},
|
206
|
+
}, 1040)
|
149
207
|
]))), 128)),
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
default: w(() => [
|
157
|
-
c(e.$slots, "next", {}, () => [
|
158
|
-
i("span", q, m(v(C)("pagination.next").value), 1),
|
159
|
-
l[3] || (l[3] = i("svg", {
|
208
|
+
r("li", null, [
|
209
|
+
P(m(M), R($(I.value)), {
|
210
|
+
default: q(() => [
|
211
|
+
_(e.$slots, "next", {}, () => [
|
212
|
+
r("span", ne, h(m(L)("pagination.next").value), 1),
|
213
|
+
l[1] || (l[1] = r("svg", {
|
160
214
|
class: "bb-pagination__page-chevron",
|
161
215
|
viewBox: "0 0 24 24",
|
162
216
|
xmlns: "http://www.w3.org/2000/svg"
|
163
217
|
}, [
|
164
|
-
|
218
|
+
r("path", {
|
165
219
|
d: "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z",
|
166
220
|
fill: "currentColor"
|
167
221
|
})
|
@@ -169,13 +223,13 @@ const G = ["aria-label"], I = { class: "bb-pagination__page-label sr-only" }, O
|
|
169
223
|
])
|
170
224
|
]),
|
171
225
|
_: 3
|
172
|
-
},
|
226
|
+
}, 16)
|
173
227
|
])
|
174
228
|
], 512)
|
175
|
-
], 8,
|
229
|
+
], 8, ee)
|
176
230
|
], 2));
|
177
231
|
}
|
178
232
|
});
|
179
233
|
export {
|
180
|
-
|
234
|
+
ge as default
|
181
235
|
};
|
package/dist/index88.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { defineComponent as O, ref as n, computed as v, openBlock as y, createElementBlock as S, mergeProps as F, createElementVNode as p, renderSlot as k, normalizeProps as H, guardReactiveProps as V, createVNode as q, withCtx as T, createBlock as I, toDisplayString as W, unref as z, createCommentVNode as A, nextTick as R } from "vue";
|
2
|
-
import { useFocusTrap as j } from "./
|
2
|
+
import { useFocusTrap as j } from "./index208.js";
|
3
3
|
import { useId as G } from "./index8.js";
|
4
4
|
import { useIntersectionObserver as J } from "./index132.js";
|
5
|
-
import { waitFor as K } from "./
|
5
|
+
import { waitFor as K } from "./index219.js";
|
6
6
|
import Q from "./index13.js";
|
7
7
|
/* empty css */
|
8
|
-
import U from "./
|
8
|
+
import U from "./index210.js";
|
9
9
|
/* empty css */
|
10
|
-
import { useLocale as X } from "./
|
11
|
-
import { useDebounceFn as Y } from "./
|
10
|
+
import { useLocale as X } from "./index217.js";
|
11
|
+
import { useDebounceFn as Y } from "./index254.js";
|
12
12
|
const Z = { class: "bb-popover__close-label sr-only" }, ce = /* @__PURE__ */ O({
|
13
13
|
__name: "BbPopover",
|
14
14
|
props: {
|
package/dist/index90.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { defineComponent as r, computed as a, openBlock as l, createElementBlock as s, normalizeClass as m, createElementVNode as n, normalizeStyle as c } from "vue";
|
2
|
-
import { clamp as p } from "./
|
2
|
+
import { clamp as p } from "./index249.js";
|
3
3
|
import { getAsPercentageBetween as i } from "./index131.js";
|
4
4
|
const _ = /* @__PURE__ */ r({
|
5
5
|
__name: "BbProgress",
|
package/package.json
CHANGED
package/dist/index215.js
DELETED
package/dist/index223.js
DELETED
@@ -1,202 +0,0 @@
|
|
1
|
-
import { defineComponent as j, ref as c, onMounted as J, watch as Q, openBlock as _, createElementBlock as R, createElementVNode as w, createTextVNode as B, toDisplayString as C, unref as x, createCommentVNode as K } from "vue";
|
2
|
-
import { useResizeObserver as Z } from "./index132.js";
|
3
|
-
import { hexToRgb as O } from "./index329.js";
|
4
|
-
import { getHueFromRGB as F } from "./index330.js";
|
5
|
-
import { hslToHex as y } from "./index331.js";
|
6
|
-
import { useLocale as ee } from "./index228.js";
|
7
|
-
const te = {
|
8
|
-
id: "mainCanvasDesc",
|
9
|
-
"aria-live": "polite",
|
10
|
-
class: "sr-only"
|
11
|
-
}, ae = { key: 0 }, ne = {
|
12
|
-
id: "hueCanvasDesc",
|
13
|
-
"aria-live": "polite",
|
14
|
-
class: "sr-only"
|
15
|
-
}, oe = { key: 0 }, de = /* @__PURE__ */ j({
|
16
|
-
__name: "ColorPallette",
|
17
|
-
props: {
|
18
|
-
modelValue: {}
|
19
|
-
},
|
20
|
-
emits: ["update:modelValue"],
|
21
|
-
setup(N, { emit: T }) {
|
22
|
-
const D = N, f = T, { t: h } = ee(), o = c(D.modelValue), d = c(
|
23
|
-
y(F(...O(o.value ?? "#ff0000")), 100, 50)
|
24
|
-
), P = c(null), s = c(null), r = c(null), l = c({ x: 0, y: 0 }), u = c({ x: 0 }), b = c(!1), k = c(!1), H = () => {
|
25
|
-
const e = s.value, t = r.value;
|
26
|
-
!e || !t || (e.width = e.offsetWidth, e.height = e.offsetHeight, t.width = t.offsetWidth, t.height = t.offsetHeight, v(), m());
|
27
|
-
}, I = () => {
|
28
|
-
const e = s.value;
|
29
|
-
return e ? e.getContext("2d", { willReadFrequently: !0 }) : null;
|
30
|
-
}, v = () => {
|
31
|
-
const e = s.value;
|
32
|
-
if (!e) return;
|
33
|
-
const t = I();
|
34
|
-
if (!t) return;
|
35
|
-
t.clearRect(0, 0, e.width, e.height);
|
36
|
-
const a = t.createLinearGradient(0, 0, e.width, 0);
|
37
|
-
a.addColorStop(0, d.value), a.addColorStop(1, "#ffffff");
|
38
|
-
const n = t.createLinearGradient(0, 0, 0, e.height);
|
39
|
-
n.addColorStop(0, "transparent"), n.addColorStop(1, "#000000"), t.fillStyle = a, t.fillRect(0, 0, e.width, e.height), t.fillStyle = n, t.globalCompositeOperation = "multiply", t.fillRect(0, 0, e.width, e.height), t.globalCompositeOperation = "source-over", t.fillStyle = "#000000", t.strokeStyle = "#000000", t.lineWidth = 1;
|
40
|
-
}, p = () => {
|
41
|
-
const e = I();
|
42
|
-
e && (e.beginPath(), e.arc(
|
43
|
-
l.value.x,
|
44
|
-
l.value.y,
|
45
|
-
8,
|
46
|
-
0,
|
47
|
-
2 * Math.PI
|
48
|
-
), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.stroke(), e.beginPath(), e.arc(
|
49
|
-
l.value.x,
|
50
|
-
l.value.y,
|
51
|
-
7,
|
52
|
-
0,
|
53
|
-
2 * Math.PI
|
54
|
-
), e.strokeStyle = "#000000", e.lineWidth = 1, e.stroke(), e.globalCompositeOperation = "source-over");
|
55
|
-
}, V = () => {
|
56
|
-
const e = r.value;
|
57
|
-
return e ? e.getContext("2d", { willReadFrequently: !0 }) : null;
|
58
|
-
}, m = () => {
|
59
|
-
const e = r.value;
|
60
|
-
if (!e) return;
|
61
|
-
const t = V();
|
62
|
-
if (!t) return;
|
63
|
-
const a = t.createLinearGradient(0, 0, e.width, 0);
|
64
|
-
for (let n = 0; n <= 360; n += 60)
|
65
|
-
a.addColorStop(n / 360, `hsl(${n}, 100%, 50%)`);
|
66
|
-
a.addColorStop(1, "hsl(360, 100%, 50%)"), t.fillStyle = a, t.fillRect(0, 0, e.width, e.height), L(), t.fillStyle = "#000000", t.strokeStyle = "#000000", t.lineWidth = 1;
|
67
|
-
}, L = () => {
|
68
|
-
const e = r.value;
|
69
|
-
if (!e) return;
|
70
|
-
const t = V();
|
71
|
-
if (!t) return;
|
72
|
-
const a = 10, n = 16, i = u.value.x - a / 2, S = e.height / 2 - n / 2;
|
73
|
-
t.beginPath(), t.roundRect(i, S, a, n, 2), t.strokeStyle = "lightgray", t.stroke(), t.fillStyle = "#ffffff", t.fill();
|
74
|
-
}, q = (e) => {
|
75
|
-
s.value && (window.addEventListener("pointermove", A), window.addEventListener("pointerup", E), b.value = !0, G(e));
|
76
|
-
}, z = (e) => {
|
77
|
-
r.value && (window.addEventListener("pointermove", A), window.addEventListener("pointerup", E), k.value = !0, W(e));
|
78
|
-
}, G = (e) => {
|
79
|
-
const t = s.value;
|
80
|
-
if (!t) return;
|
81
|
-
const a = t.getBoundingClientRect(), n = Math.max(0, Math.min(t.width, e.clientX - a.left)), i = Math.max(0, Math.min(t.height, e.clientY - a.top));
|
82
|
-
l.value = { x: n, y: i }, v(), p(), o.value = g(), f("update:modelValue", o.value);
|
83
|
-
}, W = (e) => {
|
84
|
-
const t = r.value;
|
85
|
-
if (!t) return;
|
86
|
-
const a = t.getBoundingClientRect(), n = Math.max(0, Math.min(t.width, e.clientX - a.left));
|
87
|
-
u.value = { x: n };
|
88
|
-
const i = n / t.width * 360;
|
89
|
-
d.value = y(i, 100, 50), m(), v(), p(), o.value = g(), f("update:modelValue", o.value);
|
90
|
-
}, A = (e) => {
|
91
|
-
b.value ? G(e) : k.value && W(e);
|
92
|
-
}, E = () => {
|
93
|
-
b.value = !1, k.value = !1;
|
94
|
-
}, U = (e) => {
|
95
|
-
var a, n;
|
96
|
-
switch (e.key) {
|
97
|
-
case "ArrowUp":
|
98
|
-
l.value.y = Math.max(0, l.value.y - 5);
|
99
|
-
break;
|
100
|
-
case "ArrowDown":
|
101
|
-
l.value.y = Math.min(
|
102
|
-
((a = s.value) == null ? void 0 : a.height) ?? 0,
|
103
|
-
l.value.y + 5
|
104
|
-
);
|
105
|
-
break;
|
106
|
-
case "ArrowLeft":
|
107
|
-
l.value.x = Math.max(0, l.value.x - 5);
|
108
|
-
break;
|
109
|
-
case "ArrowRight":
|
110
|
-
l.value.x = Math.min(
|
111
|
-
((n = s.value) == null ? void 0 : n.width) ?? 0,
|
112
|
-
l.value.x + 5
|
113
|
-
);
|
114
|
-
break;
|
115
|
-
default:
|
116
|
-
return;
|
117
|
-
}
|
118
|
-
v(), p(), o.value = g(), f("update:modelValue", o.value), e.preventDefault();
|
119
|
-
}, X = (e) => {
|
120
|
-
var n, i;
|
121
|
-
switch (e.key) {
|
122
|
-
case "ArrowLeft":
|
123
|
-
u.value.x = Math.max(0, u.value.x - 5);
|
124
|
-
break;
|
125
|
-
case "ArrowRight":
|
126
|
-
u.value.x = Math.min(
|
127
|
-
((n = r.value) == null ? void 0 : n.width) ?? 0,
|
128
|
-
u.value.x + 5
|
129
|
-
);
|
130
|
-
break;
|
131
|
-
default:
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
const a = u.value.x / (((i = r.value) == null ? void 0 : i.width) ?? 1) * 360;
|
135
|
-
d.value = y(a, 100, 50), m(), L(), v(), p(), o.value = g(), f("update:modelValue", o.value), e.preventDefault();
|
136
|
-
};
|
137
|
-
J(() => {
|
138
|
-
H(), M(o.value ?? "#ff0000");
|
139
|
-
}), Z(P, () => {
|
140
|
-
H(), M(o.value ?? "#ff0000");
|
141
|
-
}), Q(
|
142
|
-
() => D.modelValue,
|
143
|
-
(e) => {
|
144
|
-
!e || e === o.value || (o.value = e, M(e), m(), v());
|
145
|
-
}
|
146
|
-
);
|
147
|
-
const g = () => {
|
148
|
-
const e = s.value;
|
149
|
-
if (!e) return "#ffffff";
|
150
|
-
const t = e.getContext("2d");
|
151
|
-
if (!t) return "#ffffff";
|
152
|
-
const { x: a, y: n } = l.value, i = t.getImageData(a, n, 1, 1).data, [S, $, Y] = i;
|
153
|
-
return `#${((1 << 24) + (S << 16) + ($ << 8) + Y).toString(16).slice(1)}`;
|
154
|
-
};
|
155
|
-
function M(e) {
|
156
|
-
var a;
|
157
|
-
const t = F(...O(e));
|
158
|
-
d.value = y(t, 100, 50), u.value.x = t / 360 * (((a = r.value) == null ? void 0 : a.width) ?? 0);
|
159
|
-
}
|
160
|
-
return (e, t) => (_(), R("div", {
|
161
|
-
ref_key: "paletteRef",
|
162
|
-
ref: P,
|
163
|
-
"aria-label": "Color Picker",
|
164
|
-
class: "bb-color-palette",
|
165
|
-
role: "application"
|
166
|
-
}, [
|
167
|
-
w("canvas", {
|
168
|
-
ref_key: "mainCanvasRef",
|
169
|
-
ref: s,
|
170
|
-
"aria-describedby": "mainCanvasDesc",
|
171
|
-
"aria-label": "Main Color Selection",
|
172
|
-
class: "bb-color-palette__canvas",
|
173
|
-
role: "application",
|
174
|
-
tabindex: "0",
|
175
|
-
onKeydown: U,
|
176
|
-
onPointerdown: q
|
177
|
-
}, null, 544),
|
178
|
-
w("p", te, [
|
179
|
-
B(C(x(h)("colorInput.mainCanvasDesc")) + " ", 1),
|
180
|
-
o.value ? (_(), R("span", ae, C(x(h)("colorInput.mainCanvasSelectedColor", o.value)), 1)) : K("", !0)
|
181
|
-
]),
|
182
|
-
w("canvas", {
|
183
|
-
ref_key: "hueCanvasRef",
|
184
|
-
ref: r,
|
185
|
-
"aria-describedby": "hueCanvasDesc",
|
186
|
-
"aria-label": "Hue Selection",
|
187
|
-
class: "bb-color-palette__hue-canvas",
|
188
|
-
role: "application",
|
189
|
-
tabindex: "0",
|
190
|
-
onKeydown: X,
|
191
|
-
onPointerdown: z
|
192
|
-
}, null, 544),
|
193
|
-
w("p", ne, [
|
194
|
-
B(C(x(h)("colorInput.hueCanvasDesc")) + " ", 1),
|
195
|
-
d.value ? (_(), R("span", oe, C(x(h)("colorInput.hueCanvasSelectedHue", d.value)), 1)) : K("", !0)
|
196
|
-
])
|
197
|
-
], 512));
|
198
|
-
}
|
199
|
-
});
|
200
|
-
export {
|
201
|
-
de as default
|
202
|
-
};
|
package/dist/index260.js
DELETED
package/dist/index279.js
DELETED
package/dist/index304.js
DELETED
package/dist/index329.js
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
function i(t) {
|
2
|
-
if (t = t.replace(/^#/, ""), !/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(t))
|
3
|
-
throw new Error("Invalid hex code");
|
4
|
-
t.length === 3 && (t = t.split("").map((n) => n + n).join(""));
|
5
|
-
const r = parseInt(t.slice(0, 2), 16), s = parseInt(t.slice(2, 4), 16), o = parseInt(t.slice(4, 6), 16);
|
6
|
-
return [r, s, o];
|
7
|
-
}
|
8
|
-
export {
|
9
|
-
i as hexToRgb
|
10
|
-
};
|