@figma-vars/hooks 1.4.5 → 1.5.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/README.md +1 -1
- package/dist/index.js +17 -0
- package/dist/index.mjs +838 -0
- package/package.json +1 -1
- package/dist/figma-vars-hooks.js +0 -838
- package/dist/figma-vars-hooks.umd.cjs +0 -17
- package/dist/src/api/mutator.test.d.ts +0 -1
- package/dist/tests/FigmaVarsProvider.test.d.ts +0 -1
- package/dist/tests/api/fetcher.test.d.ts +0 -1
- package/dist/tests/api/index.test.d.ts +0 -1
- package/dist/tests/api/mutator.test.d.ts +0 -1
- package/dist/tests/constants/index.test.d.ts +0 -1
- package/dist/tests/contexts/index.test.d.ts +0 -1
- package/dist/tests/hooks/index.test.d.ts +0 -1
- package/dist/tests/hooks/useBulkUpdateVariables.test.d.ts +0 -1
- package/dist/tests/hooks/useCreateVariable.test.d.ts +0 -1
- package/dist/tests/hooks/useDeleteVariable.test.d.ts +0 -1
- package/dist/tests/hooks/useFigmaToken.test.d.ts +0 -1
- package/dist/tests/hooks/useMutation.test.d.ts +0 -1
- package/dist/tests/hooks/useUpdateVariable.test.d.ts +0 -1
- package/dist/tests/hooks/useVariableCollections.test.d.ts +0 -1
- package/dist/tests/hooks/useVariableModes.test.d.ts +0 -1
- package/dist/tests/hooks/useVariables.test.d.ts +0 -1
- package/dist/tests/index.test.d.ts +0 -1
- package/dist/tests/mocks/variables.d.ts +0 -2
- package/dist/tests/setup.d.ts +0 -0
- package/dist/tests/test-utils.d.ts +0 -10
- package/dist/tests/test-utils.test.d.ts +0 -1
- package/dist/tests/types.test.d.ts +0 -1
- package/dist/tests/utils/filterVariables.test.d.ts +0 -1
- package/dist/tests/utils/index.test.d.ts +0 -1
- /package/dist/{src/api → api}/fetcher.d.ts +0 -0
- /package/dist/{src/api → api}/index.d.ts +0 -0
- /package/dist/{src/api → api}/mutator.d.ts +0 -0
- /package/dist/{src/constants → constants}/index.d.ts +0 -0
- /package/dist/{src/contexts → contexts}/FigmaVarsProvider.d.ts +0 -0
- /package/dist/{src/contexts → contexts}/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useBulkUpdateVariables.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useCreateVariable.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useDeleteVariable.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useFigmaToken.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useMutation.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useUpdateVariable.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useVariableCollections.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useVariableModes.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useVariables.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/types → types}/contexts.d.ts +0 -0
- /package/dist/{src/types → types}/figma.d.ts +0 -0
- /package/dist/{src/types → types}/hooks.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/mutations.d.ts +0 -0
- /package/dist/{src/utils → utils}/filterVariables.d.ts +0 -0
- /package/dist/{src/utils → utils}/index.d.ts +0 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,838 @@
|
|
|
1
|
+
import { jsx as Oe } from "react/jsx-runtime";
|
|
2
|
+
import et, { createContext as Zt, useContext as te, useEffect as ve, useLayoutEffect as we, useRef as q, useMemo as ft, useCallback as lt, useDebugValue as Re, useReducer as Te } from "react";
|
|
3
|
+
const ee = Zt(
|
|
4
|
+
void 0
|
|
5
|
+
), pn = ({
|
|
6
|
+
children: t,
|
|
7
|
+
token: e,
|
|
8
|
+
fileKey: n
|
|
9
|
+
}) => /* @__PURE__ */ Oe(ee.Provider, { value: { token: e, fileKey: n }, children: t }), nt = () => {
|
|
10
|
+
const t = te(ee);
|
|
11
|
+
if (t === void 0)
|
|
12
|
+
throw new Error(
|
|
13
|
+
"useFigmaTokenContext must be used within a FigmaVarsProvider"
|
|
14
|
+
);
|
|
15
|
+
return t;
|
|
16
|
+
};
|
|
17
|
+
var at = { exports: {} }, _t = {};
|
|
18
|
+
/**
|
|
19
|
+
* @license React
|
|
20
|
+
* use-sync-external-store-shim.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
var Ht;
|
|
28
|
+
function ge() {
|
|
29
|
+
if (Ht) return _t;
|
|
30
|
+
Ht = 1;
|
|
31
|
+
var t = et;
|
|
32
|
+
function e(l, E) {
|
|
33
|
+
return l === E && (l !== 0 || 1 / l === 1 / E) || l !== l && E !== E;
|
|
34
|
+
}
|
|
35
|
+
var n = typeof Object.is == "function" ? Object.is : e, r = t.useState, s = t.useEffect, c = t.useLayoutEffect, o = t.useDebugValue;
|
|
36
|
+
function u(l, E) {
|
|
37
|
+
var a = E(), p = r({ inst: { value: a, getSnapshot: E } }), f = p[0].inst, I = p[1];
|
|
38
|
+
return c(
|
|
39
|
+
function() {
|
|
40
|
+
f.value = a, f.getSnapshot = E, m(f) && I({ inst: f });
|
|
41
|
+
},
|
|
42
|
+
[l, a, E]
|
|
43
|
+
), s(
|
|
44
|
+
function() {
|
|
45
|
+
return m(f) && I({ inst: f }), l(function() {
|
|
46
|
+
m(f) && I({ inst: f });
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
[l]
|
|
50
|
+
), o(a), a;
|
|
51
|
+
}
|
|
52
|
+
function m(l) {
|
|
53
|
+
var E = l.getSnapshot;
|
|
54
|
+
l = l.value;
|
|
55
|
+
try {
|
|
56
|
+
var a = E();
|
|
57
|
+
return !n(l, a);
|
|
58
|
+
} catch {
|
|
59
|
+
return !0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function g(l, E) {
|
|
63
|
+
return E();
|
|
64
|
+
}
|
|
65
|
+
var O = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? g : u;
|
|
66
|
+
return _t.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : O, _t;
|
|
67
|
+
}
|
|
68
|
+
var St = {};
|
|
69
|
+
/**
|
|
70
|
+
* @license React
|
|
71
|
+
* use-sync-external-store-shim.development.js
|
|
72
|
+
*
|
|
73
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the MIT license found in the
|
|
76
|
+
* LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/
|
|
78
|
+
var kt;
|
|
79
|
+
function ye() {
|
|
80
|
+
return kt || (kt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
81
|
+
function t(a, p) {
|
|
82
|
+
return a === p && (a !== 0 || 1 / a === 1 / p) || a !== a && p !== p;
|
|
83
|
+
}
|
|
84
|
+
function e(a, p) {
|
|
85
|
+
O || s.startTransition === void 0 || (O = !0, console.error(
|
|
86
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
87
|
+
));
|
|
88
|
+
var f = p();
|
|
89
|
+
if (!l) {
|
|
90
|
+
var I = p();
|
|
91
|
+
c(f, I) || (console.error(
|
|
92
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
93
|
+
), l = !0);
|
|
94
|
+
}
|
|
95
|
+
I = o({
|
|
96
|
+
inst: { value: f, getSnapshot: p }
|
|
97
|
+
});
|
|
98
|
+
var i = I[0].inst, j = I[1];
|
|
99
|
+
return m(
|
|
100
|
+
function() {
|
|
101
|
+
i.value = f, i.getSnapshot = p, n(i) && j({ inst: i });
|
|
102
|
+
},
|
|
103
|
+
[a, f, p]
|
|
104
|
+
), u(
|
|
105
|
+
function() {
|
|
106
|
+
return n(i) && j({ inst: i }), a(function() {
|
|
107
|
+
n(i) && j({ inst: i });
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
[a]
|
|
111
|
+
), g(f), f;
|
|
112
|
+
}
|
|
113
|
+
function n(a) {
|
|
114
|
+
var p = a.getSnapshot;
|
|
115
|
+
a = a.value;
|
|
116
|
+
try {
|
|
117
|
+
var f = p();
|
|
118
|
+
return !c(a, f);
|
|
119
|
+
} catch {
|
|
120
|
+
return !0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function r(a, p) {
|
|
124
|
+
return p();
|
|
125
|
+
}
|
|
126
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
127
|
+
var s = et, c = typeof Object.is == "function" ? Object.is : t, o = s.useState, u = s.useEffect, m = s.useLayoutEffect, g = s.useDebugValue, O = !1, l = !1, E = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
|
|
128
|
+
St.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : E, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
129
|
+
}()), St;
|
|
130
|
+
}
|
|
131
|
+
var Kt;
|
|
132
|
+
function Ae() {
|
|
133
|
+
return Kt || (Kt = 1, process.env.NODE_ENV === "production" ? at.exports = ge() : at.exports = ye()), at.exports;
|
|
134
|
+
}
|
|
135
|
+
var De = Ae();
|
|
136
|
+
const ne = 0, re = 1, oe = 2, Jt = 3;
|
|
137
|
+
var Yt = Object.prototype.hasOwnProperty;
|
|
138
|
+
function yt(t, e) {
|
|
139
|
+
var n, r;
|
|
140
|
+
if (t === e) return !0;
|
|
141
|
+
if (t && e && (n = t.constructor) === e.constructor) {
|
|
142
|
+
if (n === Date) return t.getTime() === e.getTime();
|
|
143
|
+
if (n === RegExp) return t.toString() === e.toString();
|
|
144
|
+
if (n === Array) {
|
|
145
|
+
if ((r = t.length) === e.length)
|
|
146
|
+
for (; r-- && yt(t[r], e[r]); ) ;
|
|
147
|
+
return r === -1;
|
|
148
|
+
}
|
|
149
|
+
if (!n || typeof t == "object") {
|
|
150
|
+
r = 0;
|
|
151
|
+
for (n in t)
|
|
152
|
+
if (Yt.call(t, n) && ++r && !Yt.call(e, n) || !(n in e) || !yt(t[n], e[n])) return !1;
|
|
153
|
+
return Object.keys(e).length === r;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return t !== t && e !== e;
|
|
157
|
+
}
|
|
158
|
+
const P = /* @__PURE__ */ new WeakMap(), G = () => {
|
|
159
|
+
}, D = (
|
|
160
|
+
/*#__NOINLINE__*/
|
|
161
|
+
G()
|
|
162
|
+
), At = Object, d = (t) => t === D, N = (t) => typeof t == "function", W = (t, e) => ({
|
|
163
|
+
...t,
|
|
164
|
+
...e
|
|
165
|
+
}), se = (t) => N(t.then), Ot = {}, ct = {}, Nt = "undefined", rt = typeof window != Nt, Dt = typeof document != Nt, Ie = rt && "Deno" in window, Le = () => rt && typeof window.requestAnimationFrame != Nt, ie = (t, e) => {
|
|
166
|
+
const n = P.get(t);
|
|
167
|
+
return [
|
|
168
|
+
// Getter
|
|
169
|
+
() => !d(e) && t.get(e) || Ot,
|
|
170
|
+
// Setter
|
|
171
|
+
(r) => {
|
|
172
|
+
if (!d(e)) {
|
|
173
|
+
const s = t.get(e);
|
|
174
|
+
e in ct || (ct[e] = s), n[5](e, W(s, r), s || Ot);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
// Subscriber
|
|
178
|
+
n[6],
|
|
179
|
+
// Get server cache snapshot
|
|
180
|
+
() => !d(e) && e in ct ? ct[e] : !d(e) && t.get(e) || Ot
|
|
181
|
+
];
|
|
182
|
+
};
|
|
183
|
+
let It = !0;
|
|
184
|
+
const Ce = () => It, [Lt, Ct] = rt && window.addEventListener ? [
|
|
185
|
+
window.addEventListener.bind(window),
|
|
186
|
+
window.removeEventListener.bind(window)
|
|
187
|
+
] : [
|
|
188
|
+
G,
|
|
189
|
+
G
|
|
190
|
+
], be = () => {
|
|
191
|
+
const t = Dt && document.visibilityState;
|
|
192
|
+
return d(t) || t !== "hidden";
|
|
193
|
+
}, Ve = (t) => (Dt && document.addEventListener("visibilitychange", t), Lt("focus", t), () => {
|
|
194
|
+
Dt && document.removeEventListener("visibilitychange", t), Ct("focus", t);
|
|
195
|
+
}), Ne = (t) => {
|
|
196
|
+
const e = () => {
|
|
197
|
+
It = !0, t();
|
|
198
|
+
}, n = () => {
|
|
199
|
+
It = !1;
|
|
200
|
+
};
|
|
201
|
+
return Lt("online", e), Lt("offline", n), () => {
|
|
202
|
+
Ct("online", e), Ct("offline", n);
|
|
203
|
+
};
|
|
204
|
+
}, Fe = {
|
|
205
|
+
isOnline: Ce,
|
|
206
|
+
isVisible: be
|
|
207
|
+
}, xe = {
|
|
208
|
+
initFocus: Ve,
|
|
209
|
+
initReconnect: Ne
|
|
210
|
+
}, zt = !et.useId, tt = !rt || Ie, Me = (t) => Le() ? window.requestAnimationFrame(t) : setTimeout(t, 1), vt = tt ? ve : we, wt = typeof navigator < "u" && navigator.connection, Xt = !tt && wt && ([
|
|
211
|
+
"slow-2g",
|
|
212
|
+
"2g"
|
|
213
|
+
].includes(wt.effectiveType) || wt.saveData), ut = /* @__PURE__ */ new WeakMap(), Pe = (t) => At.prototype.toString.call(t), Rt = (t, e) => t === `[object ${e}]`;
|
|
214
|
+
let je = 0;
|
|
215
|
+
const bt = (t) => {
|
|
216
|
+
const e = typeof t, n = Pe(t), r = Rt(n, "Date"), s = Rt(n, "RegExp"), c = Rt(n, "Object");
|
|
217
|
+
let o, u;
|
|
218
|
+
if (At(t) === t && !r && !s) {
|
|
219
|
+
if (o = ut.get(t), o) return o;
|
|
220
|
+
if (o = ++je + "~", ut.set(t, o), Array.isArray(t)) {
|
|
221
|
+
for (o = "@", u = 0; u < t.length; u++)
|
|
222
|
+
o += bt(t[u]) + ",";
|
|
223
|
+
ut.set(t, o);
|
|
224
|
+
}
|
|
225
|
+
if (c) {
|
|
226
|
+
o = "#";
|
|
227
|
+
const m = At.keys(t).sort();
|
|
228
|
+
for (; !d(u = m.pop()); )
|
|
229
|
+
d(t[u]) || (o += u + ":" + bt(t[u]) + ",");
|
|
230
|
+
ut.set(t, o);
|
|
231
|
+
}
|
|
232
|
+
} else
|
|
233
|
+
o = r ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
|
|
234
|
+
return o;
|
|
235
|
+
}, Ft = (t) => {
|
|
236
|
+
if (N(t))
|
|
237
|
+
try {
|
|
238
|
+
t = t();
|
|
239
|
+
} catch {
|
|
240
|
+
t = "";
|
|
241
|
+
}
|
|
242
|
+
const e = t;
|
|
243
|
+
return t = typeof t == "string" ? t : (Array.isArray(t) ? t.length : t) ? bt(t) : "", [
|
|
244
|
+
t,
|
|
245
|
+
e
|
|
246
|
+
];
|
|
247
|
+
};
|
|
248
|
+
let Ue = 0;
|
|
249
|
+
const Vt = () => ++Ue;
|
|
250
|
+
async function ae(...t) {
|
|
251
|
+
const [e, n, r, s] = t, c = W({
|
|
252
|
+
populateCache: !0,
|
|
253
|
+
throwOnError: !0
|
|
254
|
+
}, typeof s == "boolean" ? {
|
|
255
|
+
revalidate: s
|
|
256
|
+
} : s || {});
|
|
257
|
+
let o = c.populateCache;
|
|
258
|
+
const u = c.rollbackOnError;
|
|
259
|
+
let m = c.optimisticData;
|
|
260
|
+
const g = (E) => typeof u == "function" ? u(E) : u !== !1, O = c.throwOnError;
|
|
261
|
+
if (N(n)) {
|
|
262
|
+
const E = n, a = [], p = e.keys();
|
|
263
|
+
for (const f of p)
|
|
264
|
+
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
265
|
+
!/^\$(inf|sub)\$/.test(f) && E(e.get(f)._k) && a.push(f);
|
|
266
|
+
return Promise.all(a.map(l));
|
|
267
|
+
}
|
|
268
|
+
return l(n);
|
|
269
|
+
async function l(E) {
|
|
270
|
+
const [a] = Ft(E);
|
|
271
|
+
if (!a) return;
|
|
272
|
+
const [p, f] = ie(e, a), [I, i, j, X] = P.get(e), U = () => {
|
|
273
|
+
const y = I[a];
|
|
274
|
+
return (N(c.revalidate) ? c.revalidate(p().data, E) : c.revalidate !== !1) && (delete j[a], delete X[a], y && y[0]) ? y[0](oe).then(() => p().data) : p().data;
|
|
275
|
+
};
|
|
276
|
+
if (t.length < 3)
|
|
277
|
+
return U();
|
|
278
|
+
let R = r, F, b = !1;
|
|
279
|
+
const S = Vt();
|
|
280
|
+
i[a] = [
|
|
281
|
+
S,
|
|
282
|
+
0
|
|
283
|
+
];
|
|
284
|
+
const H = !d(m), V = p(), k = V.data, ot = V._c, B = d(ot) ? k : ot;
|
|
285
|
+
if (H && (m = N(m) ? m(B, k) : m, f({
|
|
286
|
+
data: m,
|
|
287
|
+
_c: B
|
|
288
|
+
})), N(R))
|
|
289
|
+
try {
|
|
290
|
+
R = R(B);
|
|
291
|
+
} catch (y) {
|
|
292
|
+
F = y, b = !0;
|
|
293
|
+
}
|
|
294
|
+
if (R && se(R))
|
|
295
|
+
if (R = await R.catch((y) => {
|
|
296
|
+
F = y, b = !0;
|
|
297
|
+
}), S !== i[a][0]) {
|
|
298
|
+
if (b) throw F;
|
|
299
|
+
return R;
|
|
300
|
+
} else b && H && g(F) && (o = !0, f({
|
|
301
|
+
data: B,
|
|
302
|
+
_c: D
|
|
303
|
+
}));
|
|
304
|
+
if (o && !b)
|
|
305
|
+
if (N(o)) {
|
|
306
|
+
const y = o(R, B);
|
|
307
|
+
f({
|
|
308
|
+
data: y,
|
|
309
|
+
error: D,
|
|
310
|
+
_c: D
|
|
311
|
+
});
|
|
312
|
+
} else
|
|
313
|
+
f({
|
|
314
|
+
data: R,
|
|
315
|
+
error: D,
|
|
316
|
+
_c: D
|
|
317
|
+
});
|
|
318
|
+
if (i[a][1] = Vt(), Promise.resolve(U()).then(() => {
|
|
319
|
+
f({
|
|
320
|
+
_c: D
|
|
321
|
+
});
|
|
322
|
+
}), b) {
|
|
323
|
+
if (O) throw F;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
return R;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const Qt = (t, e) => {
|
|
330
|
+
for (const n in t)
|
|
331
|
+
t[n][0] && t[n][0](e);
|
|
332
|
+
}, Ge = (t, e) => {
|
|
333
|
+
if (!P.has(t)) {
|
|
334
|
+
const n = W(xe, e), r = /* @__PURE__ */ Object.create(null), s = ae.bind(D, t);
|
|
335
|
+
let c = G;
|
|
336
|
+
const o = /* @__PURE__ */ Object.create(null), u = (O, l) => {
|
|
337
|
+
const E = o[O] || [];
|
|
338
|
+
return o[O] = E, E.push(l), () => E.splice(E.indexOf(l), 1);
|
|
339
|
+
}, m = (O, l, E) => {
|
|
340
|
+
t.set(O, l);
|
|
341
|
+
const a = o[O];
|
|
342
|
+
if (a)
|
|
343
|
+
for (const p of a)
|
|
344
|
+
p(l, E);
|
|
345
|
+
}, g = () => {
|
|
346
|
+
if (!P.has(t) && (P.set(t, [
|
|
347
|
+
r,
|
|
348
|
+
/* @__PURE__ */ Object.create(null),
|
|
349
|
+
/* @__PURE__ */ Object.create(null),
|
|
350
|
+
/* @__PURE__ */ Object.create(null),
|
|
351
|
+
s,
|
|
352
|
+
m,
|
|
353
|
+
u
|
|
354
|
+
]), !tt)) {
|
|
355
|
+
const O = n.initFocus(setTimeout.bind(D, Qt.bind(D, r, ne))), l = n.initReconnect(setTimeout.bind(D, Qt.bind(D, r, re)));
|
|
356
|
+
c = () => {
|
|
357
|
+
O && O(), l && l(), P.delete(t);
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
return g(), [
|
|
362
|
+
t,
|
|
363
|
+
s,
|
|
364
|
+
g,
|
|
365
|
+
c
|
|
366
|
+
];
|
|
367
|
+
}
|
|
368
|
+
return [
|
|
369
|
+
t,
|
|
370
|
+
P.get(t)[4]
|
|
371
|
+
];
|
|
372
|
+
}, We = (t, e, n, r, s) => {
|
|
373
|
+
const c = n.errorRetryCount, o = s.retryCount, u = ~~((Math.random() + 0.5) * (1 << (o < 8 ? o : 8))) * n.errorRetryInterval;
|
|
374
|
+
!d(c) && o > c || setTimeout(r, u, s);
|
|
375
|
+
}, Be = yt, [ce, $e] = Ge(/* @__PURE__ */ new Map()), qe = W(
|
|
376
|
+
{
|
|
377
|
+
// events
|
|
378
|
+
onLoadingSlow: G,
|
|
379
|
+
onSuccess: G,
|
|
380
|
+
onError: G,
|
|
381
|
+
onErrorRetry: We,
|
|
382
|
+
onDiscarded: G,
|
|
383
|
+
// switches
|
|
384
|
+
revalidateOnFocus: !0,
|
|
385
|
+
revalidateOnReconnect: !0,
|
|
386
|
+
revalidateIfStale: !0,
|
|
387
|
+
shouldRetryOnError: !0,
|
|
388
|
+
// timeouts
|
|
389
|
+
errorRetryInterval: Xt ? 1e4 : 5e3,
|
|
390
|
+
focusThrottleInterval: 5 * 1e3,
|
|
391
|
+
dedupingInterval: 2 * 1e3,
|
|
392
|
+
loadingTimeout: Xt ? 5e3 : 3e3,
|
|
393
|
+
// providers
|
|
394
|
+
compare: Be,
|
|
395
|
+
isPaused: () => !1,
|
|
396
|
+
cache: ce,
|
|
397
|
+
mutate: $e,
|
|
398
|
+
fallback: {}
|
|
399
|
+
},
|
|
400
|
+
// use web preset by default
|
|
401
|
+
Fe
|
|
402
|
+
), He = (t, e) => {
|
|
403
|
+
const n = W(t, e);
|
|
404
|
+
if (e) {
|
|
405
|
+
const { use: r, fallback: s } = t, { use: c, fallback: o } = e;
|
|
406
|
+
r && c && (n.use = r.concat(c)), s && o && (n.fallback = W(s, o));
|
|
407
|
+
}
|
|
408
|
+
return n;
|
|
409
|
+
}, ke = Zt({}), Ke = "$inf$", ue = rt && window.__SWR_DEVTOOLS_USE__, Je = ue ? window.__SWR_DEVTOOLS_USE__ : [], Ye = () => {
|
|
410
|
+
ue && (window.__SWR_DEVTOOLS_REACT__ = et);
|
|
411
|
+
}, ze = (t) => N(t[1]) ? [
|
|
412
|
+
t[0],
|
|
413
|
+
t[1],
|
|
414
|
+
t[2] || {}
|
|
415
|
+
] : [
|
|
416
|
+
t[0],
|
|
417
|
+
null,
|
|
418
|
+
(t[1] === null ? t[2] : t[1]) || {}
|
|
419
|
+
], Xe = () => W(qe, te(ke)), Qe = (t) => (e, n, r) => t(e, n && ((...c) => {
|
|
420
|
+
const [o] = Ft(e), [, , , u] = P.get(ce);
|
|
421
|
+
if (o.startsWith(Ke))
|
|
422
|
+
return n(...c);
|
|
423
|
+
const m = u[o];
|
|
424
|
+
return d(m) ? n(...c) : (delete u[o], m);
|
|
425
|
+
}), r), Ze = Je.concat(Qe), tn = (t) => function(...n) {
|
|
426
|
+
const r = Xe(), [s, c, o] = ze(n), u = He(r, o);
|
|
427
|
+
let m = t;
|
|
428
|
+
const { use: g } = u, O = (g || []).concat(Ze);
|
|
429
|
+
for (let l = O.length; l--; )
|
|
430
|
+
m = O[l](m);
|
|
431
|
+
return m(s, c || u.fetcher || null, u);
|
|
432
|
+
}, en = (t, e, n) => {
|
|
433
|
+
const r = e[t] || (e[t] = []);
|
|
434
|
+
return r.push(n), () => {
|
|
435
|
+
const s = r.indexOf(n);
|
|
436
|
+
s >= 0 && (r[s] = r[r.length - 1], r.pop());
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
Ye();
|
|
440
|
+
const Tt = et.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
|
|
441
|
+
// and emitting an error.
|
|
442
|
+
// We assume that this is only for the `use(thenable)` case, not `use(context)`.
|
|
443
|
+
// https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
|
|
444
|
+
((t) => {
|
|
445
|
+
switch (t.status) {
|
|
446
|
+
case "pending":
|
|
447
|
+
throw t;
|
|
448
|
+
case "fulfilled":
|
|
449
|
+
return t.value;
|
|
450
|
+
case "rejected":
|
|
451
|
+
throw t.reason;
|
|
452
|
+
default:
|
|
453
|
+
throw t.status = "pending", t.then((e) => {
|
|
454
|
+
t.status = "fulfilled", t.value = e;
|
|
455
|
+
}, (e) => {
|
|
456
|
+
t.status = "rejected", t.reason = e;
|
|
457
|
+
}), t;
|
|
458
|
+
}
|
|
459
|
+
}), gt = {
|
|
460
|
+
dedupe: !0
|
|
461
|
+
}, nn = (t, e, n) => {
|
|
462
|
+
const { cache: r, compare: s, suspense: c, fallbackData: o, revalidateOnMount: u, revalidateIfStale: m, refreshInterval: g, refreshWhenHidden: O, refreshWhenOffline: l, keepPreviousData: E } = n, [a, p, f, I] = P.get(r), [i, j] = Ft(t), X = q(!1), U = q(!1), R = q(i), F = q(e), b = q(n), S = () => b.current, H = () => S().isVisible() && S().isOnline(), [V, k, ot, B] = ie(r, i), y = q({}).current, Q = d(o) ? d(n.fallback) ? D : n.fallback[i] : o, Mt = (_, h) => {
|
|
463
|
+
for (const T in y) {
|
|
464
|
+
const v = T;
|
|
465
|
+
if (v === "data") {
|
|
466
|
+
if (!s(_[v], h[v]) && (!d(_[v]) || !s(it, h[v])))
|
|
467
|
+
return !1;
|
|
468
|
+
} else if (h[v] !== _[v])
|
|
469
|
+
return !1;
|
|
470
|
+
}
|
|
471
|
+
return !0;
|
|
472
|
+
}, Pt = ft(() => {
|
|
473
|
+
const _ = !i || !e ? !1 : d(u) ? S().isPaused() || c ? !1 : m !== !1 : u, h = (A) => {
|
|
474
|
+
const x = W(A);
|
|
475
|
+
return delete x._k, _ ? {
|
|
476
|
+
isValidating: !0,
|
|
477
|
+
isLoading: !0,
|
|
478
|
+
...x
|
|
479
|
+
} : x;
|
|
480
|
+
}, T = V(), v = B(), C = h(T), Y = T === v ? C : h(v);
|
|
481
|
+
let w = C;
|
|
482
|
+
return [
|
|
483
|
+
() => {
|
|
484
|
+
const A = h(V());
|
|
485
|
+
return Mt(A, w) ? (w.data = A.data, w.isLoading = A.isLoading, w.isValidating = A.isValidating, w.error = A.error, w) : (w = A, A);
|
|
486
|
+
},
|
|
487
|
+
() => Y
|
|
488
|
+
];
|
|
489
|
+
}, [
|
|
490
|
+
r,
|
|
491
|
+
i
|
|
492
|
+
]), K = De.useSyncExternalStore(lt(
|
|
493
|
+
(_) => ot(i, (h, T) => {
|
|
494
|
+
Mt(T, h) || _();
|
|
495
|
+
}),
|
|
496
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
497
|
+
[
|
|
498
|
+
r,
|
|
499
|
+
i
|
|
500
|
+
]
|
|
501
|
+
), Pt[0], Pt[1]), jt = !X.current, me = a[i] && a[i].length > 0, J = K.data, $ = d(J) ? Q && se(Q) ? Tt(Q) : Q : J, st = K.error, pt = q($), it = E ? d(J) ? d(pt.current) ? $ : pt.current : J : $, Ut = me && !d(st) ? !1 : jt && !d(u) ? u : S().isPaused() ? !1 : c ? d($) ? !1 : m : d($) || m, Gt = !!(i && e && jt && Ut), he = d(K.isValidating) ? Gt : K.isValidating, _e = d(K.isLoading) ? Gt : K.isLoading, Z = lt(
|
|
502
|
+
async (_) => {
|
|
503
|
+
const h = F.current;
|
|
504
|
+
if (!i || !h || U.current || S().isPaused())
|
|
505
|
+
return !1;
|
|
506
|
+
let T, v, C = !0;
|
|
507
|
+
const Y = _ || {}, w = !f[i] || !Y.dedupe, A = () => zt ? !U.current && i === R.current && X.current : i === R.current, x = {
|
|
508
|
+
isValidating: !1,
|
|
509
|
+
isLoading: !1
|
|
510
|
+
}, Bt = () => {
|
|
511
|
+
k(x);
|
|
512
|
+
}, $t = () => {
|
|
513
|
+
const L = f[i];
|
|
514
|
+
L && L[1] === v && delete f[i];
|
|
515
|
+
}, qt = {
|
|
516
|
+
isValidating: !0
|
|
517
|
+
};
|
|
518
|
+
d(V().data) && (qt.isLoading = !0);
|
|
519
|
+
try {
|
|
520
|
+
if (w && (k(qt), n.loadingTimeout && d(V().data) && setTimeout(() => {
|
|
521
|
+
C && A() && S().onLoadingSlow(i, n);
|
|
522
|
+
}, n.loadingTimeout), f[i] = [
|
|
523
|
+
h(j),
|
|
524
|
+
Vt()
|
|
525
|
+
]), [T, v] = f[i], T = await T, w && setTimeout($t, n.dedupingInterval), !f[i] || f[i][1] !== v)
|
|
526
|
+
return w && A() && S().onDiscarded(i), !1;
|
|
527
|
+
x.error = D;
|
|
528
|
+
const L = p[i];
|
|
529
|
+
if (!d(L) && // case 1
|
|
530
|
+
(v <= L[0] || // case 2
|
|
531
|
+
v <= L[1] || // case 3
|
|
532
|
+
L[1] === 0))
|
|
533
|
+
return Bt(), w && A() && S().onDiscarded(i), !1;
|
|
534
|
+
const M = V().data;
|
|
535
|
+
x.data = s(M, T) ? M : T, w && A() && S().onSuccess(T, i, n);
|
|
536
|
+
} catch (L) {
|
|
537
|
+
$t();
|
|
538
|
+
const M = S(), { shouldRetryOnError: mt } = M;
|
|
539
|
+
M.isPaused() || (x.error = L, w && A() && (M.onError(L, i, M), (mt === !0 || N(mt) && mt(L)) && (!S().revalidateOnFocus || !S().revalidateOnReconnect || H()) && M.onErrorRetry(L, i, M, (Se) => {
|
|
540
|
+
const ht = a[i];
|
|
541
|
+
ht && ht[0] && ht[0](Jt, Se);
|
|
542
|
+
}, {
|
|
543
|
+
retryCount: (Y.retryCount || 0) + 1,
|
|
544
|
+
dedupe: !0
|
|
545
|
+
})));
|
|
546
|
+
}
|
|
547
|
+
return C = !1, Bt(), !0;
|
|
548
|
+
},
|
|
549
|
+
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
550
|
+
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
551
|
+
// the deps array.
|
|
552
|
+
//
|
|
553
|
+
// FIXME:
|
|
554
|
+
// `fn` and `config` might be changed during the lifecycle,
|
|
555
|
+
// but they might be changed every render like this.
|
|
556
|
+
// `useSWR('key', () => fetch('/api/'), { suspense: true })`
|
|
557
|
+
// So we omit the values from the deps array
|
|
558
|
+
// even though it might cause unexpected behaviors.
|
|
559
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
560
|
+
[
|
|
561
|
+
i,
|
|
562
|
+
r
|
|
563
|
+
]
|
|
564
|
+
), Wt = lt(
|
|
565
|
+
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
566
|
+
(..._) => ae(r, R.current, ..._),
|
|
567
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
568
|
+
[]
|
|
569
|
+
);
|
|
570
|
+
if (vt(() => {
|
|
571
|
+
F.current = e, b.current = n, d(J) || (pt.current = J);
|
|
572
|
+
}), vt(() => {
|
|
573
|
+
if (!i) return;
|
|
574
|
+
const _ = Z.bind(D, gt);
|
|
575
|
+
let h = 0;
|
|
576
|
+
S().revalidateOnFocus && (h = Date.now() + S().focusThrottleInterval);
|
|
577
|
+
const v = en(i, a, (C, Y = {}) => {
|
|
578
|
+
if (C == ne) {
|
|
579
|
+
const w = Date.now();
|
|
580
|
+
S().revalidateOnFocus && w > h && H() && (h = w + S().focusThrottleInterval, _());
|
|
581
|
+
} else if (C == re)
|
|
582
|
+
S().revalidateOnReconnect && H() && _();
|
|
583
|
+
else {
|
|
584
|
+
if (C == oe)
|
|
585
|
+
return Z();
|
|
586
|
+
if (C == Jt)
|
|
587
|
+
return Z(Y);
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
return U.current = !1, R.current = i, X.current = !0, k({
|
|
591
|
+
_k: j
|
|
592
|
+
}), Ut && (f[i] || (d($) || tt ? _() : Me(_))), () => {
|
|
593
|
+
U.current = !0, v();
|
|
594
|
+
};
|
|
595
|
+
}, [
|
|
596
|
+
i
|
|
597
|
+
]), vt(() => {
|
|
598
|
+
let _;
|
|
599
|
+
function h() {
|
|
600
|
+
const v = N(g) ? g(V().data) : g;
|
|
601
|
+
v && _ !== -1 && (_ = setTimeout(T, v));
|
|
602
|
+
}
|
|
603
|
+
function T() {
|
|
604
|
+
!V().error && (O || S().isVisible()) && (l || S().isOnline()) ? Z(gt).then(h) : h();
|
|
605
|
+
}
|
|
606
|
+
return h(), () => {
|
|
607
|
+
_ && (clearTimeout(_), _ = -1);
|
|
608
|
+
};
|
|
609
|
+
}, [
|
|
610
|
+
g,
|
|
611
|
+
O,
|
|
612
|
+
l,
|
|
613
|
+
i
|
|
614
|
+
]), Re(it), c && d($) && i) {
|
|
615
|
+
if (!zt && tt)
|
|
616
|
+
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
617
|
+
F.current = e, b.current = n, U.current = !1;
|
|
618
|
+
const _ = I[i];
|
|
619
|
+
if (!d(_)) {
|
|
620
|
+
const h = Wt(_);
|
|
621
|
+
Tt(h);
|
|
622
|
+
}
|
|
623
|
+
if (d(st)) {
|
|
624
|
+
const h = Z(gt);
|
|
625
|
+
d(it) || (h.status = "fulfilled", h.value = !0), Tt(h);
|
|
626
|
+
} else
|
|
627
|
+
throw st;
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
mutate: Wt,
|
|
631
|
+
get data() {
|
|
632
|
+
return y.data = !0, it;
|
|
633
|
+
},
|
|
634
|
+
get error() {
|
|
635
|
+
return y.error = !0, st;
|
|
636
|
+
},
|
|
637
|
+
get isValidating() {
|
|
638
|
+
return y.isValidating = !0, he;
|
|
639
|
+
},
|
|
640
|
+
get isLoading() {
|
|
641
|
+
return y.isLoading = !0, _e;
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}, rn = tn(nn), xt = "https://api.figma.com", on = `${xt}/v1/files`, le = `${xt}/v1/variables`, fe = le, de = (t) => `${le}/${t}`, sn = (t) => `${on}/${t}/variables/local`, an = "application/json", Ee = "X-FIGMA-TOKEN", z = "A Figma API token is required.", cn = "An error occurred while fetching data from the Figma API.";
|
|
645
|
+
async function un(t, e) {
|
|
646
|
+
if (!e)
|
|
647
|
+
throw new Error(z);
|
|
648
|
+
const n = await fetch(t, {
|
|
649
|
+
method: "GET",
|
|
650
|
+
headers: {
|
|
651
|
+
[Ee]: e,
|
|
652
|
+
"Content-Type": an
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
if (!n.ok) {
|
|
656
|
+
let r = cn;
|
|
657
|
+
try {
|
|
658
|
+
const s = await n.json();
|
|
659
|
+
s != null && s.message && (r = s.message);
|
|
660
|
+
} catch {
|
|
661
|
+
}
|
|
662
|
+
throw new Error(r);
|
|
663
|
+
}
|
|
664
|
+
return n.json();
|
|
665
|
+
}
|
|
666
|
+
const pe = () => {
|
|
667
|
+
const { token: t, fileKey: e } = nt(), n = e ? sn(e) : null, { data: r, error: s, isLoading: c, isValidating: o, mutate: u } = rn(
|
|
668
|
+
t && n ? [n, t] : null,
|
|
669
|
+
un
|
|
670
|
+
);
|
|
671
|
+
return {
|
|
672
|
+
data: r,
|
|
673
|
+
isLoading: c,
|
|
674
|
+
isValidating: o,
|
|
675
|
+
error: s,
|
|
676
|
+
mutate: u
|
|
677
|
+
};
|
|
678
|
+
}, mn = () => {
|
|
679
|
+
const { data: t } = pe(), e = ft(
|
|
680
|
+
() => t != null && t.meta ? Object.values(t.meta.variableCollections) : [],
|
|
681
|
+
[t]
|
|
682
|
+
), n = ft(
|
|
683
|
+
() => t != null && t.meta ? t.meta.variableCollections : {},
|
|
684
|
+
[t]
|
|
685
|
+
);
|
|
686
|
+
return {
|
|
687
|
+
collections: e,
|
|
688
|
+
collectionsById: n
|
|
689
|
+
};
|
|
690
|
+
}, hn = () => {
|
|
691
|
+
const { data: t } = pe();
|
|
692
|
+
return ft(() => {
|
|
693
|
+
const e = [], n = {}, r = {};
|
|
694
|
+
if (t != null && t.meta)
|
|
695
|
+
for (const s of Object.values(
|
|
696
|
+
t.meta.variableCollections
|
|
697
|
+
)) {
|
|
698
|
+
e.push(...s.modes), n[s.id] = s.modes;
|
|
699
|
+
for (const c of s.modes)
|
|
700
|
+
r[c.modeId] = c;
|
|
701
|
+
}
|
|
702
|
+
return {
|
|
703
|
+
modes: e,
|
|
704
|
+
modesByCollectionId: n,
|
|
705
|
+
modesById: r
|
|
706
|
+
};
|
|
707
|
+
}, [t]);
|
|
708
|
+
};
|
|
709
|
+
function ln(t, e) {
|
|
710
|
+
switch (e.type) {
|
|
711
|
+
case "loading":
|
|
712
|
+
return { ...t, status: "loading", error: null };
|
|
713
|
+
case "success":
|
|
714
|
+
return { ...t, status: "success", data: e.payload };
|
|
715
|
+
case "error":
|
|
716
|
+
return { ...t, status: "error", error: e.payload };
|
|
717
|
+
default:
|
|
718
|
+
return t;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const dt = (t) => {
|
|
722
|
+
const e = {
|
|
723
|
+
status: "idle",
|
|
724
|
+
data: null,
|
|
725
|
+
error: null
|
|
726
|
+
}, [n, r] = Te(ln, e);
|
|
727
|
+
return {
|
|
728
|
+
mutate: lt(
|
|
729
|
+
async (c) => {
|
|
730
|
+
r({ type: "loading" });
|
|
731
|
+
try {
|
|
732
|
+
const o = await t(c);
|
|
733
|
+
return r({ type: "success", payload: o }), o;
|
|
734
|
+
} catch (o) {
|
|
735
|
+
r({ type: "error", payload: o });
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
[t]
|
|
740
|
+
),
|
|
741
|
+
...n,
|
|
742
|
+
isLoading: n.status === "loading",
|
|
743
|
+
isSuccess: n.status === "success",
|
|
744
|
+
isError: n.status === "error"
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
async function Et(t, e, n, r) {
|
|
748
|
+
if (!e)
|
|
749
|
+
throw new Error(z);
|
|
750
|
+
const c = {
|
|
751
|
+
CREATE: "POST",
|
|
752
|
+
UPDATE: "PUT",
|
|
753
|
+
DELETE: "DELETE"
|
|
754
|
+
}[n], o = await fetch(`${xt}${t}`, {
|
|
755
|
+
method: c,
|
|
756
|
+
headers: {
|
|
757
|
+
"Content-Type": "application/json",
|
|
758
|
+
[Ee]: e
|
|
759
|
+
},
|
|
760
|
+
body: r ? JSON.stringify(r) : void 0
|
|
761
|
+
});
|
|
762
|
+
if (!o.ok) {
|
|
763
|
+
const u = await o.json().catch(() => ({}));
|
|
764
|
+
throw new Error(
|
|
765
|
+
u.err || u.message || "An API error occurred"
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
return o.status === 204 || !o.body ? {} : o.json();
|
|
769
|
+
}
|
|
770
|
+
const _n = () => {
|
|
771
|
+
const { token: t } = nt();
|
|
772
|
+
return dt(async (n) => {
|
|
773
|
+
if (!t)
|
|
774
|
+
throw new Error(z);
|
|
775
|
+
return await Et(
|
|
776
|
+
fe,
|
|
777
|
+
t,
|
|
778
|
+
"CREATE",
|
|
779
|
+
n
|
|
780
|
+
);
|
|
781
|
+
});
|
|
782
|
+
}, Sn = () => {
|
|
783
|
+
const { token: t } = nt();
|
|
784
|
+
return dt(
|
|
785
|
+
async ({ variableId: n, payload: r }) => {
|
|
786
|
+
if (!t)
|
|
787
|
+
throw new Error(z);
|
|
788
|
+
const s = de(n);
|
|
789
|
+
return await Et(
|
|
790
|
+
s,
|
|
791
|
+
t,
|
|
792
|
+
"UPDATE",
|
|
793
|
+
r
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
}, On = () => {
|
|
798
|
+
const { token: t } = nt();
|
|
799
|
+
return dt(async (n) => {
|
|
800
|
+
if (!t)
|
|
801
|
+
throw new Error(z);
|
|
802
|
+
return await Et(
|
|
803
|
+
de(n),
|
|
804
|
+
t,
|
|
805
|
+
"DELETE",
|
|
806
|
+
void 0
|
|
807
|
+
);
|
|
808
|
+
});
|
|
809
|
+
}, vn = () => {
|
|
810
|
+
const { token: t } = nt();
|
|
811
|
+
return dt(async (n) => {
|
|
812
|
+
if (!t)
|
|
813
|
+
throw new Error(z);
|
|
814
|
+
return await Et(
|
|
815
|
+
fe,
|
|
816
|
+
t,
|
|
817
|
+
"CREATE",
|
|
818
|
+
n
|
|
819
|
+
);
|
|
820
|
+
});
|
|
821
|
+
};
|
|
822
|
+
function wn(t, e) {
|
|
823
|
+
return t.filter((n) => {
|
|
824
|
+
let r = !0;
|
|
825
|
+
return e.resolvedType && (r = r && n.resolvedType === e.resolvedType), e.name && (r = r && n.name.includes(e.name)), r;
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
export {
|
|
829
|
+
pn as FigmaVarsProvider,
|
|
830
|
+
wn as filterVariables,
|
|
831
|
+
vn as useBulkUpdateVariables,
|
|
832
|
+
_n as useCreateVariable,
|
|
833
|
+
On as useDeleteVariable,
|
|
834
|
+
Sn as useUpdateVariable,
|
|
835
|
+
mn as useVariableCollections,
|
|
836
|
+
hn as useVariableModes,
|
|
837
|
+
pe as useVariables
|
|
838
|
+
};
|