@valbuild/react 0.58.0 → 0.60.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/declarations/src/internal/index.d.ts +0 -1
- package/dist/{slicedToArray-11a666de.cjs.dev.js → slicedToArray-129629e4.cjs.dev.js} +11 -0
- package/dist/{slicedToArray-c405fbf0.cjs.prod.js → slicedToArray-386a8ae8.cjs.prod.js} +11 -0
- package/dist/{slicedToArray-7b69258f.browser.esm.js → slicedToArray-6b2002fa.browser.esm.js} +11 -1
- package/dist/{slicedToArray-e7da2c5e.worker.esm.js → slicedToArray-7a63acfd.worker.esm.js} +11 -1
- package/dist/{slicedToArray-1dc7d2d6.esm.js → slicedToArray-a79154e9.esm.js} +11 -1
- package/dist/toConsumableArray-0a75a603.worker.esm.js +19 -0
- package/dist/toConsumableArray-0ccd58b7.esm.js +19 -0
- package/dist/toConsumableArray-5a71fbb3.browser.esm.js +19 -0
- package/dist/toConsumableArray-b2d28ffa.cjs.dev.js +21 -0
- package/dist/toConsumableArray-b5e3b83f.cjs.prod.js +21 -0
- package/internal/dist/valbuild-react-internal.browser.esm.js +2 -18
- package/internal/dist/valbuild-react-internal.cjs.dev.js +3 -31
- package/internal/dist/valbuild-react-internal.cjs.prod.js +3 -31
- package/internal/dist/valbuild-react-internal.esm.js +2 -18
- package/internal/dist/valbuild-react-internal.worker.esm.js +2 -18
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.browser.esm.js +1 -2
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.dev.js +2 -3
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.prod.js +2 -3
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.esm.js +1 -2
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +1 -2
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.browser.esm.js +1 -2
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.dev.js +2 -3
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.prod.js +2 -3
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.esm.js +1 -2
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +1 -2
- package/package.json +5 -6
- package/stega/dist/valbuild-react-stega.browser.esm.js +53 -8
- package/stega/dist/valbuild-react-stega.cjs.dev.js +64 -19
- package/stega/dist/valbuild-react-stega.cjs.prod.js +64 -19
- package/stega/dist/valbuild-react-stega.esm.js +53 -8
- package/stega/dist/valbuild-react-stega.worker.esm.js +53 -8
- package/dist/ValProvider-47b779dc.esm.js +0 -689
- package/dist/ValProvider-48e6e607.browser.esm.js +0 -689
- package/dist/ValProvider-5b6a05e9.cjs.js +0 -7
- package/dist/ValProvider-5b6a05e9.cjs.prod.js +0 -712
- package/dist/ValProvider-7c2a7439.worker.esm.js +0 -684
- package/dist/ValProvider-87161e66.cjs.dev.js +0 -718
- package/dist/ValUI-1922d8db.cjs.dev.js +0 -83
- package/dist/ValUI-23e2422b.cjs.js +0 -7
- package/dist/ValUI-23e2422b.cjs.prod.js +0 -83
- package/dist/ValUI-7d39a3f6.browser.esm.js +0 -79
- package/dist/ValUI-84a9cc93.worker.esm.js +0 -79
- package/dist/ValUI-8775ef5c.esm.js +0 -79
- package/dist/declarations/src/internal/ValProvider.d.ts +0 -17
- package/dist/declarations/src/internal/ValStore.d.ts +0 -16
- package/dist/defineProperty-6ed7deb7.browser.esm.js +0 -32
- package/dist/defineProperty-82fbeafc.worker.esm.js +0 -32
- package/dist/defineProperty-9bf3d0c0.esm.js +0 -32
- package/dist/defineProperty-c84f9aba.cjs.dev.js +0 -35
- package/dist/defineProperty-f8fe5660.cjs.prod.js +0 -35
- package/dist/typeof-16428c61.cjs.prod.js +0 -13
- package/dist/typeof-9915e135.browser.esm.js +0 -11
- package/dist/typeof-a1531d8f.esm.js +0 -11
- package/dist/typeof-b568f48f.cjs.dev.js +0 -13
- package/dist/typeof-e0c837cc.worker.esm.js +0 -11
@@ -1,712 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
5
|
-
|
6
|
-
var slicedToArray = require('./slicedToArray-c405fbf0.cjs.prod.js');
|
7
|
-
var React = require('react');
|
8
|
-
var unsupportedIterableToArray = require('./unsupportedIterableToArray-42309462.cjs.prod.js');
|
9
|
-
var defineProperty = require('./defineProperty-f8fe5660.cjs.prod.js');
|
10
|
-
var fp = require('@valbuild/core/fp');
|
11
|
-
var core = require('@valbuild/core');
|
12
|
-
var ReactJSXRuntime = require('react/jsx-runtime');
|
13
|
-
|
14
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
15
|
-
|
16
|
-
function _interopNamespace(e) {
|
17
|
-
if (e && e.__esModule) return e;
|
18
|
-
var n = Object.create(null);
|
19
|
-
if (e) {
|
20
|
-
Object.keys(e).forEach(function (k) {
|
21
|
-
if (k !== 'default') {
|
22
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
23
|
-
Object.defineProperty(n, k, d.get ? d : {
|
24
|
-
enumerable: true,
|
25
|
-
get: function () { return e[k]; }
|
26
|
-
});
|
27
|
-
}
|
28
|
-
});
|
29
|
-
}
|
30
|
-
n["default"] = e;
|
31
|
-
return Object.freeze(n);
|
32
|
-
}
|
33
|
-
|
34
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
35
|
-
|
36
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
37
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
38
|
-
if (!it) {
|
39
|
-
if (Array.isArray(o) || (it = unsupportedIterableToArray._unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
40
|
-
if (it) o = it;
|
41
|
-
var i = 0;
|
42
|
-
var F = function () {};
|
43
|
-
return {
|
44
|
-
s: F,
|
45
|
-
n: function () {
|
46
|
-
if (i >= o.length) return {
|
47
|
-
done: true
|
48
|
-
};
|
49
|
-
return {
|
50
|
-
done: false,
|
51
|
-
value: o[i++]
|
52
|
-
};
|
53
|
-
},
|
54
|
-
e: function (e) {
|
55
|
-
throw e;
|
56
|
-
},
|
57
|
-
f: F
|
58
|
-
};
|
59
|
-
}
|
60
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
61
|
-
}
|
62
|
-
var normalCompletion = true,
|
63
|
-
didErr = false,
|
64
|
-
err;
|
65
|
-
return {
|
66
|
-
s: function () {
|
67
|
-
it = it.call(o);
|
68
|
-
},
|
69
|
-
n: function () {
|
70
|
-
var step = it.next();
|
71
|
-
normalCompletion = step.done;
|
72
|
-
return step;
|
73
|
-
},
|
74
|
-
e: function (e) {
|
75
|
-
didErr = true;
|
76
|
-
err = e;
|
77
|
-
},
|
78
|
-
f: function () {
|
79
|
-
try {
|
80
|
-
if (!normalCompletion && it.return != null) it.return();
|
81
|
-
} finally {
|
82
|
-
if (didErr) throw err;
|
83
|
-
}
|
84
|
-
}
|
85
|
-
};
|
86
|
-
}
|
87
|
-
|
88
|
-
function _regeneratorRuntime() {
|
89
|
-
_regeneratorRuntime = function () {
|
90
|
-
return e;
|
91
|
-
};
|
92
|
-
var t,
|
93
|
-
e = {},
|
94
|
-
r = Object.prototype,
|
95
|
-
n = r.hasOwnProperty,
|
96
|
-
o = Object.defineProperty || function (t, e, r) {
|
97
|
-
t[e] = r.value;
|
98
|
-
},
|
99
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
100
|
-
a = i.iterator || "@@iterator",
|
101
|
-
c = i.asyncIterator || "@@asyncIterator",
|
102
|
-
u = i.toStringTag || "@@toStringTag";
|
103
|
-
function define(t, e, r) {
|
104
|
-
return Object.defineProperty(t, e, {
|
105
|
-
value: r,
|
106
|
-
enumerable: !0,
|
107
|
-
configurable: !0,
|
108
|
-
writable: !0
|
109
|
-
}), t[e];
|
110
|
-
}
|
111
|
-
try {
|
112
|
-
define({}, "");
|
113
|
-
} catch (t) {
|
114
|
-
define = function (t, e, r) {
|
115
|
-
return t[e] = r;
|
116
|
-
};
|
117
|
-
}
|
118
|
-
function wrap(t, e, r, n) {
|
119
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
120
|
-
a = Object.create(i.prototype),
|
121
|
-
c = new Context(n || []);
|
122
|
-
return o(a, "_invoke", {
|
123
|
-
value: makeInvokeMethod(t, r, c)
|
124
|
-
}), a;
|
125
|
-
}
|
126
|
-
function tryCatch(t, e, r) {
|
127
|
-
try {
|
128
|
-
return {
|
129
|
-
type: "normal",
|
130
|
-
arg: t.call(e, r)
|
131
|
-
};
|
132
|
-
} catch (t) {
|
133
|
-
return {
|
134
|
-
type: "throw",
|
135
|
-
arg: t
|
136
|
-
};
|
137
|
-
}
|
138
|
-
}
|
139
|
-
e.wrap = wrap;
|
140
|
-
var h = "suspendedStart",
|
141
|
-
l = "suspendedYield",
|
142
|
-
f = "executing",
|
143
|
-
s = "completed",
|
144
|
-
y = {};
|
145
|
-
function Generator() {}
|
146
|
-
function GeneratorFunction() {}
|
147
|
-
function GeneratorFunctionPrototype() {}
|
148
|
-
var p = {};
|
149
|
-
define(p, a, function () {
|
150
|
-
return this;
|
151
|
-
});
|
152
|
-
var d = Object.getPrototypeOf,
|
153
|
-
v = d && d(d(values([])));
|
154
|
-
v && v !== r && n.call(v, a) && (p = v);
|
155
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
156
|
-
function defineIteratorMethods(t) {
|
157
|
-
["next", "throw", "return"].forEach(function (e) {
|
158
|
-
define(t, e, function (t) {
|
159
|
-
return this._invoke(e, t);
|
160
|
-
});
|
161
|
-
});
|
162
|
-
}
|
163
|
-
function AsyncIterator(t, e) {
|
164
|
-
function invoke(r, o, i, a) {
|
165
|
-
var c = tryCatch(t[r], t, o);
|
166
|
-
if ("throw" !== c.type) {
|
167
|
-
var u = c.arg,
|
168
|
-
h = u.value;
|
169
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
170
|
-
invoke("next", t, i, a);
|
171
|
-
}, function (t) {
|
172
|
-
invoke("throw", t, i, a);
|
173
|
-
}) : e.resolve(h).then(function (t) {
|
174
|
-
u.value = t, i(u);
|
175
|
-
}, function (t) {
|
176
|
-
return invoke("throw", t, i, a);
|
177
|
-
});
|
178
|
-
}
|
179
|
-
a(c.arg);
|
180
|
-
}
|
181
|
-
var r;
|
182
|
-
o(this, "_invoke", {
|
183
|
-
value: function (t, n) {
|
184
|
-
function callInvokeWithMethodAndArg() {
|
185
|
-
return new e(function (e, r) {
|
186
|
-
invoke(t, n, e, r);
|
187
|
-
});
|
188
|
-
}
|
189
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
190
|
-
}
|
191
|
-
});
|
192
|
-
}
|
193
|
-
function makeInvokeMethod(e, r, n) {
|
194
|
-
var o = h;
|
195
|
-
return function (i, a) {
|
196
|
-
if (o === f) throw new Error("Generator is already running");
|
197
|
-
if (o === s) {
|
198
|
-
if ("throw" === i) throw a;
|
199
|
-
return {
|
200
|
-
value: t,
|
201
|
-
done: !0
|
202
|
-
};
|
203
|
-
}
|
204
|
-
for (n.method = i, n.arg = a;;) {
|
205
|
-
var c = n.delegate;
|
206
|
-
if (c) {
|
207
|
-
var u = maybeInvokeDelegate(c, n);
|
208
|
-
if (u) {
|
209
|
-
if (u === y) continue;
|
210
|
-
return u;
|
211
|
-
}
|
212
|
-
}
|
213
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
214
|
-
if (o === h) throw o = s, n.arg;
|
215
|
-
n.dispatchException(n.arg);
|
216
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
217
|
-
o = f;
|
218
|
-
var p = tryCatch(e, r, n);
|
219
|
-
if ("normal" === p.type) {
|
220
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
221
|
-
return {
|
222
|
-
value: p.arg,
|
223
|
-
done: n.done
|
224
|
-
};
|
225
|
-
}
|
226
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
227
|
-
}
|
228
|
-
};
|
229
|
-
}
|
230
|
-
function maybeInvokeDelegate(e, r) {
|
231
|
-
var n = r.method,
|
232
|
-
o = e.iterator[n];
|
233
|
-
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;
|
234
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
235
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
236
|
-
var a = i.arg;
|
237
|
-
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);
|
238
|
-
}
|
239
|
-
function pushTryEntry(t) {
|
240
|
-
var e = {
|
241
|
-
tryLoc: t[0]
|
242
|
-
};
|
243
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
244
|
-
}
|
245
|
-
function resetTryEntry(t) {
|
246
|
-
var e = t.completion || {};
|
247
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
248
|
-
}
|
249
|
-
function Context(t) {
|
250
|
-
this.tryEntries = [{
|
251
|
-
tryLoc: "root"
|
252
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
253
|
-
}
|
254
|
-
function values(e) {
|
255
|
-
if (e || "" === e) {
|
256
|
-
var r = e[a];
|
257
|
-
if (r) return r.call(e);
|
258
|
-
if ("function" == typeof e.next) return e;
|
259
|
-
if (!isNaN(e.length)) {
|
260
|
-
var o = -1,
|
261
|
-
i = function next() {
|
262
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
263
|
-
return next.value = t, next.done = !0, next;
|
264
|
-
};
|
265
|
-
return i.next = i;
|
266
|
-
}
|
267
|
-
}
|
268
|
-
throw new TypeError(typeof e + " is not iterable");
|
269
|
-
}
|
270
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
271
|
-
value: GeneratorFunctionPrototype,
|
272
|
-
configurable: !0
|
273
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
274
|
-
value: GeneratorFunction,
|
275
|
-
configurable: !0
|
276
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
277
|
-
var e = "function" == typeof t && t.constructor;
|
278
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
279
|
-
}, e.mark = function (t) {
|
280
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
281
|
-
}, e.awrap = function (t) {
|
282
|
-
return {
|
283
|
-
__await: t
|
284
|
-
};
|
285
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
286
|
-
return this;
|
287
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
288
|
-
void 0 === i && (i = Promise);
|
289
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
290
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
291
|
-
return t.done ? t.value : a.next();
|
292
|
-
});
|
293
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
294
|
-
return this;
|
295
|
-
}), define(g, "toString", function () {
|
296
|
-
return "[object Generator]";
|
297
|
-
}), e.keys = function (t) {
|
298
|
-
var e = Object(t),
|
299
|
-
r = [];
|
300
|
-
for (var n in e) r.push(n);
|
301
|
-
return r.reverse(), function next() {
|
302
|
-
for (; r.length;) {
|
303
|
-
var t = r.pop();
|
304
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
305
|
-
}
|
306
|
-
return next.done = !0, next;
|
307
|
-
};
|
308
|
-
}, e.values = values, Context.prototype = {
|
309
|
-
constructor: Context,
|
310
|
-
reset: function (e) {
|
311
|
-
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);
|
312
|
-
},
|
313
|
-
stop: function () {
|
314
|
-
this.done = !0;
|
315
|
-
var t = this.tryEntries[0].completion;
|
316
|
-
if ("throw" === t.type) throw t.arg;
|
317
|
-
return this.rval;
|
318
|
-
},
|
319
|
-
dispatchException: function (e) {
|
320
|
-
if (this.done) throw e;
|
321
|
-
var r = this;
|
322
|
-
function handle(n, o) {
|
323
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
324
|
-
}
|
325
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
326
|
-
var i = this.tryEntries[o],
|
327
|
-
a = i.completion;
|
328
|
-
if ("root" === i.tryLoc) return handle("end");
|
329
|
-
if (i.tryLoc <= this.prev) {
|
330
|
-
var c = n.call(i, "catchLoc"),
|
331
|
-
u = n.call(i, "finallyLoc");
|
332
|
-
if (c && u) {
|
333
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
334
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
335
|
-
} else if (c) {
|
336
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
337
|
-
} else {
|
338
|
-
if (!u) throw new Error("try statement without catch or finally");
|
339
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
340
|
-
}
|
341
|
-
}
|
342
|
-
}
|
343
|
-
},
|
344
|
-
abrupt: function (t, e) {
|
345
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
346
|
-
var o = this.tryEntries[r];
|
347
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
348
|
-
var i = o;
|
349
|
-
break;
|
350
|
-
}
|
351
|
-
}
|
352
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
353
|
-
var a = i ? i.completion : {};
|
354
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
355
|
-
},
|
356
|
-
complete: function (t, e) {
|
357
|
-
if ("throw" === t.type) throw t.arg;
|
358
|
-
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;
|
359
|
-
},
|
360
|
-
finish: function (t) {
|
361
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
362
|
-
var r = this.tryEntries[e];
|
363
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
364
|
-
}
|
365
|
-
},
|
366
|
-
catch: function (t) {
|
367
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
368
|
-
var r = this.tryEntries[e];
|
369
|
-
if (r.tryLoc === t) {
|
370
|
-
var n = r.completion;
|
371
|
-
if ("throw" === n.type) {
|
372
|
-
var o = n.arg;
|
373
|
-
resetTryEntry(r);
|
374
|
-
}
|
375
|
-
return o;
|
376
|
-
}
|
377
|
-
}
|
378
|
-
throw new Error("illegal catch attempt");
|
379
|
-
},
|
380
|
-
delegateYield: function (e, r, n) {
|
381
|
-
return this.delegate = {
|
382
|
-
iterator: values(e),
|
383
|
-
resultName: r,
|
384
|
-
nextLoc: n
|
385
|
-
}, "next" === this.method && (this.arg = t), y;
|
386
|
-
}
|
387
|
-
}, e;
|
388
|
-
}
|
389
|
-
|
390
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
391
|
-
try {
|
392
|
-
var info = gen[key](arg);
|
393
|
-
var value = info.value;
|
394
|
-
} catch (error) {
|
395
|
-
reject(error);
|
396
|
-
return;
|
397
|
-
}
|
398
|
-
if (info.done) {
|
399
|
-
resolve(value);
|
400
|
-
} else {
|
401
|
-
Promise.resolve(value).then(_next, _throw);
|
402
|
-
}
|
403
|
-
}
|
404
|
-
function _asyncToGenerator(fn) {
|
405
|
-
return function () {
|
406
|
-
var self = this,
|
407
|
-
args = arguments;
|
408
|
-
return new Promise(function (resolve, reject) {
|
409
|
-
var gen = fn.apply(self, args);
|
410
|
-
function _next(value) {
|
411
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
412
|
-
}
|
413
|
-
function _throw(err) {
|
414
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
415
|
-
}
|
416
|
-
_next(undefined);
|
417
|
-
});
|
418
|
-
};
|
419
|
-
}
|
420
|
-
|
421
|
-
function _classCallCheck(instance, Constructor) {
|
422
|
-
if (!(instance instanceof Constructor)) {
|
423
|
-
throw new TypeError("Cannot call a class as a function");
|
424
|
-
}
|
425
|
-
}
|
426
|
-
|
427
|
-
function _defineProperties(target, props) {
|
428
|
-
for (var i = 0; i < props.length; i++) {
|
429
|
-
var descriptor = props[i];
|
430
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
431
|
-
descriptor.configurable = true;
|
432
|
-
if ("value" in descriptor) descriptor.writable = true;
|
433
|
-
Object.defineProperty(target, defineProperty.toPropertyKey(descriptor.key), descriptor);
|
434
|
-
}
|
435
|
-
}
|
436
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
437
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
438
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
439
|
-
Object.defineProperty(Constructor, "prototype", {
|
440
|
-
writable: false
|
441
|
-
});
|
442
|
-
return Constructor;
|
443
|
-
}
|
444
|
-
|
445
|
-
var ValStore = /*#__PURE__*/function () {
|
446
|
-
// uncertain whether this is the optimal way of returning
|
447
|
-
|
448
|
-
function ValStore(api) {
|
449
|
-
var _this = this;
|
450
|
-
_classCallCheck(this, ValStore);
|
451
|
-
defineProperty._defineProperty(this, "subscribe", function (moduleIds) {
|
452
|
-
return function (listener) {
|
453
|
-
var subscriberId = createSubscriberId(moduleIds);
|
454
|
-
if (!_this.listeners[subscriberId]) {
|
455
|
-
_this.listeners[subscriberId] = [];
|
456
|
-
_this.subscribers.set(subscriberId, {});
|
457
|
-
}
|
458
|
-
_this.listeners[subscriberId].push(listener);
|
459
|
-
return function () {
|
460
|
-
_this.listeners[subscriberId].splice(_this.listeners[subscriberId].indexOf(listener), 1);
|
461
|
-
};
|
462
|
-
};
|
463
|
-
});
|
464
|
-
defineProperty._defineProperty(this, "getSnapshot", function (moduleIds) {
|
465
|
-
return function () {
|
466
|
-
return _this.get(moduleIds);
|
467
|
-
};
|
468
|
-
});
|
469
|
-
defineProperty._defineProperty(this, "getServerSnapshot", function (moduleIds) {
|
470
|
-
return function () {
|
471
|
-
return _this.get(moduleIds);
|
472
|
-
};
|
473
|
-
});
|
474
|
-
defineProperty._defineProperty(this, "get", function (moduleIds) {
|
475
|
-
var subscriberId = createSubscriberId(moduleIds);
|
476
|
-
return _this.subscribers.get(subscriberId);
|
477
|
-
});
|
478
|
-
this.api = api;
|
479
|
-
this.subscribers = new Map();
|
480
|
-
this.listeners = {};
|
481
|
-
}
|
482
|
-
_createClass(ValStore, [{
|
483
|
-
key: "update",
|
484
|
-
value: function () {
|
485
|
-
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
|
486
|
-
var _this2 = this;
|
487
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
488
|
-
while (1) switch (_context.prev = _context.next) {
|
489
|
-
case 0:
|
490
|
-
_context.next = 2;
|
491
|
-
return Promise.all(moduleIds.map(function (moduleId) {
|
492
|
-
return _this2.updateTree(moduleId);
|
493
|
-
}));
|
494
|
-
case 2:
|
495
|
-
case "end":
|
496
|
-
return _context.stop();
|
497
|
-
}
|
498
|
-
}, _callee);
|
499
|
-
}));
|
500
|
-
function update(_x) {
|
501
|
-
return _update.apply(this, arguments);
|
502
|
-
}
|
503
|
-
return update;
|
504
|
-
}()
|
505
|
-
}, {
|
506
|
-
key: "updateAll",
|
507
|
-
value: function () {
|
508
|
-
var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
509
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
510
|
-
while (1) switch (_context2.prev = _context2.next) {
|
511
|
-
case 0:
|
512
|
-
_context2.next = 2;
|
513
|
-
return this.updateTree();
|
514
|
-
case 2:
|
515
|
-
case "end":
|
516
|
-
return _context2.stop();
|
517
|
-
}
|
518
|
-
}, _callee2, this);
|
519
|
-
}));
|
520
|
-
function updateAll() {
|
521
|
-
return _updateAll.apply(this, arguments);
|
522
|
-
}
|
523
|
-
return updateAll;
|
524
|
-
}()
|
525
|
-
}, {
|
526
|
-
key: "updateTree",
|
527
|
-
value: function () {
|
528
|
-
var _updateTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(treePath) {
|
529
|
-
var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
|
530
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
531
|
-
while (1) switch (_context4.prev = _context4.next) {
|
532
|
-
case 0:
|
533
|
-
_context4.next = 2;
|
534
|
-
return this.api.getTree({
|
535
|
-
treePath: treePath,
|
536
|
-
patch: true,
|
537
|
-
includeSource: true
|
538
|
-
});
|
539
|
-
case 2:
|
540
|
-
data = _context4.sent;
|
541
|
-
if (!fp.result.isOk(data)) {
|
542
|
-
_context4.next = 16;
|
543
|
-
break;
|
544
|
-
}
|
545
|
-
updatedSubscriberIds = new Map();
|
546
|
-
subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
|
547
|
-
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
548
|
-
var moduleId, source, updatedSubscriberId;
|
549
|
-
return _regeneratorRuntime().wrap(function _loop$(_context3) {
|
550
|
-
while (1) switch (_context3.prev = _context3.next) {
|
551
|
-
case 0:
|
552
|
-
moduleId = _arr[_i];
|
553
|
-
source = data.value.modules[moduleId].source;
|
554
|
-
if (typeof source !== "undefined") {
|
555
|
-
updatedSubscriberId = subscriberIds.find(function (subscriberId) {
|
556
|
-
return subscriberId.includes(moduleId);
|
557
|
-
} // NOTE: dependent on
|
558
|
-
);
|
559
|
-
if (updatedSubscriberId) {
|
560
|
-
updatedSubscriberIds.set(updatedSubscriberId, (updatedSubscriberIds.get(updatedSubscriberId) || []).concat(moduleId));
|
561
|
-
}
|
562
|
-
}
|
563
|
-
case 3:
|
564
|
-
case "end":
|
565
|
-
return _context3.stop();
|
566
|
-
}
|
567
|
-
}, _loop);
|
568
|
-
});
|
569
|
-
_i = 0, _arr = Object.keys(data.value.modules);
|
570
|
-
case 8:
|
571
|
-
if (!(_i < _arr.length)) {
|
572
|
-
_context4.next = 13;
|
573
|
-
break;
|
574
|
-
}
|
575
|
-
return _context4.delegateYield(_loop(), "t0", 10);
|
576
|
-
case 10:
|
577
|
-
_i++;
|
578
|
-
_context4.next = 8;
|
579
|
-
break;
|
580
|
-
case 13:
|
581
|
-
// For all updated subscribers: set new module data and emit change
|
582
|
-
for (_i2 = 0, _Array$from = Array.from(updatedSubscriberIds.entries()); _i2 < _Array$from.length; _i2++) {
|
583
|
-
_Array$from$_i = slicedToArray._slicedToArray(_Array$from[_i2], 2), updatedSubscriberId = _Array$from$_i[0], moduleIds = _Array$from$_i[1];
|
584
|
-
subscriberModules = Object.fromEntries(moduleIds.flatMap(function (moduleId) {
|
585
|
-
var source = data.value.modules[moduleId].source;
|
586
|
-
if (!source) {
|
587
|
-
return [];
|
588
|
-
}
|
589
|
-
return [[moduleId, source]];
|
590
|
-
}));
|
591
|
-
this.subscribers.set(updatedSubscriberId, subscriberModules);
|
592
|
-
this.emitChange(updatedSubscriberId);
|
593
|
-
}
|
594
|
-
_context4.next = 17;
|
595
|
-
break;
|
596
|
-
case 16:
|
597
|
-
console.error("Val: failed to update modules", data.error);
|
598
|
-
case 17:
|
599
|
-
case "end":
|
600
|
-
return _context4.stop();
|
601
|
-
}
|
602
|
-
}, _callee3, this);
|
603
|
-
}));
|
604
|
-
function updateTree(_x2) {
|
605
|
-
return _updateTree.apply(this, arguments);
|
606
|
-
}
|
607
|
-
return updateTree;
|
608
|
-
}()
|
609
|
-
}, {
|
610
|
-
key: "emitChange",
|
611
|
-
value: function emitChange(subscriberId) {
|
612
|
-
var _iterator = _createForOfIteratorHelper(this.listeners[subscriberId]),
|
613
|
-
_step;
|
614
|
-
try {
|
615
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
616
|
-
var listener = _step.value;
|
617
|
-
listener();
|
618
|
-
}
|
619
|
-
} catch (err) {
|
620
|
-
_iterator.e(err);
|
621
|
-
} finally {
|
622
|
-
_iterator.f();
|
623
|
-
}
|
624
|
-
}
|
625
|
-
}]);
|
626
|
-
return ValStore;
|
627
|
-
}();
|
628
|
-
function createSubscriberId(moduleIds) {
|
629
|
-
return moduleIds.slice().sort().join("&");
|
630
|
-
}
|
631
|
-
|
632
|
-
var useValStore = function useValStore() {
|
633
|
-
if (!ValContext) {
|
634
|
-
return undefined;
|
635
|
-
}
|
636
|
-
return React.useContext(ValContext).valStore;
|
637
|
-
};
|
638
|
-
var useValApi = function useValApi() {
|
639
|
-
if (!ValContext) {
|
640
|
-
return undefined;
|
641
|
-
}
|
642
|
-
return React.useContext(ValContext).valApi;
|
643
|
-
};
|
644
|
-
var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["default"].createContext({
|
645
|
-
valStore: undefined,
|
646
|
-
valApi: undefined
|
647
|
-
}) : undefined;
|
648
|
-
var ValUI = /*#__PURE__*/React.lazy(function () {
|
649
|
-
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-23e2422b.cjs.prod.js')); });
|
650
|
-
});
|
651
|
-
function ValProvider(_ref) {
|
652
|
-
var children = _ref.children,
|
653
|
-
onSubmit = _ref.onSubmit;
|
654
|
-
var host = "/api/val";
|
655
|
-
var api = React.useMemo(function () {
|
656
|
-
return new core.ValApi(host);
|
657
|
-
}, [host]);
|
658
|
-
var store = React.useMemo(function () {
|
659
|
-
return new ValStore(api);
|
660
|
-
}, [api]);
|
661
|
-
var _useState = React.useState(false),
|
662
|
-
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
663
|
-
isClient = _useState2[0],
|
664
|
-
setIsClient = _useState2[1];
|
665
|
-
var _useState3 = React.useState(),
|
666
|
-
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
667
|
-
enabled = _useState4[0],
|
668
|
-
setEnabled = _useState4[1];
|
669
|
-
React.useEffect(function () {
|
670
|
-
setIsClient(true);
|
671
|
-
try {
|
672
|
-
var _document$cookie, _document$cookie2;
|
673
|
-
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
674
|
-
if (valEnabled) {
|
675
|
-
setEnabled(true);
|
676
|
-
}
|
677
|
-
var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
|
678
|
-
if (valDisabled) {
|
679
|
-
setEnabled(false);
|
680
|
-
}
|
681
|
-
// If we are in development and Val is not enabled or disabled, enable Val
|
682
|
-
if ( "production" === "development" && !valEnabled && !valDisabled) ;
|
683
|
-
} catch (e) {
|
684
|
-
console.warn("Could not read Val enabled state", e);
|
685
|
-
}
|
686
|
-
}, []);
|
687
|
-
if (isClient && !enabled) {
|
688
|
-
if (!api) {
|
689
|
-
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
690
|
-
}
|
691
|
-
}
|
692
|
-
if (!isClient || !enabled || !store || !api || !ValContext) {
|
693
|
-
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
694
|
-
children: children
|
695
|
-
});
|
696
|
-
}
|
697
|
-
return /*#__PURE__*/ReactJSXRuntime.jsxs(ValContext.Provider, {
|
698
|
-
value: {
|
699
|
-
valApi: api,
|
700
|
-
valStore: store
|
701
|
-
},
|
702
|
-
children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {
|
703
|
-
host: host,
|
704
|
-
onSubmit: onSubmit
|
705
|
-
})]
|
706
|
-
});
|
707
|
-
}
|
708
|
-
|
709
|
-
exports.ValContext = ValContext;
|
710
|
-
exports.ValProvider = ValProvider;
|
711
|
-
exports.useValApi = useValApi;
|
712
|
-
exports.useValStore = useValStore;
|