@animaapp/anima-sdk-react 0.4.6 → 0.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/dist/index.js CHANGED
@@ -155,41 +155,41 @@ function za() {
155
155
  t.exports = s();
156
156
  })(Va, function() {
157
157
  var n = typeof Promise == "function", s = typeof self == "object" ? self : Fa, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", p = r && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", v = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), l = v && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), y = h && typeof Array.prototype[Symbol.iterator] == "function", m = y && Object.getPrototypeOf([][Symbol.iterator]()), W = h && typeof String.prototype[Symbol.iterator] == "function", R = W && Object.getPrototypeOf(""[Symbol.iterator]()), z = 8, L = -1;
158
- function q(j) {
159
- var Z = typeof j;
160
- if (Z !== "object")
161
- return Z;
162
- if (j === null)
158
+ function q(Z) {
159
+ var D = typeof Z;
160
+ if (D !== "object")
161
+ return D;
162
+ if (Z === null)
163
163
  return "null";
164
- if (j === s)
164
+ if (Z === s)
165
165
  return "global";
166
- if (Array.isArray(j) && (p === !1 || !(Symbol.toStringTag in j)))
166
+ if (Array.isArray(Z) && (p === !1 || !(Symbol.toStringTag in Z)))
167
167
  return "Array";
168
168
  if (typeof window == "object" && window !== null) {
169
- if (typeof window.location == "object" && j === window.location)
169
+ if (typeof window.location == "object" && Z === window.location)
170
170
  return "Location";
171
- if (typeof window.document == "object" && j === window.document)
171
+ if (typeof window.document == "object" && Z === window.document)
172
172
  return "Document";
173
173
  if (typeof window.navigator == "object") {
174
- if (typeof window.navigator.mimeTypes == "object" && j === window.navigator.mimeTypes)
174
+ if (typeof window.navigator.mimeTypes == "object" && Z === window.navigator.mimeTypes)
175
175
  return "MimeTypeArray";
176
- if (typeof window.navigator.plugins == "object" && j === window.navigator.plugins)
176
+ if (typeof window.navigator.plugins == "object" && Z === window.navigator.plugins)
177
177
  return "PluginArray";
178
178
  }
179
- if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && j instanceof window.HTMLElement) {
180
- if (j.tagName === "BLOCKQUOTE")
179
+ if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && Z instanceof window.HTMLElement) {
180
+ if (Z.tagName === "BLOCKQUOTE")
181
181
  return "HTMLQuoteElement";
182
- if (j.tagName === "TD")
182
+ if (Z.tagName === "TD")
183
183
  return "HTMLTableDataCellElement";
184
- if (j.tagName === "TH")
184
+ if (Z.tagName === "TH")
185
185
  return "HTMLTableHeaderCellElement";
186
186
  }
187
187
  }
188
- var Se = p && j[Symbol.toStringTag];
188
+ var Se = p && Z[Symbol.toStringTag];
189
189
  if (typeof Se == "string")
190
190
  return Se;
191
- var $ = Object.getPrototypeOf(j);
192
- return $ === RegExp.prototype ? "RegExp" : $ === Date.prototype ? "Date" : n && $ === Promise.prototype ? "Promise" : i && $ === Set.prototype ? "Set" : a && $ === Map.prototype ? "Map" : c && $ === WeakSet.prototype ? "WeakSet" : o && $ === WeakMap.prototype ? "WeakMap" : u && $ === DataView.prototype ? "DataView" : a && $ === l ? "Map Iterator" : i && $ === b ? "Set Iterator" : y && $ === m ? "Array Iterator" : W && $ === R ? "String Iterator" : $ === null ? "Object" : Object.prototype.toString.call(j).slice(z, L);
191
+ var $ = Object.getPrototypeOf(Z);
192
+ return $ === RegExp.prototype ? "RegExp" : $ === Date.prototype ? "Date" : n && $ === Promise.prototype ? "Promise" : i && $ === Set.prototype ? "Set" : a && $ === Map.prototype ? "Map" : c && $ === WeakSet.prototype ? "WeakSet" : o && $ === WeakMap.prototype ? "WeakMap" : u && $ === DataView.prototype ? "DataView" : a && $ === l ? "Map Iterator" : i && $ === b ? "Set Iterator" : y && $ === m ? "Array Iterator" : W && $ === R ? "String Iterator" : $ === null ? "Object" : Object.prototype.toString.call(Z).slice(z, L);
193
193
  }
194
194
  return q;
195
195
  });
