@spear-ai/spectral 1.3.56 → 1.3.57

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.
@@ -1,373 +0,0 @@
1
- import "./styles/main.css";
2
- import * as s from "react";
3
- import { jsx as E, Fragment as H } from "react/jsx-runtime";
4
- import * as j from "react-dom";
5
- function g(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
6
- return function(r) {
7
- if (e?.(r), n === !1 || !r.defaultPrevented)
8
- return t?.(r);
9
- };
10
- }
11
- function L(e, t) {
12
- if (typeof e == "function")
13
- return e(t);
14
- e != null && (e.current = t);
15
- }
16
- function T(...e) {
17
- return (t) => {
18
- let n = !1;
19
- const o = e.map((r) => {
20
- const i = L(r, t);
21
- return !n && typeof i == "function" && (n = !0), i;
22
- });
23
- if (n)
24
- return () => {
25
- for (let r = 0; r < o.length; r++) {
26
- const i = o[r];
27
- typeof i == "function" ? i() : L(e[r], null);
28
- }
29
- };
30
- };
31
- }
32
- function N(...e) {
33
- return s.useCallback(T(...e), e);
34
- }
35
- function pe(e, t) {
36
- const n = s.createContext(t), o = (i) => {
37
- const { children: u, ...c } = i, l = s.useMemo(() => c, Object.values(c));
38
- return /* @__PURE__ */ E(n.Provider, { value: l, children: u });
39
- };
40
- o.displayName = e + "Provider";
41
- function r(i) {
42
- const u = s.useContext(n);
43
- if (u) return u;
44
- if (t !== void 0) return t;
45
- throw new Error(`\`${i}\` must be used within \`${e}\``);
46
- }
47
- return [o, r];
48
- }
49
- function ve(e, t = []) {
50
- let n = [];
51
- function o(i, u) {
52
- const c = s.createContext(u), l = n.length;
53
- n = [...n, u];
54
- const a = (p) => {
55
- const { scope: v, children: h, ...m } = p, y = v?.[e]?.[l] || c, C = s.useMemo(() => m, Object.values(m));
56
- return /* @__PURE__ */ E(y.Provider, { value: C, children: h });
57
- };
58
- a.displayName = i + "Provider";
59
- function d(p, v) {
60
- const h = v?.[e]?.[l] || c, m = s.useContext(h);
61
- if (m) return m;
62
- if (u !== void 0) return u;
63
- throw new Error(`\`${p}\` must be used within \`${i}\``);
64
- }
65
- return [a, d];
66
- }
67
- const r = () => {
68
- const i = n.map((u) => s.createContext(u));
69
- return function(c) {
70
- const l = c?.[e] || i;
71
- return s.useMemo(
72
- () => ({ [`__scope${e}`]: { ...c, [e]: l } }),
73
- [c, l]
74
- );
75
- };
76
- };
77
- return r.scopeName = e, [o, V(r, ...t)];
78
- }
79
- function V(...e) {
80
- const t = e[0];
81
- if (e.length === 1) return t;
82
- const n = () => {
83
- const o = e.map((r) => ({
84
- useScope: r(),
85
- scopeName: r.scopeName
86
- }));
87
- return function(i) {
88
- const u = o.reduce((c, { useScope: l, scopeName: a }) => {
89
- const p = l(i)[`__scope${a}`];
90
- return { ...c, ...p };
91
- }, {});
92
- return s.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
93
- };
94
- };
95
- return n.scopeName = t.scopeName, n;
96
- }
97
- var B = globalThis?.document ? s.useLayoutEffect : () => {
98
- }, z = s[" useId ".trim().toString()] || (() => {
99
- }), K = 0;
100
- function Ee(e) {
101
- const [t, n] = s.useState(z());
102
- return B(() => {
103
- n((o) => o ?? String(K++));
104
- }, [e]), e || (t ? `radix-${t}` : "");
105
- }
106
- var X = s[" useInsertionEffect ".trim().toString()] || B;
107
- function me({
108
- prop: e,
109
- defaultProp: t,
110
- onChange: n = () => {
111
- },
112
- caller: o
113
- }) {
114
- const [r, i, u] = Y({
115
- defaultProp: t,
116
- onChange: n
117
- }), c = e !== void 0, l = c ? e : r;
118
- {
119
- const d = s.useRef(e !== void 0);
120
- s.useEffect(() => {
121
- const p = d.current;
122
- p !== c && console.warn(
123
- `${o} is changing from ${p ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
124
- ), d.current = c;
125
- }, [c, o]);
126
- }
127
- const a = s.useCallback(
128
- (d) => {
129
- if (c) {
130
- const p = Z(d) ? d(e) : d;
131
- p !== e && u.current?.(p);
132
- } else
133
- i(d);
134
- },
135
- [c, e, i, u]
136
- );
137
- return [l, a];
138
- }
139
- function Y({
140
- defaultProp: e,
141
- onChange: t
142
- }) {
143
- const [n, o] = s.useState(e), r = s.useRef(n), i = s.useRef(t);
144
- return X(() => {
145
- i.current = t;
146
- }, [t]), s.useEffect(() => {
147
- r.current !== n && (i.current?.(n), r.current = n);
148
- }, [n, r]), [n, o, i];
149
- }
150
- function Z(e) {
151
- return typeof e == "function";
152
- }
153
- // @__NO_SIDE_EFFECTS__
154
- function q(e) {
155
- const t = /* @__PURE__ */ G(e), n = s.forwardRef((o, r) => {
156
- const { children: i, ...u } = o, c = s.Children.toArray(i), l = c.find(J);
157
- if (l) {
158
- const a = l.props.children, d = c.map((p) => p === l ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : p);
159
- return /* @__PURE__ */ E(t, { ...u, ref: r, children: s.isValidElement(a) ? s.cloneElement(a, void 0, d) : null });
160
- }
161
- return /* @__PURE__ */ E(t, { ...u, ref: r, children: i });
162
- });
163
- return n.displayName = `${e}.Slot`, n;
164
- }
165
- // @__NO_SIDE_EFFECTS__
166
- function G(e) {
167
- const t = s.forwardRef((n, o) => {
168
- const { children: r, ...i } = n;
169
- if (s.isValidElement(r)) {
170
- const u = ee(r), c = Q(i, r.props);
171
- return r.type !== s.Fragment && (c.ref = o ? T(o, u) : u), s.cloneElement(r, c);
172
- }
173
- return s.Children.count(r) > 1 ? s.Children.only(null) : null;
174
- });
175
- return t.displayName = `${e}.SlotClone`, t;
176
- }
177
- var F = Symbol("radix.slottable");
178
- // @__NO_SIDE_EFFECTS__
179
- function he(e) {
180
- const t = ({ children: n }) => /* @__PURE__ */ E(H, { children: n });
181
- return t.displayName = `${e}.Slottable`, t.__radixId = F, t;
182
- }
183
- function J(e) {
184
- return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === F;
185
- }
186
- function Q(e, t) {
187
- const n = { ...t };
188
- for (const o in t) {
189
- const r = e[o], i = t[o];
190
- /^on[A-Z]/.test(o) ? r && i ? n[o] = (...c) => {
191
- const l = i(...c);
192
- return r(...c), l;
193
- } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
194
- }
195
- return { ...e, ...n };
196
- }
197
- function ee(e) {
198
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
199
- return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
200
- }
201
- var te = [
202
- "a",
203
- "button",
204
- "div",
205
- "form",
206
- "h2",
207
- "h3",
208
- "img",
209
- "input",
210
- "label",
211
- "li",
212
- "nav",
213
- "ol",
214
- "p",
215
- "select",
216
- "span",
217
- "svg",
218
- "ul"
219
- ], $ = te.reduce((e, t) => {
220
- const n = /* @__PURE__ */ q(`Primitive.${t}`), o = s.forwardRef((r, i) => {
221
- const { asChild: u, ...c } = r, l = u ? n : t;
222
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ E(l, { ...c, ref: i });
223
- });
224
- return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
225
- }, {});
226
- function ne(e, t) {
227
- e && j.flushSync(() => e.dispatchEvent(t));
228
- }
229
- function D(e) {
230
- const t = s.useRef(e);
231
- return s.useEffect(() => {
232
- t.current = e;
233
- }), s.useMemo(() => (...n) => t.current?.(...n), []);
234
- }
235
- function re(e, t = globalThis?.document) {
236
- const n = D(e);
237
- s.useEffect(() => {
238
- const o = (r) => {
239
- r.key === "Escape" && n(r);
240
- };
241
- return t.addEventListener("keydown", o, { capture: !0 }), () => t.removeEventListener("keydown", o, { capture: !0 });
242
- }, [n, t]);
243
- }
244
- var se = "DismissableLayer", S = "dismissableLayer.update", oe = "dismissableLayer.pointerDownOutside", ie = "dismissableLayer.focusOutside", I, W = s.createContext({
245
- layers: /* @__PURE__ */ new Set(),
246
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
247
- branches: /* @__PURE__ */ new Set()
248
- }), ce = s.forwardRef(
249
- (e, t) => {
250
- const {
251
- disableOutsidePointerEvents: n = !1,
252
- onEscapeKeyDown: o,
253
- onPointerDownOutside: r,
254
- onFocusOutside: i,
255
- onInteractOutside: u,
256
- onDismiss: c,
257
- ...l
258
- } = e, a = s.useContext(W), [d, p] = s.useState(null), v = d?.ownerDocument ?? globalThis?.document, [, h] = s.useState({}), m = N(t, (f) => p(f)), y = Array.from(a.layers), [C] = [...a.layersWithOutsidePointerEventsDisabled].slice(-1), k = y.indexOf(C), w = d ? y.indexOf(d) : -1, M = a.layersWithOutsidePointerEventsDisabled.size > 0, O = w >= k, U = le((f) => {
259
- const b = f.target, x = [...a.branches].some((P) => P.contains(b));
260
- !O || x || (r?.(f), u?.(f), f.defaultPrevented || c?.());
261
- }, v), R = de((f) => {
262
- const b = f.target;
263
- [...a.branches].some((P) => P.contains(b)) || (i?.(f), u?.(f), f.defaultPrevented || c?.());
264
- }, v);
265
- return re((f) => {
266
- w === a.layers.size - 1 && (o?.(f), !f.defaultPrevented && c && (f.preventDefault(), c()));
267
- }, v), s.useEffect(() => {
268
- if (d)
269
- return n && (a.layersWithOutsidePointerEventsDisabled.size === 0 && (I = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), a.layersWithOutsidePointerEventsDisabled.add(d)), a.layers.add(d), _(), () => {
270
- n && a.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = I);
271
- };
272
- }, [d, v, n, a]), s.useEffect(() => () => {
273
- d && (a.layers.delete(d), a.layersWithOutsidePointerEventsDisabled.delete(d), _());
274
- }, [d, a]), s.useEffect(() => {
275
- const f = () => h({});
276
- return document.addEventListener(S, f), () => document.removeEventListener(S, f);
277
- }, []), /* @__PURE__ */ E(
278
- $.div,
279
- {
280
- ...l,
281
- ref: m,
282
- style: {
283
- pointerEvents: M ? O ? "auto" : "none" : void 0,
284
- ...e.style
285
- },
286
- onFocusCapture: g(e.onFocusCapture, R.onFocusCapture),
287
- onBlurCapture: g(e.onBlurCapture, R.onBlurCapture),
288
- onPointerDownCapture: g(
289
- e.onPointerDownCapture,
290
- U.onPointerDownCapture
291
- )
292
- }
293
- );
294
- }
295
- );
296
- ce.displayName = se;
297
- var ue = "DismissableLayerBranch", ae = s.forwardRef((e, t) => {
298
- const n = s.useContext(W), o = s.useRef(null), r = N(t, o);
299
- return s.useEffect(() => {
300
- const i = o.current;
301
- if (i)
302
- return n.branches.add(i), () => {
303
- n.branches.delete(i);
304
- };
305
- }, [n.branches]), /* @__PURE__ */ E($.div, { ...e, ref: r });
306
- });
307
- ae.displayName = ue;
308
- function le(e, t = globalThis?.document) {
309
- const n = D(e), o = s.useRef(!1), r = s.useRef(() => {
310
- });
311
- return s.useEffect(() => {
312
- const i = (c) => {
313
- if (c.target && !o.current) {
314
- let l = function() {
315
- A(
316
- oe,
317
- n,
318
- a,
319
- { discrete: !0 }
320
- );
321
- };
322
- const a = { originalEvent: c };
323
- c.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = l, t.addEventListener("click", r.current, { once: !0 })) : l();
324
- } else
325
- t.removeEventListener("click", r.current);
326
- o.current = !1;
327
- }, u = window.setTimeout(() => {
328
- t.addEventListener("pointerdown", i);
329
- }, 0);
330
- return () => {
331
- window.clearTimeout(u), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
332
- };
333
- }, [t, n]), {
334
- // ensures we check React component tree (not just DOM tree)
335
- onPointerDownCapture: () => o.current = !0
336
- };
337
- }
338
- function de(e, t = globalThis?.document) {
339
- const n = D(e), o = s.useRef(!1);
340
- return s.useEffect(() => {
341
- const r = (i) => {
342
- i.target && !o.current && A(ie, n, { originalEvent: i }, {
343
- discrete: !1
344
- });
345
- };
346
- return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
347
- }, [t, n]), {
348
- onFocusCapture: () => o.current = !0,
349
- onBlurCapture: () => o.current = !1
350
- };
351
- }
352
- function _() {
353
- const e = new CustomEvent(S);
354
- document.dispatchEvent(e);
355
- }
356
- function A(e, t, n, { discrete: o }) {
357
- const r = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
358
- t && r.addEventListener(e, t, { once: !0 }), o ? ne(r, i) : r.dispatchEvent(i);
359
- }
360
- export {
361
- ce as D,
362
- $ as P,
363
- me as a,
364
- N as b,
365
- ve as c,
366
- g as d,
367
- he as e,
368
- q as f,
369
- B as g,
370
- pe as h,
371
- D as i,
372
- Ee as u
373
- };