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