@valbuild/react 0.27.0 → 0.29.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.
Files changed (28) hide show
  1. package/dist/{ValProvider-4b3dcddd.cjs.prod.js → ValProviderInternal-11c45b39.cjs.prod.js} +8 -31
  2. package/dist/ValProviderInternal-4491e75a.worker.esm.js +17 -0
  3. package/dist/{ValProvider-f27d153f.worker.esm.js → ValProviderInternal-955b2ced.esm.js} +9 -14
  4. package/dist/{ValProvider-7be3721e.cjs.dev.js → ValProviderInternal-f1bbfabb.cjs.dev.js} +8 -31
  5. package/dist/{ValProvider-772ad108.browser.esm.js → ValProviderInternal-fed8d4f2.browser.esm.js} +7 -14
  6. package/dist/{ValUI-a93bea98.worker.esm.js → ValUI-14d84602.worker.esm.js} +9 -6
  7. package/dist/{ValUI-1bebc456.browser.esm.js → ValUI-3aefbfd7.browser.esm.js} +8 -3
  8. package/dist/{ValUI-2dc20794.esm.js → ValUI-8e4092a8.esm.js} +8 -3
  9. package/dist/{ValUI-968a38fb.cjs.dev.js → ValUI-a5ff7b4f.cjs.dev.js} +10 -5
  10. package/dist/ValUI-c636bbdd.cjs.js +7 -0
  11. package/dist/{ValUI-702583bb.cjs.prod.js → ValUI-c636bbdd.cjs.prod.js} +10 -5
  12. package/dist/declarations/src/ValProvider.d.ts +2 -13
  13. package/dist/declarations/src/ValProviderInternal.d.ts +15 -0
  14. package/dist/declarations/src/ValRichText.d.ts +3 -2
  15. package/dist/declarations/src/index.d.ts +2 -1
  16. package/dist/{slicedToArray-4510c35a.worker.esm.js → slicedToArray-5b9980b8.worker.esm.js} +1 -1
  17. package/dist/valbuild-react.browser.esm.js +22 -4
  18. package/dist/valbuild-react.cjs.dev.js +22 -4
  19. package/dist/valbuild-react.cjs.prod.js +22 -4
  20. package/dist/valbuild-react.esm.js +22 -4
  21. package/dist/valbuild-react.worker.esm.js +13 -6
  22. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +1 -1
  23. package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +1 -1
  24. package/package.json +3 -3
  25. package/stega/dist/valbuild-react-stega.worker.esm.js +32 -2
  26. package/dist/ValProvider-ecdd4b68.esm.js +0 -618
  27. package/dist/ValUI-702583bb.cjs.js +0 -7
  28. package/dist/defineProperty-18559492.worker.esm.js +0 -32
