@commentkit/comment-kit 0.6.9 → 0.7.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.
- package/CHANGELOG.md +36 -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 +23 -11
- package/dist/demo.es.js +146 -69
- package/dist/headless.es.js +2 -2
- 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-B9SxYqoF.js +1093 -0
- package/dist/shared/{bridge-DRE03N9X.js → bridge-CJoGYngu.js} +6 -3
- package/dist/shared/{button-group-CHfMRXyA.js → button-group-Cl9CrvvU.js} +1 -1
- package/dist/shared/comment-drawing-canvas-Dzb5YoFw.js +124 -0
- package/dist/shared/{comment-image-lightbox-0VdAs2iT.js → comment-image-lightbox-BPYJT1sB.js} +62 -57
- package/dist/shared/{comment-kit-core-D0kY00St.js → comment-kit-core-BaSuMzp9.js} +1027 -729
- package/dist/shared/comment-kit-ui-CzfdAZs2.js +20181 -0
- package/dist/shared/comment-screenshot-annotator-C7X-_bm6.js +151 -0
- package/dist/shared/comment-screenshot-overlay-wIrZrcRy.js +206 -0
- package/dist/shared/comment-utils-BycYTSxA.js +602 -0
- package/dist/shared/{dev-export-panel-BLngcr5q.js → dev-export-panel-FwFVdady.js} +8 -8
- package/dist/shared/{dev-grab-pDAfH2lr.js → dev-grab-DDqg0LQf.js} +1 -1
- package/dist/shared/dist-De294MVF.js +623 -0
- package/dist/shared/{element-selector-CtFzgHvq.js → element-selector-BhJm-NSs.js} +294 -288
- package/dist/shared/{icons-BSHCWYO1.js → icons-nzMOLzrm.js} +2 -3
- package/dist/shared/{mount-ui-CVivB_eQ.js → mount-ui--ijs8pWT.js} +4 -4
- package/dist/shared/{pusher-BEl7Qn-8.js → pusher-ipHMJnO_.js} +1 -1
- package/dist/shared/{realtime-BG_t_ze7.js → realtime-Dk41VwKg.js} +71 -50
- package/dist/shared/{separator-DusFNTs-.js → separator-XDBsaWyw.js} +891 -785
- package/dist/shared/{shadow-root-CmYXiSRR.js → shadow-root-C5v-T8lQ.js} +1 -1
- package/dist/shared/styles-D3yMtaec.js +2 -0
- package/dist/shared/{useValueChanged-DQXLia-2.js → useValueChanged-CrzfD8l-.js} +15 -15
- package/dist/shared/{websocket-manager-BTRqNTB7.js → websocket-manager-DhLWh3Jr.js} +2 -2
- 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 +16 -17
- package/dist/types/core/comment-kit-core.d.ts +19 -11
- package/dist/types/core/local-demo.d.ts +1 -0
- package/dist/types/core/types.d.ts +68 -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 +372 -0
- package/docs/local-demo.md +60 -0
- package/package.json +16 -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-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/local-demo-context-BohlYbHt.js +0 -6
- 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
|
@@ -1,669 +0,0 @@
|
|
|
1
|
-
import { I as e, L as t, R as n, V as r, a as i, c as a, g as o, i as s, m as c, n as l, o as u, s as d, u as f, z as p } from "./button-By0hGrJK.js";
|
|
2
|
-
import { Qt as m, _t as h, dt as g, ft as _, gt as v, pt as y } from "./separator-DusFNTs-.js";
|
|
3
|
-
import { D as b, n as x, v as S } from "./useValueChanged-DQXLia-2.js";
|
|
4
|
-
import { i as C } from "./ShadowRootContext-Bv-4aElu.js";
|
|
5
|
-
import { t as w } from "./createReactComponent-BZHeRbD0.js";
|
|
6
|
-
import { a as T, f as E, i as D, l as O, o as k, p as A, r as j, s as M } from "./button-group-CHfMRXyA.js";
|
|
7
|
-
import { r as N } from "./clamp-CcFVX0vC.js";
|
|
8
|
-
import * as P from "react";
|
|
9
|
-
import { jsx as F } from "react/jsx-runtime";
|
|
10
|
-
var I = w("outline", "arrow-up-right", "ArrowUpRight", [["path", {
|
|
11
|
-
d: "M17 7l-10 10",
|
|
12
|
-
key: "svg-0"
|
|
13
|
-
}], ["path", {
|
|
14
|
-
d: "M8 7l9 0l0 9",
|
|
15
|
-
key: "svg-1"
|
|
16
|
-
}]]), L = w("outline", "check", "Check", [["path", {
|
|
17
|
-
d: "M5 12l5 5l10 -10",
|
|
18
|
-
key: "svg-0"
|
|
19
|
-
}]]), R = P.forwardRef(function({ className: e, ...t }, n) {
|
|
20
|
-
return /* @__PURE__ */ F("kbd", {
|
|
21
|
-
ref: n,
|
|
22
|
-
"data-slot": "kbd",
|
|
23
|
-
className: d("ck-kbd", e),
|
|
24
|
-
...t
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
R.displayName = "Kbd";
|
|
28
|
-
var z = P.forwardRef(function({ className: e, ...t }, n) {
|
|
29
|
-
return /* @__PURE__ */ F("kbd", {
|
|
30
|
-
ref: n,
|
|
31
|
-
"data-slot": "kbd-group",
|
|
32
|
-
className: d("ck-kbd-group", e),
|
|
33
|
-
...t
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
z.displayName = "KbdGroup";
|
|
37
|
-
var B = /*#__PURE__*/ P.createContext(void 0);
|
|
38
|
-
process.env.NODE_ENV !== "production" && (B.displayName = "ToggleGroupContext");
|
|
39
|
-
function ee() {
|
|
40
|
-
return P.useContext(B);
|
|
41
|
-
}
|
|
42
|
-
var V = /*#__PURE__*/ P.createContext({
|
|
43
|
-
register: () => {},
|
|
44
|
-
unregister: () => {},
|
|
45
|
-
subscribeMapChange: () => () => {},
|
|
46
|
-
nextIndexRef: { current: 0 }
|
|
47
|
-
});
|
|
48
|
-
process.env.NODE_ENV !== "production" && (V.displayName = "CompositeListContext");
|
|
49
|
-
function H() {
|
|
50
|
-
return P.useContext(V);
|
|
51
|
-
}
|
|
52
|
-
function te(e = {}) {
|
|
53
|
-
let { guess: n, label: r, metadata: i, textRef: a, index: o } = e, { register: s, unregister: c, subscribeMapChange: l, nextIndexRef: u } = H(), d = P.useRef(-1), [f, p] = P.useState(o == null && n ? () => {
|
|
54
|
-
if (d.current === -1) {
|
|
55
|
-
let e = u.current;
|
|
56
|
-
u.current += 1, d.current = e;
|
|
57
|
-
}
|
|
58
|
-
return d.current;
|
|
59
|
-
} : -1), m = o ?? f, h = P.useRef(null), g = P.useCallback((e) => {
|
|
60
|
-
let t = h.current;
|
|
61
|
-
t && c(t), h.current = e, e && s(e, {
|
|
62
|
-
metadata: i ?? null,
|
|
63
|
-
index: o ?? null,
|
|
64
|
-
label: r,
|
|
65
|
-
textRef: a
|
|
66
|
-
});
|
|
67
|
-
}, [
|
|
68
|
-
o,
|
|
69
|
-
s,
|
|
70
|
-
c,
|
|
71
|
-
i,
|
|
72
|
-
r,
|
|
73
|
-
a
|
|
74
|
-
]);
|
|
75
|
-
return t(() => {
|
|
76
|
-
if (o == null) return l((e) => {
|
|
77
|
-
let t = h.current ? e.get(h.current)?.index : null;
|
|
78
|
-
t != null && p(t);
|
|
79
|
-
});
|
|
80
|
-
}, [o, l]), {
|
|
81
|
-
ref: g,
|
|
82
|
-
index: m
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function ne(e = {}) {
|
|
86
|
-
let { highlightItemOnHover: t, highlightedIndex: n, onHighlightedIndexChange: r } = i(), { ref: a, index: s } = te(e), c = n === s, l = P.useRef(null), u = o(a, l);
|
|
87
|
-
return {
|
|
88
|
-
compositeProps: {
|
|
89
|
-
tabIndex: c ? 0 : -1,
|
|
90
|
-
onFocus() {
|
|
91
|
-
r(s);
|
|
92
|
-
},
|
|
93
|
-
onMouseMove() {
|
|
94
|
-
let e = l.current;
|
|
95
|
-
if (!t || !e) return;
|
|
96
|
-
let n = e.hasAttribute("disabled") || e.ariaDisabled === "true";
|
|
97
|
-
!c && !n && e.focus();
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
compositeRef: u,
|
|
101
|
-
index: s
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function U(e) {
|
|
105
|
-
let { render: t, className: r, style: i, state: a = p, props: o = n, refs: s = n, metadata: c, stateAttributesMapping: l, tag: u = "div", ...d } = e, { compositeProps: m, compositeRef: h } = ne({ metadata: c });
|
|
106
|
-
return f(u, e, {
|
|
107
|
-
state: a,
|
|
108
|
-
ref: [h, ...s],
|
|
109
|
-
props: [
|
|
110
|
-
m,
|
|
111
|
-
...o,
|
|
112
|
-
d
|
|
113
|
-
],
|
|
114
|
-
stateAttributesMapping: l
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
var W = /*#__PURE__*/ P.forwardRef(function(e, t) {
|
|
118
|
-
let { className: n, defaultPressed: r = !1, disabled: i = !1, form: a, onPressedChange: o, pressed: s, render: c, type: d, value: p, nativeButton: m = !0, style: h, ...g } = e, _ = x(p || void 0), v = ee(), y = v?.value ?? [], C = (i || v?.disabled) ?? !1;
|
|
119
|
-
process.env.NODE_ENV !== "production" && P.useEffect(() => {
|
|
120
|
-
v && p === void 0 && v.isValueInitialized && u("A `<Toggle>` component rendered in a `<ToggleGroup>` has no explicit `value` prop.", "This will cause issues between the Toggle Group and Toggle values.", "Provide the `<Toggle>` with a `value` prop matching the `<ToggleGroup>` values prop type.");
|
|
121
|
-
}, [
|
|
122
|
-
v,
|
|
123
|
-
p,
|
|
124
|
-
v?.isValueInitialized
|
|
125
|
-
]);
|
|
126
|
-
let [w, T] = N({
|
|
127
|
-
controlled: v ? _ !== void 0 && y.indexOf(_) > -1 : s,
|
|
128
|
-
default: r,
|
|
129
|
-
name: "Toggle",
|
|
130
|
-
state: "pressed"
|
|
131
|
-
}), { getButtonProps: E, buttonRef: D } = l({
|
|
132
|
-
disabled: C,
|
|
133
|
-
native: m
|
|
134
|
-
}), O = {
|
|
135
|
-
disabled: C,
|
|
136
|
-
pressed: w
|
|
137
|
-
}, k = [D, t], A = [
|
|
138
|
-
{
|
|
139
|
-
"aria-pressed": w,
|
|
140
|
-
onClick(e) {
|
|
141
|
-
let t = !w, n = b(S, e.nativeEvent);
|
|
142
|
-
o?.(t, n), !n.isCanceled && (_ && v?.setGroupValue?.(_, t, n), !n.isCanceled && T(t));
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
g,
|
|
146
|
-
E
|
|
147
|
-
], j = f("button", e, {
|
|
148
|
-
enabled: !v,
|
|
149
|
-
state: O,
|
|
150
|
-
ref: k,
|
|
151
|
-
props: A
|
|
152
|
-
}), M = P.useMemo(() => ({
|
|
153
|
-
disabled: C,
|
|
154
|
-
focusableWhenDisabled: !1
|
|
155
|
-
}), [C]);
|
|
156
|
-
return v ? /*#__PURE__*/ F(U, {
|
|
157
|
-
tag: "button",
|
|
158
|
-
render: c,
|
|
159
|
-
className: n,
|
|
160
|
-
style: h,
|
|
161
|
-
metadata: M,
|
|
162
|
-
state: O,
|
|
163
|
-
refs: k,
|
|
164
|
-
props: A
|
|
165
|
-
}) : j;
|
|
166
|
-
});
|
|
167
|
-
process.env.NODE_ENV !== "production" && (W.displayName = "Toggle");
|
|
168
|
-
function G(e) {
|
|
169
|
-
let { children: n, elementsRef: i, labelsRef: a, onMapChange: o } = e, s = c(o), [, l] = P.useState(0), u = r(ie).current, d = r(re).current, f = P.useRef(0), p = P.useRef(!0), m = P.useRef(null), h = P.useRef(null), g = c(() => {
|
|
170
|
-
p.current || (p.current = !0, l((e) => e + 1));
|
|
171
|
-
}), _ = c((e, t) => {
|
|
172
|
-
d.set(e, t), g();
|
|
173
|
-
}), v = c((e) => {
|
|
174
|
-
d.delete(e), g();
|
|
175
|
-
}), y = c((e) => {
|
|
176
|
-
let t = /* @__PURE__ */ new Map();
|
|
177
|
-
return i.current.length = 0, a && (a.current.length = 0), e.forEach((e) => {
|
|
178
|
-
t.set(e.element, {
|
|
179
|
-
...e.registration.metadata ?? {},
|
|
180
|
-
index: e.index
|
|
181
|
-
}), i.current[e.index] = e.element, a && (a.current[e.index] = e.registration.label === void 0 ? e.registration.textRef?.current?.textContent ?? e.element.textContent : e.registration.label);
|
|
182
|
-
}), f.current = i.current.length, t;
|
|
183
|
-
});
|
|
184
|
-
function b(e) {
|
|
185
|
-
if (h.current?.disconnect(), h.current = null, typeof MutationObserver != "function" || e.length < 2) return;
|
|
186
|
-
let t = new MutationObserver((n) => {
|
|
187
|
-
if (!se(n)) return;
|
|
188
|
-
let r = null;
|
|
189
|
-
for (let n of e) if (n.isConnected) {
|
|
190
|
-
if (r && K(r, n) > 0) {
|
|
191
|
-
t.disconnect(), g();
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
r = n;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
h.current = t;
|
|
198
|
-
let n = /* @__PURE__ */ new Set();
|
|
199
|
-
for (let t = 1; t < e.length; t += 1) {
|
|
200
|
-
let r = oe(e[t - 1], e[t]);
|
|
201
|
-
r && n.add(r);
|
|
202
|
-
}
|
|
203
|
-
n.forEach((e) => t.observe(e, { childList: !0 }));
|
|
204
|
-
}
|
|
205
|
-
let x = c(() => {
|
|
206
|
-
let [e, t] = ae(d), n = y(e), r = m.current, i = !r || r.length !== e.length || e.some((e, t) => {
|
|
207
|
-
let n = r[t];
|
|
208
|
-
return e.index !== n.index || e.element !== n.element || e.registration.index !== n.registration.index || e.registration.metadata !== n.registration.metadata;
|
|
209
|
-
});
|
|
210
|
-
b(t), m.current = e, p.current = !1, i && (u.forEach((e) => e(n)), s(n));
|
|
211
|
-
});
|
|
212
|
-
t(() => (!p.current && m.current && y(m.current), () => {
|
|
213
|
-
i.current = [], a && (a.current = []);
|
|
214
|
-
}), [
|
|
215
|
-
i,
|
|
216
|
-
a,
|
|
217
|
-
y
|
|
218
|
-
]), t(() => {
|
|
219
|
-
p.current && x();
|
|
220
|
-
}), t(() => () => {
|
|
221
|
-
h.current?.disconnect(), p.current = !0;
|
|
222
|
-
}, []);
|
|
223
|
-
let S = c((e) => (u.add(e), () => {
|
|
224
|
-
u.delete(e);
|
|
225
|
-
})), C = P.useMemo(() => ({
|
|
226
|
-
register: _,
|
|
227
|
-
unregister: v,
|
|
228
|
-
subscribeMapChange: S,
|
|
229
|
-
nextIndexRef: f
|
|
230
|
-
}), [
|
|
231
|
-
_,
|
|
232
|
-
v,
|
|
233
|
-
S,
|
|
234
|
-
f
|
|
235
|
-
]);
|
|
236
|
-
return /*#__PURE__*/ F(V.Provider, {
|
|
237
|
-
value: C,
|
|
238
|
-
children: n
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
function re() {
|
|
242
|
-
return /* @__PURE__ */ new Map();
|
|
243
|
-
}
|
|
244
|
-
function ie() {
|
|
245
|
-
return /* @__PURE__ */ new Set();
|
|
246
|
-
}
|
|
247
|
-
function ae(e) {
|
|
248
|
-
let t = /* @__PURE__ */ new Set(), n = [], r = [];
|
|
249
|
-
e.forEach((e, i) => {
|
|
250
|
-
if (!i.isConnected) return;
|
|
251
|
-
let a = e.index, o = {
|
|
252
|
-
index: a ?? -1,
|
|
253
|
-
element: i,
|
|
254
|
-
registration: e
|
|
255
|
-
};
|
|
256
|
-
a === null ? r.push(o) : a >= 0 && (t.add(a), n.push(o));
|
|
257
|
-
});
|
|
258
|
-
let i = 0;
|
|
259
|
-
return r.sort((e, t) => K(e.element, t.element)), r.forEach((e) => {
|
|
260
|
-
for (; t.has(i);) i += 1;
|
|
261
|
-
e.index = i, n.push(e), i += 1;
|
|
262
|
-
}), t.size > 0 && n.sort((e, t) => e.index - t.index), [n, r.map((e) => e.element)];
|
|
263
|
-
}
|
|
264
|
-
function oe(e, t) {
|
|
265
|
-
let n = e.parentElement;
|
|
266
|
-
for (; n && !n.contains(t);) n = n.parentElement;
|
|
267
|
-
return n;
|
|
268
|
-
}
|
|
269
|
-
function se(e) {
|
|
270
|
-
for (let t of e) for (let e = 0; e < t.removedNodes.length; e += 1) if (t.removedNodes[e].isConnected) return !0;
|
|
271
|
-
return !1;
|
|
272
|
-
}
|
|
273
|
-
function K(e, t) {
|
|
274
|
-
return e.nextElementSibling === t ? -1 : t.nextElementSibling === e ? 1 : e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
275
|
-
}
|
|
276
|
-
function q(e) {
|
|
277
|
-
return e == null || e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true";
|
|
278
|
-
}
|
|
279
|
-
var ce = "data-composite-item-active";
|
|
280
|
-
function le(e) {
|
|
281
|
-
let { loopFocus: r = !0, orientation: i = "both", grid: a, onLoop: s, direction: l, highlightedIndex: u, onHighlightedIndexChange: d, rootRef: f, enableHomeAndEndKeys: p = !1, stopEventPropagation: b, disabledIndices: x, modifierKeys: S = n } = e, [C, w] = P.useState(0), O = a != null, N = P.useRef(null), F = o(N, f), I = P.useRef([]), L = P.useRef(!1), R = P.useRef(null), z = u ?? C, B = c((e, t = !1) => {
|
|
282
|
-
if (R.current = I.current[e] ?? null, (d ?? w)(e), t) {
|
|
283
|
-
let t = I.current[e];
|
|
284
|
-
A(N.current, t, l, i);
|
|
285
|
-
}
|
|
286
|
-
}), ee = c((e) => {
|
|
287
|
-
if (e.size === 0) return;
|
|
288
|
-
if (L.current) {
|
|
289
|
-
let e = I.current, t = e.indexOf(R.current);
|
|
290
|
-
if (t === -1) {
|
|
291
|
-
let t = e[z];
|
|
292
|
-
!t || h(e, z, x) ? B(ue(e, x)) : R.current = t;
|
|
293
|
-
} else t !== z && B(t);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
L.current = !0;
|
|
297
|
-
let t = Array.from(e.keys()), n = t.find((e) => e?.hasAttribute("data-composite-item-active")) ?? null, r = n ? e.get(n)?.index ?? -1 : -1;
|
|
298
|
-
if (r !== -1) B(r);
|
|
299
|
-
else if (h(t, z, x)) {
|
|
300
|
-
let e = g(t, { disabledIndices: x });
|
|
301
|
-
v(t, e) || B(e);
|
|
302
|
-
}
|
|
303
|
-
A(N.current, n, l, i);
|
|
304
|
-
});
|
|
305
|
-
t(() => {
|
|
306
|
-
if (x == null || u != null || !L.current) return;
|
|
307
|
-
let e = I.current;
|
|
308
|
-
if (h(e, z, x)) {
|
|
309
|
-
let t = g(e, { disabledIndices: x });
|
|
310
|
-
v(e, t) || B(t);
|
|
311
|
-
}
|
|
312
|
-
}, [
|
|
313
|
-
x,
|
|
314
|
-
u,
|
|
315
|
-
z,
|
|
316
|
-
I,
|
|
317
|
-
B
|
|
318
|
-
]);
|
|
319
|
-
let V = c((e, t, n) => s ? s(e, t, n, I) : n), H = c((e) => {
|
|
320
|
-
let t = e.key === "Home" || e.key === "End";
|
|
321
|
-
if (!M.has(e.key) || !p && t || de(e, S) || !N.current) return;
|
|
322
|
-
let n = l === "rtl", o = n ? D : T, c = n ? T : D, u = i === "vertical" ? j : o, d = i === "vertical" ? k : c, f = m(e.nativeEvent);
|
|
323
|
-
if (f != null && E(f) && !q(f)) {
|
|
324
|
-
let t = f.selectionStart, n = f.selectionEnd, r = f.value;
|
|
325
|
-
if (t == null || e.shiftKey || t !== n || e.key !== d && t < r.length || e.key !== u && t > 0) return;
|
|
326
|
-
}
|
|
327
|
-
let h = z, C = y(I, x), w = _(I, x);
|
|
328
|
-
a != null && (h = a({
|
|
329
|
-
disabledIndices: x,
|
|
330
|
-
elementsRef: I,
|
|
331
|
-
event: e,
|
|
332
|
-
highlightedIndex: z,
|
|
333
|
-
loopFocus: r,
|
|
334
|
-
maxIndex: w,
|
|
335
|
-
minIndex: C,
|
|
336
|
-
onLoop: V,
|
|
337
|
-
orientation: i,
|
|
338
|
-
rtl: n
|
|
339
|
-
}));
|
|
340
|
-
let A = i !== "vertical" && e.key === o || i !== "horizontal" && e.key === "ArrowDown", P = i !== "vertical" && e.key === c || i !== "horizontal" && e.key === "ArrowUp";
|
|
341
|
-
p && (e.key === "Home" ? h = C : e.key === "End" && (h = w)), h === z && (A || P) && (r && h === w && A ? (h = C, s && (h = s(e, z, h, I))) : r && h === C && P ? (h = w, s && (h = s(e, z, h, I))) : h = g(I.current, {
|
|
342
|
-
startingIndex: h,
|
|
343
|
-
decrement: P,
|
|
344
|
-
disabledIndices: x
|
|
345
|
-
})), h !== z && !v(I.current, h) && (b && e.stopPropagation(), (O || t || A || P) && e.preventDefault(), B(h, !0), queueMicrotask(() => {
|
|
346
|
-
I.current[h]?.focus();
|
|
347
|
-
}));
|
|
348
|
-
});
|
|
349
|
-
return {
|
|
350
|
-
props: {
|
|
351
|
-
ref: F,
|
|
352
|
-
onFocus(e) {
|
|
353
|
-
let t = N.current, n = m(e.nativeEvent);
|
|
354
|
-
t && n != null && E(n) && n.setSelectionRange(0, n.value.length);
|
|
355
|
-
},
|
|
356
|
-
onKeyDown: H
|
|
357
|
-
},
|
|
358
|
-
highlightedIndex: z,
|
|
359
|
-
onHighlightedIndexChange: B,
|
|
360
|
-
elementsRef: I,
|
|
361
|
-
onMapChange: ee,
|
|
362
|
-
relayKeyboardEvent: H
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
function ue(e, t) {
|
|
366
|
-
let n = -1;
|
|
367
|
-
for (let r = 0; r < e.length; r += 1) {
|
|
368
|
-
let i = e[r];
|
|
369
|
-
if (i && !h(e, r, t)) {
|
|
370
|
-
if (i.hasAttribute("data-composite-item-active")) return r;
|
|
371
|
-
n === -1 && (n = r);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return Math.max(n, 0);
|
|
375
|
-
}
|
|
376
|
-
function de(e, t) {
|
|
377
|
-
for (let n of O) if (!t.includes(n) && e.getModifierState(n)) return !0;
|
|
378
|
-
return !1;
|
|
379
|
-
}
|
|
380
|
-
function J(e) {
|
|
381
|
-
let { render: t, className: r, style: i, refs: a = n, props: o = n, state: c = p, stateAttributesMapping: l, highlightedIndex: u, onHighlightedIndexChange: d, orientation: m, grid: h, loopFocus: g, onLoop: _, enableHomeAndEndKeys: v, onMapChange: y, stopEventPropagation: b = !0, rootRef: x, disabledIndices: S, modifierKeys: w, highlightItemOnHover: T = !1, tag: E = "div", ...D } = e, { props: O, highlightedIndex: k, onHighlightedIndexChange: A, elementsRef: j, onMapChange: M, relayKeyboardEvent: N } = le({
|
|
382
|
-
grid: h,
|
|
383
|
-
loopFocus: g,
|
|
384
|
-
onLoop: _,
|
|
385
|
-
orientation: m,
|
|
386
|
-
highlightedIndex: u,
|
|
387
|
-
onHighlightedIndexChange: d,
|
|
388
|
-
rootRef: x,
|
|
389
|
-
stopEventPropagation: b,
|
|
390
|
-
enableHomeAndEndKeys: v,
|
|
391
|
-
direction: C(),
|
|
392
|
-
disabledIndices: S,
|
|
393
|
-
modifierKeys: w
|
|
394
|
-
}), I = f(E, e, {
|
|
395
|
-
state: c,
|
|
396
|
-
ref: a,
|
|
397
|
-
props: [
|
|
398
|
-
O,
|
|
399
|
-
...o,
|
|
400
|
-
D
|
|
401
|
-
],
|
|
402
|
-
stateAttributesMapping: l
|
|
403
|
-
}), L = P.useMemo(() => ({
|
|
404
|
-
highlightedIndex: k,
|
|
405
|
-
onHighlightedIndexChange: A,
|
|
406
|
-
highlightItemOnHover: T,
|
|
407
|
-
relayKeyboardEvent: N
|
|
408
|
-
}), [
|
|
409
|
-
k,
|
|
410
|
-
A,
|
|
411
|
-
T,
|
|
412
|
-
N
|
|
413
|
-
]);
|
|
414
|
-
return /*#__PURE__*/ F(s.Provider, {
|
|
415
|
-
value: L,
|
|
416
|
-
children: /*#__PURE__*/ F(G, {
|
|
417
|
-
elementsRef: j,
|
|
418
|
-
onMapChange: (e) => {
|
|
419
|
-
y?.(e), M(e);
|
|
420
|
-
},
|
|
421
|
-
children: I
|
|
422
|
-
})
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
var Y = /*#__PURE__*/ P.createContext(void 0);
|
|
426
|
-
process.env.NODE_ENV !== "production" && (Y.displayName = "ToolbarRootContext");
|
|
427
|
-
function X(t) {
|
|
428
|
-
let n = P.useContext(Y);
|
|
429
|
-
if (n === void 0 && !t) throw Error(process.env.NODE_ENV === "production" ? e(69) : "Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.");
|
|
430
|
-
return n;
|
|
431
|
-
}
|
|
432
|
-
var Z = /*#__PURE__*/ P.createContext(void 0);
|
|
433
|
-
process.env.NODE_ENV !== "production" && (Z.displayName = "ToolbarGroupContext");
|
|
434
|
-
function fe() {
|
|
435
|
-
return P.useContext(Z);
|
|
436
|
-
}
|
|
437
|
-
var pe = /*#__PURE__*/ P.forwardRef(function(e, t) {
|
|
438
|
-
let { defaultValue: r, disabled: i = !1, loopFocus: a = !0, onValueChange: o, orientation: s = "horizontal", multiple: l = !1, value: u, className: d, render: p, style: m, ...h } = e, g = X(!0), _ = fe(), v = r ?? n, y = u !== void 0 || r !== void 0, b = (g?.disabled ?? !1) || (_?.disabled ?? !1) || i, [x, S] = N({
|
|
439
|
-
controlled: u,
|
|
440
|
-
default: v,
|
|
441
|
-
name: "ToggleGroup",
|
|
442
|
-
state: "value"
|
|
443
|
-
}), C = c((e, t, n) => {
|
|
444
|
-
let r;
|
|
445
|
-
l ? (r = x.slice(), t ? r.push(e) : r.splice(x.indexOf(e), 1)) : r = t ? [e] : [], o?.(r, n), !n.isCanceled && S(r);
|
|
446
|
-
}), w = {
|
|
447
|
-
disabled: b,
|
|
448
|
-
multiple: l,
|
|
449
|
-
orientation: s
|
|
450
|
-
}, T = P.useMemo(() => ({
|
|
451
|
-
disabled: b,
|
|
452
|
-
setGroupValue: C,
|
|
453
|
-
value: x,
|
|
454
|
-
isValueInitialized: y
|
|
455
|
-
}), [
|
|
456
|
-
b,
|
|
457
|
-
C,
|
|
458
|
-
x,
|
|
459
|
-
y
|
|
460
|
-
]), E = { role: "group" }, D = f("div", e, {
|
|
461
|
-
enabled: !!g,
|
|
462
|
-
state: w,
|
|
463
|
-
ref: t,
|
|
464
|
-
props: [E, h]
|
|
465
|
-
});
|
|
466
|
-
return /*#__PURE__*/ F(B.Provider, {
|
|
467
|
-
value: T,
|
|
468
|
-
children: g ? D : /*#__PURE__*/ F(J, {
|
|
469
|
-
render: p,
|
|
470
|
-
className: d,
|
|
471
|
-
style: m,
|
|
472
|
-
state: w,
|
|
473
|
-
refs: [t],
|
|
474
|
-
props: [E, h],
|
|
475
|
-
loopFocus: a,
|
|
476
|
-
enableHomeAndEndKeys: !0,
|
|
477
|
-
orientation: s
|
|
478
|
-
})
|
|
479
|
-
});
|
|
480
|
-
});
|
|
481
|
-
process.env.NODE_ENV !== "production" && (pe.displayName = "ToggleGroup");
|
|
482
|
-
var me = P.createContext({}), he = P.forwardRef(function({ className: e, variant: t, size: n, spacing: r = 2, orientation: i = "horizontal", children: o, style: s, ...c }, l) {
|
|
483
|
-
return /* @__PURE__ */ F(pe, {
|
|
484
|
-
ref: l,
|
|
485
|
-
"data-slot": "toggle-group",
|
|
486
|
-
"data-variant": t,
|
|
487
|
-
"data-size": n,
|
|
488
|
-
"data-spacing": r,
|
|
489
|
-
"data-orientation": i,
|
|
490
|
-
orientation: i,
|
|
491
|
-
style: typeof s == "function" ? (e) => ({
|
|
492
|
-
"--gap": r,
|
|
493
|
-
...s(e)
|
|
494
|
-
}) : {
|
|
495
|
-
"--gap": r,
|
|
496
|
-
...s
|
|
497
|
-
},
|
|
498
|
-
className: a("ck-toggle-group", e),
|
|
499
|
-
...c,
|
|
500
|
-
children: /* @__PURE__ */ F(me.Provider, {
|
|
501
|
-
value: {
|
|
502
|
-
variant: t,
|
|
503
|
-
size: n,
|
|
504
|
-
spacing: r,
|
|
505
|
-
orientation: i
|
|
506
|
-
},
|
|
507
|
-
children: o
|
|
508
|
-
})
|
|
509
|
-
});
|
|
510
|
-
});
|
|
511
|
-
he.displayName = "ToggleGroup";
|
|
512
|
-
var ge = P.forwardRef(function({ className: e, children: t, variant: n = "default", size: r = "default", ...i }, o) {
|
|
513
|
-
let s = P.useContext(me);
|
|
514
|
-
return /* @__PURE__ */ F(W, {
|
|
515
|
-
ref: o,
|
|
516
|
-
"data-slot": "toggle-group-item",
|
|
517
|
-
"data-variant": s.variant ?? n,
|
|
518
|
-
"data-size": s.size ?? r,
|
|
519
|
-
"data-spacing": s.spacing,
|
|
520
|
-
className: a("ck-toggle ck-toggle-group-item", e),
|
|
521
|
-
...i,
|
|
522
|
-
children: t
|
|
523
|
-
});
|
|
524
|
-
});
|
|
525
|
-
ge.displayName = "ToggleGroupItem";
|
|
526
|
-
function _e(e) {
|
|
527
|
-
return Array.isArray(e) ? e.map((e) => _e(e)).join(",") : e == null ? "" : String(e);
|
|
528
|
-
}
|
|
529
|
-
function Q(e) {
|
|
530
|
-
return String(Math.round(e * 100) / 100);
|
|
531
|
-
}
|
|
532
|
-
function ve(e, t, n, r, i) {
|
|
533
|
-
let a = Math.atan2(r - t, n - e), o = Math.max(12, i * 4);
|
|
534
|
-
return {
|
|
535
|
-
x1: n - o * Math.cos(a - Math.PI / 6),
|
|
536
|
-
y1: r - o * Math.sin(a - Math.PI / 6),
|
|
537
|
-
x2: n - o * Math.cos(a + Math.PI / 6),
|
|
538
|
-
y2: r - o * Math.sin(a + Math.PI / 6)
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
function ye(e) {
|
|
542
|
-
if (e.points.length < 2) return null;
|
|
543
|
-
let t = e.points[0], n = e.points[e.points.length - 1];
|
|
544
|
-
if (!t || !n) return null;
|
|
545
|
-
let r = e.color, i = e.strokeWidth;
|
|
546
|
-
if (e.tool === "pen") return {
|
|
547
|
-
type: "path",
|
|
548
|
-
d: e.points.map((e, t) => `${t === 0 ? "M" : "L"} ${Q(e.x)} ${Q(e.y)}`).join(" "),
|
|
549
|
-
stroke: r,
|
|
550
|
-
strokeWidth: i,
|
|
551
|
-
fill: "none"
|
|
552
|
-
};
|
|
553
|
-
if (e.tool === "line") return {
|
|
554
|
-
type: "line",
|
|
555
|
-
x: t.x,
|
|
556
|
-
y: t.y,
|
|
557
|
-
width: n.x - t.x,
|
|
558
|
-
height: n.y - t.y,
|
|
559
|
-
stroke: r,
|
|
560
|
-
strokeWidth: i,
|
|
561
|
-
fill: "none"
|
|
562
|
-
};
|
|
563
|
-
if (e.tool === "rect") return {
|
|
564
|
-
type: "rectangle",
|
|
565
|
-
x: Math.min(t.x, n.x),
|
|
566
|
-
y: Math.min(t.y, n.y),
|
|
567
|
-
width: Math.abs(n.x - t.x),
|
|
568
|
-
height: Math.abs(n.y - t.y),
|
|
569
|
-
stroke: r,
|
|
570
|
-
strokeWidth: i,
|
|
571
|
-
fill: "none"
|
|
572
|
-
};
|
|
573
|
-
if (e.tool === "circle") return {
|
|
574
|
-
type: "circle",
|
|
575
|
-
x: Math.min(t.x, n.x),
|
|
576
|
-
y: Math.min(t.y, n.y),
|
|
577
|
-
width: Math.abs(n.x - t.x),
|
|
578
|
-
height: Math.abs(n.y - t.y),
|
|
579
|
-
stroke: r,
|
|
580
|
-
strokeWidth: i,
|
|
581
|
-
fill: "none"
|
|
582
|
-
};
|
|
583
|
-
let a = ve(t.x, t.y, n.x, n.y, i);
|
|
584
|
-
return {
|
|
585
|
-
type: "path",
|
|
586
|
-
d: [
|
|
587
|
-
`M ${Q(t.x)} ${Q(t.y)} L ${Q(n.x)} ${Q(n.y)}`,
|
|
588
|
-
`M ${Q(n.x)} ${Q(n.y)} L ${Q(a.x1)} ${Q(a.y1)}`,
|
|
589
|
-
`M ${Q(n.x)} ${Q(n.y)} L ${Q(a.x2)} ${Q(a.y2)}`
|
|
590
|
-
].join(" "),
|
|
591
|
-
stroke: r,
|
|
592
|
-
strokeWidth: i,
|
|
593
|
-
fill: "none"
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
var be = P.memo(function({ path: e }) {
|
|
597
|
-
let t = {
|
|
598
|
-
stroke: e.stroke,
|
|
599
|
-
strokeWidth: e.strokeWidth,
|
|
600
|
-
fill: e.fill || "none",
|
|
601
|
-
strokeLinecap: "round",
|
|
602
|
-
strokeLinejoin: "round",
|
|
603
|
-
pointerEvents: "none"
|
|
604
|
-
}, n = e.x ?? 0, r = e.y ?? 0, i = e.width ?? 0, a = e.height ?? 0;
|
|
605
|
-
switch (e.type) {
|
|
606
|
-
case "path": return e.d ? /* @__PURE__ */ F("path", {
|
|
607
|
-
d: e.d,
|
|
608
|
-
...t
|
|
609
|
-
}) : null;
|
|
610
|
-
case "line": return /* @__PURE__ */ F("line", {
|
|
611
|
-
x1: n,
|
|
612
|
-
y1: r,
|
|
613
|
-
x2: n + i,
|
|
614
|
-
y2: r + a,
|
|
615
|
-
...t
|
|
616
|
-
});
|
|
617
|
-
case "rectangle": return /* @__PURE__ */ F("rect", {
|
|
618
|
-
x: n,
|
|
619
|
-
y: r,
|
|
620
|
-
width: i,
|
|
621
|
-
height: a,
|
|
622
|
-
...t
|
|
623
|
-
});
|
|
624
|
-
case "circle": return /* @__PURE__ */ F("ellipse", {
|
|
625
|
-
cx: n + i / 2,
|
|
626
|
-
cy: r + a / 2,
|
|
627
|
-
rx: i / 2,
|
|
628
|
-
ry: a / 2,
|
|
629
|
-
...t
|
|
630
|
-
});
|
|
631
|
-
case "text": return e.text ? /* @__PURE__ */ F("text", {
|
|
632
|
-
x: n,
|
|
633
|
-
y: r,
|
|
634
|
-
fill: e.stroke,
|
|
635
|
-
fontSize: e.strokeWidth * 4,
|
|
636
|
-
pointerEvents: "none",
|
|
637
|
-
children: e.text
|
|
638
|
-
}) : null;
|
|
639
|
-
default: return null;
|
|
640
|
-
}
|
|
641
|
-
}), $ = /* @__PURE__ */ new Map();
|
|
642
|
-
function xe(e, t) {
|
|
643
|
-
let n = JSON.stringify({
|
|
644
|
-
locale: _e(e),
|
|
645
|
-
options: t
|
|
646
|
-
}), r = $.get(n);
|
|
647
|
-
if (r) return r;
|
|
648
|
-
let i = new Intl.NumberFormat(e, t);
|
|
649
|
-
return $.set(n, i), i;
|
|
650
|
-
}
|
|
651
|
-
function Se(e, t, n) {
|
|
652
|
-
return e == null ? "" : xe(t, n).format(e);
|
|
653
|
-
}
|
|
654
|
-
function Ce(e, t, n) {
|
|
655
|
-
return (e - t) * 100 / (n - t);
|
|
656
|
-
}
|
|
657
|
-
function we(e, t, n = Object.is) {
|
|
658
|
-
let { length: r } = e;
|
|
659
|
-
if (r !== t.length) return !1;
|
|
660
|
-
for (let i = 0; i < r; i += 1) if (!n(e[i], t[i])) return !1;
|
|
661
|
-
return !0;
|
|
662
|
-
}
|
|
663
|
-
function Te(e) {
|
|
664
|
-
return e == null ? void 0 : `${e}-label`;
|
|
665
|
-
}
|
|
666
|
-
function Ee(e, t) {
|
|
667
|
-
return e ?? t;
|
|
668
|
-
}
|
|
669
|
-
export { te as _, Se as a, L as b, he as c, J as d, ce as f, ne as g, U as h, Ce as i, ge as l, G as m, Ee as n, be as o, q as p, we as r, ye as s, Te as t, X as u, R as v, I as x, z as y };
|