@commentkit/comment-kit 0.6.9 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -4
- package/LICENSE +18 -2
- package/README.md +133 -88
- package/SECURITY.md +48 -0
- package/dist/THIRD_PARTY_NOTICES.txt +284 -0
- package/dist/angular.es.js +25 -12
- package/dist/comment-kit.es.js +25 -13
- package/dist/demo.es.js +148 -70
- package/dist/headless.es.js +3 -3
- package/dist/preact.es.js +3 -3
- package/dist/qwik.es.js +1 -110
- package/dist/qwik.qwik.mjs +114 -0
- package/dist/react.es.js +3 -3
- package/dist/shared/annotation-icons-Dh-bmNYK.js +172 -0
- package/dist/shared/annotation-toolbar-cGC1p-SP.js +1093 -0
- package/dist/shared/attachment-refresh-CzQFXHkL.js +94 -0
- package/dist/shared/{bridge-DRE03N9X.js → bridge-CJoGYngu.js} +6 -3
- package/dist/shared/{button-group-CHfMRXyA.js → button-group-CWdKaOlC.js} +14 -16
- package/dist/shared/capture-colors-CxSLsU5-.js +74 -0
- package/dist/shared/comment-drawing-canvas-DdXlMgbF.js +124 -0
- package/dist/shared/comment-icon-Dg9ZWpz-.js +608 -0
- package/dist/shared/comment-image-lightbox-B7iHjnAz.js +190 -0
- package/dist/shared/comment-images-content-D7YNUgo5.js +214 -0
- package/dist/shared/{comment-kit-core-D0kY00St.js → comment-kit-core-C862uNAm.js} +1371 -853
- package/dist/shared/comment-kit-ui-0vd-DY4S.js +19977 -0
- package/dist/shared/comment-screenshot-annotator-DcaSSuWB.js +151 -0
- package/dist/shared/comment-screenshot-overlay-D_nFoJmM.js +207 -0
- package/dist/shared/{dev-export-panel-BLngcr5q.js → dev-export-panel-pWBlhlse.js} +8 -8
- package/dist/shared/dev-grab-eQ9EgEGY.js +210 -0
- package/dist/shared/dist-De294MVF.js +623 -0
- package/dist/shared/{element-selector-CtFzgHvq.js → element-selector-DC-_XJ0k.js} +350 -305
- package/dist/shared/{icons-BSHCWYO1.js → icons-nzMOLzrm.js} +2 -3
- package/dist/shared/{mount-ui-CVivB_eQ.js → mount-ui-B68j8r6I.js} +4 -4
- package/dist/shared/{pusher-BEl7Qn-8.js → pusher-C1FHQGXV.js} +1 -1
- package/dist/shared/realtime-Diqz7G_y.js +317 -0
- package/dist/shared/realtime-recovery-DJ_adc-H.js +135 -0
- package/dist/shared/{separator-DusFNTs-.js → separator-XDBsaWyw.js} +891 -785
- package/dist/shared/{shadow-root-CmYXiSRR.js → shadow-root-CrO75sED.js} +1 -1
- package/dist/shared/styles-C9Jwvm0Q.js +2 -0
- package/dist/shared/useRender-D1z_X_BY.js +5 -0
- package/dist/shared/{useValueChanged-DQXLia-2.js → useValueChanged-CrzfD8l-.js} +15 -15
- package/dist/shared/{validation-C7QG8j7Z.js → validation-D-8u4M7I.js} +14 -1
- package/dist/shared/{websocket-manager-BTRqNTB7.js → websocket-manager-CFak_YHy.js} +148 -89
- package/dist/solid.es.js +3 -3
- package/dist/svelte.es.js +3 -3
- package/dist/types/adapters/bridge.d.ts +9 -12
- package/dist/types/angular/index.d.ts +15 -5
- package/dist/types/core/api-client.d.ts +24 -18
- package/dist/types/core/comment-kit-core.d.ts +28 -11
- package/dist/types/core/local-demo.d.ts +1 -0
- package/dist/types/core/types.d.ts +103 -0
- package/dist/types/core/websocket-manager.d.ts +12 -0
- package/dist/types/core/write-access.d.ts +9 -0
- package/dist/types/headless.d.ts +1 -1
- package/dist/types/index.d.ts +8 -4
- package/dist/types/qwik/index.d.ts +4 -1
- package/dist/vue.es.js +3 -3
- package/docs/api-reference.md +378 -0
- package/docs/local-demo.md +60 -0
- package/package.json +17 -6
- package/dist/shared/annotation-toolbar-pX17NLmJ.js +0 -1104
- package/dist/shared/clamp-CcFVX0vC.js +0 -55
- package/dist/shared/comment-drawing-canvas-CYu5SwRf.js +0 -126
- package/dist/shared/comment-image-lightbox-0VdAs2iT.js +0 -178
- package/dist/shared/comment-kit-ui-D2j2gvnm.js +0 -16685
- package/dist/shared/comment-screenshot-annotator-BuojwviY.js +0 -137
- package/dist/shared/comment-screenshot-overlay-BZX0Vcb8.js +0 -144
- package/dist/shared/dev-grab-pDAfH2lr.js +0 -203
- package/dist/shared/local-demo-context-BohlYbHt.js +0 -6
- package/dist/shared/realtime-BG_t_ze7.js +0 -281
- package/dist/shared/resolveAriaLabelledBy-CIKpnjNJ.js +0 -669
- package/dist/shared/styles-D_FEJZ9G.js +0 -2
- package/dist/shared/useLabelableId-DGbfdMi_.js +0 -155
|
@@ -0,0 +1,1093 @@
|
|
|
1
|
+
import { D as e, I as t, L as n, T as r, c as i, d as a, f as o, g as s, m as c, p as l, s as u, t as d, u as f } from "./button-By0hGrJK.js";
|
|
2
|
+
import { $t as p, Ct as m, Et as h, Nt as ee, Ot as g, Tt as _, Zt as v, en as y, i as b, o as x, r as S, t as C, x as w, xt as T } from "./separator-XDBsaWyw.js";
|
|
3
|
+
import { E as te, M as ne, S as re, h as ie, j as ae, n as oe, t as se, u as ce, y as le } from "./useValueChanged-CrzfD8l-.js";
|
|
4
|
+
import { i as ue } from "./ShadowRootContext-Bv-4aElu.js";
|
|
5
|
+
import { a as de, i as fe, l as pe, n as me, o as he, r as ge, s as E, t as D, u as _e } from "./button-group-CWdKaOlC.js";
|
|
6
|
+
import { A as ve, B as O, D as k, E as ye, F as be, I as A, L as xe, M as j, O as M, P as N, R as P, T as Se, b as Ce, d as F, f as we, k as Te, o as I, s as L, w as R, x as Ee, y as De, z } from "./comment-kit-ui-0vd-DY4S.js";
|
|
7
|
+
import { a as Oe, c as B, d as V, l as H, n as ke, o as U, r as Ae, s as je, t as W, u as G } from "./annotation-icons-Dh-bmNYK.js";
|
|
8
|
+
import * as K from "react";
|
|
9
|
+
import { jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
10
|
+
var Me = () => () => {}, Ne = () => !0, Pe = () => !1;
|
|
11
|
+
function Fe() {
|
|
12
|
+
return w(Me, Ne, Pe);
|
|
13
|
+
}
|
|
14
|
+
function Ie() {
|
|
15
|
+
let [e, t] = K.useState(!1);
|
|
16
|
+
return K.useEffect(() => {
|
|
17
|
+
t(!0);
|
|
18
|
+
}, []), e;
|
|
19
|
+
}
|
|
20
|
+
var Le = l(18) ? Fe : Ie;
|
|
21
|
+
function Re() {
|
|
22
|
+
return !Le();
|
|
23
|
+
}
|
|
24
|
+
function ze(e) {
|
|
25
|
+
let { script: t } = e, { nonce: n } = we();
|
|
26
|
+
return Re() ? /*#__PURE__*/ q("script", {
|
|
27
|
+
nonce: n,
|
|
28
|
+
dangerouslySetInnerHTML: { __html: t },
|
|
29
|
+
suppressHydrationWarning: !0
|
|
30
|
+
}) : null;
|
|
31
|
+
}
|
|
32
|
+
function Y() {
|
|
33
|
+
let e = K.useRef(0), [t, n] = K.useState({
|
|
34
|
+
paths: [],
|
|
35
|
+
undone: [],
|
|
36
|
+
activePath: null,
|
|
37
|
+
tool: "pen",
|
|
38
|
+
color: j,
|
|
39
|
+
strokeWidth: 3
|
|
40
|
+
}), r = K.useCallback((e) => {
|
|
41
|
+
n((t) => ({
|
|
42
|
+
...t,
|
|
43
|
+
tool: e
|
|
44
|
+
}));
|
|
45
|
+
}, []), i = K.useCallback((e) => {
|
|
46
|
+
n((t) => ({
|
|
47
|
+
...t,
|
|
48
|
+
color: e
|
|
49
|
+
}));
|
|
50
|
+
}, []), a = K.useCallback((e) => {
|
|
51
|
+
n((t) => ({
|
|
52
|
+
...t,
|
|
53
|
+
strokeWidth: e
|
|
54
|
+
}));
|
|
55
|
+
}, []), o = K.useCallback((t, r, i = 1) => {
|
|
56
|
+
let a = `path-${String(++e.current)}`;
|
|
57
|
+
n((e) => ({
|
|
58
|
+
...e,
|
|
59
|
+
activePath: {
|
|
60
|
+
id: a,
|
|
61
|
+
tool: e.tool,
|
|
62
|
+
points: [{
|
|
63
|
+
x: t,
|
|
64
|
+
y: r
|
|
65
|
+
}],
|
|
66
|
+
color: e.color,
|
|
67
|
+
strokeWidth: e.strokeWidth * i
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
}, []), s = K.useCallback((e, t) => {
|
|
71
|
+
n((n) => {
|
|
72
|
+
if (!n.activePath) return n;
|
|
73
|
+
if (n.activePath.tool === "pen") return {
|
|
74
|
+
...n,
|
|
75
|
+
activePath: {
|
|
76
|
+
...n.activePath,
|
|
77
|
+
points: [...n.activePath.points, {
|
|
78
|
+
x: e,
|
|
79
|
+
y: t
|
|
80
|
+
}]
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
let r = n.activePath.points[0] ?? {
|
|
84
|
+
x: 0,
|
|
85
|
+
y: 0
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
...n,
|
|
89
|
+
activePath: {
|
|
90
|
+
...n.activePath,
|
|
91
|
+
points: [r, {
|
|
92
|
+
x: e,
|
|
93
|
+
y: t
|
|
94
|
+
}]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}, []), c = K.useCallback(() => {
|
|
99
|
+
n((e) => !e.activePath || e.activePath.points.length < 2 ? {
|
|
100
|
+
...e,
|
|
101
|
+
activePath: null
|
|
102
|
+
} : {
|
|
103
|
+
...e,
|
|
104
|
+
paths: [...e.paths, e.activePath],
|
|
105
|
+
undone: [],
|
|
106
|
+
activePath: null
|
|
107
|
+
});
|
|
108
|
+
}, []), l = K.useCallback(() => {
|
|
109
|
+
n((e) => ({
|
|
110
|
+
...e,
|
|
111
|
+
activePath: null
|
|
112
|
+
}));
|
|
113
|
+
}, []), u = K.useCallback(() => {
|
|
114
|
+
n((e) => e.paths.length === 0 ? e : {
|
|
115
|
+
...e,
|
|
116
|
+
paths: e.paths.slice(0, -1),
|
|
117
|
+
undone: [...e.undone, ...e.paths.slice(-1)]
|
|
118
|
+
});
|
|
119
|
+
}, []), d = K.useCallback(() => {
|
|
120
|
+
n((e) => e.undone.length === 0 ? e : {
|
|
121
|
+
...e,
|
|
122
|
+
paths: [...e.paths, ...e.undone.slice(-1)],
|
|
123
|
+
undone: e.undone.slice(0, -1)
|
|
124
|
+
});
|
|
125
|
+
}, []), f = K.useCallback(() => {
|
|
126
|
+
n((e) => ({
|
|
127
|
+
...e,
|
|
128
|
+
paths: [],
|
|
129
|
+
undone: [],
|
|
130
|
+
activePath: null
|
|
131
|
+
}));
|
|
132
|
+
}, []);
|
|
133
|
+
return {
|
|
134
|
+
...t,
|
|
135
|
+
setTool: r,
|
|
136
|
+
setColor: i,
|
|
137
|
+
setStrokeWidth: a,
|
|
138
|
+
startPath: o,
|
|
139
|
+
addPoint: s,
|
|
140
|
+
endPath: c,
|
|
141
|
+
cancelPath: l,
|
|
142
|
+
undo: u,
|
|
143
|
+
redo: d,
|
|
144
|
+
clear: f,
|
|
145
|
+
canUndo: t.paths.length > 0,
|
|
146
|
+
canRedo: t.undone.length > 0
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function Be(e) {
|
|
150
|
+
let t = e.composedPath?.()[0] ?? e.target;
|
|
151
|
+
return t instanceof Element ? [
|
|
152
|
+
"INPUT",
|
|
153
|
+
"TEXTAREA",
|
|
154
|
+
"SELECT"
|
|
155
|
+
].includes(t.tagName) || t instanceof HTMLElement && t.isContentEditable : !1;
|
|
156
|
+
}
|
|
157
|
+
function X(e, t, n) {
|
|
158
|
+
K.useEffect(() => {
|
|
159
|
+
let r = (r) => {
|
|
160
|
+
if (r.defaultPrevented || r.isComposing || Be(r)) return;
|
|
161
|
+
let i = r.key.toLowerCase();
|
|
162
|
+
(r.metaKey || r.ctrlKey) && !r.altKey && (i === "z" || i === "y") ? (r.preventDefault(), i === "y" || r.shiftKey ? t() : e()) : r.key === "Escape" && (r.preventDefault(), n());
|
|
163
|
+
};
|
|
164
|
+
return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
|
|
165
|
+
}, [
|
|
166
|
+
e,
|
|
167
|
+
t,
|
|
168
|
+
n
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
function Ve(e, t) {
|
|
172
|
+
return e - t;
|
|
173
|
+
}
|
|
174
|
+
function He(e, t, n, r, i, a) {
|
|
175
|
+
let o = F(e, n, r);
|
|
176
|
+
if (!i) return o;
|
|
177
|
+
let s = a.slice();
|
|
178
|
+
return s[t] = F(o, a[t - 1] ?? -Infinity, a[t + 1] ?? Infinity), s.sort(Ve);
|
|
179
|
+
}
|
|
180
|
+
function Ue(e, t, n) {
|
|
181
|
+
if (!Array.isArray(e)) return !0;
|
|
182
|
+
let r = t * n;
|
|
183
|
+
for (let t = 0; t < e.length - 1; t += 1) if (!(Math.abs(e[t] - e[t + 1]) >= r)) return !1;
|
|
184
|
+
return !0;
|
|
185
|
+
}
|
|
186
|
+
var Z = () => null, We = {
|
|
187
|
+
activeThumbIndex: Z,
|
|
188
|
+
max: Z,
|
|
189
|
+
min: Z,
|
|
190
|
+
minStepsBetweenValues: Z,
|
|
191
|
+
step: Z,
|
|
192
|
+
values: Z,
|
|
193
|
+
...ve
|
|
194
|
+
}, Ge = /*#__PURE__*/ K.createContext(void 0);
|
|
195
|
+
process.env.NODE_ENV !== "production" && (Ge.displayName = "SliderRootContext");
|
|
196
|
+
function Ke() {
|
|
197
|
+
let e = K.useContext(Ge);
|
|
198
|
+
if (e === void 0) throw Error(process.env.NODE_ENV === "production" ? t(62) : "Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>.");
|
|
199
|
+
return e;
|
|
200
|
+
}
|
|
201
|
+
function qe(e, t) {
|
|
202
|
+
return e === t || Array.isArray(e) && Array.isArray(t) && Ee(e, t);
|
|
203
|
+
}
|
|
204
|
+
var Je = /*#__PURE__*/ K.forwardRef(function(e, t) {
|
|
205
|
+
let { "aria-labelledby": r, className: i, defaultValue: a, disabled: s = !1, id: l, format: u, largeStep: d = 10, locale: h, render: ee, max: g = 100, min: _ = 0, minStepsBetweenValues: y = 0, form: b, name: x, onValueChange: S, onValueCommitted: C, orientation: w = "horizontal", step: T = 1, thumbCollisionBehavior: te = "push", thumbAlignment: ce = "center", value: ue, style: de, ...fe } = e, pe = oe(l), me = De(pe), he = c(S), ge = c(C), { clearErrors: E } = ye(), { state: D, disabled: _e, name: ve, setTouched: O, setDirty: be, validityData: xe, validation: j } = Te(), { labelId: M } = Se(), [N, we] = K.useState(), I = r ?? Ce(M, N), L = _e || s, R = ve ?? x, [z, Oe] = P({
|
|
206
|
+
controlled: ue,
|
|
207
|
+
default: a ?? _,
|
|
208
|
+
name: "Slider"
|
|
209
|
+
}), B = K.useRef(null), V = K.useRef(null), H = K.useRef([]), ke = K.useRef(null), U = K.useRef(-1), Ae = K.useRef(null), je = K.useRef(re), [W, G] = K.useState(-1), [J, Me] = K.useState(-1), [Ne, Pe] = K.useState(!1), [Fe, Ie] = K.useState(() => /* @__PURE__ */ new Map()), [Le, Re] = K.useState([void 0, void 0]), ze = c((e) => {
|
|
210
|
+
G(e), e !== -1 && Me(e);
|
|
211
|
+
}), Y = c((e) => {
|
|
212
|
+
e && (V.current = e);
|
|
213
|
+
}), Be = Array.isArray(z), X = K.useMemo(() => Be ? z.map((e) => F(e, _, g)).sort(Ve) : [F(z, _, g)], [
|
|
214
|
+
g,
|
|
215
|
+
_,
|
|
216
|
+
Be,
|
|
217
|
+
z
|
|
218
|
+
]), Z = Be ? X : X[0];
|
|
219
|
+
k(j.inputRef, pe, Z, void 0, !L, x), se(Z, () => {
|
|
220
|
+
E(R), j.change(Z);
|
|
221
|
+
let e = xe.initialValue, t;
|
|
222
|
+
t = Array.isArray(Z) && Array.isArray(e) ? !Ee(Z, e) : Z !== e, be(t);
|
|
223
|
+
});
|
|
224
|
+
let Ke = c((e, t) => {
|
|
225
|
+
if (Number.isNaN(e) || qe(e, z)) return !1;
|
|
226
|
+
let n = t.event, r = n.constructor, i = new r(n.type, n);
|
|
227
|
+
return Object.defineProperty(i, "target", {
|
|
228
|
+
writable: !0,
|
|
229
|
+
value: {
|
|
230
|
+
value: e,
|
|
231
|
+
name: R
|
|
232
|
+
}
|
|
233
|
+
}), t.event = i, he(e, t), !t.isCanceled && (je.current = t.reason, Oe(e), !0);
|
|
234
|
+
}), Je = c((e, t, n) => {
|
|
235
|
+
let r = He(e, t, _, g, Be, X);
|
|
236
|
+
if (Ue(r, T, y)) {
|
|
237
|
+
let e = "key" in n ? le : ie, i = Ke(r, ae(e, n.nativeEvent, void 0, { activeThumbIndex: t }));
|
|
238
|
+
O(!0), i && ge(r, ne(e, n.nativeEvent));
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
process.env.NODE_ENV !== "production" && _ >= g && o("Slider `max` must be greater than `min`."), n(() => {
|
|
242
|
+
if (!L) return;
|
|
243
|
+
let e = v(m(B.current));
|
|
244
|
+
p(B.current, e) && e.blur(), W !== -1 && ze(-1);
|
|
245
|
+
}, [
|
|
246
|
+
W,
|
|
247
|
+
L,
|
|
248
|
+
ze
|
|
249
|
+
]);
|
|
250
|
+
let Q = K.useMemo(() => ({
|
|
251
|
+
...D,
|
|
252
|
+
activeThumbIndex: W,
|
|
253
|
+
disabled: L,
|
|
254
|
+
dragging: Ne,
|
|
255
|
+
orientation: w,
|
|
256
|
+
max: g,
|
|
257
|
+
min: _,
|
|
258
|
+
minStepsBetweenValues: y,
|
|
259
|
+
step: T,
|
|
260
|
+
values: X
|
|
261
|
+
}), [
|
|
262
|
+
D,
|
|
263
|
+
W,
|
|
264
|
+
L,
|
|
265
|
+
Ne,
|
|
266
|
+
g,
|
|
267
|
+
_,
|
|
268
|
+
y,
|
|
269
|
+
w,
|
|
270
|
+
T,
|
|
271
|
+
X
|
|
272
|
+
]), Ye = K.useMemo(() => ({
|
|
273
|
+
active: W,
|
|
274
|
+
controlRef: V,
|
|
275
|
+
disabled: L,
|
|
276
|
+
dragging: Ne,
|
|
277
|
+
validation: j,
|
|
278
|
+
format: u,
|
|
279
|
+
handleInputChange: Je,
|
|
280
|
+
indicatorPosition: Le,
|
|
281
|
+
inset: ce !== "center",
|
|
282
|
+
isArrayValue: Be,
|
|
283
|
+
labelId: I,
|
|
284
|
+
rootLabelId: me,
|
|
285
|
+
largeStep: d,
|
|
286
|
+
lastUsedThumbIndex: J,
|
|
287
|
+
lastChangeReasonRef: je,
|
|
288
|
+
form: b,
|
|
289
|
+
locale: h,
|
|
290
|
+
max: g,
|
|
291
|
+
min: _,
|
|
292
|
+
minStepsBetweenValues: y,
|
|
293
|
+
name: R,
|
|
294
|
+
onValueCommitted: ge,
|
|
295
|
+
orientation: w,
|
|
296
|
+
pressedThumbCenterOffsetRef: ke,
|
|
297
|
+
pressedThumbIndexRef: U,
|
|
298
|
+
pressedValuesRef: Ae,
|
|
299
|
+
registerFieldControlRef: Y,
|
|
300
|
+
renderBeforeHydration: ce === "edge",
|
|
301
|
+
setActive: ze,
|
|
302
|
+
setDragging: Pe,
|
|
303
|
+
setIndicatorPosition: Re,
|
|
304
|
+
setLabelId: we,
|
|
305
|
+
setValue: Ke,
|
|
306
|
+
state: Q,
|
|
307
|
+
step: T,
|
|
308
|
+
thumbCollisionBehavior: te,
|
|
309
|
+
thumbMap: Fe,
|
|
310
|
+
thumbRefs: H,
|
|
311
|
+
values: X
|
|
312
|
+
}), [
|
|
313
|
+
W,
|
|
314
|
+
I,
|
|
315
|
+
me,
|
|
316
|
+
L,
|
|
317
|
+
Ne,
|
|
318
|
+
j,
|
|
319
|
+
u,
|
|
320
|
+
Je,
|
|
321
|
+
Le,
|
|
322
|
+
d,
|
|
323
|
+
J,
|
|
324
|
+
b,
|
|
325
|
+
h,
|
|
326
|
+
g,
|
|
327
|
+
_,
|
|
328
|
+
y,
|
|
329
|
+
R,
|
|
330
|
+
ge,
|
|
331
|
+
w,
|
|
332
|
+
Be,
|
|
333
|
+
Y,
|
|
334
|
+
ze,
|
|
335
|
+
Ke,
|
|
336
|
+
Q,
|
|
337
|
+
T,
|
|
338
|
+
te,
|
|
339
|
+
ce,
|
|
340
|
+
Fe,
|
|
341
|
+
X
|
|
342
|
+
]), Xe = f("div", e, {
|
|
343
|
+
state: Q,
|
|
344
|
+
ref: [t, B],
|
|
345
|
+
props: [
|
|
346
|
+
{
|
|
347
|
+
"aria-labelledby": I,
|
|
348
|
+
id: pe,
|
|
349
|
+
role: "group"
|
|
350
|
+
},
|
|
351
|
+
fe,
|
|
352
|
+
(e) => j.getValidationProps(L, e)
|
|
353
|
+
],
|
|
354
|
+
stateAttributesMapping: We
|
|
355
|
+
});
|
|
356
|
+
return /*#__PURE__*/ q(Ge.Provider, {
|
|
357
|
+
value: Ye,
|
|
358
|
+
children: /*#__PURE__*/ q(A, {
|
|
359
|
+
elementsRef: H,
|
|
360
|
+
onMapChange: Ie,
|
|
361
|
+
children: Xe
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
process.env.NODE_ENV !== "production" && (Je.displayName = "SliderRoot");
|
|
366
|
+
function Q(e) {
|
|
367
|
+
return e === "touch" || e === "pen";
|
|
368
|
+
}
|
|
369
|
+
function Ye(e, t) {
|
|
370
|
+
let n = e.getBoundingClientRect();
|
|
371
|
+
return t ? (n.top + n.bottom) / 2 : (n.left + n.right) / 2;
|
|
372
|
+
}
|
|
373
|
+
function Xe(e) {
|
|
374
|
+
if (e === 0) return 0;
|
|
375
|
+
if (Math.abs(e) < 1) {
|
|
376
|
+
let t = e.toExponential().split("e-"), n = t[0].split(".")[1];
|
|
377
|
+
return (n ? n.length : 0) + parseInt(t[1], 10);
|
|
378
|
+
}
|
|
379
|
+
let t = e.toString().split(".")[1];
|
|
380
|
+
return t ? t.length : 0;
|
|
381
|
+
}
|
|
382
|
+
function Ze(e, t, n) {
|
|
383
|
+
let r = Math.round((e - n) / t) * t + n;
|
|
384
|
+
return Number(r.toFixed(Math.max(Xe(t), Xe(n))));
|
|
385
|
+
}
|
|
386
|
+
function $(e, t, n, r, i, a, o, s) {
|
|
387
|
+
let c = e.slice(), l = a * o, u = c.length - 1, d = s ?? e, f = r + t * l, p = i - (u - t) * l;
|
|
388
|
+
c[t] = F(n, f, p);
|
|
389
|
+
for (let e = t + 1; e <= u; e += 1) {
|
|
390
|
+
let t = c[e - 1] + l, n = i - (u - e) * l, r = d[e], a = Math.max(c[e], t);
|
|
391
|
+
r < a && (a = Math.max(r, t)), c[e] = F(a, t, n);
|
|
392
|
+
}
|
|
393
|
+
for (let e = t - 1; e >= 0; --e) {
|
|
394
|
+
let t = c[e + 1] - l, n = r + e * l, i = d[e], a = Math.min(c[e], t);
|
|
395
|
+
i > a && (a = Math.min(i, t)), c[e] = F(a, n, t);
|
|
396
|
+
}
|
|
397
|
+
for (let e = 0; e <= u; e += 1) c[e] = Number(c[e].toFixed(12));
|
|
398
|
+
return c;
|
|
399
|
+
}
|
|
400
|
+
function Qe(e, t, n, r, i, a, o, s, c, l) {
|
|
401
|
+
let u = n ?? t, d = r ?? t;
|
|
402
|
+
if (!(u.length > 1)) return {
|
|
403
|
+
value: a,
|
|
404
|
+
thumbIndex: 0,
|
|
405
|
+
didSwap: !1
|
|
406
|
+
};
|
|
407
|
+
let f = c * l;
|
|
408
|
+
if (e === "push") return {
|
|
409
|
+
value: $(u, i, a, o, s, c, l),
|
|
410
|
+
thumbIndex: i,
|
|
411
|
+
didSwap: !1
|
|
412
|
+
};
|
|
413
|
+
let p = u.slice(), m = p[i - 1], h = p[i + 1], ee = m == null ? o : m + f, g = h == null ? s : h - f, _ = Number(F(a, ee, g).toFixed(12));
|
|
414
|
+
switch (p[i] = _, e) {
|
|
415
|
+
case "swap": {
|
|
416
|
+
let e = u[i], t = 1e-7, n = a > e, r = a < e, ee = n && h != null && a >= h - t, g = r && m != null && a <= m + t;
|
|
417
|
+
if (!ee && !g) return {
|
|
418
|
+
value: p,
|
|
419
|
+
thumbIndex: i,
|
|
420
|
+
didSwap: !1
|
|
421
|
+
};
|
|
422
|
+
let v = ee ? i + 1 : i - 1, y = p.map((e, t) => t === i ? _ : d[t] ?? u[t]), b = a;
|
|
423
|
+
b = ee ? Math.max(a, p[v]) : Math.min(a, p[v]);
|
|
424
|
+
let x = $(p, v, b, o, s, c, l, y), S = ee ? v - 1 : v + 1, C = x[S - 1], w = x[S + 1], T = C == null ? o : C + f;
|
|
425
|
+
T = Math.max(T, o + S * f);
|
|
426
|
+
let te = w == null ? s : w - f;
|
|
427
|
+
te = Math.min(te, s - (x.length - 1 - S) * f);
|
|
428
|
+
let ne = F(_, T, te);
|
|
429
|
+
return x[S] = Number(ne.toFixed(12)), {
|
|
430
|
+
value: x,
|
|
431
|
+
thumbIndex: v,
|
|
432
|
+
didSwap: !0
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
default: return {
|
|
436
|
+
value: p,
|
|
437
|
+
thumbIndex: i,
|
|
438
|
+
didSwap: !1
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
var $e = 2;
|
|
443
|
+
function et(e, t) {
|
|
444
|
+
if (!e) return {
|
|
445
|
+
start: 0,
|
|
446
|
+
end: 0
|
|
447
|
+
};
|
|
448
|
+
function n(e) {
|
|
449
|
+
let t = e == null ? 0 : parseFloat(e);
|
|
450
|
+
return Number.isNaN(t) ? 0 : t;
|
|
451
|
+
}
|
|
452
|
+
let r = t ? "Top" : "InlineStart", i = t ? "Bottom" : "InlineEnd";
|
|
453
|
+
return {
|
|
454
|
+
start: n(e[`border${r}Width`]) + n(e[`padding${r}`]),
|
|
455
|
+
end: n(e[`border${i}Width`]) + n(e[`padding${i}`])
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function tt(e, t) {
|
|
459
|
+
if (t.current != null && e.changedTouches) {
|
|
460
|
+
let n = e;
|
|
461
|
+
for (let e = 0; e < n.changedTouches.length; e += 1) {
|
|
462
|
+
let r = n.changedTouches[e];
|
|
463
|
+
if (r.identifier === t.current) return {
|
|
464
|
+
x: r.clientX,
|
|
465
|
+
y: r.clientY
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
x: e.clientX,
|
|
472
|
+
y: e.clientY
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
var nt = /*#__PURE__*/ K.forwardRef(function(t, n) {
|
|
476
|
+
let { render: i, className: a, style: o, ...s } = t, { disabled: l, dragging: u, inset: d, isArrayValue: ee, lastChangeReasonRef: b, max: x, min: S, minStepsBetweenValues: C, onValueCommitted: w, orientation: T, pressedThumbCenterOffsetRef: re, pressedThumbIndexRef: ie, pressedValuesRef: oe, registerFieldControlRef: se, renderBeforeHydration: le, setActive: de, setDragging: fe, setValue: pe, state: me, step: he, thumbCollisionBehavior: ge, thumbRefs: E, values: D } = Ke(), _e = ue(), ve = D.length > 1, O = T === "vertical", k = K.useRef(null), ye = K.useRef(null), be = c((e) => {
|
|
477
|
+
e && ye.current == null && (ye.current = r(e).getComputedStyle(e));
|
|
478
|
+
}), A = K.useRef(null), xe = K.useRef(0), j = K.useRef(0), M = K.useRef(null), N = K.useRef(!1), P = h(D);
|
|
479
|
+
function Se(e) {
|
|
480
|
+
return e?.querySelector("input[type=\"range\"]");
|
|
481
|
+
}
|
|
482
|
+
function Ce(e) {
|
|
483
|
+
ie.current = e, E.current[e] || (re.current = null);
|
|
484
|
+
}
|
|
485
|
+
function we() {
|
|
486
|
+
ie.current = -1, re.current = null;
|
|
487
|
+
}
|
|
488
|
+
function Te(t) {
|
|
489
|
+
return e(t) ? E.current.some((n) => !e(n) || !p(n, t) ? !1 : Se(n)?.disabled === !0) : !1;
|
|
490
|
+
}
|
|
491
|
+
function I(e) {
|
|
492
|
+
let t = k.current, n = ie.current;
|
|
493
|
+
if (!t || n < 0 || n >= D.length) return n >= D.length && (M.current = null), null;
|
|
494
|
+
let { width: r, height: i, bottom: a, left: o, right: s } = t.getBoundingClientRect(), c = et(ye.current, O), l = j.current, u = (O ? i : r) - c.start - c.end - l * 2, d = re.current ?? 0, f = e.x - d, p = e.y - d, m = O ? a - p - c.end : (_e === "rtl" ? s - f : f - o) - c.start, h = F((m - l) / u, 0, 1), g = (x - S) * h + S;
|
|
495
|
+
return g = Ze(g, he, S), g = F(g, S, x), ve ? Qe(ge, D, P.current, oe.current, n, g, S, x, he, C) : {
|
|
496
|
+
value: ee ? [g] : g,
|
|
497
|
+
thumbIndex: n,
|
|
498
|
+
didSwap: !1
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function L(t) {
|
|
502
|
+
oe.current = ve ? D.slice() : null, M.current = null, P.current = D;
|
|
503
|
+
let n = ie.current, r = n;
|
|
504
|
+
if (n > -1 && n < D.length) {
|
|
505
|
+
if (D[n] === x) {
|
|
506
|
+
let e = n;
|
|
507
|
+
for (; e > 0 && D[e - 1] === x;) --e;
|
|
508
|
+
r = e;
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
let n = O ? "y" : "x", i;
|
|
512
|
+
r = -1;
|
|
513
|
+
for (let a = 0; a < E.current.length; a += 1) {
|
|
514
|
+
let o = E.current[a];
|
|
515
|
+
if (e(o) && !Se(o)?.disabled) {
|
|
516
|
+
let e = Ye(o, O), s = Math.abs(t[n] - e);
|
|
517
|
+
(i === void 0 || s <= i) && (r = a, i = s);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (r > -1 && r !== n && Ce(r), d) {
|
|
522
|
+
let t = E.current[r];
|
|
523
|
+
if (e(t)) {
|
|
524
|
+
let e = t.getBoundingClientRect();
|
|
525
|
+
j.current = e[O ? "height" : "width"] / 2;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function R(e) {
|
|
530
|
+
let t = Se(E.current?.[e]);
|
|
531
|
+
t && t.focus({
|
|
532
|
+
preventScroll: !0,
|
|
533
|
+
focusVisible: !1
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
function Ee(e, t, n) {
|
|
537
|
+
let r = pe(e.value, ae(t, n, void 0, { activeThumbIndex: e.thumbIndex }));
|
|
538
|
+
return r && (M.current = e.value, P.current = Array.isArray(e.value) ? e.value : [e.value], e.didSwap && (Ce(e.thumbIndex), R(e.thumbIndex))), r;
|
|
539
|
+
}
|
|
540
|
+
let De = c((e) => {
|
|
541
|
+
let t = tt(e, A);
|
|
542
|
+
if (t == null) return;
|
|
543
|
+
if (xe.current += 1, e.type === "pointermove" && e.buttons === 0) {
|
|
544
|
+
z(e);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
let n = I(t);
|
|
548
|
+
n != null && Ue(n.value, he, C) && (!u && xe.current > $e && fe(!0), Ee(n, ce, e));
|
|
549
|
+
}), z = c((e) => {
|
|
550
|
+
if (tt(e, A) == null) return;
|
|
551
|
+
de(-1), fe(!1), re.current = null;
|
|
552
|
+
let t = M.current;
|
|
553
|
+
if (Array.isArray(t) && t.length !== D.length && (M.current = null), M.current != null) {
|
|
554
|
+
let t = b.current;
|
|
555
|
+
w(M.current, ne(t, e));
|
|
556
|
+
}
|
|
557
|
+
"pointerType" in e && k.current?.hasPointerCapture(e.pointerId) && k.current?.releasePointerCapture(e.pointerId), ie.current = -1, V();
|
|
558
|
+
}), Oe = c((e) => {
|
|
559
|
+
A.current ?? z(e);
|
|
560
|
+
}), B = c((e) => {
|
|
561
|
+
let t = N.current;
|
|
562
|
+
if (N.current = !1, l) return;
|
|
563
|
+
if (Te(y(e))) {
|
|
564
|
+
we();
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
let n = e.changedTouches[0];
|
|
568
|
+
if (n == null) return;
|
|
569
|
+
if (A.current = n.identifier, !t) {
|
|
570
|
+
let t = {
|
|
571
|
+
x: n.clientX,
|
|
572
|
+
y: n.clientY
|
|
573
|
+
};
|
|
574
|
+
L(t);
|
|
575
|
+
let r = I(t);
|
|
576
|
+
if (r == null) return;
|
|
577
|
+
R(r.thumbIndex), Ee(r, te, e), xe.current = 0;
|
|
578
|
+
}
|
|
579
|
+
let r = m(k.current);
|
|
580
|
+
r.addEventListener("touchmove", De, { passive: !0 }), r.addEventListener("touchend", z, { passive: !0 }), r.addEventListener("touchcancel", z, { passive: !0 });
|
|
581
|
+
}), V = c(() => {
|
|
582
|
+
let e = m(k.current);
|
|
583
|
+
e.removeEventListener("pointermove", De), e.removeEventListener("pointerup", z), e.removeEventListener("pointercancel", Oe), e.removeEventListener("touchmove", De), e.removeEventListener("touchend", z), e.removeEventListener("touchcancel", z), A.current = null, oe.current = null, M.current = null, N.current = !1;
|
|
584
|
+
}), H = _();
|
|
585
|
+
return K.useEffect(() => {
|
|
586
|
+
let e = k.current;
|
|
587
|
+
if (!e) return () => V();
|
|
588
|
+
let t = g(e, "touchstart", B, { passive: !0 });
|
|
589
|
+
return () => {
|
|
590
|
+
t(), H.cancel(), V();
|
|
591
|
+
};
|
|
592
|
+
}, [
|
|
593
|
+
V,
|
|
594
|
+
B,
|
|
595
|
+
k,
|
|
596
|
+
H
|
|
597
|
+
]), K.useEffect(() => {
|
|
598
|
+
l && V();
|
|
599
|
+
}, [l, V]), f("div", t, {
|
|
600
|
+
state: me,
|
|
601
|
+
ref: [
|
|
602
|
+
n,
|
|
603
|
+
se,
|
|
604
|
+
k,
|
|
605
|
+
be
|
|
606
|
+
],
|
|
607
|
+
props: [{
|
|
608
|
+
"data-base-ui-slider-control": le ? "" : void 0,
|
|
609
|
+
onPointerDown(t) {
|
|
610
|
+
N.current = !1;
|
|
611
|
+
let n = k.current, r = y(t.nativeEvent);
|
|
612
|
+
if (!n || l || t.defaultPrevented || !e(r) || t.button !== 0) return;
|
|
613
|
+
if (Te(r)) {
|
|
614
|
+
we();
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
let i = {
|
|
618
|
+
x: t.clientX,
|
|
619
|
+
y: t.clientY
|
|
620
|
+
};
|
|
621
|
+
L(i);
|
|
622
|
+
let a = I(i);
|
|
623
|
+
if (a == null) return;
|
|
624
|
+
p(E.current[a.thumbIndex], v(m(n))) ? t.preventDefault() : H.request(() => {
|
|
625
|
+
R(a.thumbIndex);
|
|
626
|
+
}), fe(!0), re.current ?? Ee(a, te, t.nativeEvent), t.nativeEvent.pointerId && n.setPointerCapture(t.nativeEvent.pointerId), xe.current = 0, N.current = Q(t.pointerType);
|
|
627
|
+
let o = m(n);
|
|
628
|
+
o.addEventListener("pointermove", De, { passive: !0 }), o.addEventListener("pointerup", z, { once: !0 }), o.addEventListener("pointercancel", Oe, { once: !0 });
|
|
629
|
+
}
|
|
630
|
+
}, s],
|
|
631
|
+
stateAttributesMapping: We
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
process.env.NODE_ENV !== "production" && (nt.displayName = "SliderControl");
|
|
635
|
+
var rt = /*#__PURE__*/ K.forwardRef(function(e, t) {
|
|
636
|
+
let { render: n, className: r, style: i, ...a } = e, { state: o } = Ke();
|
|
637
|
+
return f("div", e, {
|
|
638
|
+
state: o,
|
|
639
|
+
ref: t,
|
|
640
|
+
props: [{ style: { position: "relative" } }, a],
|
|
641
|
+
stateAttributesMapping: We
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
process.env.NODE_ENV !== "production" && (rt.displayName = "SliderTrack");
|
|
645
|
+
var it = "data-index", at, ot = /* @__PURE__ */ new Set([
|
|
646
|
+
...he,
|
|
647
|
+
_e,
|
|
648
|
+
pe
|
|
649
|
+
]);
|
|
650
|
+
function st(e, t, n, r) {
|
|
651
|
+
if (!(t < 0)) return e.length === 2 ? `${L(e[t], r, n)} ${t === 0 ? "start" : "end"} range` : n ? L(e[t], r, n) : void 0;
|
|
652
|
+
}
|
|
653
|
+
function ct(e, t, n, r, i) {
|
|
654
|
+
let a = e + t * n, o = Number(a.toFixed(Math.max(Xe(e), Xe(t), Xe(r))));
|
|
655
|
+
return F(o, r, i);
|
|
656
|
+
}
|
|
657
|
+
var lt = /*#__PURE__*/ K.forwardRef(function(e, t) {
|
|
658
|
+
let { render: i, children: o, className: l, "aria-describedby": u, "aria-label": d, "aria-labelledby": m, "aria-valuetext": h, disabled: g = !1, getAriaLabel: _, getAriaValueText: v, id: y, index: b, inputRef: x, onBlur: S, onFocus: C, onKeyDown: w, tabIndex: te, style: ne, ...re } = e, ie = oe(y), { active: ae, lastUsedThumbIndex: se, controlRef: ce, disabled: le, validation: D, format: ve, handleInputChange: O, inset: k, isArrayValue: ye, labelId: be, largeStep: A, locale: j, max: N, min: P, minStepsBetweenValues: Se, form: Ce, name: F, orientation: we, pressedThumbCenterOffsetRef: Ee, pressedThumbIndexRef: De, renderBeforeHydration: z, setActive: Oe, setIndicatorPosition: B, state: V, step: H, thumbRefs: ke, values: U } = Ke(), Ae = ue(), je = g || le, W = U.length > 1, G = we === "vertical", Me = Ae === "rtl", { setTouched: Ne, validationMode: Pe } = Te(), Fe = K.useRef(null), Ie = K.useRef(null), Le = M(je, Ie), Y = K.useRef(!1), Be = c((e) => {
|
|
659
|
+
Y.current || C?.(e);
|
|
660
|
+
}), X = c((e) => {
|
|
661
|
+
Y.current || S?.(e);
|
|
662
|
+
}), Ve = oe(), Ue = R(), Z = W ? Ve : Ue, Ge = K.useMemo(() => ({ inputId: Z }), [Z]), { ref: qe, index: Je } = xe({ metadata: Ge }), Q = W ? b ?? Je : 0, Xe = Q === U.length - 1, $ = U[Q], Qe = I($, P, N), [$e, et] = K.useState(), tt = Re(), nt = se >= 0 && se < U.length ? se : -1, rt = c(() => {
|
|
663
|
+
let e = ce.current, t = Fe.current;
|
|
664
|
+
if (!e || !t) return;
|
|
665
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = G ? "height" : "width", a = r[i] - n[i], o = (n[i] / 2 + a * Qe / 100) / r[i] * 100, s = Number.isFinite(o) ? o : void 0;
|
|
666
|
+
et(s), Q === 0 ? B((e) => [s, e[1]]) : Xe && B((e) => [e[0], s]);
|
|
667
|
+
});
|
|
668
|
+
n(() => {
|
|
669
|
+
k && queueMicrotask(rt);
|
|
670
|
+
}, [rt, k]), n(() => {
|
|
671
|
+
k && rt();
|
|
672
|
+
}, [
|
|
673
|
+
rt,
|
|
674
|
+
k,
|
|
675
|
+
Qe
|
|
676
|
+
]), n(() => {
|
|
677
|
+
if (!k) return;
|
|
678
|
+
let e = ce.current, t = Fe.current;
|
|
679
|
+
if (!e || !t) return;
|
|
680
|
+
let n = r(e).ResizeObserver;
|
|
681
|
+
if (typeof n != "function") return;
|
|
682
|
+
let i = new n(rt);
|
|
683
|
+
return i.observe(e), i.observe(t), () => {
|
|
684
|
+
i.disconnect();
|
|
685
|
+
};
|
|
686
|
+
}, [
|
|
687
|
+
ce,
|
|
688
|
+
rt,
|
|
689
|
+
k
|
|
690
|
+
]);
|
|
691
|
+
let lt = G ? "bottom" : "insetInlineStart", ut = G ? "left" : "top", dt;
|
|
692
|
+
W ? ae === Q ? dt = 2 : nt === Q && (dt = 1) : ae === Q && (dt = 1);
|
|
693
|
+
let ft;
|
|
694
|
+
ft = !k && !Number.isFinite(Qe) ? T : {
|
|
695
|
+
position: "absolute",
|
|
696
|
+
[lt]: k ? "var(--position)" : `${Qe}%`,
|
|
697
|
+
[ut]: "50%",
|
|
698
|
+
translate: `${(G || !Me ? -1 : 1) * 50}% ${(G ? 1 : -1) * 50}%`,
|
|
699
|
+
zIndex: dt,
|
|
700
|
+
...k && {
|
|
701
|
+
"--position": `${$e ?? 0}%`,
|
|
702
|
+
visibility: z && tt || $e === void 0 ? "hidden" : void 0
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
let pt;
|
|
706
|
+
G && (pt = Me ? "vertical-rl" : "vertical-lr");
|
|
707
|
+
let mt = typeof _ == "function" ? _(Q) : d, ht = a({
|
|
708
|
+
"aria-label": mt,
|
|
709
|
+
"aria-labelledby": m ?? (mt == null ? be : void 0),
|
|
710
|
+
"aria-describedby": u,
|
|
711
|
+
"aria-orientation": we,
|
|
712
|
+
"aria-valuenow": $,
|
|
713
|
+
"aria-valuetext": typeof v == "function" ? v(L($, j, ve), $, Q) : h ?? st(U, Q, ve, j),
|
|
714
|
+
disabled: je,
|
|
715
|
+
form: Ce,
|
|
716
|
+
id: Z,
|
|
717
|
+
max: N,
|
|
718
|
+
min: P,
|
|
719
|
+
name: F,
|
|
720
|
+
onChange(e) {
|
|
721
|
+
O(e.currentTarget.valueAsNumber, Q, e);
|
|
722
|
+
},
|
|
723
|
+
onFocus(e) {
|
|
724
|
+
let t = Y.current;
|
|
725
|
+
Y.current = !1, Oe(Q), Le(!0), t && e.stopPropagation();
|
|
726
|
+
},
|
|
727
|
+
onBlur(e) {
|
|
728
|
+
Y.current ? e.stopPropagation() : (Oe(-1), !ke.current.some((t) => p(t, e.relatedTarget)) && (Ne(!0), Le(!1), Pe === "onBlur" && D.commit(He($, Q, P, N, ye, U))));
|
|
729
|
+
},
|
|
730
|
+
onKeyDown(e) {
|
|
731
|
+
if (e.defaultPrevented || !ot.has(e.key)) return;
|
|
732
|
+
he.has(e.key) && e.stopPropagation();
|
|
733
|
+
let t = null, n = 0, r = e.shiftKey ? A : H, i = Ze($, H, P);
|
|
734
|
+
switch (e.key) {
|
|
735
|
+
case de:
|
|
736
|
+
n = 1;
|
|
737
|
+
break;
|
|
738
|
+
case fe:
|
|
739
|
+
n = Me ? -1 : 1;
|
|
740
|
+
break;
|
|
741
|
+
case me:
|
|
742
|
+
n = -1;
|
|
743
|
+
break;
|
|
744
|
+
case ge:
|
|
745
|
+
n = Me ? 1 : -1;
|
|
746
|
+
break;
|
|
747
|
+
case _e:
|
|
748
|
+
r = A, n = 1;
|
|
749
|
+
break;
|
|
750
|
+
case pe:
|
|
751
|
+
r = A, n = -1;
|
|
752
|
+
break;
|
|
753
|
+
case "End":
|
|
754
|
+
t = W && Number.isFinite(U[Q + 1]) ? U[Q + 1] - H * Se : N;
|
|
755
|
+
break;
|
|
756
|
+
case E: t = W && Number.isFinite(U[Q - 1]) ? U[Q - 1] + H * Se : P;
|
|
757
|
+
}
|
|
758
|
+
if (n !== 0 && (t = ct(i, r, n, P, N)), t !== null) {
|
|
759
|
+
let n = e.currentTarget;
|
|
760
|
+
ee(n) || (Y.current = !0, n.blur(), n.focus({
|
|
761
|
+
preventScroll: !0,
|
|
762
|
+
focusVisible: !0
|
|
763
|
+
})), O(t, Q, e), e.preventDefault();
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
step: H,
|
|
767
|
+
style: {
|
|
768
|
+
...T,
|
|
769
|
+
width: "100%",
|
|
770
|
+
height: "100%",
|
|
771
|
+
writingMode: pt
|
|
772
|
+
},
|
|
773
|
+
tabIndex: te,
|
|
774
|
+
type: "range",
|
|
775
|
+
value: $ ?? ""
|
|
776
|
+
}, (e) => D.getValidationProps(je, e), {
|
|
777
|
+
onFocus: Be,
|
|
778
|
+
onBlur: X,
|
|
779
|
+
onKeyDown: w
|
|
780
|
+
}), gt = s(Ie, D.inputRef, x);
|
|
781
|
+
return f("div", e, {
|
|
782
|
+
state: V,
|
|
783
|
+
ref: [
|
|
784
|
+
t,
|
|
785
|
+
qe,
|
|
786
|
+
Fe
|
|
787
|
+
],
|
|
788
|
+
props: [{
|
|
789
|
+
[it]: Q,
|
|
790
|
+
children: /*#__PURE__*/ J(K.Fragment, { children: [
|
|
791
|
+
o,
|
|
792
|
+
/*#__PURE__*/ q("input", {
|
|
793
|
+
ref: gt,
|
|
794
|
+
...ht,
|
|
795
|
+
suppressHydrationWarning: !0
|
|
796
|
+
}),
|
|
797
|
+
k && Xe && z && (at ||= /*#__PURE__*/ q(ze, { script: "" }))
|
|
798
|
+
] }),
|
|
799
|
+
id: ie,
|
|
800
|
+
onPointerDown(e) {
|
|
801
|
+
if (je) return;
|
|
802
|
+
De.current = Q;
|
|
803
|
+
let t = Ye(e.currentTarget, G);
|
|
804
|
+
Ee.current = (G ? e.clientY : e.clientX) - t;
|
|
805
|
+
},
|
|
806
|
+
style: ft,
|
|
807
|
+
suppressHydrationWarning: z || void 0
|
|
808
|
+
}, re],
|
|
809
|
+
stateAttributesMapping: We
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
process.env.NODE_ENV !== "production" && (lt.displayName = "SliderThumb");
|
|
813
|
+
function ut(e, t, n, r, i, a) {
|
|
814
|
+
let o = {
|
|
815
|
+
visibility: a || n && (r === void 0 || t && i === void 0) ? "hidden" : void 0,
|
|
816
|
+
position: e ? "absolute" : "relative",
|
|
817
|
+
[e ? "width" : "height"]: "inherit"
|
|
818
|
+
}, s = `${r ?? 0}%`, c = `${(i ?? 0) - (r ?? 0)}%`;
|
|
819
|
+
return n && (o["--start-position"] = s, s = "var(--start-position)", t && (o["--relative-size"] = c, c = "var(--relative-size)")), o[e ? "bottom" : "insetInlineStart"] = t ? s : 0, o[e ? "height" : "width"] = t ? c : s, o;
|
|
820
|
+
}
|
|
821
|
+
var dt = /*#__PURE__*/ K.forwardRef(function(e, t) {
|
|
822
|
+
let { render: n, className: r, style: i, ...a } = e, { indicatorPosition: o, inset: s, max: c, min: l, orientation: u, renderBeforeHydration: d, state: p, values: m } = Ke(), h = Re(), ee = ut(u === "vertical", m.length > 1, s, s ? o[0] : I(m[0], l, c), s ? o[1] : I(m[m.length - 1], l, c), s && d && h);
|
|
823
|
+
return f("div", e, {
|
|
824
|
+
state: p,
|
|
825
|
+
ref: t,
|
|
826
|
+
props: [{
|
|
827
|
+
"data-base-ui-slider-indicator": d ? "" : void 0,
|
|
828
|
+
style: ee,
|
|
829
|
+
suppressHydrationWarning: d || void 0
|
|
830
|
+
}, a],
|
|
831
|
+
stateAttributesMapping: We
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
process.env.NODE_ENV !== "production" && (dt.displayName = "SliderIndicator");
|
|
835
|
+
var ft = K.forwardRef(function({ className: e, defaultValue: t, value: n, min: r = 0, max: a = 100, thumbAriaLabels: o, ...s }, c) {
|
|
836
|
+
let l = K.useMemo(() => Array.isArray(n) ? n : Array.isArray(t) ? t : [r], [
|
|
837
|
+
n,
|
|
838
|
+
t,
|
|
839
|
+
r
|
|
840
|
+
]);
|
|
841
|
+
return /* @__PURE__ */ q(Je, {
|
|
842
|
+
ref: c,
|
|
843
|
+
className: i("ck-slider", e),
|
|
844
|
+
"data-slot": "slider",
|
|
845
|
+
defaultValue: t,
|
|
846
|
+
value: n,
|
|
847
|
+
min: r,
|
|
848
|
+
max: a,
|
|
849
|
+
thumbAlignment: "edge",
|
|
850
|
+
...s,
|
|
851
|
+
children: /* @__PURE__ */ J(nt, {
|
|
852
|
+
className: "ck-slider-control",
|
|
853
|
+
children: [/* @__PURE__ */ q(rt, {
|
|
854
|
+
"data-slot": "slider-track",
|
|
855
|
+
className: "ck-slider-track",
|
|
856
|
+
children: /* @__PURE__ */ q(dt, {
|
|
857
|
+
"data-slot": "slider-range",
|
|
858
|
+
className: "ck-slider-range"
|
|
859
|
+
})
|
|
860
|
+
}), Array.from({ length: l.length }, (e, t) => /* @__PURE__ */ q(lt, {
|
|
861
|
+
"data-slot": "slider-thumb",
|
|
862
|
+
className: "ck-slider-thumb",
|
|
863
|
+
"aria-label": o?.[t] ?? (l.length > 1 ? `Value ${t + 1} of ${l.length}` : "Value")
|
|
864
|
+
}, t))]
|
|
865
|
+
})
|
|
866
|
+
});
|
|
867
|
+
});
|
|
868
|
+
ft.displayName = "Slider";
|
|
869
|
+
var pt = [
|
|
870
|
+
"pen",
|
|
871
|
+
"line",
|
|
872
|
+
"rect",
|
|
873
|
+
"circle",
|
|
874
|
+
"arrow"
|
|
875
|
+
];
|
|
876
|
+
function mt(e) {
|
|
877
|
+
return e != null && pt.includes(e);
|
|
878
|
+
}
|
|
879
|
+
var ht = [
|
|
880
|
+
{
|
|
881
|
+
value: "pen",
|
|
882
|
+
label: "Pen",
|
|
883
|
+
icon: B
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
value: "line",
|
|
887
|
+
label: "Line",
|
|
888
|
+
icon: je
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
value: "rect",
|
|
892
|
+
label: "Rectangle",
|
|
893
|
+
icon: H
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
value: "circle",
|
|
897
|
+
label: "Circle",
|
|
898
|
+
icon: U
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
value: "arrow",
|
|
902
|
+
label: "Arrow",
|
|
903
|
+
icon: Ae
|
|
904
|
+
}
|
|
905
|
+
], gt = K.memo(function({ tools: e, colors: t, drawing: n, onSave: r, saveDisabled: i, onCancel: a }) {
|
|
906
|
+
let o = e ? ht.filter((t) => e.includes(t.value)) : ht;
|
|
907
|
+
function s(e) {
|
|
908
|
+
let t = e[0];
|
|
909
|
+
mt(t) && n.setTool(t);
|
|
910
|
+
}
|
|
911
|
+
function c(e) {
|
|
912
|
+
let t = e[0];
|
|
913
|
+
t && n.setColor(t);
|
|
914
|
+
}
|
|
915
|
+
return /* @__PURE__ */ J("div", {
|
|
916
|
+
className: "ck-annotation-toolbar",
|
|
917
|
+
role: "toolbar",
|
|
918
|
+
"aria-label": "Annotation tools",
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ q(N, {
|
|
921
|
+
value: [n.tool],
|
|
922
|
+
onValueChange: s,
|
|
923
|
+
size: "sm",
|
|
924
|
+
spacing: 1,
|
|
925
|
+
"aria-label": "Drawing tool",
|
|
926
|
+
children: o.map(({ value: e, label: t, icon: n }) => /* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
927
|
+
render: /* @__PURE__ */ q(be, {
|
|
928
|
+
value: e,
|
|
929
|
+
"aria-label": t
|
|
930
|
+
}),
|
|
931
|
+
children: /* @__PURE__ */ q(n, {
|
|
932
|
+
size: 16,
|
|
933
|
+
stroke: 2
|
|
934
|
+
})
|
|
935
|
+
}), /* @__PURE__ */ q(b, { children: t })] }, e))
|
|
936
|
+
}),
|
|
937
|
+
/* @__PURE__ */ q(C, {
|
|
938
|
+
orientation: "vertical",
|
|
939
|
+
className: "ck-annotation-separator"
|
|
940
|
+
}),
|
|
941
|
+
/* @__PURE__ */ q(N, {
|
|
942
|
+
value: [n.color],
|
|
943
|
+
onValueChange: c,
|
|
944
|
+
size: "sm",
|
|
945
|
+
spacing: 1,
|
|
946
|
+
"aria-label": "Stroke color",
|
|
947
|
+
children: t.map((e) => /* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
948
|
+
render: /* @__PURE__ */ q(be, {
|
|
949
|
+
value: e.value,
|
|
950
|
+
"aria-label": e.label
|
|
951
|
+
}),
|
|
952
|
+
children: /* @__PURE__ */ q("span", {
|
|
953
|
+
className: "ck-annotation-swatch",
|
|
954
|
+
style: { "--ck-bg": e.value }
|
|
955
|
+
})
|
|
956
|
+
}), /* @__PURE__ */ q(b, { children: e.label })] }, e.value))
|
|
957
|
+
}),
|
|
958
|
+
/* @__PURE__ */ q(C, {
|
|
959
|
+
orientation: "vertical",
|
|
960
|
+
className: "ck-annotation-separator"
|
|
961
|
+
}),
|
|
962
|
+
/* @__PURE__ */ J("div", {
|
|
963
|
+
className: "ck-annotation-stroke",
|
|
964
|
+
children: [/* @__PURE__ */ q(ft, {
|
|
965
|
+
className: "ck-annotation-slider",
|
|
966
|
+
value: [n.strokeWidth],
|
|
967
|
+
onValueChange: (e) => {
|
|
968
|
+
let t = Array.isArray(e) ? e[0] : e;
|
|
969
|
+
t != null && Number.isFinite(t) && n.setStrokeWidth(t);
|
|
970
|
+
},
|
|
971
|
+
min: 1,
|
|
972
|
+
max: 12,
|
|
973
|
+
step: 1,
|
|
974
|
+
"aria-label": "Stroke width"
|
|
975
|
+
}), /* @__PURE__ */ J("span", {
|
|
976
|
+
className: "ck-annotation-stroke-label",
|
|
977
|
+
children: [n.strokeWidth, "px"]
|
|
978
|
+
})]
|
|
979
|
+
}),
|
|
980
|
+
/* @__PURE__ */ q(C, {
|
|
981
|
+
orientation: "vertical",
|
|
982
|
+
className: "ck-annotation-separator"
|
|
983
|
+
}),
|
|
984
|
+
/* @__PURE__ */ J(D, { children: [
|
|
985
|
+
/* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
986
|
+
render: /* @__PURE__ */ q(d, {
|
|
987
|
+
variant: "outline",
|
|
988
|
+
size: "icon-sm",
|
|
989
|
+
"aria-label": "Undo",
|
|
990
|
+
onClick: () => n.undo(),
|
|
991
|
+
disabled: !n.canUndo
|
|
992
|
+
}),
|
|
993
|
+
children: /* @__PURE__ */ q(W, {
|
|
994
|
+
size: 16,
|
|
995
|
+
stroke: 2
|
|
996
|
+
})
|
|
997
|
+
}), /* @__PURE__ */ q(b, { children: /* @__PURE__ */ J("span", {
|
|
998
|
+
className: "ck-annotation-tooltip",
|
|
999
|
+
children: [
|
|
1000
|
+
"Undo",
|
|
1001
|
+
" ",
|
|
1002
|
+
/* @__PURE__ */ J(O, { children: [/* @__PURE__ */ q(z, { children: "⌘" }), /* @__PURE__ */ q(z, { children: "Z" })] })
|
|
1003
|
+
]
|
|
1004
|
+
}) })] }),
|
|
1005
|
+
/* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
1006
|
+
render: /* @__PURE__ */ q(d, {
|
|
1007
|
+
variant: "outline",
|
|
1008
|
+
size: "icon-sm",
|
|
1009
|
+
"aria-label": "Redo",
|
|
1010
|
+
onClick: () => n.redo(),
|
|
1011
|
+
disabled: !n.canRedo
|
|
1012
|
+
}),
|
|
1013
|
+
children: /* @__PURE__ */ q(ke, {
|
|
1014
|
+
size: 16,
|
|
1015
|
+
stroke: 2
|
|
1016
|
+
})
|
|
1017
|
+
}), /* @__PURE__ */ q(b, { children: /* @__PURE__ */ J("span", {
|
|
1018
|
+
className: "ck-annotation-tooltip",
|
|
1019
|
+
children: [
|
|
1020
|
+
"Redo",
|
|
1021
|
+
" ",
|
|
1022
|
+
/* @__PURE__ */ J(O, { children: [
|
|
1023
|
+
/* @__PURE__ */ q(z, { children: "⌘" }),
|
|
1024
|
+
/* @__PURE__ */ q(z, { children: "⇧" }),
|
|
1025
|
+
/* @__PURE__ */ q(z, { children: "Z" })
|
|
1026
|
+
] })
|
|
1027
|
+
]
|
|
1028
|
+
}) })] }),
|
|
1029
|
+
/* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
1030
|
+
render: /* @__PURE__ */ q(d, {
|
|
1031
|
+
variant: "outline",
|
|
1032
|
+
size: "icon-sm",
|
|
1033
|
+
"aria-label": "Clear all",
|
|
1034
|
+
onClick: () => n.clear(),
|
|
1035
|
+
disabled: n.paths.length === 0
|
|
1036
|
+
}),
|
|
1037
|
+
children: /* @__PURE__ */ q(G, {
|
|
1038
|
+
size: 16,
|
|
1039
|
+
stroke: 2
|
|
1040
|
+
})
|
|
1041
|
+
}), /* @__PURE__ */ q(b, { children: "Clear all" })] })
|
|
1042
|
+
] }),
|
|
1043
|
+
/* @__PURE__ */ q(C, {
|
|
1044
|
+
orientation: "vertical",
|
|
1045
|
+
className: "ck-annotation-separator"
|
|
1046
|
+
}),
|
|
1047
|
+
r ? /* @__PURE__ */ J(D, { children: [/* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
1048
|
+
render: /* @__PURE__ */ q(d, {
|
|
1049
|
+
variant: "outline",
|
|
1050
|
+
size: "icon-sm",
|
|
1051
|
+
"aria-label": "Cancel",
|
|
1052
|
+
onClick: a
|
|
1053
|
+
}),
|
|
1054
|
+
children: /* @__PURE__ */ q(V, {
|
|
1055
|
+
size: 16,
|
|
1056
|
+
stroke: 2
|
|
1057
|
+
})
|
|
1058
|
+
}), /* @__PURE__ */ q(b, { children: /* @__PURE__ */ J("span", {
|
|
1059
|
+
className: "ck-annotation-tooltip",
|
|
1060
|
+
children: ["Cancel ", /* @__PURE__ */ q(z, { children: "Esc" })]
|
|
1061
|
+
}) })] }), /* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
1062
|
+
render: /* @__PURE__ */ q(d, {
|
|
1063
|
+
size: "icon-sm",
|
|
1064
|
+
"aria-label": "Save drawing",
|
|
1065
|
+
"aria-disabled": i || void 0,
|
|
1066
|
+
className: u(i && "ck-annotation-save--disabled"),
|
|
1067
|
+
onClick: () => {
|
|
1068
|
+
i || r();
|
|
1069
|
+
}
|
|
1070
|
+
}),
|
|
1071
|
+
children: /* @__PURE__ */ q(Oe, {
|
|
1072
|
+
size: 16,
|
|
1073
|
+
stroke: 2
|
|
1074
|
+
})
|
|
1075
|
+
}), /* @__PURE__ */ q(b, { children: i ? "Draw something first" : "Save drawing" })] })] }) : /* @__PURE__ */ J(S, { children: [/* @__PURE__ */ q(x, {
|
|
1076
|
+
render: /* @__PURE__ */ q(d, {
|
|
1077
|
+
variant: "outline",
|
|
1078
|
+
size: "icon-sm",
|
|
1079
|
+
"aria-label": "Cancel",
|
|
1080
|
+
onClick: a
|
|
1081
|
+
}),
|
|
1082
|
+
children: /* @__PURE__ */ q(V, {
|
|
1083
|
+
size: 16,
|
|
1084
|
+
stroke: 2
|
|
1085
|
+
})
|
|
1086
|
+
}), /* @__PURE__ */ q(b, { children: /* @__PURE__ */ J("span", {
|
|
1087
|
+
className: "ck-annotation-tooltip",
|
|
1088
|
+
children: ["Cancel ", /* @__PURE__ */ q(z, { children: "Esc" })]
|
|
1089
|
+
}) })] })
|
|
1090
|
+
]
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
export { X as n, Y as r, gt as t };
|