@tomorrowevening/theatre-dataverse 1.0.0 → 1.0.2
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/Atom.d.ts +85 -127
- package/dist/Atom.d.ts.map +1 -1
- package/dist/Atom.test.d.ts +2 -0
- package/dist/Atom.test.d.ts.map +1 -0
- package/dist/PointerProxy.d.ts +33 -33
- package/dist/Ticker.d.ts +105 -105
- package/dist/Ticker.test.d.ts +2 -0
- package/dist/Ticker.test.d.ts.map +1 -0
- package/dist/atom.typeTest.d.ts +2 -2
- package/dist/dataverse.test.d.ts +2 -0
- package/dist/dataverse.test.d.ts.map +1 -0
- package/dist/index.d.ts +19 -19
- package/dist/index.js +30 -13
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +1564 -0
- package/dist/index.mjs.map +7 -0
- package/dist/integration.test.d.ts +2 -0
- package/dist/integration.test.d.ts.map +1 -0
- package/dist/pointer.d.ts +107 -107
- package/dist/pointer.test.d.ts +2 -0
- package/dist/pointer.test.d.ts.map +1 -0
- package/dist/pointer.typeTest.d.ts +2 -2
- package/dist/pointerToPrism.d.ts +20 -20
- package/dist/prism/Interface.d.ts +33 -33
- package/dist/prism/asyncIterateOver.d.ts +1 -1
- package/dist/prism/discoveryMechanism.d.ts +4 -4
- package/dist/prism/iterateAndCountTicks.d.ts +7 -7
- package/dist/prism/iterateOver.d.ts +4 -4
- package/dist/prism/iterateOver.test.d.ts +2 -0
- package/dist/prism/iterateOver.test.d.ts.map +1 -0
- package/dist/prism/prism.d.ts +1 -1
- package/dist/prism/prism.test.d.ts +2 -0
- package/dist/prism/prism.test.d.ts.map +1 -0
- package/dist/setupTestEnv.d.ts +2 -2
- package/dist/types.d.ts +6 -6
- package/dist/utils/Stack.d.ts +16 -16
- package/dist/utils/typeTestUtils.d.ts +11 -11
- package/dist/utils/updateDeep.d.ts +3 -3
- package/dist/val.d.ts +14 -14
- package/package.json +8 -10
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1564 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// ../../node_modules/lodash-es/isArray.js
|
|
22
|
+
var isArray = Array.isArray;
|
|
23
|
+
var isArray_default = isArray;
|
|
24
|
+
|
|
25
|
+
// ../../node_modules/lodash-es/_freeGlobal.js
|
|
26
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
27
|
+
var freeGlobal_default = freeGlobal;
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/lodash-es/_root.js
|
|
30
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
31
|
+
var root = freeGlobal_default || freeSelf || Function("return this")();
|
|
32
|
+
var root_default = root;
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/lodash-es/_Symbol.js
|
|
35
|
+
var Symbol2 = root_default.Symbol;
|
|
36
|
+
var Symbol_default = Symbol2;
|
|
37
|
+
|
|
38
|
+
// ../../node_modules/lodash-es/_getRawTag.js
|
|
39
|
+
var objectProto = Object.prototype;
|
|
40
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
41
|
+
var nativeObjectToString = objectProto.toString;
|
|
42
|
+
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
43
|
+
function getRawTag(value) {
|
|
44
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
45
|
+
try {
|
|
46
|
+
value[symToStringTag] = void 0;
|
|
47
|
+
var unmasked = true;
|
|
48
|
+
} catch (e) {
|
|
49
|
+
}
|
|
50
|
+
var result = nativeObjectToString.call(value);
|
|
51
|
+
if (unmasked) {
|
|
52
|
+
if (isOwn) {
|
|
53
|
+
value[symToStringTag] = tag;
|
|
54
|
+
} else {
|
|
55
|
+
delete value[symToStringTag];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
var getRawTag_default = getRawTag;
|
|
61
|
+
|
|
62
|
+
// ../../node_modules/lodash-es/_objectToString.js
|
|
63
|
+
var objectProto2 = Object.prototype;
|
|
64
|
+
var nativeObjectToString2 = objectProto2.toString;
|
|
65
|
+
function objectToString(value) {
|
|
66
|
+
return nativeObjectToString2.call(value);
|
|
67
|
+
}
|
|
68
|
+
var objectToString_default = objectToString;
|
|
69
|
+
|
|
70
|
+
// ../../node_modules/lodash-es/_baseGetTag.js
|
|
71
|
+
var nullTag = "[object Null]";
|
|
72
|
+
var undefinedTag = "[object Undefined]";
|
|
73
|
+
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
74
|
+
function baseGetTag(value) {
|
|
75
|
+
if (value == null) {
|
|
76
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
77
|
+
}
|
|
78
|
+
return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
|
|
79
|
+
}
|
|
80
|
+
var baseGetTag_default = baseGetTag;
|
|
81
|
+
|
|
82
|
+
// ../../node_modules/lodash-es/isObjectLike.js
|
|
83
|
+
function isObjectLike(value) {
|
|
84
|
+
return value != null && typeof value == "object";
|
|
85
|
+
}
|
|
86
|
+
var isObjectLike_default = isObjectLike;
|
|
87
|
+
|
|
88
|
+
// ../../node_modules/lodash-es/isSymbol.js
|
|
89
|
+
var symbolTag = "[object Symbol]";
|
|
90
|
+
function isSymbol(value) {
|
|
91
|
+
return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
|
|
92
|
+
}
|
|
93
|
+
var isSymbol_default = isSymbol;
|
|
94
|
+
|
|
95
|
+
// ../../node_modules/lodash-es/_isKey.js
|
|
96
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
97
|
+
var reIsPlainProp = /^\w*$/;
|
|
98
|
+
function isKey(value, object) {
|
|
99
|
+
if (isArray_default(value)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
var type = typeof value;
|
|
103
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol_default(value)) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
107
|
+
}
|
|
108
|
+
var isKey_default = isKey;
|
|
109
|
+
|
|
110
|
+
// ../../node_modules/lodash-es/isObject.js
|
|
111
|
+
function isObject(value) {
|
|
112
|
+
var type = typeof value;
|
|
113
|
+
return value != null && (type == "object" || type == "function");
|
|
114
|
+
}
|
|
115
|
+
var isObject_default = isObject;
|
|
116
|
+
|
|
117
|
+
// ../../node_modules/lodash-es/isFunction.js
|
|
118
|
+
var asyncTag = "[object AsyncFunction]";
|
|
119
|
+
var funcTag = "[object Function]";
|
|
120
|
+
var genTag = "[object GeneratorFunction]";
|
|
121
|
+
var proxyTag = "[object Proxy]";
|
|
122
|
+
function isFunction(value) {
|
|
123
|
+
if (!isObject_default(value)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
var tag = baseGetTag_default(value);
|
|
127
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
128
|
+
}
|
|
129
|
+
var isFunction_default = isFunction;
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/lodash-es/_coreJsData.js
|
|
132
|
+
var coreJsData = root_default["__core-js_shared__"];
|
|
133
|
+
var coreJsData_default = coreJsData;
|
|
134
|
+
|
|
135
|
+
// ../../node_modules/lodash-es/_isMasked.js
|
|
136
|
+
var maskSrcKey = function() {
|
|
137
|
+
var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
|
|
138
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
139
|
+
}();
|
|
140
|
+
function isMasked(func) {
|
|
141
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
142
|
+
}
|
|
143
|
+
var isMasked_default = isMasked;
|
|
144
|
+
|
|
145
|
+
// ../../node_modules/lodash-es/_toSource.js
|
|
146
|
+
var funcProto = Function.prototype;
|
|
147
|
+
var funcToString = funcProto.toString;
|
|
148
|
+
function toSource(func) {
|
|
149
|
+
if (func != null) {
|
|
150
|
+
try {
|
|
151
|
+
return funcToString.call(func);
|
|
152
|
+
} catch (e) {
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
return func + "";
|
|
156
|
+
} catch (e) {
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return "";
|
|
160
|
+
}
|
|
161
|
+
var toSource_default = toSource;
|
|
162
|
+
|
|
163
|
+
// ../../node_modules/lodash-es/_baseIsNative.js
|
|
164
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
165
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
166
|
+
var funcProto2 = Function.prototype;
|
|
167
|
+
var objectProto3 = Object.prototype;
|
|
168
|
+
var funcToString2 = funcProto2.toString;
|
|
169
|
+
var hasOwnProperty2 = objectProto3.hasOwnProperty;
|
|
170
|
+
var reIsNative = RegExp("^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
171
|
+
function baseIsNative(value) {
|
|
172
|
+
if (!isObject_default(value) || isMasked_default(value)) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
|
|
176
|
+
return pattern.test(toSource_default(value));
|
|
177
|
+
}
|
|
178
|
+
var baseIsNative_default = baseIsNative;
|
|
179
|
+
|
|
180
|
+
// ../../node_modules/lodash-es/_getValue.js
|
|
181
|
+
function getValue(object, key) {
|
|
182
|
+
return object == null ? void 0 : object[key];
|
|
183
|
+
}
|
|
184
|
+
var getValue_default = getValue;
|
|
185
|
+
|
|
186
|
+
// ../../node_modules/lodash-es/_getNative.js
|
|
187
|
+
function getNative(object, key) {
|
|
188
|
+
var value = getValue_default(object, key);
|
|
189
|
+
return baseIsNative_default(value) ? value : void 0;
|
|
190
|
+
}
|
|
191
|
+
var getNative_default = getNative;
|
|
192
|
+
|
|
193
|
+
// ../../node_modules/lodash-es/_nativeCreate.js
|
|
194
|
+
var nativeCreate = getNative_default(Object, "create");
|
|
195
|
+
var nativeCreate_default = nativeCreate;
|
|
196
|
+
|
|
197
|
+
// ../../node_modules/lodash-es/_hashClear.js
|
|
198
|
+
function hashClear() {
|
|
199
|
+
this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
|
|
200
|
+
this.size = 0;
|
|
201
|
+
}
|
|
202
|
+
var hashClear_default = hashClear;
|
|
203
|
+
|
|
204
|
+
// ../../node_modules/lodash-es/_hashDelete.js
|
|
205
|
+
function hashDelete(key) {
|
|
206
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
207
|
+
this.size -= result ? 1 : 0;
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
var hashDelete_default = hashDelete;
|
|
211
|
+
|
|
212
|
+
// ../../node_modules/lodash-es/_hashGet.js
|
|
213
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
214
|
+
var objectProto4 = Object.prototype;
|
|
215
|
+
var hasOwnProperty3 = objectProto4.hasOwnProperty;
|
|
216
|
+
function hashGet(key) {
|
|
217
|
+
var data = this.__data__;
|
|
218
|
+
if (nativeCreate_default) {
|
|
219
|
+
var result = data[key];
|
|
220
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
|
221
|
+
}
|
|
222
|
+
return hasOwnProperty3.call(data, key) ? data[key] : void 0;
|
|
223
|
+
}
|
|
224
|
+
var hashGet_default = hashGet;
|
|
225
|
+
|
|
226
|
+
// ../../node_modules/lodash-es/_hashHas.js
|
|
227
|
+
var objectProto5 = Object.prototype;
|
|
228
|
+
var hasOwnProperty4 = objectProto5.hasOwnProperty;
|
|
229
|
+
function hashHas(key) {
|
|
230
|
+
var data = this.__data__;
|
|
231
|
+
return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty4.call(data, key);
|
|
232
|
+
}
|
|
233
|
+
var hashHas_default = hashHas;
|
|
234
|
+
|
|
235
|
+
// ../../node_modules/lodash-es/_hashSet.js
|
|
236
|
+
var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
|
|
237
|
+
function hashSet(key, value) {
|
|
238
|
+
var data = this.__data__;
|
|
239
|
+
this.size += this.has(key) ? 0 : 1;
|
|
240
|
+
data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
var hashSet_default = hashSet;
|
|
244
|
+
|
|
245
|
+
// ../../node_modules/lodash-es/_Hash.js
|
|
246
|
+
function Hash(entries) {
|
|
247
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
248
|
+
this.clear();
|
|
249
|
+
while (++index < length) {
|
|
250
|
+
var entry = entries[index];
|
|
251
|
+
this.set(entry[0], entry[1]);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
Hash.prototype.clear = hashClear_default;
|
|
255
|
+
Hash.prototype["delete"] = hashDelete_default;
|
|
256
|
+
Hash.prototype.get = hashGet_default;
|
|
257
|
+
Hash.prototype.has = hashHas_default;
|
|
258
|
+
Hash.prototype.set = hashSet_default;
|
|
259
|
+
var Hash_default = Hash;
|
|
260
|
+
|
|
261
|
+
// ../../node_modules/lodash-es/_listCacheClear.js
|
|
262
|
+
function listCacheClear() {
|
|
263
|
+
this.__data__ = [];
|
|
264
|
+
this.size = 0;
|
|
265
|
+
}
|
|
266
|
+
var listCacheClear_default = listCacheClear;
|
|
267
|
+
|
|
268
|
+
// ../../node_modules/lodash-es/eq.js
|
|
269
|
+
function eq(value, other) {
|
|
270
|
+
return value === other || value !== value && other !== other;
|
|
271
|
+
}
|
|
272
|
+
var eq_default = eq;
|
|
273
|
+
|
|
274
|
+
// ../../node_modules/lodash-es/_assocIndexOf.js
|
|
275
|
+
function assocIndexOf(array, key) {
|
|
276
|
+
var length = array.length;
|
|
277
|
+
while (length--) {
|
|
278
|
+
if (eq_default(array[length][0], key)) {
|
|
279
|
+
return length;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return -1;
|
|
283
|
+
}
|
|
284
|
+
var assocIndexOf_default = assocIndexOf;
|
|
285
|
+
|
|
286
|
+
// ../../node_modules/lodash-es/_listCacheDelete.js
|
|
287
|
+
var arrayProto = Array.prototype;
|
|
288
|
+
var splice = arrayProto.splice;
|
|
289
|
+
function listCacheDelete(key) {
|
|
290
|
+
var data = this.__data__, index = assocIndexOf_default(data, key);
|
|
291
|
+
if (index < 0) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
var lastIndex = data.length - 1;
|
|
295
|
+
if (index == lastIndex) {
|
|
296
|
+
data.pop();
|
|
297
|
+
} else {
|
|
298
|
+
splice.call(data, index, 1);
|
|
299
|
+
}
|
|
300
|
+
--this.size;
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
var listCacheDelete_default = listCacheDelete;
|
|
304
|
+
|
|
305
|
+
// ../../node_modules/lodash-es/_listCacheGet.js
|
|
306
|
+
function listCacheGet(key) {
|
|
307
|
+
var data = this.__data__, index = assocIndexOf_default(data, key);
|
|
308
|
+
return index < 0 ? void 0 : data[index][1];
|
|
309
|
+
}
|
|
310
|
+
var listCacheGet_default = listCacheGet;
|
|
311
|
+
|
|
312
|
+
// ../../node_modules/lodash-es/_listCacheHas.js
|
|
313
|
+
function listCacheHas(key) {
|
|
314
|
+
return assocIndexOf_default(this.__data__, key) > -1;
|
|
315
|
+
}
|
|
316
|
+
var listCacheHas_default = listCacheHas;
|
|
317
|
+
|
|
318
|
+
// ../../node_modules/lodash-es/_listCacheSet.js
|
|
319
|
+
function listCacheSet(key, value) {
|
|
320
|
+
var data = this.__data__, index = assocIndexOf_default(data, key);
|
|
321
|
+
if (index < 0) {
|
|
322
|
+
++this.size;
|
|
323
|
+
data.push([key, value]);
|
|
324
|
+
} else {
|
|
325
|
+
data[index][1] = value;
|
|
326
|
+
}
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
var listCacheSet_default = listCacheSet;
|
|
330
|
+
|
|
331
|
+
// ../../node_modules/lodash-es/_ListCache.js
|
|
332
|
+
function ListCache(entries) {
|
|
333
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
334
|
+
this.clear();
|
|
335
|
+
while (++index < length) {
|
|
336
|
+
var entry = entries[index];
|
|
337
|
+
this.set(entry[0], entry[1]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
ListCache.prototype.clear = listCacheClear_default;
|
|
341
|
+
ListCache.prototype["delete"] = listCacheDelete_default;
|
|
342
|
+
ListCache.prototype.get = listCacheGet_default;
|
|
343
|
+
ListCache.prototype.has = listCacheHas_default;
|
|
344
|
+
ListCache.prototype.set = listCacheSet_default;
|
|
345
|
+
var ListCache_default = ListCache;
|
|
346
|
+
|
|
347
|
+
// ../../node_modules/lodash-es/_Map.js
|
|
348
|
+
var Map2 = getNative_default(root_default, "Map");
|
|
349
|
+
var Map_default = Map2;
|
|
350
|
+
|
|
351
|
+
// ../../node_modules/lodash-es/_mapCacheClear.js
|
|
352
|
+
function mapCacheClear() {
|
|
353
|
+
this.size = 0;
|
|
354
|
+
this.__data__ = {
|
|
355
|
+
"hash": new Hash_default(),
|
|
356
|
+
"map": new (Map_default || ListCache_default)(),
|
|
357
|
+
"string": new Hash_default()
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
var mapCacheClear_default = mapCacheClear;
|
|
361
|
+
|
|
362
|
+
// ../../node_modules/lodash-es/_isKeyable.js
|
|
363
|
+
function isKeyable(value) {
|
|
364
|
+
var type = typeof value;
|
|
365
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
366
|
+
}
|
|
367
|
+
var isKeyable_default = isKeyable;
|
|
368
|
+
|
|
369
|
+
// ../../node_modules/lodash-es/_getMapData.js
|
|
370
|
+
function getMapData(map, key) {
|
|
371
|
+
var data = map.__data__;
|
|
372
|
+
return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
373
|
+
}
|
|
374
|
+
var getMapData_default = getMapData;
|
|
375
|
+
|
|
376
|
+
// ../../node_modules/lodash-es/_mapCacheDelete.js
|
|
377
|
+
function mapCacheDelete(key) {
|
|
378
|
+
var result = getMapData_default(this, key)["delete"](key);
|
|
379
|
+
this.size -= result ? 1 : 0;
|
|
380
|
+
return result;
|
|
381
|
+
}
|
|
382
|
+
var mapCacheDelete_default = mapCacheDelete;
|
|
383
|
+
|
|
384
|
+
// ../../node_modules/lodash-es/_mapCacheGet.js
|
|
385
|
+
function mapCacheGet(key) {
|
|
386
|
+
return getMapData_default(this, key).get(key);
|
|
387
|
+
}
|
|
388
|
+
var mapCacheGet_default = mapCacheGet;
|
|
389
|
+
|
|
390
|
+
// ../../node_modules/lodash-es/_mapCacheHas.js
|
|
391
|
+
function mapCacheHas(key) {
|
|
392
|
+
return getMapData_default(this, key).has(key);
|
|
393
|
+
}
|
|
394
|
+
var mapCacheHas_default = mapCacheHas;
|
|
395
|
+
|
|
396
|
+
// ../../node_modules/lodash-es/_mapCacheSet.js
|
|
397
|
+
function mapCacheSet(key, value) {
|
|
398
|
+
var data = getMapData_default(this, key), size = data.size;
|
|
399
|
+
data.set(key, value);
|
|
400
|
+
this.size += data.size == size ? 0 : 1;
|
|
401
|
+
return this;
|
|
402
|
+
}
|
|
403
|
+
var mapCacheSet_default = mapCacheSet;
|
|
404
|
+
|
|
405
|
+
// ../../node_modules/lodash-es/_MapCache.js
|
|
406
|
+
function MapCache(entries) {
|
|
407
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
408
|
+
this.clear();
|
|
409
|
+
while (++index < length) {
|
|
410
|
+
var entry = entries[index];
|
|
411
|
+
this.set(entry[0], entry[1]);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
MapCache.prototype.clear = mapCacheClear_default;
|
|
415
|
+
MapCache.prototype["delete"] = mapCacheDelete_default;
|
|
416
|
+
MapCache.prototype.get = mapCacheGet_default;
|
|
417
|
+
MapCache.prototype.has = mapCacheHas_default;
|
|
418
|
+
MapCache.prototype.set = mapCacheSet_default;
|
|
419
|
+
var MapCache_default = MapCache;
|
|
420
|
+
|
|
421
|
+
// ../../node_modules/lodash-es/memoize.js
|
|
422
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
423
|
+
function memoize(func, resolver) {
|
|
424
|
+
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
425
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
426
|
+
}
|
|
427
|
+
var memoized = function() {
|
|
428
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
429
|
+
if (cache.has(key)) {
|
|
430
|
+
return cache.get(key);
|
|
431
|
+
}
|
|
432
|
+
var result = func.apply(this, args);
|
|
433
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
434
|
+
return result;
|
|
435
|
+
};
|
|
436
|
+
memoized.cache = new (memoize.Cache || MapCache_default)();
|
|
437
|
+
return memoized;
|
|
438
|
+
}
|
|
439
|
+
memoize.Cache = MapCache_default;
|
|
440
|
+
var memoize_default = memoize;
|
|
441
|
+
|
|
442
|
+
// ../../node_modules/lodash-es/_memoizeCapped.js
|
|
443
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
444
|
+
function memoizeCapped(func) {
|
|
445
|
+
var result = memoize_default(func, function(key) {
|
|
446
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
447
|
+
cache.clear();
|
|
448
|
+
}
|
|
449
|
+
return key;
|
|
450
|
+
});
|
|
451
|
+
var cache = result.cache;
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
var memoizeCapped_default = memoizeCapped;
|
|
455
|
+
|
|
456
|
+
// ../../node_modules/lodash-es/_stringToPath.js
|
|
457
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
458
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
459
|
+
var stringToPath = memoizeCapped_default(function(string) {
|
|
460
|
+
var result = [];
|
|
461
|
+
if (string.charCodeAt(0) === 46) {
|
|
462
|
+
result.push("");
|
|
463
|
+
}
|
|
464
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
465
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
466
|
+
});
|
|
467
|
+
return result;
|
|
468
|
+
});
|
|
469
|
+
var stringToPath_default = stringToPath;
|
|
470
|
+
|
|
471
|
+
// ../../node_modules/lodash-es/_arrayMap.js
|
|
472
|
+
function arrayMap(array, iteratee) {
|
|
473
|
+
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
474
|
+
while (++index < length) {
|
|
475
|
+
result[index] = iteratee(array[index], index, array);
|
|
476
|
+
}
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
var arrayMap_default = arrayMap;
|
|
480
|
+
|
|
481
|
+
// ../../node_modules/lodash-es/_baseToString.js
|
|
482
|
+
var INFINITY = 1 / 0;
|
|
483
|
+
var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
|
|
484
|
+
var symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
485
|
+
function baseToString(value) {
|
|
486
|
+
if (typeof value == "string") {
|
|
487
|
+
return value;
|
|
488
|
+
}
|
|
489
|
+
if (isArray_default(value)) {
|
|
490
|
+
return arrayMap_default(value, baseToString) + "";
|
|
491
|
+
}
|
|
492
|
+
if (isSymbol_default(value)) {
|
|
493
|
+
return symbolToString ? symbolToString.call(value) : "";
|
|
494
|
+
}
|
|
495
|
+
var result = value + "";
|
|
496
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
497
|
+
}
|
|
498
|
+
var baseToString_default = baseToString;
|
|
499
|
+
|
|
500
|
+
// ../../node_modules/lodash-es/toString.js
|
|
501
|
+
function toString(value) {
|
|
502
|
+
return value == null ? "" : baseToString_default(value);
|
|
503
|
+
}
|
|
504
|
+
var toString_default = toString;
|
|
505
|
+
|
|
506
|
+
// ../../node_modules/lodash-es/_castPath.js
|
|
507
|
+
function castPath(value, object) {
|
|
508
|
+
if (isArray_default(value)) {
|
|
509
|
+
return value;
|
|
510
|
+
}
|
|
511
|
+
return isKey_default(value, object) ? [value] : stringToPath_default(toString_default(value));
|
|
512
|
+
}
|
|
513
|
+
var castPath_default = castPath;
|
|
514
|
+
|
|
515
|
+
// ../../node_modules/lodash-es/_toKey.js
|
|
516
|
+
var INFINITY2 = 1 / 0;
|
|
517
|
+
function toKey(value) {
|
|
518
|
+
if (typeof value == "string" || isSymbol_default(value)) {
|
|
519
|
+
return value;
|
|
520
|
+
}
|
|
521
|
+
var result = value + "";
|
|
522
|
+
return result == "0" && 1 / value == -INFINITY2 ? "-0" : result;
|
|
523
|
+
}
|
|
524
|
+
var toKey_default = toKey;
|
|
525
|
+
|
|
526
|
+
// ../../node_modules/lodash-es/_baseGet.js
|
|
527
|
+
function baseGet(object, path) {
|
|
528
|
+
path = castPath_default(path, object);
|
|
529
|
+
var index = 0, length = path.length;
|
|
530
|
+
while (object != null && index < length) {
|
|
531
|
+
object = object[toKey_default(path[index++])];
|
|
532
|
+
}
|
|
533
|
+
return index && index == length ? object : void 0;
|
|
534
|
+
}
|
|
535
|
+
var baseGet_default = baseGet;
|
|
536
|
+
|
|
537
|
+
// ../../node_modules/lodash-es/get.js
|
|
538
|
+
function get(object, path, defaultValue) {
|
|
539
|
+
var result = object == null ? void 0 : baseGet_default(object, path);
|
|
540
|
+
return result === void 0 ? defaultValue : result;
|
|
541
|
+
}
|
|
542
|
+
var get_default = get;
|
|
543
|
+
|
|
544
|
+
// ../../node_modules/lodash-es/_overArg.js
|
|
545
|
+
function overArg(func, transform) {
|
|
546
|
+
return function(arg) {
|
|
547
|
+
return func(transform(arg));
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
var overArg_default = overArg;
|
|
551
|
+
|
|
552
|
+
// ../../node_modules/lodash-es/_getPrototype.js
|
|
553
|
+
var getPrototype = overArg_default(Object.getPrototypeOf, Object);
|
|
554
|
+
var getPrototype_default = getPrototype;
|
|
555
|
+
|
|
556
|
+
// ../../node_modules/lodash-es/isPlainObject.js
|
|
557
|
+
var objectTag = "[object Object]";
|
|
558
|
+
var funcProto3 = Function.prototype;
|
|
559
|
+
var objectProto6 = Object.prototype;
|
|
560
|
+
var funcToString3 = funcProto3.toString;
|
|
561
|
+
var hasOwnProperty5 = objectProto6.hasOwnProperty;
|
|
562
|
+
var objectCtorString = funcToString3.call(Object);
|
|
563
|
+
function isPlainObject(value) {
|
|
564
|
+
if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag) {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
var proto = getPrototype_default(value);
|
|
568
|
+
if (proto === null) {
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
var Ctor = hasOwnProperty5.call(proto, "constructor") && proto.constructor;
|
|
572
|
+
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
|
|
573
|
+
}
|
|
574
|
+
var isPlainObject_default = isPlainObject;
|
|
575
|
+
|
|
576
|
+
// ../../node_modules/lodash-es/last.js
|
|
577
|
+
function last(array) {
|
|
578
|
+
var length = array == null ? 0 : array.length;
|
|
579
|
+
return length ? array[length - 1] : void 0;
|
|
580
|
+
}
|
|
581
|
+
var last_default = last;
|
|
582
|
+
|
|
583
|
+
// src/pointer.ts
|
|
584
|
+
var pointerMetaWeakMap = new WeakMap();
|
|
585
|
+
var cachedSubPathPointersWeakMap = new WeakMap();
|
|
586
|
+
var pointerMetaSymbol = Symbol("pointerMeta");
|
|
587
|
+
var proxyHandler = {
|
|
588
|
+
get(pointerKey, prop) {
|
|
589
|
+
if (prop === pointerMetaSymbol)
|
|
590
|
+
return pointerMetaWeakMap.get(pointerKey);
|
|
591
|
+
let subPathPointers = cachedSubPathPointersWeakMap.get(pointerKey);
|
|
592
|
+
if (!subPathPointers) {
|
|
593
|
+
subPathPointers = new Map();
|
|
594
|
+
cachedSubPathPointersWeakMap.set(pointerKey, subPathPointers);
|
|
595
|
+
}
|
|
596
|
+
const existing = subPathPointers.get(prop);
|
|
597
|
+
if (existing !== void 0)
|
|
598
|
+
return existing;
|
|
599
|
+
const meta = pointerMetaWeakMap.get(pointerKey);
|
|
600
|
+
const subPointer = pointer({ root: meta.root, path: [...meta.path, prop] });
|
|
601
|
+
subPathPointers.set(prop, subPointer);
|
|
602
|
+
return subPointer;
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
var getPointerMeta = (p) => {
|
|
606
|
+
const meta = p[pointerMetaSymbol];
|
|
607
|
+
return meta;
|
|
608
|
+
};
|
|
609
|
+
var getPointerParts = (p) => {
|
|
610
|
+
const { root: root2, path } = getPointerMeta(p);
|
|
611
|
+
return { root: root2, path };
|
|
612
|
+
};
|
|
613
|
+
function pointer(args) {
|
|
614
|
+
var _a;
|
|
615
|
+
const meta = {
|
|
616
|
+
root: args.root,
|
|
617
|
+
path: (_a = args.path) != null ? _a : []
|
|
618
|
+
};
|
|
619
|
+
const pointerKey = {};
|
|
620
|
+
pointerMetaWeakMap.set(pointerKey, meta);
|
|
621
|
+
return new Proxy(pointerKey, proxyHandler);
|
|
622
|
+
}
|
|
623
|
+
var pointer_default = pointer;
|
|
624
|
+
var isPointer = (p) => {
|
|
625
|
+
return p && !!getPointerMeta(p);
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// src/utils/updateDeep.ts
|
|
629
|
+
function updateDeep(state2, path, reducer) {
|
|
630
|
+
if (path.length === 0)
|
|
631
|
+
return reducer(state2);
|
|
632
|
+
return hoop(state2, path, reducer);
|
|
633
|
+
}
|
|
634
|
+
var hoop = (s, path, reducer) => {
|
|
635
|
+
if (path.length === 0) {
|
|
636
|
+
return reducer(s);
|
|
637
|
+
}
|
|
638
|
+
if (Array.isArray(s)) {
|
|
639
|
+
let [index, ...restOfPath] = path;
|
|
640
|
+
index = parseInt(String(index), 10);
|
|
641
|
+
if (isNaN(index))
|
|
642
|
+
index = 0;
|
|
643
|
+
const oldVal = s[index];
|
|
644
|
+
const newVal = hoop(oldVal, restOfPath, reducer);
|
|
645
|
+
if (oldVal === newVal)
|
|
646
|
+
return s;
|
|
647
|
+
const newS = [...s];
|
|
648
|
+
newS.splice(index, 1, newVal);
|
|
649
|
+
return newS;
|
|
650
|
+
} else if (typeof s === "object" && s !== null) {
|
|
651
|
+
const [key, ...restOfPath] = path;
|
|
652
|
+
const oldVal = s[key];
|
|
653
|
+
const newVal = hoop(oldVal, restOfPath, reducer);
|
|
654
|
+
if (oldVal === newVal)
|
|
655
|
+
return s;
|
|
656
|
+
const newS = __spreadProps(__spreadValues({}, s), { [key]: newVal });
|
|
657
|
+
return newS;
|
|
658
|
+
} else {
|
|
659
|
+
const [key, ...restOfPath] = path;
|
|
660
|
+
return { [key]: hoop(void 0, restOfPath, reducer) };
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
// src/utils/Stack.ts
|
|
665
|
+
var Stack = class {
|
|
666
|
+
constructor() {
|
|
667
|
+
this._head = void 0;
|
|
668
|
+
}
|
|
669
|
+
peek() {
|
|
670
|
+
return this._head && this._head.data;
|
|
671
|
+
}
|
|
672
|
+
pop() {
|
|
673
|
+
const head = this._head;
|
|
674
|
+
if (!head) {
|
|
675
|
+
return void 0;
|
|
676
|
+
}
|
|
677
|
+
this._head = head.next;
|
|
678
|
+
return head.data;
|
|
679
|
+
}
|
|
680
|
+
push(data) {
|
|
681
|
+
const node = { next: this._head, data };
|
|
682
|
+
this._head = node;
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
// src/prism/Interface.ts
|
|
687
|
+
function isPrism(d) {
|
|
688
|
+
return !!(d && d.isPrism && d.isPrism === true);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// src/prism/discoveryMechanism.ts
|
|
692
|
+
function createMechanism() {
|
|
693
|
+
const noop = () => {
|
|
694
|
+
};
|
|
695
|
+
const stack = new Stack();
|
|
696
|
+
const noopCollector = noop;
|
|
697
|
+
const pushCollector2 = (collector) => {
|
|
698
|
+
stack.push(collector);
|
|
699
|
+
};
|
|
700
|
+
const popCollector2 = (collector) => {
|
|
701
|
+
const existing = stack.peek();
|
|
702
|
+
if (existing !== collector) {
|
|
703
|
+
throw new Error(`Popped collector is not on top of the stack`);
|
|
704
|
+
}
|
|
705
|
+
stack.pop();
|
|
706
|
+
};
|
|
707
|
+
const startIgnoringDependencies2 = () => {
|
|
708
|
+
stack.push(noopCollector);
|
|
709
|
+
};
|
|
710
|
+
const stopIgnoringDependencies2 = () => {
|
|
711
|
+
if (stack.peek() !== noopCollector) {
|
|
712
|
+
if (process.env.NODE_ENV === "development") {
|
|
713
|
+
console.warn("This should never happen");
|
|
714
|
+
}
|
|
715
|
+
} else {
|
|
716
|
+
stack.pop();
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
const reportResolutionStart2 = (d) => {
|
|
720
|
+
const possibleCollector = stack.peek();
|
|
721
|
+
if (possibleCollector) {
|
|
722
|
+
possibleCollector(d);
|
|
723
|
+
}
|
|
724
|
+
stack.push(noopCollector);
|
|
725
|
+
};
|
|
726
|
+
const reportResolutionEnd2 = (_d) => {
|
|
727
|
+
stack.pop();
|
|
728
|
+
};
|
|
729
|
+
return {
|
|
730
|
+
type: "Dataverse_discoveryMechanism",
|
|
731
|
+
startIgnoringDependencies: startIgnoringDependencies2,
|
|
732
|
+
stopIgnoringDependencies: stopIgnoringDependencies2,
|
|
733
|
+
reportResolutionStart: reportResolutionStart2,
|
|
734
|
+
reportResolutionEnd: reportResolutionEnd2,
|
|
735
|
+
pushCollector: pushCollector2,
|
|
736
|
+
popCollector: popCollector2
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function getSharedMechanism() {
|
|
740
|
+
const varName = "__dataverse_discoveryMechanism_sharedStack";
|
|
741
|
+
const root2 = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
742
|
+
if (root2) {
|
|
743
|
+
const existingMechanism = root2[varName];
|
|
744
|
+
if (existingMechanism && typeof existingMechanism === "object" && existingMechanism.type === "Dataverse_discoveryMechanism") {
|
|
745
|
+
return existingMechanism;
|
|
746
|
+
} else {
|
|
747
|
+
const mechanism = createMechanism();
|
|
748
|
+
root2[varName] = mechanism;
|
|
749
|
+
return mechanism;
|
|
750
|
+
}
|
|
751
|
+
} else {
|
|
752
|
+
return createMechanism();
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
var {
|
|
756
|
+
startIgnoringDependencies,
|
|
757
|
+
stopIgnoringDependencies,
|
|
758
|
+
reportResolutionEnd,
|
|
759
|
+
reportResolutionStart,
|
|
760
|
+
pushCollector,
|
|
761
|
+
popCollector
|
|
762
|
+
} = getSharedMechanism();
|
|
763
|
+
|
|
764
|
+
// src/prism/prism.ts
|
|
765
|
+
var voidFn = () => {
|
|
766
|
+
};
|
|
767
|
+
var HotHandle = class {
|
|
768
|
+
constructor(_fn, _prismInstance) {
|
|
769
|
+
this._fn = _fn;
|
|
770
|
+
this._prismInstance = _prismInstance;
|
|
771
|
+
this._didMarkDependentsAsStale = false;
|
|
772
|
+
this._isFresh = false;
|
|
773
|
+
this._cacheOfDendencyValues = new Map();
|
|
774
|
+
this._dependents = new Set();
|
|
775
|
+
this._dependencies = new Set();
|
|
776
|
+
this._possiblyStaleDeps = new Set();
|
|
777
|
+
this._scope = new HotScope(this);
|
|
778
|
+
this._lastValue = void 0;
|
|
779
|
+
this._forciblySetToStale = false;
|
|
780
|
+
this._reactToDependencyGoingStale = (which) => {
|
|
781
|
+
this._possiblyStaleDeps.add(which);
|
|
782
|
+
this._markAsStale();
|
|
783
|
+
};
|
|
784
|
+
for (const d of this._dependencies) {
|
|
785
|
+
d._addDependent(this._reactToDependencyGoingStale);
|
|
786
|
+
}
|
|
787
|
+
startIgnoringDependencies();
|
|
788
|
+
this.getValue();
|
|
789
|
+
stopIgnoringDependencies();
|
|
790
|
+
}
|
|
791
|
+
get hasDependents() {
|
|
792
|
+
return this._dependents.size > 0;
|
|
793
|
+
}
|
|
794
|
+
removeDependent(d) {
|
|
795
|
+
this._dependents.delete(d);
|
|
796
|
+
}
|
|
797
|
+
addDependent(d) {
|
|
798
|
+
this._dependents.add(d);
|
|
799
|
+
}
|
|
800
|
+
destroy() {
|
|
801
|
+
for (const d of this._dependencies) {
|
|
802
|
+
d._removeDependent(this._reactToDependencyGoingStale);
|
|
803
|
+
}
|
|
804
|
+
cleanupScopeStack(this._scope);
|
|
805
|
+
}
|
|
806
|
+
getValue() {
|
|
807
|
+
if (!this._isFresh) {
|
|
808
|
+
const newValue = this._recalculate();
|
|
809
|
+
this._lastValue = newValue;
|
|
810
|
+
this._isFresh = true;
|
|
811
|
+
this._didMarkDependentsAsStale = false;
|
|
812
|
+
this._forciblySetToStale = false;
|
|
813
|
+
}
|
|
814
|
+
return this._lastValue;
|
|
815
|
+
}
|
|
816
|
+
_recalculate() {
|
|
817
|
+
let value;
|
|
818
|
+
if (!this._forciblySetToStale) {
|
|
819
|
+
if (this._possiblyStaleDeps.size > 0) {
|
|
820
|
+
let anActuallyStaleDepWasFound = false;
|
|
821
|
+
startIgnoringDependencies();
|
|
822
|
+
for (const dep of this._possiblyStaleDeps) {
|
|
823
|
+
if (this._cacheOfDendencyValues.get(dep) !== dep.getValue()) {
|
|
824
|
+
anActuallyStaleDepWasFound = true;
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
stopIgnoringDependencies();
|
|
829
|
+
this._possiblyStaleDeps.clear();
|
|
830
|
+
if (!anActuallyStaleDepWasFound) {
|
|
831
|
+
return this._lastValue;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
const newDeps = new Set();
|
|
836
|
+
this._cacheOfDendencyValues.clear();
|
|
837
|
+
const collector = (observedDep) => {
|
|
838
|
+
newDeps.add(observedDep);
|
|
839
|
+
this._addDependency(observedDep);
|
|
840
|
+
};
|
|
841
|
+
pushCollector(collector);
|
|
842
|
+
hookScopeStack.push(this._scope);
|
|
843
|
+
try {
|
|
844
|
+
value = this._fn();
|
|
845
|
+
} catch (error) {
|
|
846
|
+
console.error(error);
|
|
847
|
+
} finally {
|
|
848
|
+
const topOfTheStack = hookScopeStack.pop();
|
|
849
|
+
if (topOfTheStack !== this._scope) {
|
|
850
|
+
console.warn(`The Prism hook stack has slipped. This is a bug.`);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
popCollector(collector);
|
|
854
|
+
for (const dep of this._dependencies) {
|
|
855
|
+
if (!newDeps.has(dep)) {
|
|
856
|
+
this._removeDependency(dep);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
this._dependencies = newDeps;
|
|
860
|
+
startIgnoringDependencies();
|
|
861
|
+
for (const dep of newDeps) {
|
|
862
|
+
this._cacheOfDendencyValues.set(dep, dep.getValue());
|
|
863
|
+
}
|
|
864
|
+
stopIgnoringDependencies();
|
|
865
|
+
return value;
|
|
866
|
+
}
|
|
867
|
+
forceStale() {
|
|
868
|
+
this._forciblySetToStale = true;
|
|
869
|
+
this._markAsStale();
|
|
870
|
+
}
|
|
871
|
+
_markAsStale() {
|
|
872
|
+
if (this._didMarkDependentsAsStale)
|
|
873
|
+
return;
|
|
874
|
+
this._didMarkDependentsAsStale = true;
|
|
875
|
+
this._isFresh = false;
|
|
876
|
+
for (const dependent of this._dependents) {
|
|
877
|
+
dependent(this._prismInstance);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
_addDependency(d) {
|
|
881
|
+
if (this._dependencies.has(d))
|
|
882
|
+
return;
|
|
883
|
+
this._dependencies.add(d);
|
|
884
|
+
d._addDependent(this._reactToDependencyGoingStale);
|
|
885
|
+
}
|
|
886
|
+
_removeDependency(d) {
|
|
887
|
+
if (!this._dependencies.has(d))
|
|
888
|
+
return;
|
|
889
|
+
this._dependencies.delete(d);
|
|
890
|
+
d._removeDependent(this._reactToDependencyGoingStale);
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
var emptyObject = {};
|
|
894
|
+
var PrismInstance = class {
|
|
895
|
+
constructor(_fn) {
|
|
896
|
+
this._fn = _fn;
|
|
897
|
+
this.isPrism = true;
|
|
898
|
+
this._state = {
|
|
899
|
+
hot: false,
|
|
900
|
+
handle: void 0
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
get isHot() {
|
|
904
|
+
return this._state.hot;
|
|
905
|
+
}
|
|
906
|
+
onChange(ticker, listener, immediate = false) {
|
|
907
|
+
const dependent = () => {
|
|
908
|
+
ticker.onThisOrNextTick(refresh);
|
|
909
|
+
};
|
|
910
|
+
let lastValue = emptyObject;
|
|
911
|
+
const refresh = () => {
|
|
912
|
+
const newValue = this.getValue();
|
|
913
|
+
if (newValue === lastValue)
|
|
914
|
+
return;
|
|
915
|
+
lastValue = newValue;
|
|
916
|
+
listener(newValue);
|
|
917
|
+
};
|
|
918
|
+
this._addDependent(dependent);
|
|
919
|
+
if (immediate) {
|
|
920
|
+
lastValue = this.getValue();
|
|
921
|
+
listener(lastValue);
|
|
922
|
+
}
|
|
923
|
+
const unsubscribe = () => {
|
|
924
|
+
this._removeDependent(dependent);
|
|
925
|
+
ticker.offThisOrNextTick(refresh);
|
|
926
|
+
ticker.offNextTick(refresh);
|
|
927
|
+
};
|
|
928
|
+
return unsubscribe;
|
|
929
|
+
}
|
|
930
|
+
onStale(callback) {
|
|
931
|
+
const untap = () => {
|
|
932
|
+
this._removeDependent(fn);
|
|
933
|
+
};
|
|
934
|
+
const fn = () => callback();
|
|
935
|
+
this._addDependent(fn);
|
|
936
|
+
return untap;
|
|
937
|
+
}
|
|
938
|
+
keepHot() {
|
|
939
|
+
return this.onStale(() => {
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
_addDependent(d) {
|
|
943
|
+
if (!this._state.hot) {
|
|
944
|
+
this._goHot();
|
|
945
|
+
}
|
|
946
|
+
this._state.handle.addDependent(d);
|
|
947
|
+
}
|
|
948
|
+
_goHot() {
|
|
949
|
+
const hotHandle = new HotHandle(this._fn, this);
|
|
950
|
+
this._state = {
|
|
951
|
+
hot: true,
|
|
952
|
+
handle: hotHandle
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
_removeDependent(d) {
|
|
956
|
+
const state2 = this._state;
|
|
957
|
+
if (!state2.hot) {
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
const handle = state2.handle;
|
|
961
|
+
handle.removeDependent(d);
|
|
962
|
+
if (!handle.hasDependents) {
|
|
963
|
+
this._state = { hot: false, handle: void 0 };
|
|
964
|
+
handle.destroy();
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
getValue() {
|
|
968
|
+
reportResolutionStart(this);
|
|
969
|
+
const state2 = this._state;
|
|
970
|
+
let val2;
|
|
971
|
+
if (state2.hot) {
|
|
972
|
+
val2 = state2.handle.getValue();
|
|
973
|
+
} else {
|
|
974
|
+
val2 = calculateColdPrism(this._fn);
|
|
975
|
+
}
|
|
976
|
+
reportResolutionEnd(this);
|
|
977
|
+
return val2;
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
var HotScope = class {
|
|
981
|
+
constructor(_hotHandle) {
|
|
982
|
+
this._hotHandle = _hotHandle;
|
|
983
|
+
this._refs = new Map();
|
|
984
|
+
this.isPrismScope = true;
|
|
985
|
+
this.subs = {};
|
|
986
|
+
this.effects = new Map();
|
|
987
|
+
this.memos = new Map();
|
|
988
|
+
}
|
|
989
|
+
ref(key, initialValue) {
|
|
990
|
+
let ref2 = this._refs.get(key);
|
|
991
|
+
if (ref2 !== void 0) {
|
|
992
|
+
return ref2;
|
|
993
|
+
} else {
|
|
994
|
+
const ref3 = {
|
|
995
|
+
current: initialValue
|
|
996
|
+
};
|
|
997
|
+
this._refs.set(key, ref3);
|
|
998
|
+
return ref3;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
effect(key, cb, deps) {
|
|
1002
|
+
let effect2 = this.effects.get(key);
|
|
1003
|
+
if (effect2 === void 0) {
|
|
1004
|
+
effect2 = {
|
|
1005
|
+
cleanup: voidFn,
|
|
1006
|
+
deps: void 0
|
|
1007
|
+
};
|
|
1008
|
+
this.effects.set(key, effect2);
|
|
1009
|
+
}
|
|
1010
|
+
if (depsHaveChanged(effect2.deps, deps)) {
|
|
1011
|
+
effect2.cleanup();
|
|
1012
|
+
startIgnoringDependencies();
|
|
1013
|
+
effect2.cleanup = safelyRun(cb, voidFn).value;
|
|
1014
|
+
stopIgnoringDependencies();
|
|
1015
|
+
effect2.deps = deps;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
memo(key, fn, deps) {
|
|
1019
|
+
let memo2 = this.memos.get(key);
|
|
1020
|
+
if (memo2 === void 0) {
|
|
1021
|
+
memo2 = {
|
|
1022
|
+
cachedValue: null,
|
|
1023
|
+
deps: void 0
|
|
1024
|
+
};
|
|
1025
|
+
this.memos.set(key, memo2);
|
|
1026
|
+
}
|
|
1027
|
+
if (depsHaveChanged(memo2.deps, deps)) {
|
|
1028
|
+
startIgnoringDependencies();
|
|
1029
|
+
memo2.cachedValue = safelyRun(fn, void 0).value;
|
|
1030
|
+
stopIgnoringDependencies();
|
|
1031
|
+
memo2.deps = deps;
|
|
1032
|
+
}
|
|
1033
|
+
return memo2.cachedValue;
|
|
1034
|
+
}
|
|
1035
|
+
state(key, initialValue) {
|
|
1036
|
+
const { value, setValue } = this.memo("state/" + key, () => {
|
|
1037
|
+
const value2 = { current: initialValue };
|
|
1038
|
+
const setValue2 = (newValue) => {
|
|
1039
|
+
value2.current = newValue;
|
|
1040
|
+
this._hotHandle.forceStale();
|
|
1041
|
+
};
|
|
1042
|
+
return { value: value2, setValue: setValue2 };
|
|
1043
|
+
}, []);
|
|
1044
|
+
return [value.current, setValue];
|
|
1045
|
+
}
|
|
1046
|
+
sub(key) {
|
|
1047
|
+
if (!this.subs[key]) {
|
|
1048
|
+
this.subs[key] = new HotScope(this._hotHandle);
|
|
1049
|
+
}
|
|
1050
|
+
return this.subs[key];
|
|
1051
|
+
}
|
|
1052
|
+
cleanupEffects() {
|
|
1053
|
+
for (const effect2 of this.effects.values()) {
|
|
1054
|
+
safelyRun(effect2.cleanup, void 0);
|
|
1055
|
+
}
|
|
1056
|
+
this.effects.clear();
|
|
1057
|
+
}
|
|
1058
|
+
source(subscribe, getValue2) {
|
|
1059
|
+
const sourceKey = "$$source/blah";
|
|
1060
|
+
this.effect(sourceKey, () => {
|
|
1061
|
+
const unsub = subscribe(() => {
|
|
1062
|
+
this._hotHandle.forceStale();
|
|
1063
|
+
});
|
|
1064
|
+
return unsub;
|
|
1065
|
+
}, [subscribe]);
|
|
1066
|
+
return getValue2();
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
function cleanupScopeStack(scope2) {
|
|
1070
|
+
for (const sub2 of Object.values(scope2.subs)) {
|
|
1071
|
+
cleanupScopeStack(sub2);
|
|
1072
|
+
}
|
|
1073
|
+
scope2.cleanupEffects();
|
|
1074
|
+
}
|
|
1075
|
+
function safelyRun(fn, returnValueInCaseOfError) {
|
|
1076
|
+
try {
|
|
1077
|
+
return { value: fn(), ok: true };
|
|
1078
|
+
} catch (error) {
|
|
1079
|
+
setTimeout(function PrismReportThrow() {
|
|
1080
|
+
throw error;
|
|
1081
|
+
});
|
|
1082
|
+
return { value: returnValueInCaseOfError, ok: false };
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
var hookScopeStack = new Stack();
|
|
1086
|
+
function ref(key, initialValue) {
|
|
1087
|
+
const scope2 = hookScopeStack.peek();
|
|
1088
|
+
if (!scope2) {
|
|
1089
|
+
throw new Error(`prism.ref() is called outside of a prism() call.`);
|
|
1090
|
+
}
|
|
1091
|
+
return scope2.ref(key, initialValue);
|
|
1092
|
+
}
|
|
1093
|
+
function effect(key, cb, deps) {
|
|
1094
|
+
const scope2 = hookScopeStack.peek();
|
|
1095
|
+
if (!scope2) {
|
|
1096
|
+
throw new Error(`prism.effect() is called outside of a prism() call.`);
|
|
1097
|
+
}
|
|
1098
|
+
return scope2.effect(key, cb, deps);
|
|
1099
|
+
}
|
|
1100
|
+
function depsHaveChanged(oldDeps, newDeps) {
|
|
1101
|
+
if (oldDeps === void 0 || newDeps === void 0) {
|
|
1102
|
+
return true;
|
|
1103
|
+
}
|
|
1104
|
+
const len = oldDeps.length;
|
|
1105
|
+
if (len !== newDeps.length)
|
|
1106
|
+
return true;
|
|
1107
|
+
for (let i = 0; i < len; i++) {
|
|
1108
|
+
if (oldDeps[i] !== newDeps[i])
|
|
1109
|
+
return true;
|
|
1110
|
+
}
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
function memo(key, fn, deps) {
|
|
1114
|
+
const scope2 = hookScopeStack.peek();
|
|
1115
|
+
if (!scope2) {
|
|
1116
|
+
throw new Error(`prism.memo() is called outside of a prism() call.`);
|
|
1117
|
+
}
|
|
1118
|
+
return scope2.memo(key, fn, deps);
|
|
1119
|
+
}
|
|
1120
|
+
function state(key, initialValue) {
|
|
1121
|
+
const scope2 = hookScopeStack.peek();
|
|
1122
|
+
if (!scope2) {
|
|
1123
|
+
throw new Error(`prism.state() is called outside of a prism() call.`);
|
|
1124
|
+
}
|
|
1125
|
+
return scope2.state(key, initialValue);
|
|
1126
|
+
}
|
|
1127
|
+
function ensurePrism() {
|
|
1128
|
+
const scope2 = hookScopeStack.peek();
|
|
1129
|
+
if (!scope2) {
|
|
1130
|
+
throw new Error(`The parent function is called outside of a prism() call.`);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
function scope(key, fn) {
|
|
1134
|
+
const parentScope = hookScopeStack.peek();
|
|
1135
|
+
if (!parentScope) {
|
|
1136
|
+
throw new Error(`prism.scope() is called outside of a prism() call.`);
|
|
1137
|
+
}
|
|
1138
|
+
const subScope = parentScope.sub(key);
|
|
1139
|
+
hookScopeStack.push(subScope);
|
|
1140
|
+
const ret = safelyRun(fn, void 0).value;
|
|
1141
|
+
hookScopeStack.pop();
|
|
1142
|
+
return ret;
|
|
1143
|
+
}
|
|
1144
|
+
function sub(key, fn, deps) {
|
|
1145
|
+
return memo(key, () => prism(fn), deps).getValue();
|
|
1146
|
+
}
|
|
1147
|
+
function inPrism() {
|
|
1148
|
+
return !!hookScopeStack.peek();
|
|
1149
|
+
}
|
|
1150
|
+
function source(subscribe, getValue2) {
|
|
1151
|
+
const scope2 = hookScopeStack.peek();
|
|
1152
|
+
if (!scope2) {
|
|
1153
|
+
throw new Error(`prism.source() is called outside of a prism() call.`);
|
|
1154
|
+
}
|
|
1155
|
+
return scope2.source(subscribe, getValue2);
|
|
1156
|
+
}
|
|
1157
|
+
var prism = (fn) => {
|
|
1158
|
+
return new PrismInstance(fn);
|
|
1159
|
+
};
|
|
1160
|
+
var ColdScope = class {
|
|
1161
|
+
effect(key, cb, deps) {
|
|
1162
|
+
console.warn(`prism.effect() does not run in cold prisms`);
|
|
1163
|
+
}
|
|
1164
|
+
memo(key, fn, deps) {
|
|
1165
|
+
return fn();
|
|
1166
|
+
}
|
|
1167
|
+
state(key, initialValue) {
|
|
1168
|
+
return [initialValue, () => {
|
|
1169
|
+
}];
|
|
1170
|
+
}
|
|
1171
|
+
ref(key, initialValue) {
|
|
1172
|
+
return { current: initialValue };
|
|
1173
|
+
}
|
|
1174
|
+
sub(key) {
|
|
1175
|
+
return new ColdScope();
|
|
1176
|
+
}
|
|
1177
|
+
source(subscribe, getValue2) {
|
|
1178
|
+
return getValue2();
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
function calculateColdPrism(fn) {
|
|
1182
|
+
const scope2 = new ColdScope();
|
|
1183
|
+
hookScopeStack.push(scope2);
|
|
1184
|
+
let value;
|
|
1185
|
+
try {
|
|
1186
|
+
value = fn();
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
console.error(error);
|
|
1189
|
+
} finally {
|
|
1190
|
+
const topOfTheStack = hookScopeStack.pop();
|
|
1191
|
+
if (topOfTheStack !== scope2) {
|
|
1192
|
+
console.warn(`The Prism hook stack has slipped. This is a bug.`);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
return value;
|
|
1196
|
+
}
|
|
1197
|
+
prism.ref = ref;
|
|
1198
|
+
prism.effect = effect;
|
|
1199
|
+
prism.memo = memo;
|
|
1200
|
+
prism.ensurePrism = ensurePrism;
|
|
1201
|
+
prism.state = state;
|
|
1202
|
+
prism.scope = scope;
|
|
1203
|
+
prism.sub = sub;
|
|
1204
|
+
prism.inPrism = inPrism;
|
|
1205
|
+
prism.source = source;
|
|
1206
|
+
var prism_default = prism;
|
|
1207
|
+
|
|
1208
|
+
// src/Atom.ts
|
|
1209
|
+
var ValueTypes;
|
|
1210
|
+
(function(ValueTypes2) {
|
|
1211
|
+
ValueTypes2[ValueTypes2["Dict"] = 0] = "Dict";
|
|
1212
|
+
ValueTypes2[ValueTypes2["Array"] = 1] = "Array";
|
|
1213
|
+
ValueTypes2[ValueTypes2["Other"] = 2] = "Other";
|
|
1214
|
+
})(ValueTypes || (ValueTypes = {}));
|
|
1215
|
+
var getTypeOfValue = (v) => {
|
|
1216
|
+
if (Array.isArray(v))
|
|
1217
|
+
return 1;
|
|
1218
|
+
if (isPlainObject_default(v))
|
|
1219
|
+
return 0;
|
|
1220
|
+
return 2;
|
|
1221
|
+
};
|
|
1222
|
+
var getKeyOfValue = (v, key, vType = getTypeOfValue(v)) => {
|
|
1223
|
+
if (vType === 0 && typeof key === "string") {
|
|
1224
|
+
return v[key];
|
|
1225
|
+
} else if (vType === 1 && isValidArrayIndex(key)) {
|
|
1226
|
+
return v[key];
|
|
1227
|
+
} else {
|
|
1228
|
+
return void 0;
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
var isValidArrayIndex = (key) => {
|
|
1232
|
+
const inNumber = typeof key === "number" ? key : parseInt(key, 10);
|
|
1233
|
+
return !isNaN(inNumber) && inNumber >= 0 && inNumber < Infinity && (inNumber | 0) === inNumber;
|
|
1234
|
+
};
|
|
1235
|
+
var Scope = class {
|
|
1236
|
+
constructor(_parent, _path) {
|
|
1237
|
+
this._parent = _parent;
|
|
1238
|
+
this._path = _path;
|
|
1239
|
+
this.children = new Map();
|
|
1240
|
+
this.identityChangeListeners = new Set();
|
|
1241
|
+
}
|
|
1242
|
+
addIdentityChangeListener(cb) {
|
|
1243
|
+
this.identityChangeListeners.add(cb);
|
|
1244
|
+
}
|
|
1245
|
+
removeIdentityChangeListener(cb) {
|
|
1246
|
+
this.identityChangeListeners.delete(cb);
|
|
1247
|
+
this._checkForGC();
|
|
1248
|
+
}
|
|
1249
|
+
removeChild(key) {
|
|
1250
|
+
this.children.delete(key);
|
|
1251
|
+
this._checkForGC();
|
|
1252
|
+
}
|
|
1253
|
+
getChild(key) {
|
|
1254
|
+
return this.children.get(key);
|
|
1255
|
+
}
|
|
1256
|
+
getOrCreateChild(key) {
|
|
1257
|
+
let child = this.children.get(key);
|
|
1258
|
+
if (!child) {
|
|
1259
|
+
child = child = new Scope(this, this._path.concat([key]));
|
|
1260
|
+
this.children.set(key, child);
|
|
1261
|
+
}
|
|
1262
|
+
return child;
|
|
1263
|
+
}
|
|
1264
|
+
_checkForGC() {
|
|
1265
|
+
if (this.identityChangeListeners.size > 0)
|
|
1266
|
+
return;
|
|
1267
|
+
if (this.children.size > 0)
|
|
1268
|
+
return;
|
|
1269
|
+
if (this._parent) {
|
|
1270
|
+
this._parent.removeChild(last_default(this._path));
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
var Atom = class {
|
|
1275
|
+
constructor(initialState) {
|
|
1276
|
+
this.$$isPointerToPrismProvider = true;
|
|
1277
|
+
this.pointer = pointer_default({ root: this, path: [] });
|
|
1278
|
+
this.prism = this.pointerToPrism(this.pointer);
|
|
1279
|
+
this._onPointerValueChange = (pointer2, cb) => {
|
|
1280
|
+
const { path } = getPointerParts(pointer2);
|
|
1281
|
+
const scope2 = this._getOrCreateScopeForPath(path);
|
|
1282
|
+
scope2.identityChangeListeners.add(cb);
|
|
1283
|
+
const unsubscribe = () => {
|
|
1284
|
+
scope2.identityChangeListeners.delete(cb);
|
|
1285
|
+
};
|
|
1286
|
+
return unsubscribe;
|
|
1287
|
+
};
|
|
1288
|
+
this._currentState = initialState;
|
|
1289
|
+
this._rootScope = new Scope(void 0, []);
|
|
1290
|
+
}
|
|
1291
|
+
set(newState) {
|
|
1292
|
+
const oldState = this._currentState;
|
|
1293
|
+
this._currentState = newState;
|
|
1294
|
+
this._checkUpdates(this._rootScope, oldState, newState);
|
|
1295
|
+
}
|
|
1296
|
+
get() {
|
|
1297
|
+
return this._currentState;
|
|
1298
|
+
}
|
|
1299
|
+
getByPointer(pointerOrFn) {
|
|
1300
|
+
const pointer2 = isPointer(pointerOrFn) ? pointerOrFn : pointerOrFn(this.pointer);
|
|
1301
|
+
const path = getPointerParts(pointer2).path;
|
|
1302
|
+
return this._getIn(path);
|
|
1303
|
+
}
|
|
1304
|
+
_getIn(path) {
|
|
1305
|
+
return path.length === 0 ? this.get() : get_default(this.get(), path);
|
|
1306
|
+
}
|
|
1307
|
+
reduce(fn) {
|
|
1308
|
+
this.set(fn(this.get()));
|
|
1309
|
+
}
|
|
1310
|
+
reduceByPointer(pointerOrFn, reducer) {
|
|
1311
|
+
const pointer2 = isPointer(pointerOrFn) ? pointerOrFn : pointerOrFn(this.pointer);
|
|
1312
|
+
const path = getPointerParts(pointer2).path;
|
|
1313
|
+
const newState = updateDeep(this.get(), path, reducer);
|
|
1314
|
+
this.set(newState);
|
|
1315
|
+
}
|
|
1316
|
+
setByPointer(pointerOrFn, val2) {
|
|
1317
|
+
this.reduceByPointer(pointerOrFn, () => val2);
|
|
1318
|
+
}
|
|
1319
|
+
_checkUpdates(scope2, oldState, newState) {
|
|
1320
|
+
if (oldState === newState)
|
|
1321
|
+
return;
|
|
1322
|
+
for (const cb of scope2.identityChangeListeners) {
|
|
1323
|
+
cb(newState);
|
|
1324
|
+
}
|
|
1325
|
+
if (scope2.children.size === 0)
|
|
1326
|
+
return;
|
|
1327
|
+
const oldValueType = getTypeOfValue(oldState);
|
|
1328
|
+
const newValueType = getTypeOfValue(newState);
|
|
1329
|
+
if (oldValueType === 2 && oldValueType === newValueType)
|
|
1330
|
+
return;
|
|
1331
|
+
for (const [childKey, childScope] of scope2.children) {
|
|
1332
|
+
const oldChildVal = getKeyOfValue(oldState, childKey, oldValueType);
|
|
1333
|
+
const newChildVal = getKeyOfValue(newState, childKey, newValueType);
|
|
1334
|
+
this._checkUpdates(childScope, oldChildVal, newChildVal);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
_getOrCreateScopeForPath(path) {
|
|
1338
|
+
let curScope = this._rootScope;
|
|
1339
|
+
for (const pathEl of path) {
|
|
1340
|
+
curScope = curScope.getOrCreateChild(pathEl);
|
|
1341
|
+
}
|
|
1342
|
+
return curScope;
|
|
1343
|
+
}
|
|
1344
|
+
pointerToPrism(pointer2) {
|
|
1345
|
+
const { path } = getPointerParts(pointer2);
|
|
1346
|
+
const subscribe = (listener) => this._onPointerValueChange(pointer2, listener);
|
|
1347
|
+
const getValue2 = () => this._getIn(path);
|
|
1348
|
+
return prism_default(() => {
|
|
1349
|
+
return prism_default.source(subscribe, getValue2);
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
// src/pointerToPrism.ts
|
|
1355
|
+
var identifyPrismWeakMap = new WeakMap();
|
|
1356
|
+
function isPointerToPrismProvider(val2) {
|
|
1357
|
+
return typeof val2 === "object" && val2 !== null && val2["$$isPointerToPrismProvider"] === true;
|
|
1358
|
+
}
|
|
1359
|
+
var pointerToPrism = (pointer2) => {
|
|
1360
|
+
const meta = getPointerMeta(pointer2);
|
|
1361
|
+
let prismInstance = identifyPrismWeakMap.get(meta);
|
|
1362
|
+
if (!prismInstance) {
|
|
1363
|
+
const root2 = meta.root;
|
|
1364
|
+
if (!isPointerToPrismProvider(root2)) {
|
|
1365
|
+
throw new Error(`Cannot run pointerToPrism() on a pointer whose root is not an PointerToPrismProvider`);
|
|
1366
|
+
}
|
|
1367
|
+
prismInstance = root2.pointerToPrism(pointer2);
|
|
1368
|
+
identifyPrismWeakMap.set(meta, prismInstance);
|
|
1369
|
+
}
|
|
1370
|
+
return prismInstance;
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
// src/val.ts
|
|
1374
|
+
var val = (input) => {
|
|
1375
|
+
if (isPointer(input)) {
|
|
1376
|
+
return pointerToPrism(input).getValue();
|
|
1377
|
+
} else if (isPrism(input)) {
|
|
1378
|
+
return input.getValue();
|
|
1379
|
+
} else {
|
|
1380
|
+
return input;
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
// src/prism/iterateAndCountTicks.ts
|
|
1385
|
+
function* iterateAndCountTicks(pointerOrPrism) {
|
|
1386
|
+
let d;
|
|
1387
|
+
if (isPointer(pointerOrPrism)) {
|
|
1388
|
+
d = pointerToPrism(pointerOrPrism);
|
|
1389
|
+
} else if (isPrism(pointerOrPrism)) {
|
|
1390
|
+
d = pointerOrPrism;
|
|
1391
|
+
} else {
|
|
1392
|
+
throw new Error(`Only pointers and prisms are supported`);
|
|
1393
|
+
}
|
|
1394
|
+
let ticksCountedSinceLastYield = 0;
|
|
1395
|
+
const untap = d.onStale(() => {
|
|
1396
|
+
ticksCountedSinceLastYield++;
|
|
1397
|
+
});
|
|
1398
|
+
try {
|
|
1399
|
+
while (true) {
|
|
1400
|
+
const ticks = ticksCountedSinceLastYield;
|
|
1401
|
+
ticksCountedSinceLastYield = 0;
|
|
1402
|
+
yield { value: d.getValue(), ticks };
|
|
1403
|
+
}
|
|
1404
|
+
} finally {
|
|
1405
|
+
untap();
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// src/Ticker.ts
|
|
1410
|
+
var EMPTY_TICKS_BEFORE_GOING_DORMANT = 60 * 3;
|
|
1411
|
+
var Ticker = class {
|
|
1412
|
+
constructor(_conf) {
|
|
1413
|
+
this._conf = _conf;
|
|
1414
|
+
this._ticking = false;
|
|
1415
|
+
this._dormant = true;
|
|
1416
|
+
this._numberOfDormantTicks = 0;
|
|
1417
|
+
this.__ticks = 0;
|
|
1418
|
+
this._scheduledForThisOrNextTick = new Set();
|
|
1419
|
+
this._scheduledForNextTick = new Set();
|
|
1420
|
+
this._timeAtCurrentTick = 0;
|
|
1421
|
+
}
|
|
1422
|
+
get dormant() {
|
|
1423
|
+
return this._dormant;
|
|
1424
|
+
}
|
|
1425
|
+
onThisOrNextTick(fn) {
|
|
1426
|
+
this._scheduledForThisOrNextTick.add(fn);
|
|
1427
|
+
if (this._dormant) {
|
|
1428
|
+
this._goActive();
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
onNextTick(fn) {
|
|
1432
|
+
this._scheduledForNextTick.add(fn);
|
|
1433
|
+
if (this._dormant) {
|
|
1434
|
+
this._goActive();
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
offThisOrNextTick(fn) {
|
|
1438
|
+
this._scheduledForThisOrNextTick.delete(fn);
|
|
1439
|
+
}
|
|
1440
|
+
offNextTick(fn) {
|
|
1441
|
+
this._scheduledForNextTick.delete(fn);
|
|
1442
|
+
}
|
|
1443
|
+
get time() {
|
|
1444
|
+
if (this._ticking) {
|
|
1445
|
+
return this._timeAtCurrentTick;
|
|
1446
|
+
} else
|
|
1447
|
+
return performance.now();
|
|
1448
|
+
}
|
|
1449
|
+
_goActive() {
|
|
1450
|
+
var _a, _b;
|
|
1451
|
+
if (!this._dormant)
|
|
1452
|
+
return;
|
|
1453
|
+
this._dormant = false;
|
|
1454
|
+
(_b = (_a = this._conf) == null ? void 0 : _a.onActive) == null ? void 0 : _b.call(_a);
|
|
1455
|
+
}
|
|
1456
|
+
_goDormant() {
|
|
1457
|
+
var _a, _b;
|
|
1458
|
+
if (this._dormant)
|
|
1459
|
+
return;
|
|
1460
|
+
this._dormant = true;
|
|
1461
|
+
this._numberOfDormantTicks = 0;
|
|
1462
|
+
(_b = (_a = this._conf) == null ? void 0 : _a.onDormant) == null ? void 0 : _b.call(_a);
|
|
1463
|
+
}
|
|
1464
|
+
tick(t = performance.now()) {
|
|
1465
|
+
if (process.env.NODE_ENV === "development") {
|
|
1466
|
+
if (!(this instanceof Ticker)) {
|
|
1467
|
+
throw new Error('ticker.tick must be called while bound to the ticker. As in, "ticker.tick(time)" or "requestAnimationFrame((t) => ticker.tick(t))" for performance.');
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
this.__ticks++;
|
|
1471
|
+
if (!this._dormant) {
|
|
1472
|
+
if (this._scheduledForNextTick.size === 0 && this._scheduledForThisOrNextTick.size === 0) {
|
|
1473
|
+
this._numberOfDormantTicks++;
|
|
1474
|
+
if (this._numberOfDormantTicks >= EMPTY_TICKS_BEFORE_GOING_DORMANT) {
|
|
1475
|
+
this._goDormant();
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
this._ticking = true;
|
|
1481
|
+
this._timeAtCurrentTick = t;
|
|
1482
|
+
for (const v of this._scheduledForNextTick) {
|
|
1483
|
+
this._scheduledForThisOrNextTick.add(v);
|
|
1484
|
+
}
|
|
1485
|
+
this._scheduledForNextTick.clear();
|
|
1486
|
+
this._tick(0);
|
|
1487
|
+
this._ticking = false;
|
|
1488
|
+
}
|
|
1489
|
+
_tick(iterationNumber) {
|
|
1490
|
+
const time = this.time;
|
|
1491
|
+
if (iterationNumber > 10) {
|
|
1492
|
+
console.warn("_tick() recursing for 10 times");
|
|
1493
|
+
}
|
|
1494
|
+
if (iterationNumber > 100) {
|
|
1495
|
+
throw new Error(`Maximum recursion limit for _tick()`);
|
|
1496
|
+
}
|
|
1497
|
+
const oldSet = this._scheduledForThisOrNextTick;
|
|
1498
|
+
this._scheduledForThisOrNextTick = new Set();
|
|
1499
|
+
for (const fn of oldSet) {
|
|
1500
|
+
fn(time);
|
|
1501
|
+
}
|
|
1502
|
+
if (this._scheduledForThisOrNextTick.size > 0) {
|
|
1503
|
+
return this._tick(iterationNumber + 1);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
// src/prism/iterateOver.ts
|
|
1509
|
+
function* iterateOver(pointerOrPrism) {
|
|
1510
|
+
let d;
|
|
1511
|
+
if (isPointer(pointerOrPrism)) {
|
|
1512
|
+
d = pointerToPrism(pointerOrPrism);
|
|
1513
|
+
} else if (isPrism(pointerOrPrism)) {
|
|
1514
|
+
d = pointerOrPrism;
|
|
1515
|
+
} else {
|
|
1516
|
+
throw new Error(`Only pointers and prisms are supported`);
|
|
1517
|
+
}
|
|
1518
|
+
const ticker = new Ticker();
|
|
1519
|
+
const untap = d.onChange(ticker, (v) => {
|
|
1520
|
+
});
|
|
1521
|
+
try {
|
|
1522
|
+
while (true) {
|
|
1523
|
+
ticker.tick();
|
|
1524
|
+
yield d.getValue();
|
|
1525
|
+
}
|
|
1526
|
+
} finally {
|
|
1527
|
+
untap();
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// src/PointerProxy.ts
|
|
1532
|
+
var PointerProxy = class {
|
|
1533
|
+
constructor(currentPointer) {
|
|
1534
|
+
this.$$isPointerToPrismProvider = true;
|
|
1535
|
+
this._currentPointerBox = new Atom(currentPointer);
|
|
1536
|
+
this.pointer = pointer_default({ root: this, path: [] });
|
|
1537
|
+
}
|
|
1538
|
+
setPointer(p) {
|
|
1539
|
+
this._currentPointerBox.set(p);
|
|
1540
|
+
}
|
|
1541
|
+
pointerToPrism(pointer2) {
|
|
1542
|
+
const { path } = getPointerMeta(pointer2);
|
|
1543
|
+
return prism_default(() => {
|
|
1544
|
+
const currentPointer = this._currentPointerBox.prism.getValue();
|
|
1545
|
+
const subPointer = path.reduce((pointerSoFar, pathItem) => pointerSoFar[pathItem], currentPointer);
|
|
1546
|
+
return val(subPointer);
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
export {
|
|
1551
|
+
Atom,
|
|
1552
|
+
PointerProxy,
|
|
1553
|
+
Ticker,
|
|
1554
|
+
getPointerParts,
|
|
1555
|
+
isPointer,
|
|
1556
|
+
isPrism,
|
|
1557
|
+
iterateAndCountTicks,
|
|
1558
|
+
iterateOver,
|
|
1559
|
+
pointer_default as pointer,
|
|
1560
|
+
pointerToPrism,
|
|
1561
|
+
prism_default as prism,
|
|
1562
|
+
val
|
|
1563
|
+
};
|
|
1564
|
+
//# sourceMappingURL=index.mjs.map
|