@spear-ai/spectral 1.1.2 → 1.1.4

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,225 +0,0 @@
1
- import * as s from "react";
2
- import { jsx as m } from "react/jsx-runtime";
3
- import * as x from "react-dom";
4
- function M(e, t, { checkForDefaultPrevented: o = !0 } = {}) {
5
- return function(n) {
6
- if (e?.(n), o === !1 || !n.defaultPrevented)
7
- return t?.(n);
8
- };
9
- }
10
- function h(e, t) {
11
- if (typeof e == "function")
12
- return e(t);
13
- e != null && (e.current = t);
14
- }
15
- function y(...e) {
16
- return (t) => {
17
- let o = !1;
18
- const c = e.map((n) => {
19
- const r = h(n, t);
20
- return !o && typeof r == "function" && (o = !0), r;
21
- });
22
- if (o)
23
- return () => {
24
- for (let n = 0; n < c.length; n++) {
25
- const r = c[n];
26
- typeof r == "function" ? r() : h(e[n], null);
27
- }
28
- };
29
- };
30
- }
31
- function W(...e) {
32
- return s.useCallback(y(...e), e);
33
- }
34
- function A(e, t) {
35
- const o = s.createContext(t), c = (r) => {
36
- const { children: u, ...i } = r, l = s.useMemo(() => i, Object.values(i));
37
- return /* @__PURE__ */ m(o.Provider, { value: l, children: u });
38
- };
39
- c.displayName = e + "Provider";
40
- function n(r) {
41
- const u = s.useContext(o);
42
- if (u) return u;
43
- if (t !== void 0) return t;
44
- throw new Error(`\`${r}\` must be used within \`${e}\``);
45
- }
46
- return [c, n];
47
- }
48
- function H(e, t = []) {
49
- let o = [];
50
- function c(r, u) {
51
- const i = s.createContext(u), l = o.length;
52
- o = [...o, u];
53
- const a = (f) => {
54
- const { scope: v, children: C, ...d } = f, S = v?.[e]?.[l] || i, E = s.useMemo(() => d, Object.values(d));
55
- return /* @__PURE__ */ m(S.Provider, { value: E, children: C });
56
- };
57
- a.displayName = r + "Provider";
58
- function p(f, v) {
59
- const C = v?.[e]?.[l] || i, d = s.useContext(C);
60
- if (d) return d;
61
- if (u !== void 0) return u;
62
- throw new Error(`\`${f}\` must be used within \`${r}\``);
63
- }
64
- return [a, p];
65
- }
66
- const n = () => {
67
- const r = o.map((u) => s.createContext(u));
68
- return function(i) {
69
- const l = i?.[e] || r;
70
- return s.useMemo(
71
- () => ({ [`__scope${e}`]: { ...i, [e]: l } }),
72
- [i, l]
73
- );
74
- };
75
- };
76
- return n.scopeName = e, [c, g(n, ...t)];
77
- }
78
- function g(...e) {
79
- const t = e[0];
80
- if (e.length === 1) return t;
81
- const o = () => {
82
- const c = e.map((n) => ({
83
- useScope: n(),
84
- scopeName: n.scopeName
85
- }));
86
- return function(r) {
87
- const u = c.reduce((i, { useScope: l, scopeName: a }) => {
88
- const f = l(r)[`__scope${a}`];
89
- return { ...i, ...f };
90
- }, {});
91
- return s.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
92
- };
93
- };
94
- return o.scopeName = t.scopeName, o;
95
- }
96
- var P = globalThis?.document ? s.useLayoutEffect : () => {
97
- }, b = s[" useInsertionEffect ".trim().toString()] || P;
98
- function L({
99
- prop: e,
100
- defaultProp: t,
101
- onChange: o = () => {
102
- },
103
- caller: c
104
- }) {
105
- const [n, r, u] = R({
106
- defaultProp: t,
107
- onChange: o
108
- }), i = e !== void 0, l = i ? e : n;
109
- {
110
- const p = s.useRef(e !== void 0);
111
- s.useEffect(() => {
112
- const f = p.current;
113
- f !== i && console.warn(
114
- `${c} is changing from ${f ? "controlled" : "uncontrolled"} to ${i ? "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.`
115
- ), p.current = i;
116
- }, [i, c]);
117
- }
118
- const a = s.useCallback(
119
- (p) => {
120
- if (i) {
121
- const f = w(p) ? p(e) : p;
122
- f !== e && u.current?.(f);
123
- } else
124
- r(p);
125
- },
126
- [i, e, r, u]
127
- );
128
- return [l, a];
129
- }
130
- function R({
131
- defaultProp: e,
132
- onChange: t
133
- }) {
134
- const [o, c] = s.useState(e), n = s.useRef(o), r = s.useRef(t);
135
- return b(() => {
136
- r.current = t;
137
- }, [t]), s.useEffect(() => {
138
- n.current !== o && (r.current?.(o), n.current = o);
139
- }, [o, n]), [o, c, r];
140
- }
141
- function w(e) {
142
- return typeof e == "function";
143
- }
144
- // @__NO_SIDE_EFFECTS__
145
- function $(e) {
146
- const t = /* @__PURE__ */ _(e), o = s.forwardRef((c, n) => {
147
- const { children: r, ...u } = c, i = s.Children.toArray(r), l = i.find(N);
148
- if (l) {
149
- const a = l.props.children, p = i.map((f) => f === l ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : f);
150
- return /* @__PURE__ */ m(t, { ...u, ref: n, children: s.isValidElement(a) ? s.cloneElement(a, void 0, p) : null });
151
- }
152
- return /* @__PURE__ */ m(t, { ...u, ref: n, children: r });
153
- });
154
- return o.displayName = `${e}.Slot`, o;
155
- }
156
- // @__NO_SIDE_EFFECTS__
157
- function _(e) {
158
- const t = s.forwardRef((o, c) => {
159
- const { children: n, ...r } = o;
160
- if (s.isValidElement(n)) {
161
- const u = I(n), i = D(r, n.props);
162
- return n.type !== s.Fragment && (i.ref = c ? y(c, u) : u), s.cloneElement(n, i);
163
- }
164
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
165
- });
166
- return t.displayName = `${e}.SlotClone`, t;
167
- }
168
- var O = Symbol("radix.slottable");
169
- function N(e) {
170
- return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === O;
171
- }
172
- function D(e, t) {
173
- const o = { ...t };
174
- for (const c in t) {
175
- const n = e[c], r = t[c];
176
- /^on[A-Z]/.test(c) ? n && r ? o[c] = (...i) => {
177
- const l = r(...i);
178
- return n(...i), l;
179
- } : n && (o[c] = n) : c === "style" ? o[c] = { ...n, ...r } : c === "className" && (o[c] = [n, r].filter(Boolean).join(" "));
180
- }
181
- return { ...e, ...o };
182
- }
183
- function I(e) {
184
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, o = t && "isReactWarning" in t && t.isReactWarning;
185
- return o ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, o = t && "isReactWarning" in t && t.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
186
- }
187
- var j = [
188
- "a",
189
- "button",
190
- "div",
191
- "form",
192
- "h2",
193
- "h3",
194
- "img",
195
- "input",
196
- "label",
197
- "li",
198
- "nav",
199
- "ol",
200
- "p",
201
- "select",
202
- "span",
203
- "svg",
204
- "ul"
205
- ], T = j.reduce((e, t) => {
206
- const o = /* @__PURE__ */ $(`Primitive.${t}`), c = s.forwardRef((n, r) => {
207
- const { asChild: u, ...i } = n, l = u ? o : t;
208
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m(l, { ...i, ref: r });
209
- });
210
- return c.displayName = `Primitive.${t}`, { ...e, [t]: c };
211
- }, {});
212
- function k(e, t) {
213
- e && x.flushSync(() => e.dispatchEvent(t));
214
- }
215
- export {
216
- T as P,
217
- W as a,
218
- H as b,
219
- M as c,
220
- k as d,
221
- $ as e,
222
- A as f,
223
- L as g,
224
- P as u
225
- };