@@ -3648,7 +3648,7 @@ const no = (t, e = {
3648
3648
  bigint: (t) => $e.create(E(d({}, t), { coerce: !0 })),
3649
3649
  date: (t) => Qe.create(E(d({}, t), { coerce: !0 }))
3650
3650
  }, Lo = S;
3651
- var M = /* @__PURE__ */ Object.freeze({
3651
+ var I = /* @__PURE__ */ Object.freeze({
3652
3652
  __proto__: null,
3653
3653
  defaultErrorMap: yt,
3654
3654
  setErrorMap: Ri,
@@ -3764,16 +3764,16 @@ var M = /* @__PURE__ */ Object.freeze({
3764
3764
  quotelessJson: Ni,
3765
3765
  ZodError: ie
3766
3766
  });
3767
- M.object({
3768
- language: M.enum(["typescript", "javascript"]).optional(),
3769
- disableMarkedForExport: M.boolean().optional(),
3770
- allowAutoSelectFirstNode: M.boolean().optional().default(!0)
3767
+ I.object({
3768
+ language: I.enum(["typescript", "javascript"]).optional(),
3769
+ disableMarkedForExport: I.boolean().optional(),
3770
+ allowAutoSelectFirstNode: I.boolean().optional().default(!0)
3771
3771
  }).and(
3772
- M.union([
3773
- M.object({
3774
- framework: M.literal("react"),
3775
- model: M.string().optional(),
3776
- styling: M.enum([
3772
+ I.union([
3773
+ I.object({
3774
+ framework: I.literal("react"),
3775
+ model: I.string().optional(),
3776
+ styling: I.enum([
3777
3777
  "plain_css",
3778
3778
  "css_modules",
3779
3779
  "styled_components",
@@ -3782,24 +3782,25 @@ M.object({
3782
3782
  "scss",
3783
3783
  "inline_styles"
3784
3784
  ]),
3785
- uiLibrary: M.enum(["mui", "antd", "radix", "shadcn"]).optional(),
3786
- responsivePages: M.array(
3787
- M.object({
3788
- name: M.string(),
3789
- framesId: M.array(M.string())
3785
+ uiLibrary: I.enum(["mui", "antd", "radix", "shadcn"]).optional(),
3786
+ responsivePages: I.array(
3787
+ I.object({
3788
+ name: I.string(),
3789
+ framesId: I.array(I.string())
3790
3790
  })
3791
3791
  ).optional(),
3792
- enableUILibraryTheming: M.boolean().optional(),
3793
- enableCompactStructure: M.boolean().optional(),
3794
- enableDisplayScreenModelId: M.boolean().optional(),
3795
- enableGeneratePackageLock: M.boolean().optional(),
3796
- enableAutoSplit: M.boolean().optional(),
3797
- autoSplitThreshold: M.number().optional()
3792
+ enableUILibraryTheming: I.boolean().optional(),
3793
+ enableCompactStructure: I.boolean().optional(),
3794
+ enableDisplayScreenModelId: I.boolean().optional(),
3795
+ enableGeneratePackageLock: I.boolean().optional(),
3796
+ enableAutoSplit: I.boolean().optional(),
3797
+ autoSplitThreshold: I.number().optional(),
3798
+ codegenSettings: I.record(I.unknown()).optional()
3798
3799
  }),
3799
- M.object({
3800
- framework: M.literal("html"),
3801
- styling: M.enum(["plain_css", "inline_styles", "tailwind"]),
3802
- enableTranslation: M.boolean().optional()
3800
+ I.object({
3801
+ framework: I.literal("html"),
3802
+ styling: I.enum(["plain_css", "inline_styles", "tailwind"]),
3803
+ enableTranslation: I.boolean().optional()
3803
3804
  })
3804
3805
  ])
3805
3806
  );
@@ -4777,8 +4778,8 @@ const yr = {
4777
4778
  if (R.status === "fulfilled") {
4778
4779
  const { assetName: L, base64: q } = R.value;
4779
4780
  z[L] = q;
4780
- const j = y ? `${y}/${L}` : L;
4781
- l.files[j] = {
4781
+ const Z = y ? `${y}/${L}` : L;
4782
+ l.files[Z] = {
4782
4783
  content: q,
4783
4784
  isBinary: !0
4784
4785
  };
@@ -5057,13 +5058,13 @@ function Yr(...t) {
5057
5058
  if (t.length < 3)
5058
5059
  return z();
5059
5060
  let L = s, q;
5060
- const j = Os();
5061
+ const Z = Os();
5061
5062
  m[v] = [
5062
- j,
5063
+ Z,
5063
5064
  0
5064
5065
  ];
5065
- const Z = !N(c), Se = b(), $ = Se.data, st = Se._c, ze = N(st) ? $ : st;
5066
- if (Z && (c = be(c) ? c(ze, $) : c, l({
5066
+ const D = !N(c), Se = b(), $ = Se.data, st = Se._c, ze = N(st) ? $ : st;
5067
+ if (D && (c = be(c) ? c(ze, $) : c, l({
5067
5068
  data: c,
5068
5069
  _c: ze
5069
5070
  })), be(L))
@@ -5075,10 +5076,10 @@ function Yr(...t) {
5075
5076
  if (L && Jr(L))
5076
5077
  if (L = yield L.catch((le) => {
5077
5078
  q = le;
5078
- }), j !== m[v][0]) {
5079
+ }), Z !== m[v][0]) {
5079
5080
  if (q) throw q;
5080
5081
  return L;
5081
- } else q && Z && u(q) && (i = !0, l({
5082
+ } else q && D && u(q) && (i = !0, l({
5082
5083
  data: ze,
5083
5084
  _c: ee
5084
5085
  }));
@@ -5242,28 +5243,28 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5242
5243
  }), Bn = {
5243
5244
  dedupe: !0
5244
5245
  }, Ic = (t, e, n) => {
5245
- const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [v, b, l, y] = Re.get(s), [m, W] = js(t), R = Ke(!1), z = Ke(!1), L = Ke(m), q = Ke(e), j = Ke(n), Z = () => j.current, Se = () => Z().isVisible() && Z().isOnline(), [$, st, ze, le] = Xr(s, m), rt = Ke({}).current, Yt = N(i) ? N(n.fallback) ? ee : n.fallback[m] : i, Zs = (D, I) => {
5246
+ const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [v, b, l, y] = Re.get(s), [m, W] = js(t), R = Ke(!1), z = Ke(!1), L = Ke(m), q = Ke(e), Z = Ke(n), D = () => Z.current, Se = () => D().isVisible() && D().isOnline(), [$, st, ze, le] = Xr(s, m), rt = Ke({}).current, Yt = N(i) ? N(n.fallback) ? ee : n.fallback[m] : i, Zs = (M, j) => {
5246
5247
  for (const G in rt) {
5247
5248
  const U = G;
5248
5249
  if (U === "data") {
5249
- if (!r(D[U], I[U]) && (!N(D[U]) || !r(en, I[U])))
5250
+ if (!r(M[U], j[U]) && (!N(M[U]) || !r(en, j[U])))
5250
5251
  return !1;
5251
- } else if (I[U] !== D[U])
5252
+ } else if (j[U] !== M[U])
5252
5253
  return !1;
5253
5254
  }
5254
5255
  return !0;
5255
5256
  }, Ds = ma(() => {
5256
- const D = !m || !e ? !1 : N(o) ? Z().isPaused() || a ? !1 : c !== !1 : o, I = (Y) => {
5257
+ const M = !m || !e ? !1 : N(o) ? D().isPaused() || a ? !1 : c !== !1 : o, j = (Y) => {
5257
5258
  const Oe = Ve(Y);
5258
- return delete Oe._k, D ? Be({
5259
+ return delete Oe._k, M ? Be({
5259
5260
  isValidating: !0,
5260
5261
  isLoading: !0
5261
5262
  }, Oe) : Oe;
5262
- }, G = $(), U = le(), fe = I(G), ot = G === U ? fe : I(U);
5263
+ }, G = $(), U = le(), fe = j(G), ot = G === U ? fe : j(U);
5263
5264
  let H = fe;
5264
5265
  return [
5265
5266
  () => {
5266
- const Y = I($());
5267
+ const Y = j($());
5267
5268
  return Zs(Y, H) ? (H.data = Y.data, H.isLoading = Y.isLoading, H.isValidating = Y.isValidating, H.error = Y.error, H) : (H = Y, Y);
5268
5269
  },
5269
5270
  () => ot
@@ -5272,21 +5273,21 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5272
5273
  s,
5273
5274
  m
5274
5275
  ]), at = ac.useSyncExternalStore(rn(
5275
- (D) => ze(m, (I, G) => {
5276
- Zs(G, I) || D();
5276
+ (M) => ze(m, (j, G) => {
5277
+ Zs(G, j) || M();
5277
5278
  }),
5278
5279
  // eslint-disable-next-line react-hooks/exhaustive-deps
5279
5280
  [
5280
5281
  s,
5281
5282
  m
5282
5283
  ]
5283
- ), Ds[0], Ds[1]), Ms = !R.current, ta = v[m] && v[m].length > 0, it = at.data, Ue = N(it) ? Yt && Jr(Yt) ? Un(Yt) : Yt : it, Qt = at.error, Cn = Ke(Ue), en = k ? N(it) ? N(Cn.current) ? Ue : Cn.current : it : Ue, Ls = ta && !N(Qt) ? !1 : Ms && !N(o) ? o : Z().isPaused() ? !1 : a ? N(Ue) ? !1 : c : N(Ue) || c, $s = !!(m && e && Ms && Ls), na = N(at.isValidating) ? $s : at.isValidating, sa = N(at.isLoading) ? $s : at.isLoading, wt = rn(
5284
- (D) => Ie(void 0, null, function* () {
5285
- const I = q.current;
5286
- if (!m || !I || z.current || Z().isPaused())
5284
+ ), Ds[0], Ds[1]), Ms = !R.current, ta = v[m] && v[m].length > 0, it = at.data, Ue = N(it) ? Yt && Jr(Yt) ? Un(Yt) : Yt : it, Qt = at.error, Cn = Ke(Ue), en = k ? N(it) ? N(Cn.current) ? Ue : Cn.current : it : Ue, Ls = ta && !N(Qt) ? !1 : Ms && !N(o) ? o : D().isPaused() ? !1 : a ? N(Ue) ? !1 : c : N(Ue) || c, $s = !!(m && e && Ms && Ls), na = N(at.isValidating) ? $s : at.isValidating, sa = N(at.isLoading) ? $s : at.isLoading, wt = rn(
5285
+ (M) => Ie(void 0, null, function* () {
5286
+ const j = q.current;
5287
+ if (!m || !j || z.current || D().isPaused())
5287
5288
  return !1;
5288
5289
  let G, U, fe = !0;
5289
- const ot = D || {}, H = !l[m] || !ot.dedupe, Y = () => xr ? !z.current && m === L.current && R.current : m === L.current, Oe = {
5290
+ const ot = M || {}, H = !l[m] || !ot.dedupe, Y = () => xr ? !z.current && m === L.current && R.current : m === L.current, Oe = {
5290
5291
  isValidating: !1,
5291
5292
  isLoading: !1
5292
5293
  }, Ws = () => {
@@ -5300,25 +5301,25 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5300
5301
  N($().data) && (zs.isLoading = !0);
5301
5302
  try {
5302
5303
  if (H && (st(zs), n.loadingTimeout && N($().data) && setTimeout(() => {
5303
- fe && Y() && Z().onLoadingSlow(m, n);
5304
+ fe && Y() && D().onLoadingSlow(m, n);
5304
5305
  }, n.loadingTimeout), l[m] = [
5305
- I(W),
5306
+ j(W),
5306
5307
  Os()
5307
5308
  ]), [G, U] = l[m], G = yield G, H && setTimeout(Vs, n.dedupingInterval), !l[m] || l[m][1] !== U)
5308
- return H && Y() && Z().onDiscarded(m), !1;
5309
+ return H && Y() && D().onDiscarded(m), !1;
5309
5310
  Oe.error = ee;
5310
5311
  const ue = b[m];
5311
5312
  if (!N(ue) && // case 1
5312
5313
  (U <= ue[0] || // case 2
5313
5314
  U <= ue[1] || // case 3
5314
5315
  ue[1] === 0))
5315
- return Ws(), H && Y() && Z().onDiscarded(m), !1;
5316
+ return Ws(), H && Y() && D().onDiscarded(m), !1;
5316
5317
  const Te = $().data;
5317
- Oe.data = r(Te, G) ? Te : G, H && Y() && Z().onSuccess(G, m, n);
5318
+ Oe.data = r(Te, G) ? Te : G, H && Y() && D().onSuccess(G, m, n);
5318
5319
  } catch (ue) {
5319
5320
  Vs();
5320
- const Te = Z(), { shouldRetryOnError: An } = Te;
5321
- Te.isPaused() || (Oe.error = ue, H && Y() && (Te.onError(ue, m, Te), (An === !0 || be(An) && An(ue)) && (!Z().revalidateOnFocus || !Z().revalidateOnReconnect || Se()) && Te.onErrorRetry(ue, m, Te, (ra) => {
5321
+ const Te = D(), { shouldRetryOnError: An } = Te;
5322
+ Te.isPaused() || (Oe.error = ue, H && Y() && (Te.onError(ue, m, Te), (An === !0 || be(An) && An(ue)) && (!D().revalidateOnFocus || !D().revalidateOnReconnect || Se()) && Te.onErrorRetry(ue, m, Te, (ra) => {
5322
5323
  const Nn = v[m];
5323
5324
  Nn && Nn[0] && Nn[0](wr, ra);
5324
5325
  }, {
@@ -5345,23 +5346,23 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5345
5346
  ]
5346
5347
  ), Fs = rn(
5347
5348
  // Use callback to make sure `keyRef.current` returns latest result every time
5348
- (...D) => Yr(s, L.current, ...D),
5349
+ (...M) => Yr(s, L.current, ...M),
5349
5350
  // eslint-disable-next-line react-hooks/exhaustive-deps
5350
5351
  []
5351
5352
  );
5352
5353
  if (Wn(() => {
5353
- q.current = e, j.current = n, N(it) || (Cn.current = it);
5354
+ q.current = e, Z.current = n, N(it) || (Cn.current = it);
5354
5355
  }), Wn(() => {
5355
5356
  if (!m) return;
5356
- const D = wt.bind(ee, Bn);
5357
- let I = 0;
5358
- Z().revalidateOnFocus && (I = Date.now() + Z().focusThrottleInterval);
5357
+ const M = wt.bind(ee, Bn);
5358
+ let j = 0;
5359
+ D().revalidateOnFocus && (j = Date.now() + D().focusThrottleInterval);
5359
5360
  const U = Pc(m, v, (fe, ot = {}) => {
5360
5361
  if (fe == qr) {
5361
5362
  const H = Date.now();
5362
- Z().revalidateOnFocus && H > I && Se() && (I = H + Z().focusThrottleInterval, D());
5363
+ D().revalidateOnFocus && H > j && Se() && (j = H + D().focusThrottleInterval, M());
5363
5364
  } else if (fe == Hr)
5364
- Z().revalidateOnReconnect && Se() && D();
5365
+ D().revalidateOnReconnect && Se() && M();
5365
5366
  else {
5366
5367
  if (fe == Gr)
5367
5368
  return wt();
@@ -5371,22 +5372,22 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5371
5372
  });
5372
5373
  return z.current = !1, L.current = m, R.current = !0, st({
5373
5374
  _k: W
5374
- }), Ls && (N(Ue) || Ht ? D() : pc(D)), () => {
5375
+ }), Ls && (N(Ue) || Ht ? M() : pc(M)), () => {
5375
5376
  z.current = !0, U();
5376
5377
  };
5377
5378
  }, [
5378
5379
  m
5379
5380
  ]), Wn(() => {
5380
- let D;
5381
- function I() {
5381
+ let M;
5382
+ function j() {
5382
5383
  const U = be(u) ? u($().data) : u;
5383
- U && D !== -1 && (D = setTimeout(G, U));
5384
+ U && M !== -1 && (M = setTimeout(G, U));
5384
5385
  }
5385
5386
  function G() {
5386
- !$().error && (h || Z().isVisible()) && (p || Z().isOnline()) ? wt(Bn).then(I) : I();
5387
+ !$().error && (h || D().isVisible()) && (p || D().isOnline()) ? wt(Bn).then(j) : j();
5387
5388
  }
5388
- return I(), () => {
5389
- D && (clearTimeout(D), D = -1);
5389
+ return j(), () => {
5390
+ M && (clearTimeout(M), M = -1);
5390
5391
  };
5391
5392
  }, [
5392
5393
  u,
@@ -5396,15 +5397,15 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5396
5397
  ]), ya(en), a && N(Ue) && m) {
5397
5398
  if (!xr && Ht)
5398
5399
  throw new Error("Fallback data is required when using Suspense in SSR.");
5399
- q.current = e, j.current = n, z.current = !1;
5400
- const D = y[m];
5401
- if (!N(D)) {
5402
- const I = Fs(D);
5403
- Un(I);
5400
+ q.current = e, Z.current = n, z.current = !1;
5401
+ const M = y[m];
5402
+ if (!N(M)) {
5403
+ const j = Fs(M);
5404
+ Un(j);
5404
5405
  }
5405
5406
  if (N(Qt)) {
5406
- const I = wt(Bn);
5407
- N(en) || (I.status = "fulfilled", I.value = !0), Un(I);
5407
+ const j = wt(Bn);
5408
+ N(en) || (j.status = "fulfilled", j.value = !0), Un(j);
5408
5409
  } else
5409
5410
  throw Qt;
5410
5411
  }
@@ -5430,7 +5431,7 @@ const Un = Gt.use || // This extra generic is to avoid TypeScript mixing up the
5430
5431
  params: s = {}
5431
5432
  }) => {
5432
5433
  const r = !!(n && t && e), { data: a, isLoading: i, error: o } = jc(
5433
- ["figma", t, e, s],
5434
+ ["useFigmaFile", t, e, s],
5434
5435
  () => r ? Ai({
5435
5436
  fileKey: t,
5436
5437
  authToken: e,