@unseenco/theatre-core 0.1.3 → 0.1.4
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/index.js +724 -68
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,6 +9,11 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
9
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __knownSymbol = (name, symbol) => {
|
|
13
|
+
if (symbol = Symbol[name])
|
|
14
|
+
return symbol;
|
|
15
|
+
throw Error("Symbol." + name + " is not defined");
|
|
16
|
+
};
|
|
12
17
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
18
|
var __spreadValues = (a2, b2) => {
|
|
14
19
|
for (var prop in b2 || (b2 = {}))
|
|
@@ -50,6 +55,43 @@ var __publicField = (obj, key, value) => {
|
|
|
50
55
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
51
56
|
return value;
|
|
52
57
|
};
|
|
58
|
+
var __await = function(promise, isYieldStar) {
|
|
59
|
+
this[0] = promise;
|
|
60
|
+
this[1] = isYieldStar;
|
|
61
|
+
};
|
|
62
|
+
var __yieldStar = (value) => {
|
|
63
|
+
var obj = value[__knownSymbol("asyncIterator")];
|
|
64
|
+
var isAwait = false;
|
|
65
|
+
var method;
|
|
66
|
+
var it = {};
|
|
67
|
+
if (obj == null) {
|
|
68
|
+
obj = value[__knownSymbol("iterator")]();
|
|
69
|
+
method = (k2) => it[k2] = (x2) => obj[k2](x2);
|
|
70
|
+
} else {
|
|
71
|
+
obj = obj.call(value);
|
|
72
|
+
method = (k2) => it[k2] = (v2) => {
|
|
73
|
+
if (isAwait) {
|
|
74
|
+
isAwait = false;
|
|
75
|
+
if (k2 === "throw")
|
|
76
|
+
throw v2;
|
|
77
|
+
return v2;
|
|
78
|
+
}
|
|
79
|
+
isAwait = true;
|
|
80
|
+
return {
|
|
81
|
+
done: false,
|
|
82
|
+
value: new __await(new Promise((resolve) => {
|
|
83
|
+
var x2 = obj[k2](v2);
|
|
84
|
+
if (!(x2 instanceof Object))
|
|
85
|
+
throw TypeError("Object expected");
|
|
86
|
+
resolve(x2);
|
|
87
|
+
}), 1)
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x2) => {
|
|
92
|
+
throw x2;
|
|
93
|
+
}, "return" in obj && method("return"), it;
|
|
94
|
+
};
|
|
53
95
|
|
|
54
96
|
// ../node_modules/timing-function/lib/UnitBezier.js
|
|
55
97
|
var require_UnitBezier = __commonJS({
|
|
@@ -277,7 +319,7 @@ __export(src_exports, {
|
|
|
277
319
|
onChange: () => onChange,
|
|
278
320
|
setCoreRafDriver: () => setCoreRafDriver,
|
|
279
321
|
types: () => propTypes_exports,
|
|
280
|
-
val: () =>
|
|
322
|
+
val: () => val10
|
|
281
323
|
});
|
|
282
324
|
module.exports = __toCommonJS(src_exports);
|
|
283
325
|
|
|
@@ -291,7 +333,7 @@ __export(coreExports_exports, {
|
|
|
291
333
|
onChange: () => onChange,
|
|
292
334
|
setCoreRafDriver: () => setCoreRafDriver,
|
|
293
335
|
types: () => propTypes_exports,
|
|
294
|
-
val: () =>
|
|
336
|
+
val: () => val10
|
|
295
337
|
});
|
|
296
338
|
|
|
297
339
|
// core/src/projects/projectsSingleton.ts
|
|
@@ -3156,8 +3198,8 @@ var TheatreSheetObject = class {
|
|
|
3156
3198
|
}
|
|
3157
3199
|
return der.getValue();
|
|
3158
3200
|
}
|
|
3159
|
-
set initialValue(
|
|
3160
|
-
privateAPI(this).setInitialValue(
|
|
3201
|
+
set initialValue(val11) {
|
|
3202
|
+
privateAPI(this).setInitialValue(val11);
|
|
3161
3203
|
}
|
|
3162
3204
|
};
|
|
3163
3205
|
|
|
@@ -3172,6 +3214,192 @@ function memoizeFn(producer) {
|
|
|
3172
3214
|
};
|
|
3173
3215
|
}
|
|
3174
3216
|
|
|
3217
|
+
// shared/src/utils/addresses.ts
|
|
3218
|
+
var encodePathToProp = memoizeFn(
|
|
3219
|
+
(p2) => (
|
|
3220
|
+
// we're using JSON.stringify here, but we could use a faster alternative.
|
|
3221
|
+
// If you happen to do that, first make sure no `PathToProp_Encoded` is ever
|
|
3222
|
+
// used in the store, otherwise you'll have to write a migration.
|
|
3223
|
+
JSON.stringify(p2)
|
|
3224
|
+
)
|
|
3225
|
+
);
|
|
3226
|
+
|
|
3227
|
+
// shared/src/utils/removePathFromObject.ts
|
|
3228
|
+
function removePathFromObject(base, path) {
|
|
3229
|
+
if (typeof base !== "object" || base === null)
|
|
3230
|
+
return;
|
|
3231
|
+
if (path.length === 0) {
|
|
3232
|
+
for (const key of Object.keys(base)) {
|
|
3233
|
+
delete base[key];
|
|
3234
|
+
}
|
|
3235
|
+
return;
|
|
3236
|
+
}
|
|
3237
|
+
const keysUpToLastKey = path.slice(0, path.length - 1);
|
|
3238
|
+
let cur = base;
|
|
3239
|
+
const childToParentMapping = /* @__PURE__ */ new WeakMap();
|
|
3240
|
+
for (const key of keysUpToLastKey) {
|
|
3241
|
+
const parent2 = cur;
|
|
3242
|
+
const child = parent2[key];
|
|
3243
|
+
if (typeof child !== "object" || child === null) {
|
|
3244
|
+
return;
|
|
3245
|
+
} else {
|
|
3246
|
+
childToParentMapping.set(child, parent2);
|
|
3247
|
+
cur = child;
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
const keysReversed = path.slice().reverse();
|
|
3251
|
+
for (const key of keysReversed) {
|
|
3252
|
+
delete cur[key];
|
|
3253
|
+
if (Object.keys(cur).length > 0) {
|
|
3254
|
+
return;
|
|
3255
|
+
} else {
|
|
3256
|
+
cur = childToParentMapping.get(cur);
|
|
3257
|
+
continue;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
// shared/src/utils/transientPropPaths.ts
|
|
3263
|
+
function parseTransientPropPath(input) {
|
|
3264
|
+
if (typeof input === "string") {
|
|
3265
|
+
if (input.length === 0) {
|
|
3266
|
+
throw new Error(
|
|
3267
|
+
'Transient prop path cannot be an empty string. Use a dot-separated path like "foo.bar".'
|
|
3268
|
+
);
|
|
3269
|
+
}
|
|
3270
|
+
return input.split(".");
|
|
3271
|
+
}
|
|
3272
|
+
return [...input];
|
|
3273
|
+
}
|
|
3274
|
+
function isPathUnderTransientPrefix(path, prefixes) {
|
|
3275
|
+
for (let i2 = 1; i2 <= path.length; i2++) {
|
|
3276
|
+
const prefix = path.slice(0, i2);
|
|
3277
|
+
if (prefixes.has(encodePathToProp(prefix))) {
|
|
3278
|
+
return true;
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
return false;
|
|
3282
|
+
}
|
|
3283
|
+
function normalizePropPaths(paths, config, objectKeyForError, optionName) {
|
|
3284
|
+
if (!paths || paths.length === 0) {
|
|
3285
|
+
return /* @__PURE__ */ new Set();
|
|
3286
|
+
}
|
|
3287
|
+
const result = /* @__PURE__ */ new Set();
|
|
3288
|
+
for (const rawPath of paths) {
|
|
3289
|
+
const pathToProp = parseTransientPropPath(rawPath);
|
|
3290
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3291
|
+
const propConfig = getPropConfigByPath(config, pathToProp);
|
|
3292
|
+
if (!propConfig) {
|
|
3293
|
+
throw new Error(
|
|
3294
|
+
'sheet.object("'.concat(objectKeyForError, '", ..., { ').concat(optionName, ": [...] }): ") + "path ".concat(JSON.stringify(
|
|
3295
|
+
rawPath
|
|
3296
|
+
), " does not match any prop in the object's config.")
|
|
3297
|
+
);
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
result.add(encodePathToProp(pathToProp));
|
|
3301
|
+
}
|
|
3302
|
+
return result;
|
|
3303
|
+
}
|
|
3304
|
+
function normalizeTransientPropPaths(paths, config, objectKeyForError) {
|
|
3305
|
+
return normalizePropPaths(paths, config, objectKeyForError, "transient");
|
|
3306
|
+
}
|
|
3307
|
+
function normalizeStaticPropPaths(paths, config, objectKeyForError) {
|
|
3308
|
+
return normalizePropPaths(paths, config, objectKeyForError, "static");
|
|
3309
|
+
}
|
|
3310
|
+
function stripTransientPathsFromSerializableMap(map, prefixes) {
|
|
3311
|
+
if (prefixes.size === 0) {
|
|
3312
|
+
return map;
|
|
3313
|
+
}
|
|
3314
|
+
const result = cloneDeep_default(map);
|
|
3315
|
+
for (const encodedPrefix of prefixes) {
|
|
3316
|
+
const path = JSON.parse(encodedPrefix);
|
|
3317
|
+
removePathFromObject(result, path);
|
|
3318
|
+
}
|
|
3319
|
+
return result;
|
|
3320
|
+
}
|
|
3321
|
+
function stripTransientPathsFromSequenceTracks(sequence, objectKey, prefixes) {
|
|
3322
|
+
var _a;
|
|
3323
|
+
if (!sequence || prefixes.size === 0)
|
|
3324
|
+
return;
|
|
3325
|
+
const objectTracks = (_a = sequence.tracksByObject) == null ? void 0 : _a[objectKey];
|
|
3326
|
+
if (!objectTracks)
|
|
3327
|
+
return;
|
|
3328
|
+
for (const [encodedPath, trackId] of Object.entries(
|
|
3329
|
+
objectTracks.trackIdByPropPath
|
|
3330
|
+
)) {
|
|
3331
|
+
if (typeof trackId !== "string")
|
|
3332
|
+
continue;
|
|
3333
|
+
const path = JSON.parse(encodedPath);
|
|
3334
|
+
if (isPathUnderTransientPrefix(path, prefixes)) {
|
|
3335
|
+
delete objectTracks.trackIdByPropPath[encodedPath];
|
|
3336
|
+
delete objectTracks.trackData[trackId];
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
if (objectTracks.unsequencedPropPaths) {
|
|
3340
|
+
objectTracks.unsequencedPropPaths = objectTracks.unsequencedPropPaths.filter(
|
|
3341
|
+
(encodedPath) => !isPathUnderTransientPrefix(
|
|
3342
|
+
JSON.parse(encodedPath),
|
|
3343
|
+
prefixes
|
|
3344
|
+
)
|
|
3345
|
+
);
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
function stripSequenceTracksForPathsFromObjectInSheetState(sheetState, objectKey, prefixes) {
|
|
3349
|
+
if (prefixes.size === 0)
|
|
3350
|
+
return;
|
|
3351
|
+
stripTransientPathsFromSequenceTracks(
|
|
3352
|
+
sheetState.sequence,
|
|
3353
|
+
objectKey,
|
|
3354
|
+
prefixes
|
|
3355
|
+
);
|
|
3356
|
+
if (sheetState.sequencesById) {
|
|
3357
|
+
for (const sequence of Object.values(sheetState.sequencesById)) {
|
|
3358
|
+
stripTransientPathsFromSequenceTracks(sequence, objectKey, prefixes);
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
function stripTransientPropsFromObjectInSheetState(sheetState, objectKey, prefixes) {
|
|
3363
|
+
if (prefixes.size === 0)
|
|
3364
|
+
return;
|
|
3365
|
+
const staticOverrides = sheetState.staticOverrides.byObject[objectKey];
|
|
3366
|
+
if (staticOverrides) {
|
|
3367
|
+
sheetState.staticOverrides.byObject[objectKey] = stripTransientPathsFromSerializableMap(staticOverrides, prefixes);
|
|
3368
|
+
}
|
|
3369
|
+
if (sheetState.staticOverridesByVariant) {
|
|
3370
|
+
for (const variantOverrides of Object.values(
|
|
3371
|
+
sheetState.staticOverridesByVariant
|
|
3372
|
+
)) {
|
|
3373
|
+
const objOverrides = variantOverrides == null ? void 0 : variantOverrides.byObject[objectKey];
|
|
3374
|
+
if (objOverrides) {
|
|
3375
|
+
variantOverrides.byObject[objectKey] = stripTransientPathsFromSerializableMap(objOverrides, prefixes);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
stripTransientPathsFromSequenceTracks(
|
|
3380
|
+
sheetState.sequence,
|
|
3381
|
+
objectKey,
|
|
3382
|
+
prefixes
|
|
3383
|
+
);
|
|
3384
|
+
if (sheetState.sequencesById) {
|
|
3385
|
+
for (const sequence of Object.values(sheetState.sequencesById)) {
|
|
3386
|
+
stripTransientPathsFromSequenceTracks(sequence, objectKey, prefixes);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
var transientPropPathsRegistry = /* @__PURE__ */ new Map();
|
|
3391
|
+
function transientPropPathsRegistryKey(projectId, sheetId, objectKey) {
|
|
3392
|
+
return "".concat(projectId, "\0").concat(sheetId, "\0").concat(objectKey);
|
|
3393
|
+
}
|
|
3394
|
+
function registerObjectTransientPropPaths(projectId, sheetId, objectKey, paths) {
|
|
3395
|
+
const key = transientPropPathsRegistryKey(projectId, sheetId, objectKey);
|
|
3396
|
+
if (paths.size === 0) {
|
|
3397
|
+
transientPropPathsRegistry.delete(key);
|
|
3398
|
+
} else {
|
|
3399
|
+
transientPropPathsRegistry.set(key, paths);
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3175
3403
|
// shared/src/propTypes/utils.ts
|
|
3176
3404
|
function isPropConfigComposite(c2) {
|
|
3177
3405
|
return c2.type === "compound" || c2.type === "enum";
|
|
@@ -3187,6 +3415,25 @@ function getPropConfigByPath(parentConf, path) {
|
|
|
3187
3415
|
const sub = parentConf.type === "enum" ? parentConf.cases[key] : parentConf.props[key];
|
|
3188
3416
|
return getPropConfigByPath(sub, rest);
|
|
3189
3417
|
}
|
|
3418
|
+
function propTypeConfigPersists(conf) {
|
|
3419
|
+
if (conf.type === "image") {
|
|
3420
|
+
return conf.persist !== false;
|
|
3421
|
+
}
|
|
3422
|
+
return true;
|
|
3423
|
+
}
|
|
3424
|
+
function getNonPersistingPropPathEncodings(config) {
|
|
3425
|
+
const result = /* @__PURE__ */ new Set();
|
|
3426
|
+
for (const { path, conf } of iteratePropType(config, [])) {
|
|
3427
|
+
if (!propTypeConfigPersists(conf)) {
|
|
3428
|
+
result.add(encodePathToProp(path));
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
return result;
|
|
3432
|
+
}
|
|
3433
|
+
function stripNonPersistingPropValuesFromMap(map, config) {
|
|
3434
|
+
const paths = getNonPersistingPropPathEncodings(config);
|
|
3435
|
+
return stripTransientPathsFromSerializableMap(map, paths);
|
|
3436
|
+
}
|
|
3190
3437
|
function isPropConfSequencable(conf) {
|
|
3191
3438
|
return !isPropConfigComposite(conf);
|
|
3192
3439
|
}
|
|
@@ -3208,6 +3455,61 @@ var compoundHasSimpleDescendants = memoizeFn(
|
|
|
3208
3455
|
return false;
|
|
3209
3456
|
}
|
|
3210
3457
|
);
|
|
3458
|
+
function* iteratePropType(conf, pathPrefix) {
|
|
3459
|
+
if (conf.type === "compound") {
|
|
3460
|
+
for (const key in conf.props) {
|
|
3461
|
+
yield* __yieldStar(iteratePropType(conf.props[key], [
|
|
3462
|
+
...pathPrefix,
|
|
3463
|
+
key
|
|
3464
|
+
]));
|
|
3465
|
+
}
|
|
3466
|
+
} else if (conf.type === "enum") {
|
|
3467
|
+
throw new Error("Not implemented yet");
|
|
3468
|
+
} else {
|
|
3469
|
+
return yield { path: pathPrefix, conf };
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
// shared/src/utils/updateDeep.ts
|
|
3474
|
+
function updateDeep(obj, path, reducer) {
|
|
3475
|
+
if (path.length === 0)
|
|
3476
|
+
return reducer(obj);
|
|
3477
|
+
return hoop(obj, path, reducer);
|
|
3478
|
+
}
|
|
3479
|
+
var hoop = (s2, path, reducer) => {
|
|
3480
|
+
if (path.length === 0) {
|
|
3481
|
+
return reducer(s2);
|
|
3482
|
+
}
|
|
3483
|
+
if (Array.isArray(s2)) {
|
|
3484
|
+
let [index, ...restOfPath] = path;
|
|
3485
|
+
index = parseInt(String(index), 10);
|
|
3486
|
+
if (isNaN(index))
|
|
3487
|
+
index = 0;
|
|
3488
|
+
const oldVal = s2[index];
|
|
3489
|
+
const newVal = hoop(oldVal, restOfPath, reducer);
|
|
3490
|
+
if (oldVal === newVal)
|
|
3491
|
+
return s2;
|
|
3492
|
+
const newS = [...s2];
|
|
3493
|
+
newS.splice(index, 1, newVal);
|
|
3494
|
+
return newS;
|
|
3495
|
+
} else if (typeof s2 === "object" && s2 !== null) {
|
|
3496
|
+
const [key, ...restOfPath] = path;
|
|
3497
|
+
const oldVal = s2[key];
|
|
3498
|
+
const newVal = hoop(oldVal, restOfPath, reducer);
|
|
3499
|
+
if (oldVal === newVal)
|
|
3500
|
+
return s2;
|
|
3501
|
+
const newS = __spreadProps(__spreadValues({}, s2), { [key]: newVal });
|
|
3502
|
+
return newS;
|
|
3503
|
+
} else {
|
|
3504
|
+
const [key, ...restOfPath] = path;
|
|
3505
|
+
return { [key]: hoop(void 0, restOfPath, reducer) };
|
|
3506
|
+
}
|
|
3507
|
+
};
|
|
3508
|
+
|
|
3509
|
+
// shared/src/utils/setDeepImmutable.ts
|
|
3510
|
+
function setDeepImmutable(obj, path, replace) {
|
|
3511
|
+
return updateDeep(obj, path, () => replace);
|
|
3512
|
+
}
|
|
3211
3513
|
|
|
3212
3514
|
// core/src/sequences/sequenceVariants.ts
|
|
3213
3515
|
var import_theatre_dataverse5 = require("@unseenco/theatre-dataverse");
|
|
@@ -3420,6 +3722,11 @@ var SheetObject = class {
|
|
|
3420
3722
|
* no-op merge for every app that never uses the remote-sync feature.
|
|
3421
3723
|
*/
|
|
3422
3724
|
__publicField(this, "_remoteOverride", new import_theatre_dataverse6.Atom({}));
|
|
3725
|
+
/**
|
|
3726
|
+
* Session-only overrides for props with `persist: false`. Not written to
|
|
3727
|
+
* persisted project state and cleared on refresh.
|
|
3728
|
+
*/
|
|
3729
|
+
__publicField(this, "_sessionOverrides", new import_theatre_dataverse6.Atom({}));
|
|
3423
3730
|
__publicField(this, "_cache", new SimpleCache());
|
|
3424
3731
|
__publicField(this, "_logger");
|
|
3425
3732
|
__publicField(this, "_internalUtilCtx");
|
|
@@ -3493,6 +3800,17 @@ var SheetObject = class {
|
|
|
3493
3800
|
const withSeqs = deepMergeWithCache(final, sequenced, withSeqsCache);
|
|
3494
3801
|
final = withSeqs;
|
|
3495
3802
|
}
|
|
3803
|
+
const sessionOverrides = (0, import_theatre_dataverse6.val)(this._sessionOverrides.pointer);
|
|
3804
|
+
const withSessionOverridesCache = import_theatre_dataverse6.prism.memo(
|
|
3805
|
+
"withSessionOverridesCache",
|
|
3806
|
+
() => /* @__PURE__ */ new WeakMap(),
|
|
3807
|
+
[]
|
|
3808
|
+
);
|
|
3809
|
+
final = deepMergeWithCache(
|
|
3810
|
+
final,
|
|
3811
|
+
sessionOverrides,
|
|
3812
|
+
withSessionOverridesCache
|
|
3813
|
+
);
|
|
3496
3814
|
const remoteOverride = (0, import_theatre_dataverse6.val)(this._remoteOverride.pointer);
|
|
3497
3815
|
const withRemoteOverrideCache = import_theatre_dataverse6.prism.memo(
|
|
3498
3816
|
"withRemoteOverrideCache",
|
|
@@ -3542,6 +3860,8 @@ var SheetObject = class {
|
|
|
3542
3860
|
() => {
|
|
3543
3861
|
const untaps = [];
|
|
3544
3862
|
for (const { trackId, pathToProp, trackVariant } of tracksToProcess) {
|
|
3863
|
+
if (this.template.isNonSequencablePropPath(pathToProp))
|
|
3864
|
+
continue;
|
|
3545
3865
|
const pr = this._trackIdToPrism(trackId, trackVariant);
|
|
3546
3866
|
const propConfig = getPropConfigByPath(
|
|
3547
3867
|
config,
|
|
@@ -3604,16 +3924,32 @@ var SheetObject = class {
|
|
|
3604
3924
|
}
|
|
3605
3925
|
validateValue(pointer3, value) {
|
|
3606
3926
|
}
|
|
3607
|
-
setInitialValue(
|
|
3608
|
-
this.validateValue(this.propsP,
|
|
3609
|
-
this._initialValue.set(
|
|
3927
|
+
setInitialValue(val11) {
|
|
3928
|
+
this.validateValue(this.propsP, val11);
|
|
3929
|
+
this._initialValue.set(val11);
|
|
3930
|
+
}
|
|
3931
|
+
setSessionOverride(path, value) {
|
|
3932
|
+
const propConfig = getPropConfigByPath(this.template.staticConfig, path);
|
|
3933
|
+
if (!propConfig)
|
|
3934
|
+
return;
|
|
3935
|
+
const sanitized = propConfig.deserializeAndSanitize(value);
|
|
3936
|
+
if (sanitized === void 0)
|
|
3937
|
+
return;
|
|
3938
|
+
this._sessionOverrides.set(
|
|
3939
|
+
setDeepImmutable(this._sessionOverrides.get(), path, sanitized)
|
|
3940
|
+
);
|
|
3941
|
+
}
|
|
3942
|
+
unsetSessionOverride(path) {
|
|
3943
|
+
const next = cloneDeep_default(this._sessionOverrides.get());
|
|
3944
|
+
removePathFromObject(next, path);
|
|
3945
|
+
this._sessionOverrides.set(next);
|
|
3610
3946
|
}
|
|
3611
3947
|
/**
|
|
3612
3948
|
* Internal: called by `RemoteSync` when a value update for this object
|
|
3613
3949
|
* arrives from a remote editor window. Not exposed on the public API.
|
|
3614
3950
|
*/
|
|
3615
|
-
setRemoteOverride(
|
|
3616
|
-
this._remoteOverride.set(
|
|
3951
|
+
setRemoteOverride(val11) {
|
|
3952
|
+
this._remoteOverride.set(val11);
|
|
3617
3953
|
}
|
|
3618
3954
|
/**
|
|
3619
3955
|
* Internal: used by `RemoteSync` to subscribe to this object's fully
|
|
@@ -4102,7 +4438,7 @@ function isObjectEmpty(obj) {
|
|
|
4102
4438
|
return typeof obj === "object" && obj !== null && Object.keys(obj).length === 0;
|
|
4103
4439
|
}
|
|
4104
4440
|
var SheetObjectTemplate = class {
|
|
4105
|
-
constructor(sheetTemplate, objectKey, nativeObject, config, _temp_actions) {
|
|
4441
|
+
constructor(sheetTemplate, objectKey, nativeObject, config, _temp_actions, transient, staticPropPaths) {
|
|
4106
4442
|
this.sheetTemplate = sheetTemplate;
|
|
4107
4443
|
__publicField(this, "address");
|
|
4108
4444
|
__publicField(this, "type", "Theatre_SheetObjectTemplate");
|
|
@@ -4114,15 +4450,36 @@ var SheetObjectTemplate = class {
|
|
|
4114
4450
|
__publicField(this, "pointerToStaticOverrides");
|
|
4115
4451
|
__publicField(this, "pointerToAhistoricSheetState");
|
|
4116
4452
|
__publicField(this, "pointerToAhistoricStaticOverrides");
|
|
4453
|
+
__publicField(this, "_transientPropPaths", /* @__PURE__ */ new Set());
|
|
4454
|
+
__publicField(this, "_staticPropPaths", /* @__PURE__ */ new Set());
|
|
4117
4455
|
__publicField(this, "_visibleInOutline", true);
|
|
4118
4456
|
this.address = __spreadProps(__spreadValues({}, sheetTemplate.address), { objectKey });
|
|
4119
4457
|
this._config = new import_theatre_dataverse7.Atom(config);
|
|
4120
4458
|
this._temp_actions_atom = new import_theatre_dataverse7.Atom(_temp_actions);
|
|
4459
|
+
this._transientPropPaths = normalizeTransientPropPaths(
|
|
4460
|
+
transient,
|
|
4461
|
+
config,
|
|
4462
|
+
objectKey
|
|
4463
|
+
);
|
|
4464
|
+
this._staticPropPaths = normalizeStaticPropPaths(
|
|
4465
|
+
staticPropPaths,
|
|
4466
|
+
config,
|
|
4467
|
+
objectKey
|
|
4468
|
+
);
|
|
4121
4469
|
this.project = sheetTemplate.project;
|
|
4470
|
+
registerObjectTransientPropPaths(
|
|
4471
|
+
this.address.projectId,
|
|
4472
|
+
this.address.sheetId,
|
|
4473
|
+
objectKey,
|
|
4474
|
+
this._transientPropPaths
|
|
4475
|
+
);
|
|
4122
4476
|
this.pointerToSheetState = this.sheetTemplate.project.pointers.historic.sheetsById[this.address.sheetId];
|
|
4123
4477
|
this.pointerToStaticOverrides = this.pointerToSheetState.staticOverrides.byObject[this.address.objectKey];
|
|
4124
4478
|
this.pointerToAhistoricSheetState = this.sheetTemplate.project.pointers.ahistoric.sheetsById[this.address.sheetId];
|
|
4125
4479
|
this.pointerToAhistoricStaticOverrides = this.pointerToAhistoricSheetState.staticOverrides.byObject[this.address.objectKey];
|
|
4480
|
+
this._stripTransientFromHistoricState();
|
|
4481
|
+
this._stripSequencedStaticPathsFromHistoricState();
|
|
4482
|
+
this._stripNonPersistingPropsFromAhistoricState();
|
|
4126
4483
|
}
|
|
4127
4484
|
get staticConfig() {
|
|
4128
4485
|
return this._config.get();
|
|
@@ -4136,12 +4493,85 @@ var SheetObjectTemplate = class {
|
|
|
4136
4493
|
get _temp_actionsPointer() {
|
|
4137
4494
|
return this._temp_actions_atom.pointer;
|
|
4138
4495
|
}
|
|
4496
|
+
_stripNonPersistingPropsFromAhistoricState() {
|
|
4497
|
+
const config = (0, import_theatre_dataverse7.val)(this.configPointer);
|
|
4498
|
+
this.project._stripNonPersistingPropsFromAhistoric(
|
|
4499
|
+
this.address.sheetId,
|
|
4500
|
+
this.address.objectKey,
|
|
4501
|
+
config
|
|
4502
|
+
);
|
|
4503
|
+
this.project._stripNonPersistingPropsFromHistoric(
|
|
4504
|
+
this.address.sheetId,
|
|
4505
|
+
this.address.objectKey,
|
|
4506
|
+
config
|
|
4507
|
+
);
|
|
4508
|
+
}
|
|
4509
|
+
_stripTransientFromHistoricState() {
|
|
4510
|
+
if (this._transientPropPaths.size === 0)
|
|
4511
|
+
return;
|
|
4512
|
+
this.project._stripTransientPropsFromHistoric(
|
|
4513
|
+
this.address.sheetId,
|
|
4514
|
+
this.address.objectKey,
|
|
4515
|
+
this._transientPropPaths
|
|
4516
|
+
);
|
|
4517
|
+
}
|
|
4518
|
+
_stripSequencedStaticPathsFromHistoricState() {
|
|
4519
|
+
if (this._staticPropPaths.size === 0)
|
|
4520
|
+
return;
|
|
4521
|
+
this.project._stripSequenceTracksFromHistoric(
|
|
4522
|
+
this.address.sheetId,
|
|
4523
|
+
this.address.objectKey,
|
|
4524
|
+
this._staticPropPaths
|
|
4525
|
+
);
|
|
4526
|
+
}
|
|
4139
4527
|
createInstance(sheet, nativeObject, config) {
|
|
4140
4528
|
this._config.set(config);
|
|
4141
4529
|
return new SheetObject(sheet, this, nativeObject);
|
|
4142
4530
|
}
|
|
4143
4531
|
reconfigure(config) {
|
|
4144
4532
|
this._config.set(config);
|
|
4533
|
+
this._stripNonPersistingPropsFromAhistoricState();
|
|
4534
|
+
}
|
|
4535
|
+
setTransientPropPaths(transient, config) {
|
|
4536
|
+
this._transientPropPaths = normalizeTransientPropPaths(
|
|
4537
|
+
transient,
|
|
4538
|
+
config,
|
|
4539
|
+
this.address.objectKey
|
|
4540
|
+
);
|
|
4541
|
+
registerObjectTransientPropPaths(
|
|
4542
|
+
this.address.projectId,
|
|
4543
|
+
this.address.sheetId,
|
|
4544
|
+
this.address.objectKey,
|
|
4545
|
+
this._transientPropPaths
|
|
4546
|
+
);
|
|
4547
|
+
this._stripTransientFromHistoricState();
|
|
4548
|
+
}
|
|
4549
|
+
setStaticPropPaths(staticPropPaths, config) {
|
|
4550
|
+
this._staticPropPaths = normalizeStaticPropPaths(
|
|
4551
|
+
staticPropPaths,
|
|
4552
|
+
config,
|
|
4553
|
+
this.address.objectKey
|
|
4554
|
+
);
|
|
4555
|
+
this._stripSequencedStaticPathsFromHistoricState();
|
|
4556
|
+
}
|
|
4557
|
+
isStaticPropPath(path) {
|
|
4558
|
+
return isPathUnderTransientPrefix(path, this._staticPropPaths);
|
|
4559
|
+
}
|
|
4560
|
+
isNonSequencablePropPath(path) {
|
|
4561
|
+
if (this.isTransientPropPath(path) || this.isStaticPropPath(path)) {
|
|
4562
|
+
return true;
|
|
4563
|
+
}
|
|
4564
|
+
const propConfig = getPropConfigByPath(this.staticConfig, path);
|
|
4565
|
+
return propConfig ? !propTypeConfigPersists(propConfig) : false;
|
|
4566
|
+
}
|
|
4567
|
+
getStaticPropPaths() {
|
|
4568
|
+
return this._staticPropPaths;
|
|
4569
|
+
}
|
|
4570
|
+
isTransientPropPath(path) {
|
|
4571
|
+
return isPathUnderTransientPrefix(path, this._transientPropPaths);
|
|
4572
|
+
}
|
|
4573
|
+
getTransientPropPaths() {
|
|
4574
|
+
return this._transientPropPaths;
|
|
4145
4575
|
}
|
|
4146
4576
|
/**
|
|
4147
4577
|
* The `actions` api is temporary until we implement events.
|
|
@@ -4184,7 +4614,17 @@ var SheetObjectTemplate = class {
|
|
|
4184
4614
|
)) != null ? _a : {};
|
|
4185
4615
|
const config = (0, import_theatre_dataverse7.val)(this.configPointer);
|
|
4186
4616
|
const deserialized = config.deserializeAndSanitize(json) || {};
|
|
4187
|
-
|
|
4617
|
+
const withoutNonPersisting = stripNonPersistingPropValuesFromMap(
|
|
4618
|
+
deserialized,
|
|
4619
|
+
config
|
|
4620
|
+
);
|
|
4621
|
+
if (this._transientPropPaths.size > 0) {
|
|
4622
|
+
return stripTransientPathsFromSerializableMap(
|
|
4623
|
+
withoutNonPersisting,
|
|
4624
|
+
this._transientPropPaths
|
|
4625
|
+
);
|
|
4626
|
+
}
|
|
4627
|
+
return withoutNonPersisting;
|
|
4188
4628
|
})
|
|
4189
4629
|
);
|
|
4190
4630
|
}
|
|
@@ -4200,7 +4640,7 @@ var SheetObjectTemplate = class {
|
|
|
4200
4640
|
const json = (_a = (0, import_theatre_dataverse7.val)(this.pointerToAhistoricStaticOverrides)) != null ? _a : {};
|
|
4201
4641
|
const config = (0, import_theatre_dataverse7.val)(this.configPointer);
|
|
4202
4642
|
const deserialized = config.deserializeAndSanitize(json) || {};
|
|
4203
|
-
return deserialized;
|
|
4643
|
+
return stripNonPersistingPropValuesFromMap(deserialized, config);
|
|
4204
4644
|
})
|
|
4205
4645
|
);
|
|
4206
4646
|
}
|
|
@@ -4257,6 +4697,8 @@ var SheetObjectTemplate = class {
|
|
|
4257
4697
|
const pathToProp = parsePathToProp(pathToPropInString);
|
|
4258
4698
|
if (!pathToProp)
|
|
4259
4699
|
continue;
|
|
4700
|
+
if (this.isNonSequencablePropPath(pathToProp))
|
|
4701
|
+
continue;
|
|
4260
4702
|
const propConfig = getPropConfigByPath(objectConfig, pathToProp);
|
|
4261
4703
|
const isSequencable = propConfig && isPropConfSequencable(propConfig);
|
|
4262
4704
|
if (!isSequencable)
|
|
@@ -4368,16 +4810,6 @@ function parsePathToProp(pathToPropInString) {
|
|
|
4368
4810
|
// core/src/sheets/SheetTemplate.ts
|
|
4369
4811
|
var import_theatre_dataverse16 = require("@unseenco/theatre-dataverse");
|
|
4370
4812
|
|
|
4371
|
-
// shared/src/utils/addresses.ts
|
|
4372
|
-
var encodePathToProp = memoizeFn(
|
|
4373
|
-
(p2) => (
|
|
4374
|
-
// we're using JSON.stringify here, but we could use a faster alternative.
|
|
4375
|
-
// If you happen to do that, first make sure no `PathToProp_Encoded` is ever
|
|
4376
|
-
// used in the store, otherwise you'll have to write a migration.
|
|
4377
|
-
JSON.stringify(p2)
|
|
4378
|
-
)
|
|
4379
|
-
);
|
|
4380
|
-
|
|
4381
4813
|
// shared/src/utils/didYouMean.ts
|
|
4382
4814
|
var import_propose = __toESM(require_propose());
|
|
4383
4815
|
function didYouMean(str, dictionary, prepend = "Did you mean ", append = "?") {
|
|
@@ -5608,11 +6040,11 @@ function sanitizeCompoundProps(props) {
|
|
|
5608
6040
|
);
|
|
5609
6041
|
}
|
|
5610
6042
|
}
|
|
5611
|
-
const
|
|
5612
|
-
if (isLonghandPropType(
|
|
5613
|
-
sanitizedProps[key] =
|
|
6043
|
+
const val11 = props[key];
|
|
6044
|
+
if (isLonghandPropType(val11)) {
|
|
6045
|
+
sanitizedProps[key] = val11;
|
|
5614
6046
|
} else {
|
|
5615
|
-
sanitizedProps[key] = toLonghandProp(
|
|
6047
|
+
sanitizedProps[key] = toLonghandProp(val11);
|
|
5616
6048
|
}
|
|
5617
6049
|
}
|
|
5618
6050
|
return sanitizedProps;
|
|
@@ -5710,18 +6142,18 @@ var file = (defaultValue, opts = {}) => {
|
|
|
5710
6142
|
deserializeAndSanitize: _ensureFile
|
|
5711
6143
|
};
|
|
5712
6144
|
};
|
|
5713
|
-
var _ensureFile = (
|
|
5714
|
-
if (!
|
|
6145
|
+
var _ensureFile = (val11) => {
|
|
6146
|
+
if (!val11)
|
|
5715
6147
|
return void 0;
|
|
5716
6148
|
let valid = true;
|
|
5717
|
-
if (typeof
|
|
6149
|
+
if (typeof val11.id !== "string" && ![null, void 0].includes(val11.id)) {
|
|
5718
6150
|
valid = false;
|
|
5719
6151
|
}
|
|
5720
|
-
if (
|
|
6152
|
+
if (val11.type !== "file")
|
|
5721
6153
|
valid = false;
|
|
5722
6154
|
if (!valid)
|
|
5723
6155
|
return void 0;
|
|
5724
|
-
return
|
|
6156
|
+
return val11;
|
|
5725
6157
|
};
|
|
5726
6158
|
var image = (defaultValue, opts = {}) => {
|
|
5727
6159
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -5741,22 +6173,23 @@ var image = (defaultValue, opts = {}) => {
|
|
|
5741
6173
|
valueType: null,
|
|
5742
6174
|
[propTypeSymbol]: "TheatrePropType",
|
|
5743
6175
|
label: opts.label,
|
|
6176
|
+
persist: opts.persist !== false,
|
|
5744
6177
|
interpolate,
|
|
5745
6178
|
deserializeAndSanitize: _ensureImage
|
|
5746
6179
|
};
|
|
5747
6180
|
};
|
|
5748
|
-
var _ensureImage = (
|
|
5749
|
-
if (!
|
|
6181
|
+
var _ensureImage = (val11) => {
|
|
6182
|
+
if (!val11)
|
|
5750
6183
|
return void 0;
|
|
5751
6184
|
let valid = true;
|
|
5752
|
-
if (typeof
|
|
6185
|
+
if (typeof val11.id !== "string" && ![null, void 0].includes(val11.id)) {
|
|
5753
6186
|
valid = false;
|
|
5754
6187
|
}
|
|
5755
|
-
if (
|
|
6188
|
+
if (val11.type !== "image")
|
|
5756
6189
|
valid = false;
|
|
5757
6190
|
if (!valid)
|
|
5758
6191
|
return void 0;
|
|
5759
|
-
return
|
|
6192
|
+
return val11;
|
|
5760
6193
|
};
|
|
5761
6194
|
var number = (defaultValue, opts = {}) => {
|
|
5762
6195
|
var _a;
|
|
@@ -5871,12 +6304,12 @@ var rgba = (defaultValue = { r: 0, g: 0, b: 0, a: 1 }, opts = {}) => {
|
|
|
5871
6304
|
deserializeAndSanitize: _sanitizeRgba
|
|
5872
6305
|
};
|
|
5873
6306
|
};
|
|
5874
|
-
var _sanitizeRgba = (
|
|
5875
|
-
if (!
|
|
6307
|
+
var _sanitizeRgba = (val11) => {
|
|
6308
|
+
if (!val11)
|
|
5876
6309
|
return void 0;
|
|
5877
6310
|
let valid = true;
|
|
5878
6311
|
for (const c2 of ["r", "g", "b", "a"]) {
|
|
5879
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
6312
|
+
if (!Object.prototype.hasOwnProperty.call(val11, c2) || typeof val11[c2] !== "number") {
|
|
5880
6313
|
valid = false;
|
|
5881
6314
|
}
|
|
5882
6315
|
}
|
|
@@ -5886,7 +6319,7 @@ var _sanitizeRgba = (val10) => {
|
|
|
5886
6319
|
for (const c2 of ["r", "g", "b", "a"]) {
|
|
5887
6320
|
;
|
|
5888
6321
|
sanitized[c2] = Math.min(
|
|
5889
|
-
Math.max(
|
|
6322
|
+
Math.max(val11[c2], 0),
|
|
5890
6323
|
1
|
|
5891
6324
|
);
|
|
5892
6325
|
}
|
|
@@ -5926,8 +6359,8 @@ var boolean = (defaultValue, opts = {}) => {
|
|
|
5926
6359
|
deserializeAndSanitize: _ensureBoolean
|
|
5927
6360
|
};
|
|
5928
6361
|
};
|
|
5929
|
-
var _ensureBoolean = (
|
|
5930
|
-
return typeof
|
|
6362
|
+
var _ensureBoolean = (val11) => {
|
|
6363
|
+
return typeof val11 === "boolean" ? val11 : void 0;
|
|
5931
6364
|
};
|
|
5932
6365
|
function leftInterpolate(left) {
|
|
5933
6366
|
return left;
|
|
@@ -6076,6 +6509,18 @@ var TheatreSheet = class {
|
|
|
6076
6509
|
if ((opts == null ? void 0 : opts.reconfigure) === true) {
|
|
6077
6510
|
const sanitizedConfig = compound(config);
|
|
6078
6511
|
existingObject.template.reconfigure(sanitizedConfig);
|
|
6512
|
+
if (opts.transient !== void 0) {
|
|
6513
|
+
existingObject.template.setTransientPropPaths(
|
|
6514
|
+
opts.transient,
|
|
6515
|
+
sanitizedConfig
|
|
6516
|
+
);
|
|
6517
|
+
}
|
|
6518
|
+
if (opts.static !== void 0) {
|
|
6519
|
+
existingObject.template.setStaticPropPaths(
|
|
6520
|
+
opts.static,
|
|
6521
|
+
sanitizedConfig
|
|
6522
|
+
);
|
|
6523
|
+
}
|
|
6079
6524
|
weakMapOfUnsanitizedProps.set(existingObject, config);
|
|
6080
6525
|
return existingObject.publicApi;
|
|
6081
6526
|
} else {
|
|
@@ -6092,6 +6537,18 @@ var TheatreSheet = class {
|
|
|
6092
6537
|
if ((opts == null ? void 0 : opts.visible) !== void 0) {
|
|
6093
6538
|
existingObject.template.setVisibleInOutline(opts.visible);
|
|
6094
6539
|
}
|
|
6540
|
+
if ((opts == null ? void 0 : opts.transient) !== void 0) {
|
|
6541
|
+
existingObject.template.setTransientPropPaths(
|
|
6542
|
+
opts.transient,
|
|
6543
|
+
existingObject.template.staticConfig
|
|
6544
|
+
);
|
|
6545
|
+
}
|
|
6546
|
+
if ((opts == null ? void 0 : opts.static) !== void 0) {
|
|
6547
|
+
existingObject.template.setStaticPropPaths(
|
|
6548
|
+
opts.static,
|
|
6549
|
+
existingObject.template.staticConfig
|
|
6550
|
+
);
|
|
6551
|
+
}
|
|
6095
6552
|
return existingObject.publicApi;
|
|
6096
6553
|
} else {
|
|
6097
6554
|
const sanitizedConfig = compound(config);
|
|
@@ -6100,7 +6557,9 @@ var TheatreSheet = class {
|
|
|
6100
6557
|
nativeObject,
|
|
6101
6558
|
sanitizedConfig,
|
|
6102
6559
|
actions,
|
|
6103
|
-
opts == null ? void 0 : opts.visible
|
|
6560
|
+
opts == null ? void 0 : opts.visible,
|
|
6561
|
+
opts == null ? void 0 : opts.transient,
|
|
6562
|
+
opts == null ? void 0 : opts.static
|
|
6104
6563
|
);
|
|
6105
6564
|
if (process.env.NODE_ENV !== "production") {
|
|
6106
6565
|
weakMapOfUnsanitizedProps.set(object, config);
|
|
@@ -6209,12 +6668,14 @@ var Sheet = class {
|
|
|
6209
6668
|
* @remarks At some point, we have to reconcile the concept of "an object"
|
|
6210
6669
|
* with that of "an element."
|
|
6211
6670
|
*/
|
|
6212
|
-
createObject(objectKey, nativeObject, config, actions = {}, visibleInOutline) {
|
|
6671
|
+
createObject(objectKey, nativeObject, config, actions = {}, visibleInOutline, transient, staticPropPaths) {
|
|
6213
6672
|
const objTemplate = this.template.getObjectTemplate(
|
|
6214
6673
|
objectKey,
|
|
6215
6674
|
nativeObject,
|
|
6216
6675
|
config,
|
|
6217
|
-
actions
|
|
6676
|
+
actions,
|
|
6677
|
+
transient,
|
|
6678
|
+
staticPropPaths
|
|
6218
6679
|
);
|
|
6219
6680
|
if (visibleInOutline !== void 0) {
|
|
6220
6681
|
objTemplate.setVisibleInOutline(visibleInOutline);
|
|
@@ -6329,7 +6790,7 @@ var SheetTemplate = class {
|
|
|
6329
6790
|
}
|
|
6330
6791
|
return inst;
|
|
6331
6792
|
}
|
|
6332
|
-
getObjectTemplate(objectKey, nativeObject, config, actions) {
|
|
6793
|
+
getObjectTemplate(objectKey, nativeObject, config, actions, transient, staticPropPaths) {
|
|
6333
6794
|
let template = this._objectTemplates.get()[objectKey];
|
|
6334
6795
|
if (!template) {
|
|
6335
6796
|
template = new SheetObjectTemplate(
|
|
@@ -6337,9 +6798,18 @@ var SheetTemplate = class {
|
|
|
6337
6798
|
objectKey,
|
|
6338
6799
|
nativeObject,
|
|
6339
6800
|
config,
|
|
6340
|
-
actions
|
|
6801
|
+
actions,
|
|
6802
|
+
transient,
|
|
6803
|
+
staticPropPaths
|
|
6341
6804
|
);
|
|
6342
6805
|
this._objectTemplates.setByPointer((p2) => p2[objectKey], template);
|
|
6806
|
+
} else {
|
|
6807
|
+
if (transient !== void 0) {
|
|
6808
|
+
template.setTransientPropPaths(transient, config);
|
|
6809
|
+
}
|
|
6810
|
+
if (staticPropPaths !== void 0) {
|
|
6811
|
+
template.setStaticPropPaths(staticPropPaths, config);
|
|
6812
|
+
}
|
|
6343
6813
|
}
|
|
6344
6814
|
return template;
|
|
6345
6815
|
}
|
|
@@ -6372,8 +6842,8 @@ var SheetTemplate = class {
|
|
|
6372
6842
|
};
|
|
6373
6843
|
|
|
6374
6844
|
// core/src/projects/Project.ts
|
|
6375
|
-
var import_theatre_dataverse18 = require("@unseenco/theatre-dataverse");
|
|
6376
6845
|
var import_theatre_dataverse19 = require("@unseenco/theatre-dataverse");
|
|
6846
|
+
var import_theatre_dataverse20 = require("@unseenco/theatre-dataverse");
|
|
6377
6847
|
|
|
6378
6848
|
// shared/src/utils/delay.ts
|
|
6379
6849
|
var delay = (dur) => new Promise((resolve) => setTimeout(resolve, dur));
|
|
@@ -7031,6 +7501,63 @@ function _coreLogger(config) {
|
|
|
7031
7501
|
return internal2.getLogger().named("Theatre");
|
|
7032
7502
|
}
|
|
7033
7503
|
|
|
7504
|
+
// shared/src/utils/assets.ts
|
|
7505
|
+
var import_theatre_dataverse18 = require("@unseenco/theatre-dataverse");
|
|
7506
|
+
|
|
7507
|
+
// shared/src/utils/forEachDeep.ts
|
|
7508
|
+
function forEachPropDeep(m, fn2, startingPath = []) {
|
|
7509
|
+
if (typeof m === "object" && m) {
|
|
7510
|
+
if (isImage(m) || isRGBA(m)) {
|
|
7511
|
+
fn2(m, startingPath);
|
|
7512
|
+
return;
|
|
7513
|
+
}
|
|
7514
|
+
for (const [key, value] of Object.entries(m)) {
|
|
7515
|
+
forEachPropDeep(value, fn2, [...startingPath, key]);
|
|
7516
|
+
}
|
|
7517
|
+
} else if (m === void 0 || m === null) {
|
|
7518
|
+
return;
|
|
7519
|
+
} else {
|
|
7520
|
+
fn2(m, startingPath);
|
|
7521
|
+
}
|
|
7522
|
+
}
|
|
7523
|
+
var isImage = (value) => {
|
|
7524
|
+
return typeof value === "object" && value !== null && Object.hasOwnProperty.call(value, "type") && // @ts-ignore
|
|
7525
|
+
value.type === "image" && Object.hasOwnProperty.call(value, "id") && // @ts-ignore
|
|
7526
|
+
typeof value.id === "string" && // @ts-ignore
|
|
7527
|
+
value.id !== "";
|
|
7528
|
+
};
|
|
7529
|
+
var isRGBA = (value) => {
|
|
7530
|
+
return typeof value === "object" && value !== null && Object.hasOwnProperty.call(value, "r") && Object.hasOwnProperty.call(value, "g") && Object.hasOwnProperty.call(value, "b") && Object.hasOwnProperty.call(value, "a") && // @ts-ignore
|
|
7531
|
+
typeof value.r === "number" && // @ts-ignore
|
|
7532
|
+
typeof value.g === "number" && // @ts-ignore
|
|
7533
|
+
typeof value.b === "number" && // @ts-ignore
|
|
7534
|
+
typeof value.a === "number";
|
|
7535
|
+
};
|
|
7536
|
+
|
|
7537
|
+
// shared/src/utils/assets.ts
|
|
7538
|
+
function stripImageAssetsFromAhistoricStaticOverrides(ahistoricStaticOverridesByObject) {
|
|
7539
|
+
for (const objectKey of Object.keys(ahistoricStaticOverridesByObject)) {
|
|
7540
|
+
const overrides = ahistoricStaticOverridesByObject[objectKey];
|
|
7541
|
+
if (!overrides)
|
|
7542
|
+
continue;
|
|
7543
|
+
const cloned = cloneDeep_default(overrides);
|
|
7544
|
+
forEachPropDeep(
|
|
7545
|
+
cloned,
|
|
7546
|
+
(value, path) => {
|
|
7547
|
+
if ((value == null ? void 0 : value.type) === "image") {
|
|
7548
|
+
removePathFromObject(cloned, path);
|
|
7549
|
+
}
|
|
7550
|
+
},
|
|
7551
|
+
[]
|
|
7552
|
+
);
|
|
7553
|
+
if (Object.keys(cloned).length === 0) {
|
|
7554
|
+
delete ahistoricStaticOverridesByObject[objectKey];
|
|
7555
|
+
} else {
|
|
7556
|
+
ahistoricStaticOverridesByObject[objectKey] = cloned;
|
|
7557
|
+
}
|
|
7558
|
+
}
|
|
7559
|
+
}
|
|
7560
|
+
|
|
7034
7561
|
// core/src/projects/Project.ts
|
|
7035
7562
|
var Project = class {
|
|
7036
7563
|
constructor(id, config = {}, publicApi) {
|
|
@@ -7042,7 +7569,7 @@ var Project = class {
|
|
|
7042
7569
|
__publicField(this, "_studioReadyDeferred");
|
|
7043
7570
|
__publicField(this, "_assetStorageReadyDeferred");
|
|
7044
7571
|
__publicField(this, "_readyPromise");
|
|
7045
|
-
__publicField(this, "_sheetTemplates", new
|
|
7572
|
+
__publicField(this, "_sheetTemplates", new import_theatre_dataverse20.Atom({}));
|
|
7046
7573
|
__publicField(this, "sheetTemplatesP", this._sheetTemplates.pointer);
|
|
7047
7574
|
__publicField(this, "_studio");
|
|
7048
7575
|
__publicField(this, "_onDiskStateAtom");
|
|
@@ -7056,7 +7583,7 @@ var Project = class {
|
|
|
7056
7583
|
this._logger.traceDev("creating project");
|
|
7057
7584
|
this.address = { projectId: id };
|
|
7058
7585
|
this._remoteSync = new RemoteSync(this);
|
|
7059
|
-
const onDiskStateAtom = new
|
|
7586
|
+
const onDiskStateAtom = new import_theatre_dataverse20.Atom({
|
|
7060
7587
|
ahistoric: {
|
|
7061
7588
|
ahistoricStuff: ""
|
|
7062
7589
|
},
|
|
@@ -7085,9 +7612,9 @@ var Project = class {
|
|
|
7085
7612
|
}
|
|
7086
7613
|
};
|
|
7087
7614
|
this._pointerProxies = {
|
|
7088
|
-
historic: new
|
|
7089
|
-
ahistoric: new
|
|
7090
|
-
ephemeral: new
|
|
7615
|
+
historic: new import_theatre_dataverse19.PointerProxy(onDiskStateAtom.pointer.historic),
|
|
7616
|
+
ahistoric: new import_theatre_dataverse19.PointerProxy(onDiskStateAtom.pointer.ahistoric),
|
|
7617
|
+
ephemeral: new import_theatre_dataverse19.PointerProxy(onDiskStateAtom.pointer.ephemeral)
|
|
7091
7618
|
};
|
|
7092
7619
|
this.pointers = {
|
|
7093
7620
|
historic: this._pointerProxies.historic.pointer,
|
|
@@ -7154,6 +7681,7 @@ var Project = class {
|
|
|
7154
7681
|
this._pointerProxies.ephemeral.setPointer(
|
|
7155
7682
|
studio.atomP.ephemeral.coreByProject[this.address.projectId]
|
|
7156
7683
|
);
|
|
7684
|
+
this._stripImageAssetsFromAhistoricState();
|
|
7157
7685
|
await studio.createAssetStorage(this, (_a = this.config.assets) == null ? void 0 : _a.baseUrl).then((assetStorage) => {
|
|
7158
7686
|
this.assetStorage = assetStorage;
|
|
7159
7687
|
this._assetStorageReadyDeferred.resolve(void 0);
|
|
@@ -7236,16 +7764,144 @@ var Project = class {
|
|
|
7236
7764
|
});
|
|
7237
7765
|
}
|
|
7238
7766
|
}
|
|
7767
|
+
_stripImageAssetsFromAhistoricState() {
|
|
7768
|
+
const strip = (ahistoric) => {
|
|
7769
|
+
var _a;
|
|
7770
|
+
for (const sheetState of Object.values((_a = ahistoric.sheetsById) != null ? _a : {})) {
|
|
7771
|
+
if (!sheetState)
|
|
7772
|
+
continue;
|
|
7773
|
+
stripImageAssetsFromAhistoricStaticOverrides(
|
|
7774
|
+
sheetState.staticOverrides.byObject
|
|
7775
|
+
);
|
|
7776
|
+
}
|
|
7777
|
+
};
|
|
7778
|
+
if (this._studio) {
|
|
7779
|
+
this._studio.transaction(({ drafts }) => {
|
|
7780
|
+
const ahistoric = drafts.ahistoric.coreByProject[this.address.projectId];
|
|
7781
|
+
if (ahistoric)
|
|
7782
|
+
strip(ahistoric);
|
|
7783
|
+
});
|
|
7784
|
+
} else {
|
|
7785
|
+
this._mutateCoreAhistoric(strip);
|
|
7786
|
+
}
|
|
7787
|
+
}
|
|
7788
|
+
_stripNonPersistingPropsFromAhistoric(sheetId, objectKey, config) {
|
|
7789
|
+
const paths = getNonPersistingPropPathEncodings(config);
|
|
7790
|
+
if (paths.size === 0)
|
|
7791
|
+
return;
|
|
7792
|
+
const strip = (ahistoric) => {
|
|
7793
|
+
var _a;
|
|
7794
|
+
const sheetState = (_a = ahistoric.sheetsById) == null ? void 0 : _a[sheetId];
|
|
7795
|
+
if (!sheetState)
|
|
7796
|
+
return;
|
|
7797
|
+
const staticOverrides = sheetState.staticOverrides.byObject[objectKey];
|
|
7798
|
+
if (staticOverrides) {
|
|
7799
|
+
sheetState.staticOverrides.byObject[objectKey] = stripTransientPathsFromSerializableMap(staticOverrides, paths);
|
|
7800
|
+
}
|
|
7801
|
+
};
|
|
7802
|
+
if (this._studio) {
|
|
7803
|
+
this._studio.transaction(({ drafts }) => {
|
|
7804
|
+
const ahistoric = drafts.ahistoric.coreByProject[this.address.projectId];
|
|
7805
|
+
if (ahistoric)
|
|
7806
|
+
strip(ahistoric);
|
|
7807
|
+
});
|
|
7808
|
+
} else {
|
|
7809
|
+
this._mutateCoreAhistoric(strip);
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7812
|
+
_stripNonPersistingPropsFromHistoric(sheetId, objectKey, config) {
|
|
7813
|
+
const paths = getNonPersistingPropPathEncodings(config);
|
|
7814
|
+
if (paths.size === 0)
|
|
7815
|
+
return;
|
|
7816
|
+
const strip = (historic) => {
|
|
7817
|
+
const sheetState = historic.sheetsById[sheetId];
|
|
7818
|
+
if (!sheetState)
|
|
7819
|
+
return;
|
|
7820
|
+
stripTransientPropsFromObjectInSheetState(sheetState, objectKey, paths);
|
|
7821
|
+
stripSequenceTracksForPathsFromObjectInSheetState(
|
|
7822
|
+
sheetState,
|
|
7823
|
+
objectKey,
|
|
7824
|
+
paths
|
|
7825
|
+
);
|
|
7826
|
+
};
|
|
7827
|
+
if (this._studio) {
|
|
7828
|
+
this._studio.transaction(({ drafts }) => {
|
|
7829
|
+
const historic = drafts.historic.coreByProject[this.address.projectId];
|
|
7830
|
+
if (historic)
|
|
7831
|
+
strip(historic);
|
|
7832
|
+
});
|
|
7833
|
+
} else {
|
|
7834
|
+
this._onDiskStateAtom.reduce((state) => {
|
|
7835
|
+
const historic = __spreadValues({}, state.historic);
|
|
7836
|
+
strip(historic);
|
|
7837
|
+
return __spreadProps(__spreadValues({}, state), { historic });
|
|
7838
|
+
});
|
|
7839
|
+
}
|
|
7840
|
+
}
|
|
7841
|
+
_stripTransientPropsFromHistoric(sheetId, objectKey, transientPaths) {
|
|
7842
|
+
if (transientPaths.size === 0)
|
|
7843
|
+
return;
|
|
7844
|
+
const strip = (historic) => {
|
|
7845
|
+
const sheetState = historic.sheetsById[sheetId];
|
|
7846
|
+
if (!sheetState)
|
|
7847
|
+
return;
|
|
7848
|
+
stripTransientPropsFromObjectInSheetState(
|
|
7849
|
+
sheetState,
|
|
7850
|
+
objectKey,
|
|
7851
|
+
transientPaths
|
|
7852
|
+
);
|
|
7853
|
+
};
|
|
7854
|
+
if (this._studio) {
|
|
7855
|
+
this._studio.transaction(({ drafts }) => {
|
|
7856
|
+
const historic = drafts.historic.coreByProject[this.address.projectId];
|
|
7857
|
+
if (historic)
|
|
7858
|
+
strip(historic);
|
|
7859
|
+
});
|
|
7860
|
+
} else {
|
|
7861
|
+
this._onDiskStateAtom.reduce((state) => {
|
|
7862
|
+
const historic = __spreadValues({}, state.historic);
|
|
7863
|
+
strip(historic);
|
|
7864
|
+
return __spreadProps(__spreadValues({}, state), { historic });
|
|
7865
|
+
});
|
|
7866
|
+
}
|
|
7867
|
+
}
|
|
7868
|
+
_stripSequenceTracksFromHistoric(sheetId, objectKey, propPaths) {
|
|
7869
|
+
if (propPaths.size === 0)
|
|
7870
|
+
return;
|
|
7871
|
+
const strip = (historic) => {
|
|
7872
|
+
const sheetState = historic.sheetsById[sheetId];
|
|
7873
|
+
if (!sheetState)
|
|
7874
|
+
return;
|
|
7875
|
+
stripSequenceTracksForPathsFromObjectInSheetState(
|
|
7876
|
+
sheetState,
|
|
7877
|
+
objectKey,
|
|
7878
|
+
propPaths
|
|
7879
|
+
);
|
|
7880
|
+
};
|
|
7881
|
+
if (this._studio) {
|
|
7882
|
+
this._studio.transaction(({ drafts }) => {
|
|
7883
|
+
const historic = drafts.historic.coreByProject[this.address.projectId];
|
|
7884
|
+
if (historic)
|
|
7885
|
+
strip(historic);
|
|
7886
|
+
});
|
|
7887
|
+
} else {
|
|
7888
|
+
this._onDiskStateAtom.reduce((state) => {
|
|
7889
|
+
const historic = __spreadValues({}, state.historic);
|
|
7890
|
+
strip(historic);
|
|
7891
|
+
return __spreadProps(__spreadValues({}, state), { historic });
|
|
7892
|
+
});
|
|
7893
|
+
}
|
|
7894
|
+
}
|
|
7239
7895
|
};
|
|
7240
7896
|
|
|
7241
7897
|
// shared/src/utils/sanitizers.ts
|
|
7242
|
-
var _validateSym = (
|
|
7243
|
-
if (typeof
|
|
7244
|
-
return "".concat(thingy, " must be a string. ").concat(userReadableTypeOfValue_default(
|
|
7245
|
-
} else if (
|
|
7246
|
-
return "".concat(thingy, " must not have leading or trailing spaces. '").concat(
|
|
7247
|
-
} else if (
|
|
7248
|
-
return "".concat(thingy, " must have between ").concat(range[0], " and ").concat(range[1], " characters. '").concat(
|
|
7898
|
+
var _validateSym = (val11, thingy, range) => {
|
|
7899
|
+
if (typeof val11 !== "string") {
|
|
7900
|
+
return "".concat(thingy, " must be a string. ").concat(userReadableTypeOfValue_default(val11), " given.");
|
|
7901
|
+
} else if (val11.trim().length !== val11.length) {
|
|
7902
|
+
return "".concat(thingy, " must not have leading or trailing spaces. '").concat(val11, "' given.");
|
|
7903
|
+
} else if (val11.length < range[0] || val11.length > range[1]) {
|
|
7904
|
+
return "".concat(thingy, " must have between ").concat(range[0], " and ").concat(range[1], " characters. '").concat(val11, "' given.");
|
|
7249
7905
|
}
|
|
7250
7906
|
};
|
|
7251
7907
|
var validateName = (name, thingy, shouldThrow = false) => {
|
|
@@ -7324,8 +7980,8 @@ var TheatreProject = class {
|
|
|
7324
7980
|
|
|
7325
7981
|
// core/src/coreExports.ts
|
|
7326
7982
|
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
|
7327
|
-
var import_theatre_dataverse20 = require("@unseenco/theatre-dataverse");
|
|
7328
7983
|
var import_theatre_dataverse21 = require("@unseenco/theatre-dataverse");
|
|
7984
|
+
var import_theatre_dataverse22 = require("@unseenco/theatre-dataverse");
|
|
7329
7985
|
function getProject(id, config = {}) {
|
|
7330
7986
|
const existingProject = projectsSingleton_default.get(id);
|
|
7331
7987
|
if (existingProject) {
|
|
@@ -7392,10 +8048,10 @@ var validateProjectIdOrThrow = (value) => {
|
|
|
7392
8048
|
};
|
|
7393
8049
|
function onChange(pointer3, callback, rafDriver) {
|
|
7394
8050
|
const ticker = rafDriver ? privateAPI(rafDriver).ticker : getCoreTicker();
|
|
7395
|
-
if ((0,
|
|
7396
|
-
const pr = (0,
|
|
8051
|
+
if ((0, import_theatre_dataverse21.isPointer)(pointer3)) {
|
|
8052
|
+
const pr = (0, import_theatre_dataverse22.pointerToPrism)(pointer3);
|
|
7397
8053
|
return pr.onChange(ticker, callback, true);
|
|
7398
|
-
} else if ((0,
|
|
8054
|
+
} else if ((0, import_theatre_dataverse22.isPrism)(pointer3)) {
|
|
7399
8055
|
return pointer3.onChange(ticker, callback, true);
|
|
7400
8056
|
} else {
|
|
7401
8057
|
throw new Error(
|
|
@@ -7403,9 +8059,9 @@ function onChange(pointer3, callback, rafDriver) {
|
|
|
7403
8059
|
);
|
|
7404
8060
|
}
|
|
7405
8061
|
}
|
|
7406
|
-
function
|
|
7407
|
-
if ((0,
|
|
7408
|
-
return (0,
|
|
8062
|
+
function val10(pointer3) {
|
|
8063
|
+
if ((0, import_theatre_dataverse21.isPointer)(pointer3)) {
|
|
8064
|
+
return (0, import_theatre_dataverse22.pointerToPrism)(pointer3).getValue();
|
|
7409
8065
|
} else {
|
|
7410
8066
|
throw new Error("Called val(p) where p is not a pointer.");
|
|
7411
8067
|
}
|
|
@@ -7420,7 +8076,7 @@ var CoreBundle = class {
|
|
|
7420
8076
|
return "Theatre_CoreBundle";
|
|
7421
8077
|
}
|
|
7422
8078
|
get version() {
|
|
7423
|
-
return "0.1.
|
|
8079
|
+
return "0.1.4";
|
|
7424
8080
|
}
|
|
7425
8081
|
getBitsForStudio(studio, callback) {
|
|
7426
8082
|
if (this._studio) {
|