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

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