@tomorrowevening/theatric 1.0.8
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/LICENSE +203 -0
- package/README.md +294 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1792 -0
- package/dist/index.js.map +7 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +50 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1792 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
__markAsModule(target);
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __reExport = (target, module2, desc) => {
|
|
28
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(module2))
|
|
30
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
31
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __toModule = (module2) => {
|
|
36
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/index.ts
|
|
40
|
+
__export(exports, {
|
|
41
|
+
button: () => button,
|
|
42
|
+
getAssetUrl: () => getAssetUrl,
|
|
43
|
+
initialize: () => initialize,
|
|
44
|
+
types: () => import_theatre_core3.types,
|
|
45
|
+
useControls: () => useControls
|
|
46
|
+
});
|
|
47
|
+
var import_theatre_core = __toModule(require("@tomorrowevening/theatre-core"));
|
|
48
|
+
var import_theatre_core2 = __toModule(require("@tomorrowevening/theatre-core"));
|
|
49
|
+
|
|
50
|
+
// ../../node_modules/lodash-es/isArray.js
|
|
51
|
+
var isArray = Array.isArray;
|
|
52
|
+
var isArray_default = isArray;
|
|
53
|
+
|
|
54
|
+
// ../../node_modules/lodash-es/_freeGlobal.js
|
|
55
|
+
var freeGlobal = typeof window == "object" && window && window.Object === Object && window;
|
|
56
|
+
var freeGlobal_default = freeGlobal;
|
|
57
|
+
|
|
58
|
+
// ../../node_modules/lodash-es/_root.js
|
|
59
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
60
|
+
var root = freeGlobal_default || freeSelf || Function("return this")();
|
|
61
|
+
var root_default = root;
|
|
62
|
+
|
|
63
|
+
// ../../node_modules/lodash-es/_Symbol.js
|
|
64
|
+
var Symbol2 = root_default.Symbol;
|
|
65
|
+
var Symbol_default = Symbol2;
|
|
66
|
+
|
|
67
|
+
// ../../node_modules/lodash-es/_getRawTag.js
|
|
68
|
+
var objectProto = Object.prototype;
|
|
69
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
70
|
+
var nativeObjectToString = objectProto.toString;
|
|
71
|
+
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
72
|
+
function getRawTag(value) {
|
|
73
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
74
|
+
try {
|
|
75
|
+
value[symToStringTag] = void 0;
|
|
76
|
+
var unmasked = true;
|
|
77
|
+
} catch (e) {
|
|
78
|
+
}
|
|
79
|
+
var result = nativeObjectToString.call(value);
|
|
80
|
+
if (unmasked) {
|
|
81
|
+
if (isOwn) {
|
|
82
|
+
value[symToStringTag] = tag;
|
|
83
|
+
} else {
|
|
84
|
+
delete value[symToStringTag];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
var getRawTag_default = getRawTag;
|
|
90
|
+
|
|
91
|
+
// ../../node_modules/lodash-es/_objectToString.js
|
|
92
|
+
var objectProto2 = Object.prototype;
|
|
93
|
+
var nativeObjectToString2 = objectProto2.toString;
|
|
94
|
+
function objectToString(value) {
|
|
95
|
+
return nativeObjectToString2.call(value);
|
|
96
|
+
}
|
|
97
|
+
var objectToString_default = objectToString;
|
|
98
|
+
|
|
99
|
+
// ../../node_modules/lodash-es/_baseGetTag.js
|
|
100
|
+
var nullTag = "[object Null]";
|
|
101
|
+
var undefinedTag = "[object Undefined]";
|
|
102
|
+
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
103
|
+
function baseGetTag(value) {
|
|
104
|
+
if (value == null) {
|
|
105
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
106
|
+
}
|
|
107
|
+
return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
|
|
108
|
+
}
|
|
109
|
+
var baseGetTag_default = baseGetTag;
|
|
110
|
+
|
|
111
|
+
// ../../node_modules/lodash-es/isObjectLike.js
|
|
112
|
+
function isObjectLike(value) {
|
|
113
|
+
return value != null && typeof value == "object";
|
|
114
|
+
}
|
|
115
|
+
var isObjectLike_default = isObjectLike;
|
|
116
|
+
|
|
117
|
+
// ../../node_modules/lodash-es/isObject.js
|
|
118
|
+
function isObject(value) {
|
|
119
|
+
var type = typeof value;
|
|
120
|
+
return value != null && (type == "object" || type == "function");
|
|
121
|
+
}
|
|
122
|
+
var isObject_default = isObject;
|
|
123
|
+
|
|
124
|
+
// ../../node_modules/lodash-es/isFunction.js
|
|
125
|
+
var asyncTag = "[object AsyncFunction]";
|
|
126
|
+
var funcTag = "[object Function]";
|
|
127
|
+
var genTag = "[object GeneratorFunction]";
|
|
128
|
+
var proxyTag = "[object Proxy]";
|
|
129
|
+
function isFunction(value) {
|
|
130
|
+
if (!isObject_default(value)) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
var tag = baseGetTag_default(value);
|
|
134
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
135
|
+
}
|
|
136
|
+
var isFunction_default = isFunction;
|
|
137
|
+
|
|
138
|
+
// ../../node_modules/lodash-es/_coreJsData.js
|
|
139
|
+
var coreJsData = root_default["__core-js_shared__"];
|
|
140
|
+
var coreJsData_default = coreJsData;
|
|
141
|
+
|
|
142
|
+
// ../../node_modules/lodash-es/_isMasked.js
|
|
143
|
+
var maskSrcKey = function() {
|
|
144
|
+
var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
|
|
145
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
146
|
+
}();
|
|
147
|
+
function isMasked(func) {
|
|
148
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
149
|
+
}
|
|
150
|
+
var isMasked_default = isMasked;
|
|
151
|
+
|
|
152
|
+
// ../../node_modules/lodash-es/_toSource.js
|
|
153
|
+
var funcProto = Function.prototype;
|
|
154
|
+
var funcToString = funcProto.toString;
|
|
155
|
+
function toSource(func) {
|
|
156
|
+
if (func != null) {
|
|
157
|
+
try {
|
|
158
|
+
return funcToString.call(func);
|
|
159
|
+
} catch (e) {
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
return func + "";
|
|
163
|
+
} catch (e) {
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return "";
|
|
167
|
+
}
|
|
168
|
+
var toSource_default = toSource;
|
|
169
|
+
|
|
170
|
+
// ../../node_modules/lodash-es/_baseIsNative.js
|
|
171
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
172
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
173
|
+
var funcProto2 = Function.prototype;
|
|
174
|
+
var objectProto3 = Object.prototype;
|
|
175
|
+
var funcToString2 = funcProto2.toString;
|
|
176
|
+
var hasOwnProperty2 = objectProto3.hasOwnProperty;
|
|
177
|
+
var reIsNative = RegExp("^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
178
|
+
function baseIsNative(value) {
|
|
179
|
+
if (!isObject_default(value) || isMasked_default(value)) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
|
|
183
|
+
return pattern.test(toSource_default(value));
|
|
184
|
+
}
|
|
185
|
+
var baseIsNative_default = baseIsNative;
|
|
186
|
+
|
|
187
|
+
// ../../node_modules/lodash-es/_getValue.js
|
|
188
|
+
function getValue(object, key) {
|
|
189
|
+
return object == null ? void 0 : object[key];
|
|
190
|
+
}
|
|
191
|
+
var getValue_default = getValue;
|
|
192
|
+
|
|
193
|
+
// ../../node_modules/lodash-es/_getNative.js
|
|
194
|
+
function getNative(object, key) {
|
|
195
|
+
var value = getValue_default(object, key);
|
|
196
|
+
return baseIsNative_default(value) ? value : void 0;
|
|
197
|
+
}
|
|
198
|
+
var getNative_default = getNative;
|
|
199
|
+
|
|
200
|
+
// ../../node_modules/lodash-es/_nativeCreate.js
|
|
201
|
+
var nativeCreate = getNative_default(Object, "create");
|
|
202
|
+
var nativeCreate_default = nativeCreate;
|
|
203
|
+
|
|
204
|
+
// ../../node_modules/lodash-es/_hashClear.js
|
|
205
|
+
function hashClear() {
|
|
206
|
+
this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
|
|
207
|
+
this.size = 0;
|
|
208
|
+
}
|
|
209
|
+
var hashClear_default = hashClear;
|
|
210
|
+
|
|
211
|
+
// ../../node_modules/lodash-es/_hashDelete.js
|
|
212
|
+
function hashDelete(key) {
|
|
213
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
214
|
+
this.size -= result ? 1 : 0;
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
var hashDelete_default = hashDelete;
|
|
218
|
+
|
|
219
|
+
// ../../node_modules/lodash-es/_hashGet.js
|
|
220
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
221
|
+
var objectProto4 = Object.prototype;
|
|
222
|
+
var hasOwnProperty3 = objectProto4.hasOwnProperty;
|
|
223
|
+
function hashGet(key) {
|
|
224
|
+
var data = this.__data__;
|
|
225
|
+
if (nativeCreate_default) {
|
|
226
|
+
var result = data[key];
|
|
227
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
|
228
|
+
}
|
|
229
|
+
return hasOwnProperty3.call(data, key) ? data[key] : void 0;
|
|
230
|
+
}
|
|
231
|
+
var hashGet_default = hashGet;
|
|
232
|
+
|
|
233
|
+
// ../../node_modules/lodash-es/_hashHas.js
|
|
234
|
+
var objectProto5 = Object.prototype;
|
|
235
|
+
var hasOwnProperty4 = objectProto5.hasOwnProperty;
|
|
236
|
+
function hashHas(key) {
|
|
237
|
+
var data = this.__data__;
|
|
238
|
+
return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty4.call(data, key);
|
|
239
|
+
}
|
|
240
|
+
var hashHas_default = hashHas;
|
|
241
|
+
|
|
242
|
+
// ../../node_modules/lodash-es/_hashSet.js
|
|
243
|
+
var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
|
|
244
|
+
function hashSet(key, value) {
|
|
245
|
+
var data = this.__data__;
|
|
246
|
+
this.size += this.has(key) ? 0 : 1;
|
|
247
|
+
data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
|
|
248
|
+
return this;
|
|
249
|
+
}
|
|
250
|
+
var hashSet_default = hashSet;
|
|
251
|
+
|
|
252
|
+
// ../../node_modules/lodash-es/_Hash.js
|
|
253
|
+
function Hash(entries) {
|
|
254
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
255
|
+
this.clear();
|
|
256
|
+
while (++index < length) {
|
|
257
|
+
var entry = entries[index];
|
|
258
|
+
this.set(entry[0], entry[1]);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
Hash.prototype.clear = hashClear_default;
|
|
262
|
+
Hash.prototype["delete"] = hashDelete_default;
|
|
263
|
+
Hash.prototype.get = hashGet_default;
|
|
264
|
+
Hash.prototype.has = hashHas_default;
|
|
265
|
+
Hash.prototype.set = hashSet_default;
|
|
266
|
+
var Hash_default = Hash;
|
|
267
|
+
|
|
268
|
+
// ../../node_modules/lodash-es/_listCacheClear.js
|
|
269
|
+
function listCacheClear() {
|
|
270
|
+
this.__data__ = [];
|
|
271
|
+
this.size = 0;
|
|
272
|
+
}
|
|
273
|
+
var listCacheClear_default = listCacheClear;
|
|
274
|
+
|
|
275
|
+
// ../../node_modules/lodash-es/eq.js
|
|
276
|
+
function eq(value, other) {
|
|
277
|
+
return value === other || value !== value && other !== other;
|
|
278
|
+
}
|
|
279
|
+
var eq_default = eq;
|
|
280
|
+
|
|
281
|
+
// ../../node_modules/lodash-es/_assocIndexOf.js
|
|
282
|
+
function assocIndexOf(array, key) {
|
|
283
|
+
var length = array.length;
|
|
284
|
+
while (length--) {
|
|
285
|
+
if (eq_default(array[length][0], key)) {
|
|
286
|
+
return length;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return -1;
|
|
290
|
+
}
|
|
291
|
+
var assocIndexOf_default = assocIndexOf;
|
|
292
|
+
|
|
293
|
+
// ../../node_modules/lodash-es/_listCacheDelete.js
|
|
294
|
+
var arrayProto = Array.prototype;
|
|
295
|
+
var splice = arrayProto.splice;
|
|
296
|
+
function listCacheDelete(key) {
|
|
297
|
+
var data = this.__data__, index = assocIndexOf_default(data, key);
|
|
298
|
+
if (index < 0) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
var lastIndex = data.length - 1;
|
|
302
|
+
if (index == lastIndex) {
|
|
303
|
+
data.pop();
|
|
304
|
+
} else {
|
|
305
|
+
splice.call(data, index, 1);
|
|
306
|
+
}
|
|
307
|
+
--this.size;
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
var listCacheDelete_default = listCacheDelete;
|
|
311
|
+
|
|
312
|
+
// ../../node_modules/lodash-es/_listCacheGet.js
|
|
313
|
+
function listCacheGet(key) {
|
|
314
|
+
var data = this.__data__, index = assocIndexOf_default(data, key);
|
|
315
|
+
return index < 0 ? void 0 : data[index][1];
|
|
316
|
+
}
|
|
317
|
+
var listCacheGet_default = listCacheGet;
|
|
318
|
+
|
|
319
|
+
// ../../node_modules/lodash-es/_listCacheHas.js
|
|
320
|
+
function listCacheHas(key) {
|
|
321
|
+
return assocIndexOf_default(this.__data__, key) > -1;
|
|
322
|
+
}
|
|
323
|
+
var listCacheHas_default = listCacheHas;
|
|
324
|
+
|
|
325
|
+
// ../../node_modules/lodash-es/_listCacheSet.js
|
|
326
|
+
function listCacheSet(key, value) {
|
|
327
|
+
var data = this.__data__, index = assocIndexOf_default(data, key);
|
|
328
|
+
if (index < 0) {
|
|
329
|
+
++this.size;
|
|
330
|
+
data.push([key, value]);
|
|
331
|
+
} else {
|
|
332
|
+
data[index][1] = value;
|
|
333
|
+
}
|
|
334
|
+
return this;
|
|
335
|
+
}
|
|
336
|
+
var listCacheSet_default = listCacheSet;
|
|
337
|
+
|
|
338
|
+
// ../../node_modules/lodash-es/_ListCache.js
|
|
339
|
+
function ListCache(entries) {
|
|
340
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
341
|
+
this.clear();
|
|
342
|
+
while (++index < length) {
|
|
343
|
+
var entry = entries[index];
|
|
344
|
+
this.set(entry[0], entry[1]);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
ListCache.prototype.clear = listCacheClear_default;
|
|
348
|
+
ListCache.prototype["delete"] = listCacheDelete_default;
|
|
349
|
+
ListCache.prototype.get = listCacheGet_default;
|
|
350
|
+
ListCache.prototype.has = listCacheHas_default;
|
|
351
|
+
ListCache.prototype.set = listCacheSet_default;
|
|
352
|
+
var ListCache_default = ListCache;
|
|
353
|
+
|
|
354
|
+
// ../../node_modules/lodash-es/_Map.js
|
|
355
|
+
var Map2 = getNative_default(root_default, "Map");
|
|
356
|
+
var Map_default = Map2;
|
|
357
|
+
|
|
358
|
+
// ../../node_modules/lodash-es/_mapCacheClear.js
|
|
359
|
+
function mapCacheClear() {
|
|
360
|
+
this.size = 0;
|
|
361
|
+
this.__data__ = {
|
|
362
|
+
"hash": new Hash_default(),
|
|
363
|
+
"map": new (Map_default || ListCache_default)(),
|
|
364
|
+
"string": new Hash_default()
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
var mapCacheClear_default = mapCacheClear;
|
|
368
|
+
|
|
369
|
+
// ../../node_modules/lodash-es/_isKeyable.js
|
|
370
|
+
function isKeyable(value) {
|
|
371
|
+
var type = typeof value;
|
|
372
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
373
|
+
}
|
|
374
|
+
var isKeyable_default = isKeyable;
|
|
375
|
+
|
|
376
|
+
// ../../node_modules/lodash-es/_getMapData.js
|
|
377
|
+
function getMapData(map, key) {
|
|
378
|
+
var data = map.__data__;
|
|
379
|
+
return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
380
|
+
}
|
|
381
|
+
var getMapData_default = getMapData;
|
|
382
|
+
|
|
383
|
+
// ../../node_modules/lodash-es/_mapCacheDelete.js
|
|
384
|
+
function mapCacheDelete(key) {
|
|
385
|
+
var result = getMapData_default(this, key)["delete"](key);
|
|
386
|
+
this.size -= result ? 1 : 0;
|
|
387
|
+
return result;
|
|
388
|
+
}
|
|
389
|
+
var mapCacheDelete_default = mapCacheDelete;
|
|
390
|
+
|
|
391
|
+
// ../../node_modules/lodash-es/_mapCacheGet.js
|
|
392
|
+
function mapCacheGet(key) {
|
|
393
|
+
return getMapData_default(this, key).get(key);
|
|
394
|
+
}
|
|
395
|
+
var mapCacheGet_default = mapCacheGet;
|
|
396
|
+
|
|
397
|
+
// ../../node_modules/lodash-es/_mapCacheHas.js
|
|
398
|
+
function mapCacheHas(key) {
|
|
399
|
+
return getMapData_default(this, key).has(key);
|
|
400
|
+
}
|
|
401
|
+
var mapCacheHas_default = mapCacheHas;
|
|
402
|
+
|
|
403
|
+
// ../../node_modules/lodash-es/_mapCacheSet.js
|
|
404
|
+
function mapCacheSet(key, value) {
|
|
405
|
+
var data = getMapData_default(this, key), size = data.size;
|
|
406
|
+
data.set(key, value);
|
|
407
|
+
this.size += data.size == size ? 0 : 1;
|
|
408
|
+
return this;
|
|
409
|
+
}
|
|
410
|
+
var mapCacheSet_default = mapCacheSet;
|
|
411
|
+
|
|
412
|
+
// ../../node_modules/lodash-es/_MapCache.js
|
|
413
|
+
function MapCache(entries) {
|
|
414
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
415
|
+
this.clear();
|
|
416
|
+
while (++index < length) {
|
|
417
|
+
var entry = entries[index];
|
|
418
|
+
this.set(entry[0], entry[1]);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
MapCache.prototype.clear = mapCacheClear_default;
|
|
422
|
+
MapCache.prototype["delete"] = mapCacheDelete_default;
|
|
423
|
+
MapCache.prototype.get = mapCacheGet_default;
|
|
424
|
+
MapCache.prototype.has = mapCacheHas_default;
|
|
425
|
+
MapCache.prototype.set = mapCacheSet_default;
|
|
426
|
+
var MapCache_default = MapCache;
|
|
427
|
+
|
|
428
|
+
// ../../node_modules/lodash-es/_overArg.js
|
|
429
|
+
function overArg(func, transform) {
|
|
430
|
+
return function(arg) {
|
|
431
|
+
return func(transform(arg));
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
var overArg_default = overArg;
|
|
435
|
+
|
|
436
|
+
// ../dataverse/src/pointer.ts
|
|
437
|
+
var pointerMetaWeakMap = new WeakMap();
|
|
438
|
+
var cachedSubPathPointersWeakMap = new WeakMap();
|
|
439
|
+
var pointerMetaSymbol = Symbol("pointerMeta");
|
|
440
|
+
var getPointerMeta = (p) => {
|
|
441
|
+
const meta = p[pointerMetaSymbol];
|
|
442
|
+
return meta;
|
|
443
|
+
};
|
|
444
|
+
var isPointer = (p) => {
|
|
445
|
+
return p && !!getPointerMeta(p);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
// ../dataverse/src/utils/Stack.ts
|
|
449
|
+
var Stack = class {
|
|
450
|
+
constructor() {
|
|
451
|
+
this._head = void 0;
|
|
452
|
+
}
|
|
453
|
+
peek() {
|
|
454
|
+
return this._head && this._head.data;
|
|
455
|
+
}
|
|
456
|
+
pop() {
|
|
457
|
+
const head = this._head;
|
|
458
|
+
if (!head) {
|
|
459
|
+
return void 0;
|
|
460
|
+
}
|
|
461
|
+
this._head = head.next;
|
|
462
|
+
return head.data;
|
|
463
|
+
}
|
|
464
|
+
push(data) {
|
|
465
|
+
const node = { next: this._head, data };
|
|
466
|
+
this._head = node;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// ../dataverse/src/prism/discoveryMechanism.ts
|
|
471
|
+
function createMechanism() {
|
|
472
|
+
const noop = () => {
|
|
473
|
+
};
|
|
474
|
+
const stack = new Stack();
|
|
475
|
+
const noopCollector = noop;
|
|
476
|
+
const pushCollector2 = (collector) => {
|
|
477
|
+
stack.push(collector);
|
|
478
|
+
};
|
|
479
|
+
const popCollector2 = (collector) => {
|
|
480
|
+
const existing = stack.peek();
|
|
481
|
+
if (existing !== collector) {
|
|
482
|
+
throw new Error(`Popped collector is not on top of the stack`);
|
|
483
|
+
}
|
|
484
|
+
stack.pop();
|
|
485
|
+
};
|
|
486
|
+
const startIgnoringDependencies2 = () => {
|
|
487
|
+
stack.push(noopCollector);
|
|
488
|
+
};
|
|
489
|
+
const stopIgnoringDependencies2 = () => {
|
|
490
|
+
if (stack.peek() !== noopCollector) {
|
|
491
|
+
if (process.env.NODE_ENV === "development") {
|
|
492
|
+
console.warn("This should never happen");
|
|
493
|
+
}
|
|
494
|
+
} else {
|
|
495
|
+
stack.pop();
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
const reportResolutionStart2 = (d) => {
|
|
499
|
+
const possibleCollector = stack.peek();
|
|
500
|
+
if (possibleCollector) {
|
|
501
|
+
possibleCollector(d);
|
|
502
|
+
}
|
|
503
|
+
stack.push(noopCollector);
|
|
504
|
+
};
|
|
505
|
+
const reportResolutionEnd2 = (_d) => {
|
|
506
|
+
stack.pop();
|
|
507
|
+
};
|
|
508
|
+
return {
|
|
509
|
+
type: "Dataverse_discoveryMechanism",
|
|
510
|
+
startIgnoringDependencies: startIgnoringDependencies2,
|
|
511
|
+
stopIgnoringDependencies: stopIgnoringDependencies2,
|
|
512
|
+
reportResolutionStart: reportResolutionStart2,
|
|
513
|
+
reportResolutionEnd: reportResolutionEnd2,
|
|
514
|
+
pushCollector: pushCollector2,
|
|
515
|
+
popCollector: popCollector2
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function getSharedMechanism() {
|
|
519
|
+
const varName = "__dataverse_discoveryMechanism_sharedStack";
|
|
520
|
+
const root2 = typeof window !== "undefined" ? window : typeof window !== "undefined" ? window : {};
|
|
521
|
+
if (root2) {
|
|
522
|
+
const existingMechanism = root2[varName];
|
|
523
|
+
if (existingMechanism && typeof existingMechanism === "object" && existingMechanism.type === "Dataverse_discoveryMechanism") {
|
|
524
|
+
return existingMechanism;
|
|
525
|
+
} else {
|
|
526
|
+
const mechanism = createMechanism();
|
|
527
|
+
root2[varName] = mechanism;
|
|
528
|
+
return mechanism;
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
531
|
+
return createMechanism();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
var {
|
|
535
|
+
startIgnoringDependencies,
|
|
536
|
+
stopIgnoringDependencies,
|
|
537
|
+
reportResolutionEnd,
|
|
538
|
+
reportResolutionStart,
|
|
539
|
+
pushCollector,
|
|
540
|
+
popCollector
|
|
541
|
+
} = getSharedMechanism();
|
|
542
|
+
|
|
543
|
+
// ../dataverse/src/prism/prism.ts
|
|
544
|
+
var voidFn = () => {
|
|
545
|
+
};
|
|
546
|
+
var HotHandle = class {
|
|
547
|
+
constructor(_fn, _prismInstance) {
|
|
548
|
+
this._fn = _fn;
|
|
549
|
+
this._prismInstance = _prismInstance;
|
|
550
|
+
this._didMarkDependentsAsStale = false;
|
|
551
|
+
this._isFresh = false;
|
|
552
|
+
this._cacheOfDendencyValues = new Map();
|
|
553
|
+
this._dependents = new Set();
|
|
554
|
+
this._dependencies = new Set();
|
|
555
|
+
this._possiblyStaleDeps = new Set();
|
|
556
|
+
this._scope = new HotScope(this);
|
|
557
|
+
this._lastValue = void 0;
|
|
558
|
+
this._forciblySetToStale = false;
|
|
559
|
+
this._reactToDependencyGoingStale = (which) => {
|
|
560
|
+
this._possiblyStaleDeps.add(which);
|
|
561
|
+
this._markAsStale();
|
|
562
|
+
};
|
|
563
|
+
for (const d of this._dependencies) {
|
|
564
|
+
d._addDependent(this._reactToDependencyGoingStale);
|
|
565
|
+
}
|
|
566
|
+
startIgnoringDependencies();
|
|
567
|
+
this.getValue();
|
|
568
|
+
stopIgnoringDependencies();
|
|
569
|
+
}
|
|
570
|
+
get hasDependents() {
|
|
571
|
+
return this._dependents.size > 0;
|
|
572
|
+
}
|
|
573
|
+
removeDependent(d) {
|
|
574
|
+
this._dependents.delete(d);
|
|
575
|
+
}
|
|
576
|
+
addDependent(d) {
|
|
577
|
+
this._dependents.add(d);
|
|
578
|
+
}
|
|
579
|
+
destroy() {
|
|
580
|
+
for (const d of this._dependencies) {
|
|
581
|
+
d._removeDependent(this._reactToDependencyGoingStale);
|
|
582
|
+
}
|
|
583
|
+
cleanupScopeStack(this._scope);
|
|
584
|
+
}
|
|
585
|
+
getValue() {
|
|
586
|
+
if (!this._isFresh) {
|
|
587
|
+
const newValue = this._recalculate();
|
|
588
|
+
this._lastValue = newValue;
|
|
589
|
+
this._isFresh = true;
|
|
590
|
+
this._didMarkDependentsAsStale = false;
|
|
591
|
+
this._forciblySetToStale = false;
|
|
592
|
+
}
|
|
593
|
+
return this._lastValue;
|
|
594
|
+
}
|
|
595
|
+
_recalculate() {
|
|
596
|
+
let value;
|
|
597
|
+
if (!this._forciblySetToStale) {
|
|
598
|
+
if (this._possiblyStaleDeps.size > 0) {
|
|
599
|
+
let anActuallyStaleDepWasFound = false;
|
|
600
|
+
startIgnoringDependencies();
|
|
601
|
+
for (const dep of this._possiblyStaleDeps) {
|
|
602
|
+
if (this._cacheOfDendencyValues.get(dep) !== dep.getValue()) {
|
|
603
|
+
anActuallyStaleDepWasFound = true;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
stopIgnoringDependencies();
|
|
608
|
+
this._possiblyStaleDeps.clear();
|
|
609
|
+
if (!anActuallyStaleDepWasFound) {
|
|
610
|
+
return this._lastValue;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
const newDeps = new Set();
|
|
615
|
+
this._cacheOfDendencyValues.clear();
|
|
616
|
+
const collector = (observedDep) => {
|
|
617
|
+
newDeps.add(observedDep);
|
|
618
|
+
this._addDependency(observedDep);
|
|
619
|
+
};
|
|
620
|
+
pushCollector(collector);
|
|
621
|
+
hookScopeStack.push(this._scope);
|
|
622
|
+
try {
|
|
623
|
+
value = this._fn();
|
|
624
|
+
} catch (error) {
|
|
625
|
+
console.error(error);
|
|
626
|
+
} finally {
|
|
627
|
+
const topOfTheStack = hookScopeStack.pop();
|
|
628
|
+
if (topOfTheStack !== this._scope) {
|
|
629
|
+
console.warn(`The Prism hook stack has slipped. This is a bug.`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
popCollector(collector);
|
|
633
|
+
for (const dep of this._dependencies) {
|
|
634
|
+
if (!newDeps.has(dep)) {
|
|
635
|
+
this._removeDependency(dep);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
this._dependencies = newDeps;
|
|
639
|
+
startIgnoringDependencies();
|
|
640
|
+
for (const dep of newDeps) {
|
|
641
|
+
this._cacheOfDendencyValues.set(dep, dep.getValue());
|
|
642
|
+
}
|
|
643
|
+
stopIgnoringDependencies();
|
|
644
|
+
return value;
|
|
645
|
+
}
|
|
646
|
+
forceStale() {
|
|
647
|
+
this._forciblySetToStale = true;
|
|
648
|
+
this._markAsStale();
|
|
649
|
+
}
|
|
650
|
+
_markAsStale() {
|
|
651
|
+
if (this._didMarkDependentsAsStale)
|
|
652
|
+
return;
|
|
653
|
+
this._didMarkDependentsAsStale = true;
|
|
654
|
+
this._isFresh = false;
|
|
655
|
+
for (const dependent of this._dependents) {
|
|
656
|
+
dependent(this._prismInstance);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
_addDependency(d) {
|
|
660
|
+
if (this._dependencies.has(d))
|
|
661
|
+
return;
|
|
662
|
+
this._dependencies.add(d);
|
|
663
|
+
d._addDependent(this._reactToDependencyGoingStale);
|
|
664
|
+
}
|
|
665
|
+
_removeDependency(d) {
|
|
666
|
+
if (!this._dependencies.has(d))
|
|
667
|
+
return;
|
|
668
|
+
this._dependencies.delete(d);
|
|
669
|
+
d._removeDependent(this._reactToDependencyGoingStale);
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
var emptyObject = {};
|
|
673
|
+
var PrismInstance = class {
|
|
674
|
+
constructor(_fn) {
|
|
675
|
+
this._fn = _fn;
|
|
676
|
+
this.isPrism = true;
|
|
677
|
+
this._state = {
|
|
678
|
+
hot: false,
|
|
679
|
+
handle: void 0
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
get isHot() {
|
|
683
|
+
return this._state.hot;
|
|
684
|
+
}
|
|
685
|
+
onChange(ticker, listener, immediate = false) {
|
|
686
|
+
const dependent = () => {
|
|
687
|
+
ticker.onThisOrNextTick(refresh);
|
|
688
|
+
};
|
|
689
|
+
let lastValue = emptyObject;
|
|
690
|
+
const refresh = () => {
|
|
691
|
+
const newValue = this.getValue();
|
|
692
|
+
if (newValue === lastValue)
|
|
693
|
+
return;
|
|
694
|
+
lastValue = newValue;
|
|
695
|
+
listener(newValue);
|
|
696
|
+
};
|
|
697
|
+
this._addDependent(dependent);
|
|
698
|
+
if (immediate) {
|
|
699
|
+
lastValue = this.getValue();
|
|
700
|
+
listener(lastValue);
|
|
701
|
+
}
|
|
702
|
+
const unsubscribe = () => {
|
|
703
|
+
this._removeDependent(dependent);
|
|
704
|
+
ticker.offThisOrNextTick(refresh);
|
|
705
|
+
ticker.offNextTick(refresh);
|
|
706
|
+
};
|
|
707
|
+
return unsubscribe;
|
|
708
|
+
}
|
|
709
|
+
onStale(callback) {
|
|
710
|
+
const untap = () => {
|
|
711
|
+
this._removeDependent(fn);
|
|
712
|
+
};
|
|
713
|
+
const fn = () => callback();
|
|
714
|
+
this._addDependent(fn);
|
|
715
|
+
return untap;
|
|
716
|
+
}
|
|
717
|
+
keepHot() {
|
|
718
|
+
return this.onStale(() => {
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
_addDependent(d) {
|
|
722
|
+
if (!this._state.hot) {
|
|
723
|
+
this._goHot();
|
|
724
|
+
}
|
|
725
|
+
this._state.handle.addDependent(d);
|
|
726
|
+
}
|
|
727
|
+
_goHot() {
|
|
728
|
+
const hotHandle = new HotHandle(this._fn, this);
|
|
729
|
+
this._state = {
|
|
730
|
+
hot: true,
|
|
731
|
+
handle: hotHandle
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
_removeDependent(d) {
|
|
735
|
+
const state2 = this._state;
|
|
736
|
+
if (!state2.hot) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const handle = state2.handle;
|
|
740
|
+
handle.removeDependent(d);
|
|
741
|
+
if (!handle.hasDependents) {
|
|
742
|
+
this._state = { hot: false, handle: void 0 };
|
|
743
|
+
handle.destroy();
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
getValue() {
|
|
747
|
+
reportResolutionStart(this);
|
|
748
|
+
const state2 = this._state;
|
|
749
|
+
let val3;
|
|
750
|
+
if (state2.hot) {
|
|
751
|
+
val3 = state2.handle.getValue();
|
|
752
|
+
} else {
|
|
753
|
+
val3 = calculateColdPrism(this._fn);
|
|
754
|
+
}
|
|
755
|
+
reportResolutionEnd(this);
|
|
756
|
+
return val3;
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
var HotScope = class {
|
|
760
|
+
constructor(_hotHandle) {
|
|
761
|
+
this._hotHandle = _hotHandle;
|
|
762
|
+
this._refs = new Map();
|
|
763
|
+
this.isPrismScope = true;
|
|
764
|
+
this.subs = {};
|
|
765
|
+
this.effects = new Map();
|
|
766
|
+
this.memos = new Map();
|
|
767
|
+
}
|
|
768
|
+
ref(key, initialValue) {
|
|
769
|
+
let ref2 = this._refs.get(key);
|
|
770
|
+
if (ref2 !== void 0) {
|
|
771
|
+
return ref2;
|
|
772
|
+
} else {
|
|
773
|
+
const ref3 = {
|
|
774
|
+
current: initialValue
|
|
775
|
+
};
|
|
776
|
+
this._refs.set(key, ref3);
|
|
777
|
+
return ref3;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
effect(key, cb, deps) {
|
|
781
|
+
let effect2 = this.effects.get(key);
|
|
782
|
+
if (effect2 === void 0) {
|
|
783
|
+
effect2 = {
|
|
784
|
+
cleanup: voidFn,
|
|
785
|
+
deps: void 0
|
|
786
|
+
};
|
|
787
|
+
this.effects.set(key, effect2);
|
|
788
|
+
}
|
|
789
|
+
if (depsHaveChanged(effect2.deps, deps)) {
|
|
790
|
+
effect2.cleanup();
|
|
791
|
+
startIgnoringDependencies();
|
|
792
|
+
effect2.cleanup = safelyRun(cb, voidFn).value;
|
|
793
|
+
stopIgnoringDependencies();
|
|
794
|
+
effect2.deps = deps;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
memo(key, fn, deps) {
|
|
798
|
+
let memo2 = this.memos.get(key);
|
|
799
|
+
if (memo2 === void 0) {
|
|
800
|
+
memo2 = {
|
|
801
|
+
cachedValue: null,
|
|
802
|
+
deps: void 0
|
|
803
|
+
};
|
|
804
|
+
this.memos.set(key, memo2);
|
|
805
|
+
}
|
|
806
|
+
if (depsHaveChanged(memo2.deps, deps)) {
|
|
807
|
+
startIgnoringDependencies();
|
|
808
|
+
memo2.cachedValue = safelyRun(fn, void 0).value;
|
|
809
|
+
stopIgnoringDependencies();
|
|
810
|
+
memo2.deps = deps;
|
|
811
|
+
}
|
|
812
|
+
return memo2.cachedValue;
|
|
813
|
+
}
|
|
814
|
+
state(key, initialValue) {
|
|
815
|
+
const { value, setValue } = this.memo("state/" + key, () => {
|
|
816
|
+
const value2 = { current: initialValue };
|
|
817
|
+
const setValue2 = (newValue) => {
|
|
818
|
+
value2.current = newValue;
|
|
819
|
+
this._hotHandle.forceStale();
|
|
820
|
+
};
|
|
821
|
+
return { value: value2, setValue: setValue2 };
|
|
822
|
+
}, []);
|
|
823
|
+
return [value.current, setValue];
|
|
824
|
+
}
|
|
825
|
+
sub(key) {
|
|
826
|
+
if (!this.subs[key]) {
|
|
827
|
+
this.subs[key] = new HotScope(this._hotHandle);
|
|
828
|
+
}
|
|
829
|
+
return this.subs[key];
|
|
830
|
+
}
|
|
831
|
+
cleanupEffects() {
|
|
832
|
+
for (const effect2 of this.effects.values()) {
|
|
833
|
+
safelyRun(effect2.cleanup, void 0);
|
|
834
|
+
}
|
|
835
|
+
this.effects.clear();
|
|
836
|
+
}
|
|
837
|
+
source(subscribe, getValue2) {
|
|
838
|
+
const sourceKey = "$$source/blah";
|
|
839
|
+
this.effect(sourceKey, () => {
|
|
840
|
+
const unsub = subscribe(() => {
|
|
841
|
+
this._hotHandle.forceStale();
|
|
842
|
+
});
|
|
843
|
+
return unsub;
|
|
844
|
+
}, [subscribe]);
|
|
845
|
+
return getValue2();
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
function cleanupScopeStack(scope2) {
|
|
849
|
+
for (const sub2 of Object.values(scope2.subs)) {
|
|
850
|
+
cleanupScopeStack(sub2);
|
|
851
|
+
}
|
|
852
|
+
scope2.cleanupEffects();
|
|
853
|
+
}
|
|
854
|
+
function safelyRun(fn, returnValueInCaseOfError) {
|
|
855
|
+
try {
|
|
856
|
+
return { value: fn(), ok: true };
|
|
857
|
+
} catch (error) {
|
|
858
|
+
setTimeout(function PrismReportThrow() {
|
|
859
|
+
throw error;
|
|
860
|
+
});
|
|
861
|
+
return { value: returnValueInCaseOfError, ok: false };
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
var hookScopeStack = new Stack();
|
|
865
|
+
function ref(key, initialValue) {
|
|
866
|
+
const scope2 = hookScopeStack.peek();
|
|
867
|
+
if (!scope2) {
|
|
868
|
+
throw new Error(`prism.ref() is called outside of a prism() call.`);
|
|
869
|
+
}
|
|
870
|
+
return scope2.ref(key, initialValue);
|
|
871
|
+
}
|
|
872
|
+
function effect(key, cb, deps) {
|
|
873
|
+
const scope2 = hookScopeStack.peek();
|
|
874
|
+
if (!scope2) {
|
|
875
|
+
throw new Error(`prism.effect() is called outside of a prism() call.`);
|
|
876
|
+
}
|
|
877
|
+
return scope2.effect(key, cb, deps);
|
|
878
|
+
}
|
|
879
|
+
function depsHaveChanged(oldDeps, newDeps) {
|
|
880
|
+
if (oldDeps === void 0 || newDeps === void 0) {
|
|
881
|
+
return true;
|
|
882
|
+
}
|
|
883
|
+
const len = oldDeps.length;
|
|
884
|
+
if (len !== newDeps.length)
|
|
885
|
+
return true;
|
|
886
|
+
for (let i = 0; i < len; i++) {
|
|
887
|
+
if (oldDeps[i] !== newDeps[i])
|
|
888
|
+
return true;
|
|
889
|
+
}
|
|
890
|
+
return false;
|
|
891
|
+
}
|
|
892
|
+
function memo(key, fn, deps) {
|
|
893
|
+
const scope2 = hookScopeStack.peek();
|
|
894
|
+
if (!scope2) {
|
|
895
|
+
throw new Error(`prism.memo() is called outside of a prism() call.`);
|
|
896
|
+
}
|
|
897
|
+
return scope2.memo(key, fn, deps);
|
|
898
|
+
}
|
|
899
|
+
function state(key, initialValue) {
|
|
900
|
+
const scope2 = hookScopeStack.peek();
|
|
901
|
+
if (!scope2) {
|
|
902
|
+
throw new Error(`prism.state() is called outside of a prism() call.`);
|
|
903
|
+
}
|
|
904
|
+
return scope2.state(key, initialValue);
|
|
905
|
+
}
|
|
906
|
+
function ensurePrism() {
|
|
907
|
+
const scope2 = hookScopeStack.peek();
|
|
908
|
+
if (!scope2) {
|
|
909
|
+
throw new Error(`The parent function is called outside of a prism() call.`);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
function scope(key, fn) {
|
|
913
|
+
const parentScope = hookScopeStack.peek();
|
|
914
|
+
if (!parentScope) {
|
|
915
|
+
throw new Error(`prism.scope() is called outside of a prism() call.`);
|
|
916
|
+
}
|
|
917
|
+
const subScope = parentScope.sub(key);
|
|
918
|
+
hookScopeStack.push(subScope);
|
|
919
|
+
const ret = safelyRun(fn, void 0).value;
|
|
920
|
+
hookScopeStack.pop();
|
|
921
|
+
return ret;
|
|
922
|
+
}
|
|
923
|
+
function sub(key, fn, deps) {
|
|
924
|
+
return memo(key, () => prism(fn), deps).getValue();
|
|
925
|
+
}
|
|
926
|
+
function inPrism() {
|
|
927
|
+
return !!hookScopeStack.peek();
|
|
928
|
+
}
|
|
929
|
+
function source(subscribe, getValue2) {
|
|
930
|
+
const scope2 = hookScopeStack.peek();
|
|
931
|
+
if (!scope2) {
|
|
932
|
+
throw new Error(`prism.source() is called outside of a prism() call.`);
|
|
933
|
+
}
|
|
934
|
+
return scope2.source(subscribe, getValue2);
|
|
935
|
+
}
|
|
936
|
+
var prism = (fn) => {
|
|
937
|
+
return new PrismInstance(fn);
|
|
938
|
+
};
|
|
939
|
+
var ColdScope = class {
|
|
940
|
+
effect(key, cb, deps) {
|
|
941
|
+
console.warn(`prism.effect() does not run in cold prisms`);
|
|
942
|
+
}
|
|
943
|
+
memo(key, fn, deps) {
|
|
944
|
+
return fn();
|
|
945
|
+
}
|
|
946
|
+
state(key, initialValue) {
|
|
947
|
+
return [initialValue, () => {
|
|
948
|
+
}];
|
|
949
|
+
}
|
|
950
|
+
ref(key, initialValue) {
|
|
951
|
+
return { current: initialValue };
|
|
952
|
+
}
|
|
953
|
+
sub(key) {
|
|
954
|
+
return new ColdScope();
|
|
955
|
+
}
|
|
956
|
+
source(subscribe, getValue2) {
|
|
957
|
+
return getValue2();
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
function calculateColdPrism(fn) {
|
|
961
|
+
const scope2 = new ColdScope();
|
|
962
|
+
hookScopeStack.push(scope2);
|
|
963
|
+
let value;
|
|
964
|
+
try {
|
|
965
|
+
value = fn();
|
|
966
|
+
} catch (error) {
|
|
967
|
+
console.error(error);
|
|
968
|
+
} finally {
|
|
969
|
+
const topOfTheStack = hookScopeStack.pop();
|
|
970
|
+
if (topOfTheStack !== scope2) {
|
|
971
|
+
console.warn(`The Prism hook stack has slipped. This is a bug.`);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
return value;
|
|
975
|
+
}
|
|
976
|
+
prism.ref = ref;
|
|
977
|
+
prism.effect = effect;
|
|
978
|
+
prism.memo = memo;
|
|
979
|
+
prism.ensurePrism = ensurePrism;
|
|
980
|
+
prism.state = state;
|
|
981
|
+
prism.scope = scope;
|
|
982
|
+
prism.sub = sub;
|
|
983
|
+
prism.inPrism = inPrism;
|
|
984
|
+
prism.source = source;
|
|
985
|
+
|
|
986
|
+
// ../dataverse/src/Atom.ts
|
|
987
|
+
var ValueTypes;
|
|
988
|
+
(function(ValueTypes2) {
|
|
989
|
+
ValueTypes2[ValueTypes2["Dict"] = 0] = "Dict";
|
|
990
|
+
ValueTypes2[ValueTypes2["Array"] = 1] = "Array";
|
|
991
|
+
ValueTypes2[ValueTypes2["Other"] = 2] = "Other";
|
|
992
|
+
})(ValueTypes || (ValueTypes = {}));
|
|
993
|
+
|
|
994
|
+
// ../dataverse/src/pointerToPrism.ts
|
|
995
|
+
var identifyPrismWeakMap = new WeakMap();
|
|
996
|
+
|
|
997
|
+
// ../dataverse/src/Ticker.ts
|
|
998
|
+
var EMPTY_TICKS_BEFORE_GOING_DORMANT = 60 * 3;
|
|
999
|
+
|
|
1000
|
+
// src/index.ts
|
|
1001
|
+
var import_theatre_studio = __toModule(require("@tomorrowevening/theatre-studio"));
|
|
1002
|
+
|
|
1003
|
+
// ../../node_modules/lodash-es/_stackClear.js
|
|
1004
|
+
function stackClear() {
|
|
1005
|
+
this.__data__ = new ListCache_default();
|
|
1006
|
+
this.size = 0;
|
|
1007
|
+
}
|
|
1008
|
+
var stackClear_default = stackClear;
|
|
1009
|
+
|
|
1010
|
+
// ../../node_modules/lodash-es/_stackDelete.js
|
|
1011
|
+
function stackDelete(key) {
|
|
1012
|
+
var data = this.__data__, result = data["delete"](key);
|
|
1013
|
+
this.size = data.size;
|
|
1014
|
+
return result;
|
|
1015
|
+
}
|
|
1016
|
+
var stackDelete_default = stackDelete;
|
|
1017
|
+
|
|
1018
|
+
// ../../node_modules/lodash-es/_stackGet.js
|
|
1019
|
+
function stackGet(key) {
|
|
1020
|
+
return this.__data__.get(key);
|
|
1021
|
+
}
|
|
1022
|
+
var stackGet_default = stackGet;
|
|
1023
|
+
|
|
1024
|
+
// ../../node_modules/lodash-es/_stackHas.js
|
|
1025
|
+
function stackHas(key) {
|
|
1026
|
+
return this.__data__.has(key);
|
|
1027
|
+
}
|
|
1028
|
+
var stackHas_default = stackHas;
|
|
1029
|
+
|
|
1030
|
+
// ../../node_modules/lodash-es/_stackSet.js
|
|
1031
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1032
|
+
function stackSet(key, value) {
|
|
1033
|
+
var data = this.__data__;
|
|
1034
|
+
if (data instanceof ListCache_default) {
|
|
1035
|
+
var pairs = data.__data__;
|
|
1036
|
+
if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
1037
|
+
pairs.push([key, value]);
|
|
1038
|
+
this.size = ++data.size;
|
|
1039
|
+
return this;
|
|
1040
|
+
}
|
|
1041
|
+
data = this.__data__ = new MapCache_default(pairs);
|
|
1042
|
+
}
|
|
1043
|
+
data.set(key, value);
|
|
1044
|
+
this.size = data.size;
|
|
1045
|
+
return this;
|
|
1046
|
+
}
|
|
1047
|
+
var stackSet_default = stackSet;
|
|
1048
|
+
|
|
1049
|
+
// ../../node_modules/lodash-es/_Stack.js
|
|
1050
|
+
function Stack2(entries) {
|
|
1051
|
+
var data = this.__data__ = new ListCache_default(entries);
|
|
1052
|
+
this.size = data.size;
|
|
1053
|
+
}
|
|
1054
|
+
Stack2.prototype.clear = stackClear_default;
|
|
1055
|
+
Stack2.prototype["delete"] = stackDelete_default;
|
|
1056
|
+
Stack2.prototype.get = stackGet_default;
|
|
1057
|
+
Stack2.prototype.has = stackHas_default;
|
|
1058
|
+
Stack2.prototype.set = stackSet_default;
|
|
1059
|
+
var Stack_default = Stack2;
|
|
1060
|
+
|
|
1061
|
+
// ../../node_modules/lodash-es/_setCacheAdd.js
|
|
1062
|
+
var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
|
|
1063
|
+
function setCacheAdd(value) {
|
|
1064
|
+
this.__data__.set(value, HASH_UNDEFINED3);
|
|
1065
|
+
return this;
|
|
1066
|
+
}
|
|
1067
|
+
var setCacheAdd_default = setCacheAdd;
|
|
1068
|
+
|
|
1069
|
+
// ../../node_modules/lodash-es/_setCacheHas.js
|
|
1070
|
+
function setCacheHas(value) {
|
|
1071
|
+
return this.__data__.has(value);
|
|
1072
|
+
}
|
|
1073
|
+
var setCacheHas_default = setCacheHas;
|
|
1074
|
+
|
|
1075
|
+
// ../../node_modules/lodash-es/_SetCache.js
|
|
1076
|
+
function SetCache(values) {
|
|
1077
|
+
var index = -1, length = values == null ? 0 : values.length;
|
|
1078
|
+
this.__data__ = new MapCache_default();
|
|
1079
|
+
while (++index < length) {
|
|
1080
|
+
this.add(values[index]);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
|
|
1084
|
+
SetCache.prototype.has = setCacheHas_default;
|
|
1085
|
+
var SetCache_default = SetCache;
|
|
1086
|
+
|
|
1087
|
+
// ../../node_modules/lodash-es/_arraySome.js
|
|
1088
|
+
function arraySome(array, predicate) {
|
|
1089
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
1090
|
+
while (++index < length) {
|
|
1091
|
+
if (predicate(array[index], index, array)) {
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
var arraySome_default = arraySome;
|
|
1098
|
+
|
|
1099
|
+
// ../../node_modules/lodash-es/_cacheHas.js
|
|
1100
|
+
function cacheHas(cache, key) {
|
|
1101
|
+
return cache.has(key);
|
|
1102
|
+
}
|
|
1103
|
+
var cacheHas_default = cacheHas;
|
|
1104
|
+
|
|
1105
|
+
// ../../node_modules/lodash-es/_equalArrays.js
|
|
1106
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
1107
|
+
var COMPARE_UNORDERED_FLAG = 2;
|
|
1108
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
1109
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
|
|
1110
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
var arrStacked = stack.get(array);
|
|
1114
|
+
var othStacked = stack.get(other);
|
|
1115
|
+
if (arrStacked && othStacked) {
|
|
1116
|
+
return arrStacked == other && othStacked == array;
|
|
1117
|
+
}
|
|
1118
|
+
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
|
|
1119
|
+
stack.set(array, other);
|
|
1120
|
+
stack.set(other, array);
|
|
1121
|
+
while (++index < arrLength) {
|
|
1122
|
+
var arrValue = array[index], othValue = other[index];
|
|
1123
|
+
if (customizer) {
|
|
1124
|
+
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
1125
|
+
}
|
|
1126
|
+
if (compared !== void 0) {
|
|
1127
|
+
if (compared) {
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
result = false;
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
if (seen) {
|
|
1134
|
+
if (!arraySome_default(other, function(othValue2, othIndex) {
|
|
1135
|
+
if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
1136
|
+
return seen.push(othIndex);
|
|
1137
|
+
}
|
|
1138
|
+
})) {
|
|
1139
|
+
result = false;
|
|
1140
|
+
break;
|
|
1141
|
+
}
|
|
1142
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
1143
|
+
result = false;
|
|
1144
|
+
break;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
stack["delete"](array);
|
|
1148
|
+
stack["delete"](other);
|
|
1149
|
+
return result;
|
|
1150
|
+
}
|
|
1151
|
+
var equalArrays_default = equalArrays;
|
|
1152
|
+
|
|
1153
|
+
// ../../node_modules/lodash-es/_Uint8Array.js
|
|
1154
|
+
var Uint8Array2 = root_default.Uint8Array;
|
|
1155
|
+
var Uint8Array_default = Uint8Array2;
|
|
1156
|
+
|
|
1157
|
+
// ../../node_modules/lodash-es/_mapToArray.js
|
|
1158
|
+
function mapToArray(map) {
|
|
1159
|
+
var index = -1, result = Array(map.size);
|
|
1160
|
+
map.forEach(function(value, key) {
|
|
1161
|
+
result[++index] = [key, value];
|
|
1162
|
+
});
|
|
1163
|
+
return result;
|
|
1164
|
+
}
|
|
1165
|
+
var mapToArray_default = mapToArray;
|
|
1166
|
+
|
|
1167
|
+
// ../../node_modules/lodash-es/_setToArray.js
|
|
1168
|
+
function setToArray(set) {
|
|
1169
|
+
var index = -1, result = Array(set.size);
|
|
1170
|
+
set.forEach(function(value) {
|
|
1171
|
+
result[++index] = value;
|
|
1172
|
+
});
|
|
1173
|
+
return result;
|
|
1174
|
+
}
|
|
1175
|
+
var setToArray_default = setToArray;
|
|
1176
|
+
|
|
1177
|
+
// ../../node_modules/lodash-es/_equalByTag.js
|
|
1178
|
+
var COMPARE_PARTIAL_FLAG2 = 1;
|
|
1179
|
+
var COMPARE_UNORDERED_FLAG2 = 2;
|
|
1180
|
+
var boolTag = "[object Boolean]";
|
|
1181
|
+
var dateTag = "[object Date]";
|
|
1182
|
+
var errorTag = "[object Error]";
|
|
1183
|
+
var mapTag = "[object Map]";
|
|
1184
|
+
var numberTag = "[object Number]";
|
|
1185
|
+
var regexpTag = "[object RegExp]";
|
|
1186
|
+
var setTag = "[object Set]";
|
|
1187
|
+
var stringTag = "[object String]";
|
|
1188
|
+
var symbolTag = "[object Symbol]";
|
|
1189
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
|
1190
|
+
var dataViewTag = "[object DataView]";
|
|
1191
|
+
var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
|
|
1192
|
+
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1193
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1194
|
+
switch (tag) {
|
|
1195
|
+
case dataViewTag:
|
|
1196
|
+
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
1197
|
+
return false;
|
|
1198
|
+
}
|
|
1199
|
+
object = object.buffer;
|
|
1200
|
+
other = other.buffer;
|
|
1201
|
+
case arrayBufferTag:
|
|
1202
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
|
|
1203
|
+
return false;
|
|
1204
|
+
}
|
|
1205
|
+
return true;
|
|
1206
|
+
case boolTag:
|
|
1207
|
+
case dateTag:
|
|
1208
|
+
case numberTag:
|
|
1209
|
+
return eq_default(+object, +other);
|
|
1210
|
+
case errorTag:
|
|
1211
|
+
return object.name == other.name && object.message == other.message;
|
|
1212
|
+
case regexpTag:
|
|
1213
|
+
case stringTag:
|
|
1214
|
+
return object == other + "";
|
|
1215
|
+
case mapTag:
|
|
1216
|
+
var convert = mapToArray_default;
|
|
1217
|
+
case setTag:
|
|
1218
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
|
|
1219
|
+
convert || (convert = setToArray_default);
|
|
1220
|
+
if (object.size != other.size && !isPartial) {
|
|
1221
|
+
return false;
|
|
1222
|
+
}
|
|
1223
|
+
var stacked = stack.get(object);
|
|
1224
|
+
if (stacked) {
|
|
1225
|
+
return stacked == other;
|
|
1226
|
+
}
|
|
1227
|
+
bitmask |= COMPARE_UNORDERED_FLAG2;
|
|
1228
|
+
stack.set(object, other);
|
|
1229
|
+
var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1230
|
+
stack["delete"](object);
|
|
1231
|
+
return result;
|
|
1232
|
+
case symbolTag:
|
|
1233
|
+
if (symbolValueOf) {
|
|
1234
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
return false;
|
|
1238
|
+
}
|
|
1239
|
+
var equalByTag_default = equalByTag;
|
|
1240
|
+
|
|
1241
|
+
// ../../node_modules/lodash-es/_arrayPush.js
|
|
1242
|
+
function arrayPush(array, values) {
|
|
1243
|
+
var index = -1, length = values.length, offset = array.length;
|
|
1244
|
+
while (++index < length) {
|
|
1245
|
+
array[offset + index] = values[index];
|
|
1246
|
+
}
|
|
1247
|
+
return array;
|
|
1248
|
+
}
|
|
1249
|
+
var arrayPush_default = arrayPush;
|
|
1250
|
+
|
|
1251
|
+
// ../../node_modules/lodash-es/_baseGetAllKeys.js
|
|
1252
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1253
|
+
var result = keysFunc(object);
|
|
1254
|
+
return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
|
|
1255
|
+
}
|
|
1256
|
+
var baseGetAllKeys_default = baseGetAllKeys;
|
|
1257
|
+
|
|
1258
|
+
// ../../node_modules/lodash-es/_arrayFilter.js
|
|
1259
|
+
function arrayFilter(array, predicate) {
|
|
1260
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
1261
|
+
while (++index < length) {
|
|
1262
|
+
var value = array[index];
|
|
1263
|
+
if (predicate(value, index, array)) {
|
|
1264
|
+
result[resIndex++] = value;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
return result;
|
|
1268
|
+
}
|
|
1269
|
+
var arrayFilter_default = arrayFilter;
|
|
1270
|
+
|
|
1271
|
+
// ../../node_modules/lodash-es/stubArray.js
|
|
1272
|
+
function stubArray() {
|
|
1273
|
+
return [];
|
|
1274
|
+
}
|
|
1275
|
+
var stubArray_default = stubArray;
|
|
1276
|
+
|
|
1277
|
+
// ../../node_modules/lodash-es/_getSymbols.js
|
|
1278
|
+
var objectProto6 = Object.prototype;
|
|
1279
|
+
var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
|
|
1280
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1281
|
+
var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
|
|
1282
|
+
if (object == null) {
|
|
1283
|
+
return [];
|
|
1284
|
+
}
|
|
1285
|
+
object = Object(object);
|
|
1286
|
+
return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
|
|
1287
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
1288
|
+
});
|
|
1289
|
+
};
|
|
1290
|
+
var getSymbols_default = getSymbols;
|
|
1291
|
+
|
|
1292
|
+
// ../../node_modules/lodash-es/_baseTimes.js
|
|
1293
|
+
function baseTimes(n, iteratee) {
|
|
1294
|
+
var index = -1, result = Array(n);
|
|
1295
|
+
while (++index < n) {
|
|
1296
|
+
result[index] = iteratee(index);
|
|
1297
|
+
}
|
|
1298
|
+
return result;
|
|
1299
|
+
}
|
|
1300
|
+
var baseTimes_default = baseTimes;
|
|
1301
|
+
|
|
1302
|
+
// ../../node_modules/lodash-es/_baseIsArguments.js
|
|
1303
|
+
var argsTag = "[object Arguments]";
|
|
1304
|
+
function baseIsArguments(value) {
|
|
1305
|
+
return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
|
|
1306
|
+
}
|
|
1307
|
+
var baseIsArguments_default = baseIsArguments;
|
|
1308
|
+
|
|
1309
|
+
// ../../node_modules/lodash-es/isArguments.js
|
|
1310
|
+
var objectProto7 = Object.prototype;
|
|
1311
|
+
var hasOwnProperty5 = objectProto7.hasOwnProperty;
|
|
1312
|
+
var propertyIsEnumerable2 = objectProto7.propertyIsEnumerable;
|
|
1313
|
+
var isArguments = baseIsArguments_default(function() {
|
|
1314
|
+
return arguments;
|
|
1315
|
+
}()) ? baseIsArguments_default : function(value) {
|
|
1316
|
+
return isObjectLike_default(value) && hasOwnProperty5.call(value, "callee") && !propertyIsEnumerable2.call(value, "callee");
|
|
1317
|
+
};
|
|
1318
|
+
var isArguments_default = isArguments;
|
|
1319
|
+
|
|
1320
|
+
// ../../node_modules/lodash-es/stubFalse.js
|
|
1321
|
+
function stubFalse() {
|
|
1322
|
+
return false;
|
|
1323
|
+
}
|
|
1324
|
+
var stubFalse_default = stubFalse;
|
|
1325
|
+
|
|
1326
|
+
// ../../node_modules/lodash-es/isBuffer.js
|
|
1327
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1328
|
+
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
1329
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1330
|
+
var Buffer2 = moduleExports ? root_default.Buffer : void 0;
|
|
1331
|
+
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
|
1332
|
+
var isBuffer = nativeIsBuffer || stubFalse_default;
|
|
1333
|
+
var isBuffer_default = isBuffer;
|
|
1334
|
+
|
|
1335
|
+
// ../../node_modules/lodash-es/_isIndex.js
|
|
1336
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1337
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1338
|
+
function isIndex(value, length) {
|
|
1339
|
+
var type = typeof value;
|
|
1340
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
1341
|
+
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
1342
|
+
}
|
|
1343
|
+
var isIndex_default = isIndex;
|
|
1344
|
+
|
|
1345
|
+
// ../../node_modules/lodash-es/isLength.js
|
|
1346
|
+
var MAX_SAFE_INTEGER2 = 9007199254740991;
|
|
1347
|
+
function isLength(value) {
|
|
1348
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
|
|
1349
|
+
}
|
|
1350
|
+
var isLength_default = isLength;
|
|
1351
|
+
|
|
1352
|
+
// ../../node_modules/lodash-es/_baseIsTypedArray.js
|
|
1353
|
+
var argsTag2 = "[object Arguments]";
|
|
1354
|
+
var arrayTag = "[object Array]";
|
|
1355
|
+
var boolTag2 = "[object Boolean]";
|
|
1356
|
+
var dateTag2 = "[object Date]";
|
|
1357
|
+
var errorTag2 = "[object Error]";
|
|
1358
|
+
var funcTag2 = "[object Function]";
|
|
1359
|
+
var mapTag2 = "[object Map]";
|
|
1360
|
+
var numberTag2 = "[object Number]";
|
|
1361
|
+
var objectTag = "[object Object]";
|
|
1362
|
+
var regexpTag2 = "[object RegExp]";
|
|
1363
|
+
var setTag2 = "[object Set]";
|
|
1364
|
+
var stringTag2 = "[object String]";
|
|
1365
|
+
var weakMapTag = "[object WeakMap]";
|
|
1366
|
+
var arrayBufferTag2 = "[object ArrayBuffer]";
|
|
1367
|
+
var dataViewTag2 = "[object DataView]";
|
|
1368
|
+
var float32Tag = "[object Float32Array]";
|
|
1369
|
+
var float64Tag = "[object Float64Array]";
|
|
1370
|
+
var int8Tag = "[object Int8Array]";
|
|
1371
|
+
var int16Tag = "[object Int16Array]";
|
|
1372
|
+
var int32Tag = "[object Int32Array]";
|
|
1373
|
+
var uint8Tag = "[object Uint8Array]";
|
|
1374
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
|
1375
|
+
var uint16Tag = "[object Uint16Array]";
|
|
1376
|
+
var uint32Tag = "[object Uint32Array]";
|
|
1377
|
+
var typedArrayTags = {};
|
|
1378
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
1379
|
+
typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag2] = typedArrayTags[boolTag2] = typedArrayTags[dataViewTag2] = typedArrayTags[dateTag2] = typedArrayTags[errorTag2] = typedArrayTags[funcTag2] = typedArrayTags[mapTag2] = typedArrayTags[numberTag2] = typedArrayTags[objectTag] = typedArrayTags[regexpTag2] = typedArrayTags[setTag2] = typedArrayTags[stringTag2] = typedArrayTags[weakMapTag] = false;
|
|
1380
|
+
function baseIsTypedArray(value) {
|
|
1381
|
+
return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
|
|
1382
|
+
}
|
|
1383
|
+
var baseIsTypedArray_default = baseIsTypedArray;
|
|
1384
|
+
|
|
1385
|
+
// ../../node_modules/lodash-es/_baseUnary.js
|
|
1386
|
+
function baseUnary(func) {
|
|
1387
|
+
return function(value) {
|
|
1388
|
+
return func(value);
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
var baseUnary_default = baseUnary;
|
|
1392
|
+
|
|
1393
|
+
// ../../node_modules/lodash-es/_nodeUtil.js
|
|
1394
|
+
var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1395
|
+
var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
|
|
1396
|
+
var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
|
|
1397
|
+
var freeProcess = moduleExports2 && freeGlobal_default.process;
|
|
1398
|
+
var nodeUtil = function() {
|
|
1399
|
+
try {
|
|
1400
|
+
var types2 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
|
|
1401
|
+
if (types2) {
|
|
1402
|
+
return types2;
|
|
1403
|
+
}
|
|
1404
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1405
|
+
} catch (e) {
|
|
1406
|
+
}
|
|
1407
|
+
}();
|
|
1408
|
+
var nodeUtil_default = nodeUtil;
|
|
1409
|
+
|
|
1410
|
+
// ../../node_modules/lodash-es/isTypedArray.js
|
|
1411
|
+
var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
|
|
1412
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
|
|
1413
|
+
var isTypedArray_default = isTypedArray;
|
|
1414
|
+
|
|
1415
|
+
// ../../node_modules/lodash-es/_arrayLikeKeys.js
|
|
1416
|
+
var objectProto8 = Object.prototype;
|
|
1417
|
+
var hasOwnProperty6 = objectProto8.hasOwnProperty;
|
|
1418
|
+
function arrayLikeKeys(value, inherited) {
|
|
1419
|
+
var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
|
|
1420
|
+
for (var key in value) {
|
|
1421
|
+
if ((inherited || hasOwnProperty6.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex_default(key, length)))) {
|
|
1422
|
+
result.push(key);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
return result;
|
|
1426
|
+
}
|
|
1427
|
+
var arrayLikeKeys_default = arrayLikeKeys;
|
|
1428
|
+
|
|
1429
|
+
// ../../node_modules/lodash-es/_isPrototype.js
|
|
1430
|
+
var objectProto9 = Object.prototype;
|
|
1431
|
+
function isPrototype(value) {
|
|
1432
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto9;
|
|
1433
|
+
return value === proto;
|
|
1434
|
+
}
|
|
1435
|
+
var isPrototype_default = isPrototype;
|
|
1436
|
+
|
|
1437
|
+
// ../../node_modules/lodash-es/_nativeKeys.js
|
|
1438
|
+
var nativeKeys = overArg_default(Object.keys, Object);
|
|
1439
|
+
var nativeKeys_default = nativeKeys;
|
|
1440
|
+
|
|
1441
|
+
// ../../node_modules/lodash-es/_baseKeys.js
|
|
1442
|
+
var objectProto10 = Object.prototype;
|
|
1443
|
+
var hasOwnProperty7 = objectProto10.hasOwnProperty;
|
|
1444
|
+
function baseKeys(object) {
|
|
1445
|
+
if (!isPrototype_default(object)) {
|
|
1446
|
+
return nativeKeys_default(object);
|
|
1447
|
+
}
|
|
1448
|
+
var result = [];
|
|
1449
|
+
for (var key in Object(object)) {
|
|
1450
|
+
if (hasOwnProperty7.call(object, key) && key != "constructor") {
|
|
1451
|
+
result.push(key);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
return result;
|
|
1455
|
+
}
|
|
1456
|
+
var baseKeys_default = baseKeys;
|
|
1457
|
+
|
|
1458
|
+
// ../../node_modules/lodash-es/isArrayLike.js
|
|
1459
|
+
function isArrayLike(value) {
|
|
1460
|
+
return value != null && isLength_default(value.length) && !isFunction_default(value);
|
|
1461
|
+
}
|
|
1462
|
+
var isArrayLike_default = isArrayLike;
|
|
1463
|
+
|
|
1464
|
+
// ../../node_modules/lodash-es/keys.js
|
|
1465
|
+
function keys(object) {
|
|
1466
|
+
return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
|
|
1467
|
+
}
|
|
1468
|
+
var keys_default = keys;
|
|
1469
|
+
|
|
1470
|
+
// ../../node_modules/lodash-es/_getAllKeys.js
|
|
1471
|
+
function getAllKeys(object) {
|
|
1472
|
+
return baseGetAllKeys_default(object, keys_default, getSymbols_default);
|
|
1473
|
+
}
|
|
1474
|
+
var getAllKeys_default = getAllKeys;
|
|
1475
|
+
|
|
1476
|
+
// ../../node_modules/lodash-es/_equalObjects.js
|
|
1477
|
+
var COMPARE_PARTIAL_FLAG3 = 1;
|
|
1478
|
+
var objectProto11 = Object.prototype;
|
|
1479
|
+
var hasOwnProperty8 = objectProto11.hasOwnProperty;
|
|
1480
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1481
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
|
|
1482
|
+
if (objLength != othLength && !isPartial) {
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
var index = objLength;
|
|
1486
|
+
while (index--) {
|
|
1487
|
+
var key = objProps[index];
|
|
1488
|
+
if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
|
|
1489
|
+
return false;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
var objStacked = stack.get(object);
|
|
1493
|
+
var othStacked = stack.get(other);
|
|
1494
|
+
if (objStacked && othStacked) {
|
|
1495
|
+
return objStacked == other && othStacked == object;
|
|
1496
|
+
}
|
|
1497
|
+
var result = true;
|
|
1498
|
+
stack.set(object, other);
|
|
1499
|
+
stack.set(other, object);
|
|
1500
|
+
var skipCtor = isPartial;
|
|
1501
|
+
while (++index < objLength) {
|
|
1502
|
+
key = objProps[index];
|
|
1503
|
+
var objValue = object[key], othValue = other[key];
|
|
1504
|
+
if (customizer) {
|
|
1505
|
+
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
1506
|
+
}
|
|
1507
|
+
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
1508
|
+
result = false;
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
skipCtor || (skipCtor = key == "constructor");
|
|
1512
|
+
}
|
|
1513
|
+
if (result && !skipCtor) {
|
|
1514
|
+
var objCtor = object.constructor, othCtor = other.constructor;
|
|
1515
|
+
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
1516
|
+
result = false;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
stack["delete"](object);
|
|
1520
|
+
stack["delete"](other);
|
|
1521
|
+
return result;
|
|
1522
|
+
}
|
|
1523
|
+
var equalObjects_default = equalObjects;
|
|
1524
|
+
|
|
1525
|
+
// ../../node_modules/lodash-es/_DataView.js
|
|
1526
|
+
var DataView = getNative_default(root_default, "DataView");
|
|
1527
|
+
var DataView_default = DataView;
|
|
1528
|
+
|
|
1529
|
+
// ../../node_modules/lodash-es/_Promise.js
|
|
1530
|
+
var Promise2 = getNative_default(root_default, "Promise");
|
|
1531
|
+
var Promise_default = Promise2;
|
|
1532
|
+
|
|
1533
|
+
// ../../node_modules/lodash-es/_Set.js
|
|
1534
|
+
var Set2 = getNative_default(root_default, "Set");
|
|
1535
|
+
var Set_default = Set2;
|
|
1536
|
+
|
|
1537
|
+
// ../../node_modules/lodash-es/_WeakMap.js
|
|
1538
|
+
var WeakMap2 = getNative_default(root_default, "WeakMap");
|
|
1539
|
+
var WeakMap_default = WeakMap2;
|
|
1540
|
+
|
|
1541
|
+
// ../../node_modules/lodash-es/_getTag.js
|
|
1542
|
+
var mapTag3 = "[object Map]";
|
|
1543
|
+
var objectTag2 = "[object Object]";
|
|
1544
|
+
var promiseTag = "[object Promise]";
|
|
1545
|
+
var setTag3 = "[object Set]";
|
|
1546
|
+
var weakMapTag2 = "[object WeakMap]";
|
|
1547
|
+
var dataViewTag3 = "[object DataView]";
|
|
1548
|
+
var dataViewCtorString = toSource_default(DataView_default);
|
|
1549
|
+
var mapCtorString = toSource_default(Map_default);
|
|
1550
|
+
var promiseCtorString = toSource_default(Promise_default);
|
|
1551
|
+
var setCtorString = toSource_default(Set_default);
|
|
1552
|
+
var weakMapCtorString = toSource_default(WeakMap_default);
|
|
1553
|
+
var getTag = baseGetTag_default;
|
|
1554
|
+
if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag3 || Map_default && getTag(new Map_default()) != mapTag3 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag3 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
|
|
1555
|
+
getTag = function(value) {
|
|
1556
|
+
var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
|
|
1557
|
+
if (ctorString) {
|
|
1558
|
+
switch (ctorString) {
|
|
1559
|
+
case dataViewCtorString:
|
|
1560
|
+
return dataViewTag3;
|
|
1561
|
+
case mapCtorString:
|
|
1562
|
+
return mapTag3;
|
|
1563
|
+
case promiseCtorString:
|
|
1564
|
+
return promiseTag;
|
|
1565
|
+
case setCtorString:
|
|
1566
|
+
return setTag3;
|
|
1567
|
+
case weakMapCtorString:
|
|
1568
|
+
return weakMapTag2;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
return result;
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
var getTag_default = getTag;
|
|
1575
|
+
|
|
1576
|
+
// ../../node_modules/lodash-es/_baseIsEqualDeep.js
|
|
1577
|
+
var COMPARE_PARTIAL_FLAG4 = 1;
|
|
1578
|
+
var argsTag3 = "[object Arguments]";
|
|
1579
|
+
var arrayTag2 = "[object Array]";
|
|
1580
|
+
var objectTag3 = "[object Object]";
|
|
1581
|
+
var objectProto12 = Object.prototype;
|
|
1582
|
+
var hasOwnProperty9 = objectProto12.hasOwnProperty;
|
|
1583
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1584
|
+
var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
|
|
1585
|
+
objTag = objTag == argsTag3 ? objectTag3 : objTag;
|
|
1586
|
+
othTag = othTag == argsTag3 ? objectTag3 : othTag;
|
|
1587
|
+
var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
|
|
1588
|
+
if (isSameTag && isBuffer_default(object)) {
|
|
1589
|
+
if (!isBuffer_default(other)) {
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
objIsArr = true;
|
|
1593
|
+
objIsObj = false;
|
|
1594
|
+
}
|
|
1595
|
+
if (isSameTag && !objIsObj) {
|
|
1596
|
+
stack || (stack = new Stack_default());
|
|
1597
|
+
return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1598
|
+
}
|
|
1599
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
|
|
1600
|
+
var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
|
|
1601
|
+
if (objIsWrapped || othIsWrapped) {
|
|
1602
|
+
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1603
|
+
stack || (stack = new Stack_default());
|
|
1604
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
if (!isSameTag) {
|
|
1608
|
+
return false;
|
|
1609
|
+
}
|
|
1610
|
+
stack || (stack = new Stack_default());
|
|
1611
|
+
return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
|
|
1612
|
+
}
|
|
1613
|
+
var baseIsEqualDeep_default = baseIsEqualDeep;
|
|
1614
|
+
|
|
1615
|
+
// ../../node_modules/lodash-es/_baseIsEqual.js
|
|
1616
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
1617
|
+
if (value === other) {
|
|
1618
|
+
return true;
|
|
1619
|
+
}
|
|
1620
|
+
if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
|
|
1621
|
+
return value !== value && other !== other;
|
|
1622
|
+
}
|
|
1623
|
+
return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1624
|
+
}
|
|
1625
|
+
var baseIsEqual_default = baseIsEqual;
|
|
1626
|
+
|
|
1627
|
+
// ../../node_modules/lodash-es/isEqualWith.js
|
|
1628
|
+
function isEqualWith(value, other, customizer) {
|
|
1629
|
+
customizer = typeof customizer == "function" ? customizer : void 0;
|
|
1630
|
+
var result = customizer ? customizer(value, other) : void 0;
|
|
1631
|
+
return result === void 0 ? baseIsEqual_default(value, other, void 0, customizer) : !!result;
|
|
1632
|
+
}
|
|
1633
|
+
var isEqualWith_default = isEqualWith;
|
|
1634
|
+
|
|
1635
|
+
// ../../node_modules/lodash-es/isEqual.js
|
|
1636
|
+
function isEqual(value, other) {
|
|
1637
|
+
return baseIsEqual_default(value, other);
|
|
1638
|
+
}
|
|
1639
|
+
var isEqual_default = isEqual;
|
|
1640
|
+
|
|
1641
|
+
// src/index.ts
|
|
1642
|
+
var import_react = __toModule(require("react"));
|
|
1643
|
+
var import_theatre_core3 = __toModule(require("@tomorrowevening/theatre-core"));
|
|
1644
|
+
if (process.env.NODE_ENV === "development") {
|
|
1645
|
+
import_theatre_studio.default.initialize();
|
|
1646
|
+
}
|
|
1647
|
+
var maybeTransaction = process.env.NODE_ENV === "development" ? import_theatre_studio.default.transaction.bind(import_theatre_studio.default) : () => {
|
|
1648
|
+
};
|
|
1649
|
+
var _projectConfig = void 0;
|
|
1650
|
+
function equalityCheckWithFunctionsAlwaysEqual(a, b) {
|
|
1651
|
+
if (typeof a === "function" && typeof b === "function") {
|
|
1652
|
+
return true;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
function initialize(config) {
|
|
1656
|
+
if (_project) {
|
|
1657
|
+
console.warn("Theatric has already been initialized, either through another initialize call, or by calling useControls() before calling initialize().");
|
|
1658
|
+
return _project.ready.then(() => {
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
_projectConfig = config;
|
|
1662
|
+
const project = callGetProject();
|
|
1663
|
+
return project.ready.then(() => {
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
function getAssetUrl(asset) {
|
|
1667
|
+
if (!_project) {
|
|
1668
|
+
throw new Error("Theatric has not been initialized yet. Please call initialize() before calling getAssetUrl().");
|
|
1669
|
+
}
|
|
1670
|
+
if (!_project.isReady) {
|
|
1671
|
+
throw new Error("Calling `getAssetUrl()` before `initialize()` is resolved.\nThe best way to solve this is to delay rendering your react app until `project.ready` is resolved, like this: \n\n```\nproject.ready.then(() => {ReactDom.render(...)})\n```");
|
|
1672
|
+
}
|
|
1673
|
+
return _project.getAssetUrl(asset);
|
|
1674
|
+
}
|
|
1675
|
+
var allProps = {};
|
|
1676
|
+
var allActions = {};
|
|
1677
|
+
function useControls(config, options = {}) {
|
|
1678
|
+
var _a, _b, _c;
|
|
1679
|
+
if (_projectConfig === void 0) {
|
|
1680
|
+
_projectConfig = null;
|
|
1681
|
+
}
|
|
1682
|
+
const configRef = (0, import_react.useRef)(config);
|
|
1683
|
+
const _config = (0, import_react.useMemo)(() => {
|
|
1684
|
+
let currentConfig = configRef.current;
|
|
1685
|
+
if (!isEqualWith_default(config, configRef.current, equalityCheckWithFunctionsAlwaysEqual)) {
|
|
1686
|
+
configRef.current = config;
|
|
1687
|
+
currentConfig = config;
|
|
1688
|
+
}
|
|
1689
|
+
return currentConfig;
|
|
1690
|
+
}, [config]);
|
|
1691
|
+
const { folder } = options;
|
|
1692
|
+
const controlsWithoutButtons = (0, import_react.useMemo)(() => Object.fromEntries(Object.entries(_config).filter(([key, value]) => value.type !== "button")), [_config]);
|
|
1693
|
+
const buttons = (0, import_react.useMemo)(() => Object.fromEntries(Object.entries(_config).filter(([key, value]) => value.type === "button")), [_config]);
|
|
1694
|
+
const props = (0, import_react.useMemo)(() => folder ? { [folder]: controlsWithoutButtons } : controlsWithoutButtons, [folder, controlsWithoutButtons]);
|
|
1695
|
+
const actions = (0, import_react.useMemo)(() => Object.fromEntries(Object.entries(buttons).map(([key, value]) => [
|
|
1696
|
+
`${folder ? `${folder}: ` : ""}${key}`,
|
|
1697
|
+
() => {
|
|
1698
|
+
var _a2, _b2;
|
|
1699
|
+
(_b2 = (_a2 = configRef.current[key]).onClick) == null ? void 0 : _b2.call(_a2);
|
|
1700
|
+
}
|
|
1701
|
+
])), [buttons, folder]);
|
|
1702
|
+
const sheet = (0, import_react.useMemo)(() => callGetProject().sheet("Panels"), []);
|
|
1703
|
+
const panel = (_a = options.panel) != null ? _a : "Default panel";
|
|
1704
|
+
const allPanelProps = (_b = allProps[panel]) != null ? _b : allProps[panel] = [];
|
|
1705
|
+
const allPanelActions = (_c = allActions[panel]) != null ? _c : allActions[panel] = [];
|
|
1706
|
+
const object = (0, import_react.useMemo)(() => sheet.object(panel, Object.assign({}, ...allProps[panel], props), {
|
|
1707
|
+
reconfigure: true,
|
|
1708
|
+
__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION: Object.assign({}, ...allActions[panel], actions)
|
|
1709
|
+
}), [panel, props, actions]);
|
|
1710
|
+
(0, import_react.useEffect)(() => {
|
|
1711
|
+
allPanelProps.push(props);
|
|
1712
|
+
allPanelActions.push(actions);
|
|
1713
|
+
let obj = sheet.object(panel, Object.assign({}, ...allPanelProps), {
|
|
1714
|
+
reconfigure: true,
|
|
1715
|
+
__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION: Object.assign({}, ...allPanelActions)
|
|
1716
|
+
});
|
|
1717
|
+
selectObjectIfNecessary(obj);
|
|
1718
|
+
return () => {
|
|
1719
|
+
allPanelProps.splice(allPanelProps.indexOf(props), 1);
|
|
1720
|
+
allActions[panel].splice(allPanelActions.indexOf(actions), 1);
|
|
1721
|
+
sheet.object(panel, Object.assign({}, ...allPanelProps), {
|
|
1722
|
+
reconfigure: true,
|
|
1723
|
+
__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION: Object.assign({}, ...allPanelActions)
|
|
1724
|
+
});
|
|
1725
|
+
};
|
|
1726
|
+
}, [props, actions, allPanelActions, allPanelProps, sheet, panel]);
|
|
1727
|
+
const [values, setValues] = (0, import_react.useState)(folder ? object.value[folder] : object.value);
|
|
1728
|
+
const valuesRef = (0, import_react.useRef)(object.value);
|
|
1729
|
+
(0, import_react.useEffect)(() => {
|
|
1730
|
+
const unsub = object.onValuesChange((newValues) => {
|
|
1731
|
+
if (folder)
|
|
1732
|
+
newValues = newValues[folder];
|
|
1733
|
+
if (isEqual_default(newValues, valuesRef.current))
|
|
1734
|
+
return;
|
|
1735
|
+
valuesRef.current = newValues;
|
|
1736
|
+
setValues(newValues);
|
|
1737
|
+
});
|
|
1738
|
+
return unsub;
|
|
1739
|
+
}, [object]);
|
|
1740
|
+
const $setAndGet = (0, import_react.useMemo)(() => {
|
|
1741
|
+
const rootPointer = folder ? object.props[folder] : object.props;
|
|
1742
|
+
const $set = (getPointer, value) => {
|
|
1743
|
+
if (typeof getPointer !== "function") {
|
|
1744
|
+
throw new Error(`The first argument to $set must be a function that returns a pointer. Instead, it was ${typeof getPointer}`);
|
|
1745
|
+
}
|
|
1746
|
+
const pointer = getPointer(rootPointer);
|
|
1747
|
+
if (!isPointer(pointer)) {
|
|
1748
|
+
throw new Error(`The function passed to $set must return a pointer. Instead, it returned ${pointer}`);
|
|
1749
|
+
}
|
|
1750
|
+
maybeTransaction((api) => {
|
|
1751
|
+
api.set(pointer, value);
|
|
1752
|
+
});
|
|
1753
|
+
};
|
|
1754
|
+
const $get = (getPointer) => {
|
|
1755
|
+
if (typeof getPointer !== "function") {
|
|
1756
|
+
throw new Error(`The first argument to $get must be a function that returns a pointer. Instead, it was ${typeof getPointer}`);
|
|
1757
|
+
}
|
|
1758
|
+
const pointer = getPointer(rootPointer);
|
|
1759
|
+
if (!isPointer(pointer)) {
|
|
1760
|
+
throw new Error(`The function passed to $get must return a pointer. Instead, it returned ${pointer}`);
|
|
1761
|
+
}
|
|
1762
|
+
return (0, import_theatre_core.val)(pointer);
|
|
1763
|
+
};
|
|
1764
|
+
return { $set, $get };
|
|
1765
|
+
}, [folder, object]);
|
|
1766
|
+
return __spreadValues(__spreadValues({}, values), $setAndGet);
|
|
1767
|
+
}
|
|
1768
|
+
var button = (onClick) => {
|
|
1769
|
+
return {
|
|
1770
|
+
type: "button",
|
|
1771
|
+
onClick
|
|
1772
|
+
};
|
|
1773
|
+
};
|
|
1774
|
+
var _project;
|
|
1775
|
+
function callGetProject() {
|
|
1776
|
+
if (_project)
|
|
1777
|
+
return _project;
|
|
1778
|
+
_project = (0, import_theatre_core2.getProject)("Theatric", _projectConfig != null ? _projectConfig : void 0);
|
|
1779
|
+
return _project;
|
|
1780
|
+
}
|
|
1781
|
+
var objAlreadySelected = false;
|
|
1782
|
+
function selectObjectIfNecessary(obj) {
|
|
1783
|
+
if (objAlreadySelected)
|
|
1784
|
+
return;
|
|
1785
|
+
objAlreadySelected = true;
|
|
1786
|
+
if (process.env.NODE_ENV === "development") {
|
|
1787
|
+
if (import_theatre_studio.default.selection.length === 0) {
|
|
1788
|
+
import_theatre_studio.default.setSelection([obj]);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
//# sourceMappingURL=index.js.map
|