@@ -1,618 +0,0 @@
1
- import React, { useContext, useMemo, lazy } from 'react';
2
- import { _ as _unsupportedIterableToArray, a as _slicedToArray } from './slicedToArray-5418adeb.esm.js';
3
- import { _ as _toPropertyKey, a as _defineProperty } from './defineProperty-b209a901.esm.js';
4
- import { result } from '@valbuild/core/fp';
5
- import { ValApi } from '@valbuild/core';
6
- import { jsxs, jsx } from 'react/jsx-runtime';
7
-
8
- function _createForOfIteratorHelper(o, allowArrayLike) {
9
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
10
- if (!it) {
11
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
12
- if (it) o = it;
13
- var i = 0;
14
- var F = function () {};
15
- return {
16
- s: F,
17
- n: function () {
18
- if (i >= o.length) return {
19
- done: true
20
- };
21
- return {
22
- done: false,
23
- value: o[i++]
24
- };
25
- },
26
- e: function (e) {
27
- throw e;
28
- },
29
- f: F
30
- };
31
- }
32
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
33
- }
34
- var normalCompletion = true,
35
- didErr = false,
36
- err;
37
- return {
38
- s: function () {
39
- it = it.call(o);
40
- },
41
- n: function () {
42
- var step = it.next();
43
- normalCompletion = step.done;
44
- return step;
45
- },
46
- e: function (e) {
47
- didErr = true;
48
- err = e;
49
- },
50
- f: function () {
51
- try {
52
- if (!normalCompletion && it.return != null) it.return();
53
- } finally {
54
- if (didErr) throw err;
55
- }
56
- }
57
- };
58
- }
59
-
60
- function _regeneratorRuntime() {
61
- _regeneratorRuntime = function () {
62
- return e;
63
- };
64
- var t,
65
- e = {},
66
- r = Object.prototype,
67
- n = r.hasOwnProperty,
68
- o = Object.defineProperty || function (t, e, r) {
69
- t[e] = r.value;
70
- },
71
- i = "function" == typeof Symbol ? Symbol : {},
72
- a = i.iterator || "@@iterator",
73
- c = i.asyncIterator || "@@asyncIterator",
74
- u = i.toStringTag || "@@toStringTag";
75
- function define(t, e, r) {
76
- return Object.defineProperty(t, e, {
77
- value: r,
78
- enumerable: !0,
79
- configurable: !0,
80
- writable: !0
81
- }), t[e];
82
- }
83
- try {
84
- define({}, "");
85
- } catch (t) {
86
- define = function (t, e, r) {
87
- return t[e] = r;
88
- };
89
- }
90
- function wrap(t, e, r, n) {
91
- var i = e && e.prototype instanceof Generator ? e : Generator,
92
- a = Object.create(i.prototype),
93
- c = new Context(n || []);
94
- return o(a, "_invoke", {
95
- value: makeInvokeMethod(t, r, c)
96
- }), a;
97
- }
98
- function tryCatch(t, e, r) {
99
- try {
100
- return {
101
- type: "normal",
102
- arg: t.call(e, r)
103
- };
104
- } catch (t) {
105
- return {
106
- type: "throw",
107
- arg: t
108
- };
109
- }
110
- }
111
- e.wrap = wrap;
112
- var h = "suspendedStart",
113
- l = "suspendedYield",
114
- f = "executing",
115
- s = "completed",
116
- y = {};
117
- function Generator() {}
118
- function GeneratorFunction() {}
119
- function GeneratorFunctionPrototype() {}
120
- var p = {};
121
- define(p, a, function () {
122
- return this;
123
- });
124
- var d = Object.getPrototypeOf,
125
- v = d && d(d(values([])));
126
- v && v !== r && n.call(v, a) && (p = v);
127
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
128
- function defineIteratorMethods(t) {
129
- ["next", "throw", "return"].forEach(function (e) {
130
- define(t, e, function (t) {
131
- return this._invoke(e, t);
132
- });
133
- });
134
- }
135
- function AsyncIterator(t, e) {
136
- function invoke(r, o, i, a) {
137
- var c = tryCatch(t[r], t, o);
138
- if ("throw" !== c.type) {
139
- var u = c.arg,
140
- h = u.value;
141
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
142
- invoke("next", t, i, a);
143
- }, function (t) {
144
- invoke("throw", t, i, a);
145
- }) : e.resolve(h).then(function (t) {
146
- u.value = t, i(u);
147
- }, function (t) {
148
- return invoke("throw", t, i, a);
149
- });
150
- }
151
- a(c.arg);
152
- }
153
- var r;
154
- o(this, "_invoke", {
155
- value: function (t, n) {
156
- function callInvokeWithMethodAndArg() {
157
- return new e(function (e, r) {
158
- invoke(t, n, e, r);
159
- });
160
- }
161
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
162
- }
163
- });
164
- }
165
- function makeInvokeMethod(e, r, n) {
166
- var o = h;
167
- return function (i, a) {
168
- if (o === f) throw new Error("Generator is already running");
169
- if (o === s) {
170
- if ("throw" === i) throw a;
171
- return {
172
- value: t,
173
- done: !0
174
- };
175
- }
176
- for (n.method = i, n.arg = a;;) {
177
- var c = n.delegate;
178
- if (c) {
179
- var u = maybeInvokeDelegate(c, n);
180
- if (u) {
181
- if (u === y) continue;
182
- return u;
183
- }
184
- }
185
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
186
- if (o === h) throw o = s, n.arg;
187
- n.dispatchException(n.arg);
188
- } else "return" === n.method && n.abrupt("return", n.arg);
189
- o = f;
190
- var p = tryCatch(e, r, n);
191
- if ("normal" === p.type) {
192
- if (o = n.done ? s : l, p.arg === y) continue;
193
- return {
194
- value: p.arg,
195
- done: n.done
196
- };
197
- }
198
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
199
- }
200
- };
201
- }
202
- function maybeInvokeDelegate(e, r) {
203
- var n = r.method,
204
- o = e.iterator[n];
205
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
206
- var i = tryCatch(o, e.iterator, r.arg);
207
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
208
- var a = i.arg;
209
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
210
- }
211
- function pushTryEntry(t) {
212
- var e = {
213
- tryLoc: t[0]
214
- };
215
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
216
- }
217
- function resetTryEntry(t) {
218
- var e = t.completion || {};
219
- e.type = "normal", delete e.arg, t.completion = e;
220
- }
221
- function Context(t) {
222
- this.tryEntries = [{
223
- tryLoc: "root"
224
- }], t.forEach(pushTryEntry, this), this.reset(!0);
225
- }
226
- function values(e) {
227
- if (e || "" === e) {
228
- var r = e[a];
229
- if (r) return r.call(e);
230
- if ("function" == typeof e.next) return e;
231
- if (!isNaN(e.length)) {
232
- var o = -1,
233
- i = function next() {
234
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
235
- return next.value = t, next.done = !0, next;
236
- };
237
- return i.next = i;
238
- }
239
- }
240
- throw new TypeError(typeof e + " is not iterable");
241
- }
242
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
243
- value: GeneratorFunctionPrototype,
244
- configurable: !0
245
- }), o(GeneratorFunctionPrototype, "constructor", {
246
- value: GeneratorFunction,
247
- configurable: !0
248
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
249
- var e = "function" == typeof t && t.constructor;
250
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
251
- }, e.mark = function (t) {
252
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
253
- }, e.awrap = function (t) {
254
- return {
255
- __await: t
256
- };
257
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
258
- return this;
259
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
260
- void 0 === i && (i = Promise);
261
- var a = new AsyncIterator(wrap(t, r, n, o), i);
262
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
263
- return t.done ? t.value : a.next();
264
- });
265
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
266
- return this;
267
- }), define(g, "toString", function () {
268
- return "[object Generator]";
269
- }), e.keys = function (t) {
270
- var e = Object(t),
271
- r = [];
272
- for (var n in e) r.push(n);
273
- return r.reverse(), function next() {
274
- for (; r.length;) {
275
- var t = r.pop();
276
- if (t in e) return next.value = t, next.done = !1, next;
277
- }
278
- return next.done = !0, next;
279
- };
280
- }, e.values = values, Context.prototype = {
281
- constructor: Context,
282
- reset: function (e) {
283
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
284
- },
285
- stop: function () {
286
- this.done = !0;
287
- var t = this.tryEntries[0].completion;
288
- if ("throw" === t.type) throw t.arg;
289
- return this.rval;
290
- },
291
- dispatchException: function (e) {
292
- if (this.done) throw e;
293
- var r = this;
294
- function handle(n, o) {
295
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
296
- }
297
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
298
- var i = this.tryEntries[o],
299
- a = i.completion;
300
- if ("root" === i.tryLoc) return handle("end");
301
- if (i.tryLoc <= this.prev) {
302
- var c = n.call(i, "catchLoc"),
303
- u = n.call(i, "finallyLoc");
304
- if (c && u) {
305
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
306
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
307
- } else if (c) {
308
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
309
- } else {
310
- if (!u) throw new Error("try statement without catch or finally");
311
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
312
- }
313
- }
314
- }
315
- },
316
- abrupt: function (t, e) {
317
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
318
- var o = this.tryEntries[r];
319
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
320
- var i = o;
321
- break;
322
- }
323
- }
324
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
325
- var a = i ? i.completion : {};
326
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
327
- },
328
- complete: function (t, e) {
329
- if ("throw" === t.type) throw t.arg;
330
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
331
- },
332
- finish: function (t) {
333
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
334
- var r = this.tryEntries[e];
335
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
336
- }
337
- },
338
- catch: function (t) {
339
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
340
- var r = this.tryEntries[e];
341
- if (r.tryLoc === t) {
342
- var n = r.completion;
343
- if ("throw" === n.type) {
344
- var o = n.arg;
345
- resetTryEntry(r);
346
- }
347
- return o;
348
- }
349
- }
350
- throw new Error("illegal catch attempt");
351
- },
352
- delegateYield: function (e, r, n) {
353
- return this.delegate = {
354
- iterator: values(e),
355
- resultName: r,
356
- nextLoc: n
357
- }, "next" === this.method && (this.arg = t), y;
358
- }
359
- }, e;
360
- }
361
-
362
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
363
- try {
364
- var info = gen[key](arg);
365
- var value = info.value;
366
- } catch (error) {
367
- reject(error);
368
- return;
369
- }
370
- if (info.done) {
371
- resolve(value);
372
- } else {
373
- Promise.resolve(value).then(_next, _throw);
374
- }
375
- }
376
- function _asyncToGenerator(fn) {
377
- return function () {
378
- var self = this,
379
- args = arguments;
380
- return new Promise(function (resolve, reject) {
381
- var gen = fn.apply(self, args);
382
- function _next(value) {
383
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
384
- }
385
- function _throw(err) {
386
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
387
- }
388
- _next(undefined);
389
- });
390
- };
391
- }
392
-
393
- function _classCallCheck(instance, Constructor) {
394
- if (!(instance instanceof Constructor)) {
395
- throw new TypeError("Cannot call a class as a function");
396
- }
397
- }
398
-
399
- function _defineProperties(target, props) {
400
- for (var i = 0; i < props.length; i++) {
401
- var descriptor = props[i];
402
- descriptor.enumerable = descriptor.enumerable || false;
403
- descriptor.configurable = true;
404
- if ("value" in descriptor) descriptor.writable = true;
405
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
406
- }
407
- }
408
- function _createClass(Constructor, protoProps, staticProps) {
409
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
410
- if (staticProps) _defineProperties(Constructor, staticProps);
411
- Object.defineProperty(Constructor, "prototype", {
412
- writable: false
413
- });
414
- return Constructor;
415
- }
416
-
417
- var ValStore = /*#__PURE__*/function () {
418
- // uncertain whether this is the optimal way of returning
419
-
420
- function ValStore(api) {
421
- var _this = this;
422
- _classCallCheck(this, ValStore);
423
- _defineProperty(this, "subscribe", function (moduleIds) {
424
- return function (listener) {
425
- var subscriberId = createSubscriberId(moduleIds);
426
- if (!_this.listeners[subscriberId]) {
427
- _this.listeners[subscriberId] = [];
428
- _this.subscribers.set(subscriberId, {});
429
- }
430
- _this.listeners[subscriberId].push(listener);
431
- return function () {
432
- _this.listeners[subscriberId].splice(_this.listeners[subscriberId].indexOf(listener), 1);
433
- };
434
- };
435
- });
436
- _defineProperty(this, "getSnapshot", function (moduleIds) {
437
- return function () {
438
- return _this.get(moduleIds);
439
- };
440
- });
441
- _defineProperty(this, "getServerSnapshot", function (moduleIds) {
442
- return function () {
443
- return _this.get(moduleIds);
444
- };
445
- });
446
- _defineProperty(this, "get", function (moduleIds) {
447
- var subscriberId = createSubscriberId(moduleIds);
448
- return _this.subscribers.get(subscriberId);
449
- });
450
- this.api = api;
451
- this.subscribers = new Map();
452
- this.listeners = {};
453
- }
454
-
455
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
456
- _createClass(ValStore, [{
457
- key: "update",
458
- value: function () {
459
- var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
460
- return _regeneratorRuntime().wrap(function _callee$(_context) {
461
- while (1) switch (_context.prev = _context.next) {
462
- case 0:
463
- return _context.abrupt("return", this.updateAll());
464
- case 1:
465
- case "end":
466
- return _context.stop();
467
- }
468
- }, _callee, this);
469
- }));
470
- function update(_x) {
471
- return _update.apply(this, arguments);
472
- }
473
- return update;
474
- }()
475
- }, {
476
- key: "updateAll",
477
- value: function () {
478
- var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
479
- var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
480
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
481
- while (1) switch (_context3.prev = _context3.next) {
482
- case 0:
483
- _context3.next = 2;
484
- return this.api.getModules({
485
- patch: true,
486
- includeSource: true
487
- });
488
- case 2:
489
- data = _context3.sent;
490
- if (!result.isOk(data)) {
491
- _context3.next = 16;
492
- break;
493
- }
494
- updatedSubscriberIds = new Map();
495
- subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
496
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
497
- var moduleId, source, updatedSubscriberId;
498
- return _regeneratorRuntime().wrap(function _loop$(_context2) {
499
- while (1) switch (_context2.prev = _context2.next) {
500
- case 0:
501
- moduleId = _arr[_i];
502
- source = data.value.modules[moduleId].source;
503
- if (typeof source !== "undefined") {
504
- updatedSubscriberId = subscriberIds.find(function (subscriberId) {
505
- return subscriberId.includes(moduleId);
506
- } // NOTE: dependent on
507
- );
508
-
509
- if (updatedSubscriberId) {
510
- updatedSubscriberIds.set(updatedSubscriberId, (updatedSubscriberIds.get(updatedSubscriberId) || []).concat(moduleId));
511
- }
512
- }
513
- case 3:
514
- case "end":
515
- return _context2.stop();
516
- }
517
- }, _loop);
518
- });
519
- _i = 0, _arr = Object.keys(data.value.modules);
520
- case 8:
521
- if (!(_i < _arr.length)) {
522
- _context3.next = 13;
523
- break;
524
- }
525
- return _context3.delegateYield(_loop(), "t0", 10);
526
- case 10:
527
- _i++;
528
- _context3.next = 8;
529
- break;
530
- case 13:
531
- // For all updated subscribers: set new module data and emit change
532
- for (_i2 = 0, _Array$from = Array.from(updatedSubscriberIds.entries()); _i2 < _Array$from.length; _i2++) {
533
- _Array$from$_i = _slicedToArray(_Array$from[_i2], 2), updatedSubscriberId = _Array$from$_i[0], moduleIds = _Array$from$_i[1];
534
- subscriberModules = Object.fromEntries(moduleIds.flatMap(function (moduleId) {
535
- var source = data.value.modules[moduleId].source;
536
- if (!source) {
537
- return [];
538
- }
539
- return [[moduleId, source]];
540
- }));
541
- this.subscribers.set(updatedSubscriberId, subscriberModules);
542
- this.emitChange(updatedSubscriberId);
543
- }
544
- _context3.next = 17;
545
- break;
546
- case 16:
547
- console.error("Val: failed to update modules", data.error.message);
548
- case 17:
549
- case "end":
550
- return _context3.stop();
551
- }
552
- }, _callee2, this);
553
- }));
554
- function updateAll() {
555
- return _updateAll.apply(this, arguments);
556
- }
557
- return updateAll;
558
- }()
559
- }, {
560
- key: "emitChange",
561
- value: function emitChange(subscriberId) {
562
- var _iterator = _createForOfIteratorHelper(this.listeners[subscriberId]),
563
- _step;
564
- try {
565
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
566
- var listener = _step.value;
567
- listener();
568
- }
569
- } catch (err) {
570
- _iterator.e(err);
571
- } finally {
572
- _iterator.f();
573
- }
574
- }
575
- }]);
576
- return ValStore;
577
- }();
578
- function createSubscriberId(moduleIds) {
579
- return moduleIds.slice().sort().join("&");
580
- }
581
-
582
- /* eslint-disable @typescript-eslint/no-explicit-any */
583
- function useValStore() {
584
- return useContext(ValContext).valStore;
585
- }
586
- function useValApi() {
587
- return useContext(ValContext).valApi;
588
- }
589
- var ValContext = /*#__PURE__*/React.createContext({
590
- get valStore() {
591
- throw Error("Val context not found. Ensure components are wrapped by ValProvider!");
592
- },
593
- get valApi() {
594
- throw Error("Val context not found. Ensure components are wrapped by ValProvider!");
595
- }
596
- });
597
- var ValUI = typeof window !== "undefined" ? /*#__PURE__*/lazy(function () {
598
- return import('./ValUI-2dc20794.esm.js');
599
- }) : null;
600
- function ValProvider(_ref) {
601
- var children = _ref.children;
602
- var host = "/api/val";
603
- var valApi = useMemo(function () {
604
- return new ValApi(host);
605
- }, [host]);
606
- var valStore = useMemo(function () {
607
- return new ValStore(valApi);
608
- }, [valApi]);
609
- return /*#__PURE__*/jsxs(ValContext.Provider, {
610
- value: {
611
- valApi: valApi,
612
- valStore: valStore
613
- },
614
- children: [children, ValUI && /*#__PURE__*/jsx(ValUI, {})]
615
- });
616
- }
617
-
618
- export { ValProvider as V, useValApi as a, useValStore as u };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValUI-702583bb.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValUI-702583bb.cjs.dev.js");
7
- }
@@ -1,32 +0,0 @@
1
- function _toPrimitive(input, hint) {
2
- if (typeof input !== "object" || input === null) return input;
3
- var prim = input[Symbol.toPrimitive];
4
- if (prim !== undefined) {
5
- var res = prim.call(input, hint || "default");
6
- if (typeof res !== "object") return res;
7
- throw new TypeError("@@toPrimitive must return a primitive value.");
8
- }
9
- return (hint === "string" ? String : Number)(input);
10
- }
11
-
12
- function _toPropertyKey(arg) {
13
- var key = _toPrimitive(arg, "string");
14
- return typeof key === "symbol" ? key : String(key);
15
- }
16
-
17
- function _defineProperty(obj, key, value) {
18
- key = _toPropertyKey(key);
19
- if (key in obj) {
20
- Object.defineProperty(obj, key, {
21
- value: value,
22
- enumerable: true,
23
- configurable: true,
24
- writable: true
25
- });
26
- } else {
27
- obj[key] = value;
28
- }
29
- return obj;
30
- }
31
-
32
- export { _toPropertyKey as _, _defineProperty as a };