@ikonai/sdk-react-ui-rive 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/index.js +376 -358
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import me, { memo as ge, useMemo as V, useRef as se, useEffect as Y, useCallback as q } from "react";
2
- import { Fit as _, Alignment as O, Layout as be, useRive as ve, EventType as Z } from "@rive-app/react-canvas";
3
- import { useUiNode as he } from "@ikonai/sdk-react-ui";
4
- var U = { exports: {} }, z = {};
1
+ import me, { memo as ge, useMemo as Y, useRef as ee, useEffect as q, useCallback as U } from "react";
2
+ import { Fit as k, Alignment as O, Layout as be, useRive as he, EventType as te } from "@rive-app/react-canvas";
3
+ import { useUiNode as ve } from "@ikonai/sdk-react-ui";
4
+ var $ = { exports: {} }, z = {};
5
5
  /**
6
6
  * @license React
7
7
  * react-jsx-runtime.production.js
@@ -11,27 +11,27 @@ var U = { exports: {} }, z = {};
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
13
  */
14
- var ae;
14
+ var ce;
15
15
  function pe() {
16
- if (ae) return z;
17
- ae = 1;
18
- var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
19
- function o(a, i, n) {
20
- var f = null;
21
- if (n !== void 0 && (f = "" + n), i.key !== void 0 && (f = "" + i.key), "key" in i) {
22
- n = {};
23
- for (var E in i)
24
- E !== "key" && (n[E] = i[E]);
25
- } else n = i;
26
- return i = n.ref, {
16
+ if (ce) return z;
17
+ ce = 1;
18
+ var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
19
+ function r(c, i, o) {
20
+ var l = null;
21
+ if (o !== void 0 && (l = "" + o), i.key !== void 0 && (l = "" + i.key), "key" in i) {
22
+ o = {};
23
+ for (var p in i)
24
+ p !== "key" && (o[p] = i[p]);
25
+ } else o = i;
26
+ return i = o.ref, {
27
27
  $$typeof: e,
28
- type: a,
29
- key: f,
28
+ type: c,
29
+ key: l,
30
30
  ref: i !== void 0 ? i : null,
31
- props: n
31
+ props: o
32
32
  };
33
33
  }
34
- return z.Fragment = r, z.jsx = o, z.jsxs = o, z;
34
+ return z.Fragment = n, z.jsx = r, z.jsxs = r, z;
35
35
  }
36
36
  var B = {};
37
37
  /**
@@ -43,26 +43,26 @@ var B = {};
43
43
  * This source code is licensed under the MIT license found in the
44
44
  * LICENSE file in the root directory of this source tree.
45
45
  */
46
- var ce;
46
+ var ue;
47
47
  function ye() {
48
- return ce || (ce = 1, process.env.NODE_ENV !== "production" && function() {
48
+ return ue || (ue = 1, process.env.NODE_ENV !== "production" && function() {
49
49
  function e(t) {
50
50
  if (t == null) return null;
51
51
  if (typeof t == "function")
52
- return t.$$typeof === W ? null : t.displayName || t.name || null;
52
+ return t.$$typeof === H ? null : t.displayName || t.name || null;
53
53
  if (typeof t == "string") return t;
54
54
  switch (t) {
55
55
  case x:
56
56
  return "Fragment";
57
57
  case S:
58
58
  return "Profiler";
59
- case P:
59
+ case M:
60
60
  return "StrictMode";
61
61
  case b:
62
62
  return "Suspense";
63
- case v:
63
+ case m:
64
64
  return "SuspenseList";
65
- case K:
65
+ case W:
66
66
  return "Activity";
67
67
  }
68
68
  if (typeof t == "object")
@@ -71,51 +71,51 @@ function ye() {
71
71
  ), t.$$typeof) {
72
72
  case L:
73
73
  return "Portal";
74
- case c:
74
+ case f:
75
75
  return (t.displayName || "Context") + ".Provider";
76
76
  case u:
77
77
  return (t._context.displayName || "Context") + ".Consumer";
78
78
  case d:
79
- var s = t.render;
80
- return t = t.displayName, t || (t = s.displayName || s.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
81
- case m:
82
- return s = t.displayName || null, s !== null ? s : e(t.type) || "Memo";
83
- case h:
84
- s = t._payload, t = t._init;
79
+ var a = t.render;
80
+ return t = t.displayName, t || (t = a.displayName || a.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
81
+ case g:
82
+ return a = t.displayName || null, a !== null ? a : e(t.type) || "Memo";
83
+ case v:
84
+ a = t._payload, t = t._init;
85
85
  try {
86
- return e(t(s));
86
+ return e(t(a));
87
87
  } catch {
88
88
  }
89
89
  }
90
90
  return null;
91
91
  }
92
- function r(t) {
92
+ function n(t) {
93
93
  return "" + t;
94
94
  }
95
- function o(t) {
95
+ function r(t) {
96
96
  try {
97
- r(t);
98
- var s = !1;
97
+ n(t);
98
+ var a = !1;
99
99
  } catch {
100
- s = !0;
100
+ a = !0;
101
101
  }
102
- if (s) {
103
- s = console;
104
- var g = s.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
105
- return g.call(
106
- s,
102
+ if (a) {
103
+ a = console;
104
+ var h = a.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
105
+ return h.call(
106
+ a,
107
107
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
108
  y
109
- ), r(t);
109
+ ), n(t);
110
110
  }
111
111
  }
112
- function a(t) {
112
+ function c(t) {
113
113
  if (t === x) return "<>";
114
- if (typeof t == "object" && t !== null && t.$$typeof === h)
114
+ if (typeof t == "object" && t !== null && t.$$typeof === v)
115
115
  return "<...>";
116
116
  try {
117
- var s = e(t);
118
- return s ? "<" + s + ">" : "<...>";
117
+ var a = e(t);
118
+ return a ? "<" + a + ">" : "<...>";
119
119
  } catch {
120
120
  return "<...>";
121
121
  }
@@ -124,44 +124,44 @@ function ye() {
124
124
  var t = D.A;
125
125
  return t === null ? null : t.getOwner();
126
126
  }
127
- function n() {
127
+ function o() {
128
128
  return Error("react-stack-top-frame");
129
129
  }
130
- function f(t) {
131
- if (ee.call(t, "key")) {
132
- var s = Object.getOwnPropertyDescriptor(t, "key").get;
133
- if (s && s.isReactWarning) return !1;
130
+ function l(t) {
131
+ if (V.call(t, "key")) {
132
+ var a = Object.getOwnPropertyDescriptor(t, "key").get;
133
+ if (a && a.isReactWarning) return !1;
134
134
  }
135
135
  return t.key !== void 0;
136
136
  }
137
- function E(t, s) {
138
- function g() {
139
- te || (te = !0, console.error(
137
+ function p(t, a) {
138
+ function h() {
139
+ re || (re = !0, console.error(
140
140
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
141
- s
141
+ a
142
142
  ));
143
143
  }
144
- g.isReactWarning = !0, Object.defineProperty(t, "key", {
145
- get: g,
144
+ h.isReactWarning = !0, Object.defineProperty(t, "key", {
145
+ get: h,
146
146
  configurable: !0
147
147
  });
148
148
  }
149
- function l() {
149
+ function _() {
150
150
  var t = e(this.type);
151
- return re[t] || (re[t] = !0, console.error(
151
+ return oe[t] || (oe[t] = !0, console.error(
152
152
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
153
153
  )), t = this.props.ref, t !== void 0 ? t : null;
154
154
  }
155
- function T(t, s, g, y, N, A, J, G) {
156
- return g = A.ref, t = {
155
+ function T(t, a, h, y, P, A, X, Z) {
156
+ return h = A.ref, t = {
157
157
  $$typeof: I,
158
158
  type: t,
159
- key: s,
159
+ key: a,
160
160
  props: A,
161
- _owner: N
162
- }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(t, "ref", {
161
+ _owner: P
162
+ }, (h !== void 0 ? h : null) !== null ? Object.defineProperty(t, "ref", {
163
163
  enumerable: !1,
164
- get: l
164
+ get: _
165
165
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
@@ -176,33 +176,33 @@ function ye() {
176
176
  configurable: !1,
177
177
  enumerable: !1,
178
178
  writable: !0,
179
- value: J
179
+ value: X
180
180
  }), Object.defineProperty(t, "_debugTask", {
181
181
  configurable: !1,
182
182
  enumerable: !1,
183
183
  writable: !0,
184
- value: G
184
+ value: Z
185
185
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
186
186
  }
187
- function p(t, s, g, y, N, A, J, G) {
188
- var R = s.children;
187
+ function s(t, a, h, y, P, A, X, Z) {
188
+ var R = a.children;
189
189
  if (R !== void 0)
190
190
  if (y)
191
- if (fe(R)) {
191
+ if (J(R)) {
192
192
  for (y = 0; y < R.length; y++)
193
- w(R[y]);
193
+ E(R[y]);
194
194
  Object.freeze && Object.freeze(R);
195
195
  } else
196
196
  console.error(
197
197
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
198
  );
199
- else w(R);
200
- if (ee.call(s, "key")) {
199
+ else E(R);
200
+ if (V.call(a, "key")) {
201
201
  R = e(t);
202
- var F = Object.keys(s).filter(function(de) {
202
+ var F = Object.keys(a).filter(function(de) {
203
203
  return de !== "key";
204
204
  });
205
- y = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ie[R + y] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
205
+ y = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ae[R + y] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
206
206
  `A props object containing a "key" prop is being spread into JSX:
207
207
  let props = %s;
208
208
  <%s {...props} />
@@ -213,31 +213,31 @@ React keys must be passed directly to JSX without using spread:
213
213
  R,
214
214
  F,
215
215
  R
216
- ), ie[R + y] = !0);
216
+ ), ae[R + y] = !0);
217
217
  }
218
- if (R = null, g !== void 0 && (o(g), R = "" + g), f(s) && (o(s.key), R = "" + s.key), "key" in s) {
219
- g = {};
220
- for (var X in s)
221
- X !== "key" && (g[X] = s[X]);
222
- } else g = s;
223
- return R && E(
224
- g,
218
+ if (R = null, h !== void 0 && (r(h), R = "" + h), l(a) && (r(a.key), R = "" + a.key), "key" in a) {
219
+ h = {};
220
+ for (var Q in a)
221
+ Q !== "key" && (h[Q] = a[Q]);
222
+ } else h = a;
223
+ return R && p(
224
+ h,
225
225
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
226
226
  ), T(
227
227
  t,
228
228
  R,
229
229
  A,
230
- N,
230
+ P,
231
231
  i(),
232
- g,
233
- J,
234
- G
232
+ h,
233
+ X,
234
+ Z
235
235
  );
236
236
  }
237
- function w(t) {
237
+ function E(t) {
238
238
  typeof t == "object" && t !== null && t.$$typeof === I && t._store && (t._store.validated = 1);
239
239
  }
240
- var j = me, I = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), u = Symbol.for("react.consumer"), c = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), W = Symbol.for("react.client.reference"), D = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, fe = Array.isArray, H = console.createTask ? console.createTask : function() {
240
+ var j = me, I = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), u = Symbol.for("react.consumer"), f = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), W = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), D = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, J = Array.isArray, G = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
243
  j = {
@@ -245,52 +245,52 @@ React keys must be passed directly to JSX without using spread:
245
245
  return t();
246
246
  }
247
247
  };
248
- var te, re = {}, ne = j["react-stack-bottom-frame"].bind(
248
+ var re, oe = {}, ie = j["react-stack-bottom-frame"].bind(
249
249
  j,
250
- n
251
- )(), oe = H(a(n)), ie = {};
252
- B.Fragment = x, B.jsx = function(t, s, g, y, N) {
250
+ o
251
+ )(), se = G(c(o)), ae = {};
252
+ B.Fragment = x, B.jsx = function(t, a, h, y, P) {
253
253
  var A = 1e4 > D.recentlyCreatedOwnerStacks++;
254
- return p(
254
+ return s(
255
255
  t,
256
- s,
257
- g,
256
+ a,
257
+ h,
258
258
  !1,
259
259
  y,
260
- N,
261
- A ? Error("react-stack-top-frame") : ne,
262
- A ? H(a(t)) : oe
260
+ P,
261
+ A ? Error("react-stack-top-frame") : ie,
262
+ A ? G(c(t)) : se
263
263
  );
264
- }, B.jsxs = function(t, s, g, y, N) {
264
+ }, B.jsxs = function(t, a, h, y, P) {
265
265
  var A = 1e4 > D.recentlyCreatedOwnerStacks++;
266
- return p(
266
+ return s(
267
267
  t,
268
- s,
269
- g,
268
+ a,
269
+ h,
270
270
  !0,
271
271
  y,
272
- N,
273
- A ? Error("react-stack-top-frame") : ne,
274
- A ? H(a(t)) : oe
272
+ P,
273
+ A ? Error("react-stack-top-frame") : ie,
274
+ A ? G(c(t)) : se
275
275
  );
276
276
  };
277
277
  }()), B;
278
278
  }
279
- var ue;
279
+ var fe;
280
280
  function Re() {
281
- return ue || (ue = 1, process.env.NODE_ENV === "production" ? U.exports = pe() : U.exports = ye()), U.exports;
281
+ return fe || (fe = 1, process.env.NODE_ENV === "production" ? $.exports = pe() : $.exports = ye()), $.exports;
282
282
  }
283
- var Q = Re();
283
+ var ne = Re();
284
284
  function C(e) {
285
285
  return typeof e == "object" && e !== null && !Array.isArray(e);
286
286
  }
287
- function k(e) {
287
+ function w(e) {
288
288
  if (typeof e == "string") {
289
- const r = e.trim();
290
- return r.length > 0 ? r : void 0;
289
+ const n = e.trim();
290
+ return n.length > 0 ? n : void 0;
291
291
  }
292
292
  }
293
- function M(e) {
293
+ function N(e) {
294
294
  if (typeof e == "boolean")
295
295
  return e;
296
296
  if (typeof e == "string") {
@@ -300,67 +300,67 @@ function M(e) {
300
300
  return !1;
301
301
  }
302
302
  }
303
- function $(e) {
303
+ function K(e) {
304
304
  if (typeof e == "number" && Number.isFinite(e))
305
305
  return e;
306
306
  if (typeof e == "string") {
307
- const r = Number(e.trim());
308
- return Number.isFinite(r) ? r : void 0;
307
+ const n = Number(e.trim());
308
+ return Number.isFinite(n) ? n : void 0;
309
309
  }
310
310
  }
311
311
  function le(e) {
312
312
  if (typeof e == "number" && Number.isFinite(e))
313
313
  return `${e}px`;
314
314
  if (typeof e == "string") {
315
- const r = e.trim();
316
- return r.length > 0 ? r : void 0;
315
+ const n = e.trim();
316
+ return n.length > 0 ? n : void 0;
317
317
  }
318
318
  }
319
- function Ee(e, r, o) {
320
- const a = [];
319
+ function Ee(e, n, r) {
320
+ const c = [];
321
321
  for (const i of e)
322
322
  if (typeof i == "string") {
323
- const n = i.trim();
324
- n.length > 0 && a.push(n);
323
+ const o = i.trim();
324
+ o.length > 0 && c.push(o);
325
325
  }
326
+ if (typeof n == "string") {
327
+ const i = n.trim();
328
+ i.length > 0 && c.push(i);
329
+ }
326
330
  if (typeof r == "string") {
327
331
  const i = r.trim();
328
- i.length > 0 && a.push(i);
329
- }
330
- if (typeof o == "string") {
331
- const i = o.trim();
332
- i.length > 0 && a.push(i);
332
+ i.length > 0 && c.push(i);
333
333
  }
334
- return a.length > 0 ? a.join(" ") : void 0;
334
+ return c.length > 0 ? c.join(" ") : void 0;
335
335
  }
336
336
  function we(e) {
337
337
  if (typeof e == "string") {
338
- const r = e.trim();
339
- return r.length > 0 ? [r] : void 0;
338
+ const n = e.trim();
339
+ return n.length > 0 ? [n] : void 0;
340
340
  }
341
341
  if (Array.isArray(e)) {
342
- const r = e.map((o) => typeof o == "string" ? o.trim() : "").filter((o) => o.length > 0);
343
- return r.length > 0 ? Array.from(new Set(r)) : void 0;
342
+ const n = e.map((r) => typeof r == "string" ? r.trim() : "").filter((r) => r.length > 0);
343
+ return n.length > 0 ? Array.from(new Set(n)) : void 0;
344
344
  }
345
345
  }
346
346
  const ke = {
347
- contain: _.Contain,
348
- cover: _.Cover,
349
- fill: _.Fill,
350
- fitwidth: _.FitWidth,
351
- fitheight: _.FitHeight,
352
- width: _.FitWidth,
353
- height: _.FitHeight,
354
- scaledown: _.ScaleDown,
355
- layout: _.Layout,
356
- stretch: _.Fill,
357
- none: _.None
347
+ contain: k.Contain,
348
+ cover: k.Cover,
349
+ fill: k.Fill,
350
+ fitwidth: k.FitWidth,
351
+ fitheight: k.FitHeight,
352
+ width: k.FitWidth,
353
+ height: k.FitHeight,
354
+ scaledown: k.ScaleDown,
355
+ layout: k.Layout,
356
+ stretch: k.Fill,
357
+ none: k.None
358
358
  };
359
359
  function Te(e) {
360
360
  if (typeof e != "string")
361
361
  return;
362
- const r = e.replace(/[-_\s]/g, "").toLowerCase();
363
- return ke[r];
362
+ const n = e.replace(/[-_\s]/g, "").toLowerCase();
363
+ return ke[n];
364
364
  }
365
365
  const _e = {
366
366
  center: O.Center,
@@ -376,343 +376,354 @@ const _e = {
376
376
  function Ae(e) {
377
377
  if (typeof e != "string")
378
378
  return;
379
- const r = e.replace(/[-_\s]/g, "").toLowerCase();
380
- return _e[r];
379
+ const n = e.replace(/[-_\s]/g, "").toLowerCase();
380
+ return _e[n];
381
381
  }
382
382
  function Oe(e) {
383
383
  if (!C(e))
384
384
  return;
385
- const r = {};
386
- let o = !1;
387
- for (const [a, i] of Object.entries(e)) {
388
- const n = a.trim();
389
- if (!n)
385
+ const n = {};
386
+ let r = !1;
387
+ for (const [c, i] of Object.entries(e)) {
388
+ const o = c.trim();
389
+ if (!o)
390
390
  continue;
391
- const f = M(i);
392
- f !== void 0 && (r[n] = f, o = !0);
391
+ const l = N(i);
392
+ l !== void 0 && (n[o] = l, r = !0);
393
393
  }
394
- return o ? r : void 0;
394
+ return r ? n : void 0;
395
395
  }
396
396
  function Se(e) {
397
397
  if (!C(e))
398
398
  return;
399
- const r = {};
400
- let o = !1;
401
- for (const [a, i] of Object.entries(e)) {
402
- const n = a.trim();
403
- if (!n)
399
+ const n = {};
400
+ let r = !1;
401
+ for (const [c, i] of Object.entries(e)) {
402
+ const o = c.trim();
403
+ if (!o)
404
404
  continue;
405
- const f = $(i);
406
- f !== void 0 && (r[n] = f, o = !0);
405
+ const l = K(i);
406
+ l !== void 0 && (n[o] = l, r = !0);
407
407
  }
408
- return o ? r : void 0;
408
+ return r ? n : void 0;
409
409
  }
410
410
  function Ce(e) {
411
411
  if (!C(e))
412
412
  return;
413
- const r = {};
414
- let o = !1;
415
- for (const [a, i] of Object.entries(e)) {
416
- const n = a.trim();
417
- if (!n)
413
+ const n = {};
414
+ let r = !1;
415
+ for (const [c, i] of Object.entries(e)) {
416
+ const o = c.trim();
417
+ if (!o)
418
418
  continue;
419
- const f = k(i);
420
- f && (r[n] = f, o = !0);
419
+ const l = w(i);
420
+ l && (n[o] = l, r = !0);
421
421
  }
422
- return o ? r : void 0;
422
+ return r ? n : void 0;
423
423
  }
424
424
  function je(e) {
425
425
  if (!C(e))
426
426
  return;
427
- const r = Oe(e.booleans), o = Se(e.numbers), a = Ce(e.strings);
428
- if (!(!r && !o && !a))
429
- return { booleans: r, numbers: o, strings: a };
427
+ const n = Oe(e.booleans), r = Se(e.numbers), c = Ce(e.strings);
428
+ if (!(!n && !r && !c))
429
+ return { booleans: n, numbers: r, strings: c };
430
430
  }
431
- function Pe(e) {
431
+ function Me(e) {
432
432
  if (!Array.isArray(e))
433
433
  return;
434
- const r = [];
435
- for (const o of e) {
436
- if (!C(o))
434
+ const n = [];
435
+ for (const r of e) {
436
+ if (!C(r))
437
437
  continue;
438
- const a = k(o.name), i = $(o.sequence);
439
- !a || i === void 0 || r.push({ name: a, sequence: i });
438
+ const c = w(r.name), i = K(r.sequence);
439
+ !c || i === void 0 || n.push({ name: c, sequence: i });
440
440
  }
441
- if (r.length !== 0)
442
- return r;
441
+ if (n.length !== 0)
442
+ return n;
443
443
  }
444
- function Ne(e) {
444
+ function Pe(e) {
445
445
  if (!C(e))
446
446
  return;
447
- const r = {};
448
- let o = !1;
449
- for (const [a, i] of Object.entries(e)) {
450
- const n = a.trim();
451
- if (n) {
447
+ const n = {};
448
+ let r = !1;
449
+ for (const [c, i] of Object.entries(e)) {
450
+ const o = c.trim();
451
+ if (o) {
452
452
  if (typeof i == "boolean") {
453
- r[n] = i, o = !0;
453
+ n[o] = i, r = !0;
454
454
  continue;
455
455
  }
456
456
  if (typeof i == "number" && Number.isFinite(i)) {
457
- r[n] = i, o = !0;
457
+ n[o] = i, r = !0;
458
458
  continue;
459
459
  }
460
460
  if (typeof i == "string") {
461
- const f = i.trim();
462
- if (!f)
461
+ const l = i.trim();
462
+ if (!l)
463
463
  continue;
464
- r[n] = f, o = !0;
464
+ n[o] = l, r = !0;
465
465
  }
466
466
  }
467
467
  }
468
- return o ? r : void 0;
468
+ return r ? n : void 0;
469
469
  }
470
- function Me(e) {
470
+ function Ne(e) {
471
471
  if (!C(e))
472
472
  return;
473
- const r = k(e.name);
474
- if (!r)
473
+ const n = w(e.name);
474
+ if (!n)
475
475
  return;
476
- const o = $(e.type), a = $(e.delay), i = k(e.url), n = k(e.target), f = Ne(e.properties);
476
+ const r = K(e.type), c = K(e.delay), i = w(e.url), o = w(e.target), l = Pe(e.properties);
477
477
  return {
478
- name: r,
479
- type: o === void 0 ? void 0 : Math.trunc(o),
480
- delay: a,
478
+ name: n,
479
+ type: r === void 0 ? void 0 : Math.trunc(r),
480
+ delay: c,
481
481
  url: i,
482
- target: n,
483
- properties: f
482
+ target: o,
483
+ properties: l
484
484
  };
485
485
  }
486
486
  function xe(e) {
487
487
  if (!C(e))
488
488
  return;
489
- const r = {};
490
- let o = !1;
491
- for (const [a, i] of Object.entries(e)) {
492
- const n = a.trim();
493
- if (!n)
489
+ const n = {};
490
+ let r = !1;
491
+ for (const [c, i] of Object.entries(e)) {
492
+ const o = c.trim();
493
+ if (!o)
494
494
  continue;
495
- const f = k(i);
496
- f && (r[n] = f, o = !0);
495
+ const l = w(i);
496
+ l && (n[o] = l, r = !0);
497
497
  }
498
- return o ? r : void 0;
498
+ return r ? n : void 0;
499
499
  }
500
500
  function Ie(e) {
501
501
  if (!Array.isArray(e))
502
502
  return;
503
- const r = [];
504
- for (const o of e) {
505
- if (!C(o))
503
+ const n = [];
504
+ for (const r of e) {
505
+ if (!C(r))
506
506
  continue;
507
- const a = k(o.key), i = k(o.input), n = k(o.kind);
508
- if (!a || !i || !n)
507
+ const c = w(r.key), i = w(r.input), o = w(r.kind);
508
+ if (!c || !i || !o)
509
509
  continue;
510
- const f = a.replace(/[-_\s]+/g, "").toLowerCase();
511
- let E;
512
- switch (f) {
510
+ const l = c.replace(/[-_\s]+/g, "").toLowerCase();
511
+ let p;
512
+ switch (l) {
513
513
  case "arrowup":
514
514
  case "up":
515
- E = "ArrowUp";
515
+ p = "ArrowUp";
516
516
  break;
517
517
  case "arrowdown":
518
518
  case "down":
519
- E = "ArrowDown";
519
+ p = "ArrowDown";
520
520
  break;
521
521
  case "arrowleft":
522
522
  case "left":
523
- E = "ArrowLeft";
523
+ p = "ArrowLeft";
524
524
  break;
525
525
  case "arrowright":
526
526
  case "right":
527
- E = "ArrowRight";
527
+ p = "ArrowRight";
528
528
  break;
529
529
  default:
530
530
  continue;
531
531
  }
532
- const l = n.replace(/[-_\s]+/g, "").toLowerCase();
532
+ const _ = o.replace(/[-_\s]+/g, "").toLowerCase();
533
533
  let T;
534
- l === "boolean" ? T = "boolean" : l === "trigger" && (T = "trigger"), T && r.push({ key: E, input: i, kind: T });
534
+ _ === "boolean" ? T = "boolean" : _ === "trigger" && (T = "trigger"), T && n.push({ key: p, input: i, kind: T });
535
535
  }
536
- return r.length > 0 ? r : void 0;
536
+ return n.length > 0 ? n : void 0;
537
537
  }
538
- function Fe(e, r) {
539
- return r.byteLength > 0 ? (e.decode(r), !0) : !1;
538
+ function Fe(e, n) {
539
+ return n.byteLength > 0 ? (e.decode(n), !0) : !1;
540
540
  }
541
541
  function Le() {
542
542
  if (typeof globalThis > "u")
543
543
  return !1;
544
- const e = globalThis, r = typeof e.OffscreenCanvas < "u", o = typeof e.crossOriginIsolated == "boolean" ? e.crossOriginIsolated : !1;
545
- return r && o;
544
+ const e = globalThis, n = typeof e.OffscreenCanvas < "u", r = typeof e.crossOriginIsolated == "boolean" ? e.crossOriginIsolated : !1;
545
+ return n && r;
546
546
  }
547
547
  function De(e) {
548
- const r = V(
548
+ const n = Y(
549
549
  () => new be({
550
- fit: e.layoutFit ?? _.Contain,
550
+ fit: e.layoutFit ?? k.Contain,
551
551
  alignment: e.layoutAlignment ?? O.Center
552
552
  }),
553
553
  [e.layoutFit, e.layoutAlignment]
554
- ), o = V(() => Le(), []), a = (e.useOffscreenRenderer ?? !0) && o, i = {
554
+ ), r = Y(() => Le(), []), c = (e.useOffscreenRenderer ?? !0) && r, i = ee(null);
555
+ i.current === null && (i.current = {
555
556
  src: e.src,
556
557
  stateMachines: e.stateMachines,
557
558
  autoplay: e.autoplay ?? !0,
558
- useOffscreenRenderer: a,
559
+ useOffscreenRenderer: c,
559
560
  autoBind: e.autoBind ?? !0,
560
561
  enableMultiTouch: e.enableMultiTouch,
561
562
  dispatchPointerExit: e.dispatchPointerExit,
562
563
  isTouchScrollEnabled: e.isTouchScrollEnabled,
563
564
  shouldDisableRiveListeners: e.shouldDisableRiveListeners,
564
- layout: r,
565
+ layout: n,
565
566
  assetLoader: Fe
566
- }, { rive: n, RiveComponent: f } = ve(i), E = se(/* @__PURE__ */ new Map()), { dispatchAction: l } = e, T = V(() => {
567
+ });
568
+ const { rive: o, RiveComponent: l } = he(i.current), p = ee(/* @__PURE__ */ new Map()), { dispatchAction: _ } = e, T = Y(() => {
567
569
  if (!e.eventHandlers)
568
570
  return;
569
571
  const u = Object.entries(e.eventHandlers);
570
572
  if (u.length === 0)
571
573
  return;
572
- const c = /* @__PURE__ */ new Map();
574
+ const f = /* @__PURE__ */ new Map();
573
575
  for (const [d, b] of u) {
574
- const v = d.trim();
575
- if (!v)
576
+ const m = d.trim();
577
+ if (!m)
576
578
  continue;
577
- const m = b.trim();
578
- m && c.set(v, m);
579
+ const g = b.trim();
580
+ g && f.set(m, g);
579
581
  }
580
- return c.size > 0 ? c : void 0;
581
- }, [e.eventHandlers]), p = V(() => {
582
+ return f.size > 0 ? f : void 0;
583
+ }, [e.eventHandlers]), s = Y(() => {
582
584
  if (!e.keyboardBindings || e.keyboardBindings.length === 0)
583
585
  return;
584
586
  const u = /* @__PURE__ */ new Map();
585
- for (const c of e.keyboardBindings) {
586
- const d = u.get(c.key);
587
- d ? d.push(c) : u.set(c.key, [c]);
587
+ for (const f of e.keyboardBindings) {
588
+ const d = u.get(f.key);
589
+ d ? d.push(f) : u.set(f.key, [f]);
588
590
  }
589
591
  return u;
590
- }, [e.keyboardBindings]), w = se(/* @__PURE__ */ new Set());
591
- Y(() => {
592
- w.current.clear();
593
- }, [p]), Y(() => {
594
- const u = n?.viewModelInstance;
592
+ }, [e.keyboardBindings]), E = ee(/* @__PURE__ */ new Set());
593
+ q(() => {
594
+ E.current.clear();
595
+ }, [s]), q(() => {
596
+ const u = o?.viewModelInstance;
595
597
  if (!u)
596
598
  return;
597
- const c = e.viewModel?.booleans;
598
- if (c)
599
- for (const [v, m] of Object.entries(c)) {
600
- const h = u.boolean(v);
601
- h && (h.value = m);
599
+ const f = e.viewModel?.booleans;
600
+ if (f)
601
+ for (const [m, g] of Object.entries(f)) {
602
+ const v = u.boolean(m);
603
+ v && (v.value = g);
602
604
  }
603
605
  const d = e.viewModel?.numbers;
604
606
  if (d)
605
- for (const [v, m] of Object.entries(d)) {
606
- const h = u.number(v);
607
- h && (h.value = m);
607
+ for (const [m, g] of Object.entries(d)) {
608
+ const v = u.number(m);
609
+ v && (v.value = g);
608
610
  }
609
611
  const b = e.viewModel?.strings;
610
612
  if (b)
611
- for (const [v, m] of Object.entries(b)) {
612
- const h = u.string(v);
613
- h && (h.value = m);
613
+ for (const [m, g] of Object.entries(b)) {
614
+ const v = u.string(m);
615
+ v && (v.value = g);
614
616
  }
615
- }, [e.viewModel, n]), Y(() => {
616
- const u = n?.viewModelInstance;
617
- if (!(!u || !e.triggerRequests))
618
- for (const c of e.triggerRequests) {
619
- const d = E.current.get(c.name);
620
- if (d !== void 0 && c.sequence <= d)
621
- continue;
622
- E.current.set(c.name, c.sequence), u.trigger(c.name)?.trigger();
617
+ }, [e.viewModel, o]), q(() => {
618
+ if (!(!o || !e.triggerRequests || !e.stateMachines))
619
+ for (const u of e.triggerRequests) {
620
+ const f = p.current.get(u.name);
621
+ if (!(f !== void 0 && u.sequence <= f)) {
622
+ p.current.set(u.name, u.sequence);
623
+ for (const d of e.stateMachines) {
624
+ const b = o.stateMachineInputs(d);
625
+ if (!b)
626
+ continue;
627
+ const m = b.find((g) => g.name === u.name);
628
+ if (m && "fire" in m) {
629
+ m.fire();
630
+ break;
631
+ }
632
+ }
633
+ }
623
634
  }
624
- }, [e.triggerRequests, n]), Y(() => {
625
- if (!n || !T || !l)
635
+ }, [e.triggerRequests, e.stateMachines, o]), q(() => {
636
+ if (!o || !T || !_)
626
637
  return;
627
- const u = (c) => {
628
- if (c.type !== Z.RiveEvent)
638
+ const u = (f) => {
639
+ if (f.type !== te.RiveEvent)
629
640
  return;
630
- const d = Me(c.data);
641
+ const d = Ne(f.data);
631
642
  if (!d)
632
643
  return;
633
644
  const b = T.get(d.name);
634
- b && l(b, d);
645
+ b && _(b, d);
635
646
  };
636
- return n.on?.(Z.RiveEvent, u), () => {
637
- n.off?.(Z.RiveEvent, u);
647
+ return o.on?.(te.RiveEvent, u), () => {
648
+ o.off?.(te.RiveEvent, u);
638
649
  };
639
- }, [n, T, l]);
640
- const j = q(
650
+ }, [o, T, _]);
651
+ const j = U(
641
652
  (u) => {
642
- p && u.currentTarget.focus();
653
+ s && u.currentTarget.focus();
643
654
  },
644
- [p]
645
- ), I = q(
655
+ [s]
656
+ ), I = U(
646
657
  (u) => {
647
- if (!p)
658
+ if (!s)
648
659
  return;
649
- const c = u.key, d = p.get(c);
660
+ const f = u.key, d = s.get(f);
650
661
  if (!d || d.length === 0)
651
662
  return;
652
- if (w.current.has(c)) {
663
+ if (E.current.has(f)) {
653
664
  u.preventDefault();
654
665
  return;
655
666
  }
656
- const b = n?.viewModelInstance;
667
+ const b = o?.viewModelInstance;
657
668
  if (!b)
658
669
  return;
659
- let v = !1;
660
- for (const m of d)
661
- if (m.kind === "boolean") {
662
- const h = b.boolean(m.input);
663
- h && (h.value = !0, v = !0);
664
- } else if (m.kind === "trigger") {
665
- const h = b.trigger(m.input);
666
- h && (h.trigger(), v = !0);
670
+ let m = !1;
671
+ for (const g of d)
672
+ if (g.kind === "boolean") {
673
+ const v = b.boolean(g.input);
674
+ v && (v.value = !0, m = !0);
675
+ } else if (g.kind === "trigger") {
676
+ const v = b.trigger(g.input);
677
+ v && (v.trigger(), m = !0);
667
678
  }
668
- v && (w.current.add(c), u.preventDefault());
679
+ m && (E.current.add(f), u.preventDefault());
669
680
  },
670
- [p, n]
671
- ), L = q(
681
+ [s, o]
682
+ ), L = U(
672
683
  (u) => {
673
- if (!p)
684
+ if (!s)
674
685
  return;
675
- const c = u.key, d = p.get(c);
686
+ const f = u.key, d = s.get(f);
676
687
  if (!d || d.length === 0)
677
688
  return;
678
- const b = n?.viewModelInstance;
689
+ const b = o?.viewModelInstance;
679
690
  if (!b) {
680
- w.current.delete(c);
691
+ E.current.delete(f);
681
692
  return;
682
693
  }
683
- w.current.delete(c);
684
- let v = !1;
685
- for (const m of d) {
686
- if (m.kind !== "boolean")
694
+ E.current.delete(f);
695
+ let m = !1;
696
+ for (const g of d) {
697
+ if (g.kind !== "boolean")
687
698
  continue;
688
- const h = b.boolean(m.input);
689
- h && (h.value = !1, v = !0);
699
+ const v = b.boolean(g.input);
700
+ v && (v.value = !1, m = !0);
690
701
  }
691
- v && u.preventDefault();
702
+ m && u.preventDefault();
692
703
  },
693
- [p, n]
694
- ), x = q(() => {
695
- if (!p || p.size === 0) {
696
- w.current.clear();
704
+ [s, o]
705
+ ), x = U(() => {
706
+ if (!s || s.size === 0) {
707
+ E.current.clear();
697
708
  return;
698
709
  }
699
- const u = n?.viewModelInstance, c = Array.from(w.current);
700
- if (w.current.clear(), !!u)
701
- for (const d of c) {
702
- const b = p.get(d);
710
+ const u = o?.viewModelInstance, f = Array.from(E.current);
711
+ if (E.current.clear(), !!u)
712
+ for (const d of f) {
713
+ const b = s.get(d);
703
714
  if (b)
704
- for (const v of b) {
705
- if (v.kind !== "boolean")
715
+ for (const m of b) {
716
+ if (m.kind !== "boolean")
706
717
  continue;
707
- const m = u.boolean(v.input);
708
- m && (m.value = !1);
718
+ const g = u.boolean(m.input);
719
+ g && (g.value = !1);
709
720
  }
710
721
  }
711
- }, [p, n]), P = {};
712
- e.backgroundColor && (P.backgroundColor = e.backgroundColor), e.width && (P.width = e.width), e.height && (P.height = e.height);
713
- const S = !!p;
714
- return /* @__PURE__ */ Q.jsx("div", { className: e.className, style: P, children: /* @__PURE__ */ Q.jsx(
715
- f,
722
+ }, [s, o]), M = {};
723
+ e.backgroundColor && (M.backgroundColor = e.backgroundColor), e.width && (M.width = e.width), e.height && (M.height = e.height);
724
+ const S = !!s;
725
+ return /* @__PURE__ */ ne.jsx("div", { className: e.className, style: M, children: /* @__PURE__ */ ne.jsx(
726
+ l,
716
727
  {
717
728
  style: { width: "100%", height: "100%", backgroundColor: "transparent" },
718
729
  tabIndex: S ? 0 : void 0,
@@ -724,42 +735,49 @@ function De(e) {
724
735
  ) });
725
736
  }
726
737
  function ze() {
727
- return (e) => {
728
- if (e.type !== "rive-canvas")
738
+ const e = /* @__PURE__ */ new Map();
739
+ return (n) => {
740
+ if (n.type !== "rive-canvas")
729
741
  return;
730
- const r = k(e.props.src);
731
- return r ? ge(function({ nodeId: i, context: n, className: f }) {
732
- const l = he(n.store, i) ?? e, T = k(l.props.src) ?? r, p = we(l.props.stateMachines), w = M(l.props.autoplay), j = M(l.props.autoBind), I = M(l.props.useOffscreenRenderer), L = M(l.props.enableMultiTouch), x = M(l.props.dispatchPointerExit), P = M(l.props.isTouchScrollEnabled), S = M(l.props.shouldDisableRiveListeners), u = Ie(l.props.keyboardBindings), c = Te(l.props.layoutFit), d = Ae(l.props.layoutAlignment), b = k(l.props.backgroundColor), v = le(l.props.width), m = le(l.props.height), h = je(l.props.viewModel), K = Pe(l.props.triggerRequests), W = xe(l.props.eventHandlers), D = Ee(
733
- l.styleIds,
734
- f,
735
- k(l.props.style)
742
+ const r = w(n.props.src);
743
+ if (!r)
744
+ return;
745
+ const c = e.get(n.id);
746
+ if (c)
747
+ return c;
748
+ const i = ge(function({ nodeId: l, context: p, className: _ }) {
749
+ const s = ve(p.store, l) ?? n, E = w(s.props.src) ?? r, j = we(s.props.stateMachines), I = N(s.props.autoplay), L = N(s.props.autoBind), x = N(s.props.useOffscreenRenderer), M = N(s.props.enableMultiTouch), S = N(s.props.dispatchPointerExit), u = N(s.props.isTouchScrollEnabled), f = N(s.props.shouldDisableRiveListeners), d = Ie(s.props.keyboardBindings), b = Te(s.props.layoutFit), m = Ae(s.props.layoutAlignment), g = w(s.props.backgroundColor), v = le(s.props.width), W = le(s.props.height), H = je(s.props.viewModel), D = Me(s.props.triggerRequests), V = xe(s.props.eventHandlers), J = Ee(
750
+ s.styleIds,
751
+ _,
752
+ w(s.props.style)
736
753
  );
737
- return /* @__PURE__ */ Q.jsx(
754
+ return /* @__PURE__ */ ne.jsx(
738
755
  De,
739
756
  {
740
- src: T,
741
- stateMachines: p,
742
- autoplay: w,
743
- autoBind: j,
744
- useOffscreenRenderer: I,
745
- enableMultiTouch: L,
746
- dispatchPointerExit: x,
747
- isTouchScrollEnabled: P,
748
- shouldDisableRiveListeners: S,
749
- keyboardBindings: u,
750
- layoutFit: c,
751
- layoutAlignment: d,
752
- backgroundColor: b,
757
+ src: E,
758
+ stateMachines: j,
759
+ autoplay: I,
760
+ autoBind: L,
761
+ useOffscreenRenderer: x,
762
+ enableMultiTouch: M,
763
+ dispatchPointerExit: S,
764
+ isTouchScrollEnabled: u,
765
+ shouldDisableRiveListeners: f,
766
+ keyboardBindings: d,
767
+ layoutFit: b,
768
+ layoutAlignment: m,
769
+ backgroundColor: g,
753
770
  width: v,
754
- height: m,
755
- viewModel: h,
756
- triggerRequests: K,
757
- eventHandlers: W,
758
- dispatchAction: n.dispatchAction,
759
- className: D
771
+ height: W,
772
+ viewModel: H,
773
+ triggerRequests: D,
774
+ eventHandlers: V,
775
+ dispatchAction: p.dispatchAction,
776
+ className: J
760
777
  }
761
778
  );
762
- }) : void 0;
779
+ });
780
+ return e.set(n.id, i), i;
763
781
  };
764
782
  }
765
783
  const Be = "rive";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk-react-ui-rive",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",