@unseenco/theatre-core 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -276,7 +276,7 @@ __export(coreExports_exports, {
276
276
  syncNativeDocumentScrollToSequencePosition: () => syncNativeDocumentScrollToSequencePosition,
277
277
  syncPageScrollToSequencePosition: () => syncPageScrollToSequencePosition,
278
278
  types: () => propTypes_exports,
279
- val: () => val12
279
+ val: () => val14
280
280
  });
281
281
 
282
282
  // core/src/projects/projectsSingleton.ts
@@ -968,7 +968,7 @@ var SimpleCache = class {
968
968
  };
969
969
 
970
970
  // core/src/sheetObjects/SheetObjectTemplate.ts
971
- import { Atom as Atom4, getPointerParts as getPointerParts2, prism as prism5, val as val5 } from "@unseenco/theatre-dataverse";
971
+ import { Atom as Atom5, getPointerParts as getPointerParts2, prism as prism6, val as val6 } from "@unseenco/theatre-dataverse";
972
972
 
973
973
  // ../node_modules/lodash-es/_defineProperty.js
974
974
  var defineProperty = (function() {
@@ -1079,181 +1079,6 @@ function generateDefaultsForCompound(config) {
1079
1079
  return defaults;
1080
1080
  }
1081
1081
 
1082
- // core/src/sequences/interpolationTripleAtPosition.ts
1083
- var import_UnitBezier = __toESM(require_UnitBezier());
1084
- import { prism, val } from "@unseenco/theatre-dataverse";
1085
- function interpolationTripleAtPosition(ctx, trackP, timeD) {
1086
- return prism(() => {
1087
- const track = val(trackP);
1088
- const driverD = prism.memo(
1089
- "driver",
1090
- () => {
1091
- if (!track) {
1092
- return prism(() => void 0);
1093
- } else if (track.type === "BasicKeyframedTrack") {
1094
- return _forKeyframedTrack(ctx, track, timeD);
1095
- } else if (track.type === "GsapClipTrack") {
1096
- return prism(() => void 0);
1097
- } else {
1098
- ctx.logger.error("Track type not yet supported.");
1099
- return prism(() => void 0);
1100
- }
1101
- },
1102
- [track]
1103
- );
1104
- return driverD.getValue();
1105
- });
1106
- }
1107
- function _forKeyframedTrack(ctx, track, timeD) {
1108
- return prism(() => {
1109
- let stateRef = prism.ref("state", { started: false });
1110
- let state = stateRef.current;
1111
- const time = timeD.getValue();
1112
- if (!state.started || time < state.validFrom || state.validTo <= time) {
1113
- stateRef.current = state = updateState(ctx, timeD, track);
1114
- }
1115
- return state.der.getValue();
1116
- });
1117
- }
1118
- var undefinedConstD = prism(() => void 0);
1119
- function updateState(ctx, progressionD, track) {
1120
- const progression = progressionD.getValue();
1121
- if (track.keyframes.length === 0) {
1122
- return {
1123
- started: true,
1124
- validFrom: -Infinity,
1125
- validTo: Infinity,
1126
- der: undefinedConstD
1127
- };
1128
- }
1129
- let currentKeyframeIndex = 0;
1130
- while (true) {
1131
- const currentKeyframe = track.keyframes[currentKeyframeIndex];
1132
- if (!currentKeyframe) {
1133
- if (process.env.NODE_ENV !== "production") {
1134
- ctx.logger.error("Bug here");
1135
- }
1136
- return states.error;
1137
- }
1138
- const isLastKeyframe = currentKeyframeIndex === track.keyframes.length - 1;
1139
- if (progression < currentKeyframe.position) {
1140
- if (currentKeyframeIndex === 0) {
1141
- return states.beforeFirstKeyframe(currentKeyframe);
1142
- } else {
1143
- if (process.env.NODE_ENV !== "production") {
1144
- ctx.logger.error("Bug here");
1145
- }
1146
- return states.error;
1147
- }
1148
- } else if (currentKeyframe.position === progression) {
1149
- if (isLastKeyframe) {
1150
- return states.lastKeyframe(currentKeyframe);
1151
- } else {
1152
- return states.between(
1153
- currentKeyframe,
1154
- track.keyframes[currentKeyframeIndex + 1],
1155
- progressionD
1156
- );
1157
- }
1158
- } else {
1159
- if (currentKeyframeIndex === track.keyframes.length - 1) {
1160
- return states.lastKeyframe(currentKeyframe);
1161
- } else {
1162
- const nextKeyframeIndex = currentKeyframeIndex + 1;
1163
- if (track.keyframes[nextKeyframeIndex].position <= progression) {
1164
- currentKeyframeIndex = nextKeyframeIndex;
1165
- continue;
1166
- } else {
1167
- return states.between(
1168
- currentKeyframe,
1169
- track.keyframes[currentKeyframeIndex + 1],
1170
- progressionD
1171
- );
1172
- }
1173
- }
1174
- }
1175
- }
1176
- }
1177
- var states = {
1178
- beforeFirstKeyframe(kf) {
1179
- return {
1180
- started: true,
1181
- validFrom: -Infinity,
1182
- validTo: kf.position,
1183
- der: prism(() => ({ left: kf.value, progression: 0 }))
1184
- };
1185
- },
1186
- lastKeyframe(kf) {
1187
- return {
1188
- started: true,
1189
- validFrom: kf.position,
1190
- validTo: Infinity,
1191
- der: prism(() => ({ left: kf.value, progression: 0 }))
1192
- };
1193
- },
1194
- between(left, right, progressionD) {
1195
- if (!left.connectedRight) {
1196
- return {
1197
- started: true,
1198
- validFrom: left.position,
1199
- validTo: right.position,
1200
- der: prism(() => ({ left: left.value, progression: 0 }))
1201
- };
1202
- }
1203
- const globalProgressionToLocalProgression = (globalProgression) => {
1204
- return (globalProgression - left.position) / (right.position - left.position);
1205
- };
1206
- if (!left.type || left.type === "bezier") {
1207
- const solver = new import_UnitBezier.default(
1208
- left.handles[2],
1209
- left.handles[3],
1210
- right.handles[0],
1211
- right.handles[1]
1212
- );
1213
- const bezierDer = prism(() => {
1214
- const progression = globalProgressionToLocalProgression(
1215
- progressionD.getValue()
1216
- );
1217
- const valueProgression = solver.solveSimple(progression);
1218
- return {
1219
- left: left.value,
1220
- right: right.value,
1221
- progression: valueProgression
1222
- };
1223
- });
1224
- return {
1225
- started: true,
1226
- validFrom: left.position,
1227
- validTo: right.position,
1228
- der: bezierDer
1229
- };
1230
- }
1231
- const holdDer = prism(() => {
1232
- const progression = globalProgressionToLocalProgression(
1233
- progressionD.getValue()
1234
- );
1235
- const valueProgression = Math.floor(progression);
1236
- return {
1237
- left: left.value,
1238
- right: right.value,
1239
- progression: valueProgression
1240
- };
1241
- });
1242
- return {
1243
- started: true,
1244
- validFrom: left.position,
1245
- validTo: right.position,
1246
- der: holdDer
1247
- };
1248
- },
1249
- error: {
1250
- started: true,
1251
- validFrom: -Infinity,
1252
- validTo: Infinity,
1253
- der: undefinedConstD
1254
- }
1255
- };
1256
-
1257
1082
  // shared/src/utils/deepMergeWithCache.ts
1258
1083
  function deepMergeWithCache(base, override, cache2) {
1259
1084
  const _cache = cache2;
@@ -1285,24 +1110,24 @@ function pointerDeep(base, toAppend) {
1285
1110
  }
1286
1111
 
1287
1112
  // shared/src/utils/valToAtom.ts
1288
- import { Atom as Atom2, prism as prism2 } from "@unseenco/theatre-dataverse";
1113
+ import { Atom as Atom2, prism } from "@unseenco/theatre-dataverse";
1289
1114
  var valToAtom = (key, vals) => {
1290
- const a2 = prism2.memo(key, () => new Atom2(vals), []);
1115
+ const a2 = prism.memo(key, () => new Atom2(vals), []);
1291
1116
  a2.set(vals);
1292
1117
  return a2;
1293
1118
  };
1294
1119
 
1295
1120
  // core/src/sheetObjects/SheetObject.ts
1296
1121
  import {
1297
- Atom as Atom3,
1122
+ Atom as Atom4,
1298
1123
  getPointerParts,
1299
1124
  pointer,
1300
- prism as prism4,
1301
- val as val4
1125
+ prism as prism5,
1126
+ val as val5
1302
1127
  } from "@unseenco/theatre-dataverse";
1303
1128
 
1304
1129
  // core/src/sheetObjects/TheatreSheetObject.ts
1305
- import { prism as prism3, val as val2 } from "@unseenco/theatre-dataverse";
1130
+ import { prism as prism2, val } from "@unseenco/theatre-dataverse";
1306
1131
 
1307
1132
  // core/src/propTypes/index.ts
1308
1133
  var propTypes_exports = {};
@@ -3343,11 +3168,11 @@ function sanitizeCompoundProps(props) {
3343
3168
  );
3344
3169
  }
3345
3170
  }
3346
- const val13 = props[key];
3347
- if (isLonghandPropType(val13)) {
3348
- sanitizedProps[key] = val13;
3171
+ const val15 = props[key];
3172
+ if (isLonghandPropType(val15)) {
3173
+ sanitizedProps[key] = val15;
3349
3174
  } else {
3350
- sanitizedProps[key] = toLonghandProp(val13);
3175
+ sanitizedProps[key] = toLonghandProp(val15);
3351
3176
  }
3352
3177
  }
3353
3178
  return sanitizedProps;
@@ -3445,15 +3270,15 @@ var file = (defaultValue, opts = {}) => {
3445
3270
  deserializeAndSanitize: _ensureFile
3446
3271
  };
3447
3272
  };
3448
- var _ensureFile = (val13) => {
3449
- if (!val13) return void 0;
3273
+ var _ensureFile = (val15) => {
3274
+ if (!val15) return void 0;
3450
3275
  let valid = true;
3451
- if (typeof val13.id !== "string" && ![null, void 0].includes(val13.id)) {
3276
+ if (typeof val15.id !== "string" && ![null, void 0].includes(val15.id)) {
3452
3277
  valid = false;
3453
3278
  }
3454
- if (val13.type !== "file") valid = false;
3279
+ if (val15.type !== "file") valid = false;
3455
3280
  if (!valid) return void 0;
3456
- return val13;
3281
+ return val15;
3457
3282
  };
3458
3283
  var image = (defaultValue, opts = {}) => {
3459
3284
  if (process.env.NODE_ENV !== "production") {
@@ -3477,15 +3302,15 @@ var image = (defaultValue, opts = {}) => {
3477
3302
  deserializeAndSanitize: _ensureImage
3478
3303
  };
3479
3304
  };
3480
- var _ensureImage = (val13) => {
3481
- if (!val13) return void 0;
3305
+ var _ensureImage = (val15) => {
3306
+ if (!val15) return void 0;
3482
3307
  let valid = true;
3483
- if (typeof val13.id !== "string" && ![null, void 0].includes(val13.id)) {
3308
+ if (typeof val15.id !== "string" && ![null, void 0].includes(val15.id)) {
3484
3309
  valid = false;
3485
3310
  }
3486
- if (val13.type !== "image") valid = false;
3311
+ if (val15.type !== "image") valid = false;
3487
3312
  if (!valid) return void 0;
3488
- return val13;
3313
+ return val15;
3489
3314
  };
3490
3315
  var number = (defaultValue, opts = {}) => {
3491
3316
  if (process.env.NODE_ENV !== "production") {
@@ -3608,11 +3433,11 @@ var rgba = (defaultValue = { r: 0, g: 0, b: 0, a: 1 }, opts = {}) => {
3608
3433
  deserializeAndSanitize: _sanitizeRgba
3609
3434
  };
3610
3435
  };
3611
- var _sanitizeRgba = (val13) => {
3612
- if (!val13) return void 0;
3436
+ var _sanitizeRgba = (val15) => {
3437
+ if (!val15) return void 0;
3613
3438
  let valid = true;
3614
3439
  for (const c2 of ["r", "g", "b", "a"]) {
3615
- if (!Object.prototype.hasOwnProperty.call(val13, c2) || typeof val13[c2] !== "number") {
3440
+ if (!Object.prototype.hasOwnProperty.call(val15, c2) || typeof val15[c2] !== "number") {
3616
3441
  valid = false;
3617
3442
  }
3618
3443
  }
@@ -3621,7 +3446,7 @@ var _sanitizeRgba = (val13) => {
3621
3446
  for (const c2 of ["r", "g", "b", "a"]) {
3622
3447
  ;
3623
3448
  sanitized[c2] = Math.min(
3624
- Math.max(val13[c2], 0),
3449
+ Math.max(val15[c2], 0),
3625
3450
  1
3626
3451
  );
3627
3452
  }
@@ -3660,8 +3485,8 @@ var boolean = (defaultValue, opts = {}) => {
3660
3485
  deserializeAndSanitize: _ensureBoolean
3661
3486
  };
3662
3487
  };
3663
- var _ensureBoolean = (val13) => {
3664
- return typeof val13 === "boolean" ? val13 : void 0;
3488
+ var _ensureBoolean = (val15) => {
3489
+ return typeof val15 === "boolean" ? val15 : void 0;
3665
3490
  };
3666
3491
  function leftInterpolate(left) {
3667
3492
  return left;
@@ -3819,8 +3644,8 @@ var TheatreSheetObject = class {
3819
3644
  _valuesPrism() {
3820
3645
  return this._cache.get("_valuesPrism", () => {
3821
3646
  const sheetObject = privateAPI(this);
3822
- const d2 = prism3(() => {
3823
- return val2(sheetObject.getValues().getValue());
3647
+ const d2 = prism2(() => {
3648
+ return val(sheetObject.getValues().getValue());
3824
3649
  });
3825
3650
  return d2;
3826
3651
  });
@@ -3828,10 +3653,10 @@ var TheatreSheetObject = class {
3828
3653
  _valuesWithVariantPrism() {
3829
3654
  return this._cache.get("_valuesWithVariantPrism", () => {
3830
3655
  const sheetObject = privateAPI(this);
3831
- return prism3(() => {
3656
+ return prism2(() => {
3832
3657
  return {
3833
- values: val2(sheetObject.getValues().getValue()),
3834
- variant: val2(sheetObject.sheet.effectiveActiveSequenceVariantD)
3658
+ values: val(sheetObject.getValues().getValue()),
3659
+ variant: val(sheetObject.sheet.effectiveActiveSequenceVariantD)
3835
3660
  };
3836
3661
  });
3837
3662
  });
@@ -3868,8 +3693,8 @@ var TheatreSheetObject = class {
3868
3693
  }
3869
3694
  return der.getValue();
3870
3695
  }
3871
- set initialValue(val13) {
3872
- privateAPI(this).setInitialValue(val13);
3696
+ set initialValue(val15) {
3697
+ privateAPI(this).setInitialValue(val15);
3873
3698
  }
3874
3699
  showPropsOf(objects) {
3875
3700
  const host = privateAPI(this);
@@ -3909,62 +3734,240 @@ var TheatreSheetObject = class {
3909
3734
  }
3910
3735
  };
3911
3736
 
3912
- // shared/src/propTypes/utils.ts
3913
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
3914
-
3915
- // shared/src/utils/memoizeFn.ts
3916
- function memoizeFn(producer) {
3917
- const cache2 = /* @__PURE__ */ new WeakMap();
3918
- return (k2) => {
3919
- if (!cache2.has(k2)) {
3920
- cache2.set(k2, producer(k2));
3921
- }
3922
- return cache2.get(k2);
3923
- };
3737
+ // core/src/sequences/interpolationTripleAtPosition.ts
3738
+ var import_UnitBezier = __toESM(require_UnitBezier());
3739
+ import { prism as prism3, val as val2 } from "@unseenco/theatre-dataverse";
3740
+ function interpolationTripleAtPosition(ctx, trackP, timeD) {
3741
+ return prism3(() => {
3742
+ const track = val2(trackP);
3743
+ const driverD = prism3.memo(
3744
+ "driver",
3745
+ () => {
3746
+ if (!track) {
3747
+ return prism3(() => void 0);
3748
+ } else if (track.type === "BasicKeyframedTrack") {
3749
+ return _forKeyframedTrack(ctx, track, timeD);
3750
+ } else if (track.type === "GsapClipTrack") {
3751
+ return prism3(() => void 0);
3752
+ } else {
3753
+ ctx.logger.error("Track type not yet supported.");
3754
+ return prism3(() => void 0);
3755
+ }
3756
+ },
3757
+ [track]
3758
+ );
3759
+ return driverD.getValue();
3760
+ });
3924
3761
  }
3925
-
3926
- // shared/src/utils/addresses.ts
3927
- var encodePathToProp = memoizeFn(
3928
- (p2) => (
3929
- // we're using JSON.stringify here, but we could use a faster alternative.
3930
- // If you happen to do that, first make sure no `PathToProp_Encoded` is ever
3931
- // used in the store, otherwise you'll have to write a migration.
3932
- JSON.stringify(p2)
3933
- )
3934
- );
3935
-
3936
- // shared/src/utils/removePathFromObject.ts
3937
- function removePathFromObject(base, path) {
3938
- if (typeof base !== "object" || base === null) return;
3939
- if (path.length === 0) {
3940
- for (const key of Object.keys(base)) {
3941
- delete base[key];
3942
- }
3943
- return;
3944
- }
3945
- const keysUpToLastKey = path.slice(0, path.length - 1);
3946
- let cur = base;
3947
- const childToParentMapping = /* @__PURE__ */ new WeakMap();
3948
- for (const key of keysUpToLastKey) {
3949
- const parent2 = cur;
3950
- const child = parent2[key];
3951
- if (typeof child !== "object" || child === null) {
3952
- return;
3953
- } else {
3954
- childToParentMapping.set(child, parent2);
3955
- cur = child;
3762
+ function _forKeyframedTrack(ctx, track, timeD) {
3763
+ return prism3(() => {
3764
+ let stateRef = prism3.ref("state", { started: false });
3765
+ let state = stateRef.current;
3766
+ const time = timeD.getValue();
3767
+ if (!state.started || time < state.validFrom || state.validTo <= time) {
3768
+ stateRef.current = state = updateState(ctx, timeD, track);
3956
3769
  }
3770
+ return state.der.getValue();
3771
+ });
3772
+ }
3773
+ var undefinedConstD = prism3(() => void 0);
3774
+ function updateState(ctx, progressionD, track) {
3775
+ const progression = progressionD.getValue();
3776
+ if (track.keyframes.length === 0) {
3777
+ return {
3778
+ started: true,
3779
+ validFrom: -Infinity,
3780
+ validTo: Infinity,
3781
+ der: undefinedConstD
3782
+ };
3957
3783
  }
3958
- const keysReversed = path.slice().reverse();
3959
- for (const key of keysReversed) {
3960
- delete cur[key];
3961
- if (Object.keys(cur).length > 0) {
3962
- return;
3963
- } else {
3964
- cur = childToParentMapping.get(cur);
3965
- continue;
3784
+ let currentKeyframeIndex = 0;
3785
+ while (true) {
3786
+ const currentKeyframe = track.keyframes[currentKeyframeIndex];
3787
+ if (!currentKeyframe) {
3788
+ if (process.env.NODE_ENV !== "production") {
3789
+ ctx.logger.error("Bug here");
3790
+ }
3791
+ return states.error;
3966
3792
  }
3967
- }
3793
+ const isLastKeyframe = currentKeyframeIndex === track.keyframes.length - 1;
3794
+ if (progression < currentKeyframe.position) {
3795
+ if (currentKeyframeIndex === 0) {
3796
+ return states.beforeFirstKeyframe(currentKeyframe);
3797
+ } else {
3798
+ if (process.env.NODE_ENV !== "production") {
3799
+ ctx.logger.error("Bug here");
3800
+ }
3801
+ return states.error;
3802
+ }
3803
+ } else if (currentKeyframe.position === progression) {
3804
+ if (isLastKeyframe) {
3805
+ return states.lastKeyframe(currentKeyframe);
3806
+ } else {
3807
+ return states.between(
3808
+ currentKeyframe,
3809
+ track.keyframes[currentKeyframeIndex + 1],
3810
+ progressionD
3811
+ );
3812
+ }
3813
+ } else {
3814
+ if (currentKeyframeIndex === track.keyframes.length - 1) {
3815
+ return states.lastKeyframe(currentKeyframe);
3816
+ } else {
3817
+ const nextKeyframeIndex = currentKeyframeIndex + 1;
3818
+ if (track.keyframes[nextKeyframeIndex].position <= progression) {
3819
+ currentKeyframeIndex = nextKeyframeIndex;
3820
+ continue;
3821
+ } else {
3822
+ return states.between(
3823
+ currentKeyframe,
3824
+ track.keyframes[currentKeyframeIndex + 1],
3825
+ progressionD
3826
+ );
3827
+ }
3828
+ }
3829
+ }
3830
+ }
3831
+ }
3832
+ var states = {
3833
+ beforeFirstKeyframe(kf) {
3834
+ return {
3835
+ started: true,
3836
+ validFrom: -Infinity,
3837
+ validTo: kf.position,
3838
+ der: prism3(() => ({ left: kf.value, progression: 0 }))
3839
+ };
3840
+ },
3841
+ lastKeyframe(kf) {
3842
+ return {
3843
+ started: true,
3844
+ validFrom: kf.position,
3845
+ validTo: Infinity,
3846
+ der: prism3(() => ({ left: kf.value, progression: 0 }))
3847
+ };
3848
+ },
3849
+ between(left, right, progressionD) {
3850
+ if (!left.connectedRight) {
3851
+ return {
3852
+ started: true,
3853
+ validFrom: left.position,
3854
+ validTo: right.position,
3855
+ der: prism3(() => ({ left: left.value, progression: 0 }))
3856
+ };
3857
+ }
3858
+ const globalProgressionToLocalProgression = (globalProgression) => {
3859
+ return (globalProgression - left.position) / (right.position - left.position);
3860
+ };
3861
+ if (!left.type || left.type === "bezier") {
3862
+ const solver = new import_UnitBezier.default(
3863
+ left.handles[2],
3864
+ left.handles[3],
3865
+ right.handles[0],
3866
+ right.handles[1]
3867
+ );
3868
+ const bezierDer = prism3(() => {
3869
+ const progression = globalProgressionToLocalProgression(
3870
+ progressionD.getValue()
3871
+ );
3872
+ const valueProgression = solver.solveSimple(progression);
3873
+ return {
3874
+ left: left.value,
3875
+ right: right.value,
3876
+ progression: valueProgression
3877
+ };
3878
+ });
3879
+ return {
3880
+ started: true,
3881
+ validFrom: left.position,
3882
+ validTo: right.position,
3883
+ der: bezierDer
3884
+ };
3885
+ }
3886
+ const holdDer = prism3(() => {
3887
+ const progression = globalProgressionToLocalProgression(
3888
+ progressionD.getValue()
3889
+ );
3890
+ const valueProgression = Math.floor(progression);
3891
+ return {
3892
+ left: left.value,
3893
+ right: right.value,
3894
+ progression: valueProgression
3895
+ };
3896
+ });
3897
+ return {
3898
+ started: true,
3899
+ validFrom: left.position,
3900
+ validTo: right.position,
3901
+ der: holdDer
3902
+ };
3903
+ },
3904
+ error: {
3905
+ started: true,
3906
+ validFrom: -Infinity,
3907
+ validTo: Infinity,
3908
+ der: undefinedConstD
3909
+ }
3910
+ };
3911
+
3912
+ // core/src/sheetObjects/sheetObjectSequencedFull.ts
3913
+ import { Atom as Atom3, prism as prism4, val as val4 } from "@unseenco/theatre-dataverse";
3914
+
3915
+ // shared/src/propTypes/utils.ts
3916
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
3917
+
3918
+ // shared/src/utils/memoizeFn.ts
3919
+ function memoizeFn(producer) {
3920
+ const cache2 = /* @__PURE__ */ new WeakMap();
3921
+ return (k2) => {
3922
+ if (!cache2.has(k2)) {
3923
+ cache2.set(k2, producer(k2));
3924
+ }
3925
+ return cache2.get(k2);
3926
+ };
3927
+ }
3928
+
3929
+ // shared/src/utils/addresses.ts
3930
+ var encodePathToProp = memoizeFn(
3931
+ (p2) => (
3932
+ // we're using JSON.stringify here, but we could use a faster alternative.
3933
+ // If you happen to do that, first make sure no `PathToProp_Encoded` is ever
3934
+ // used in the store, otherwise you'll have to write a migration.
3935
+ JSON.stringify(p2)
3936
+ )
3937
+ );
3938
+
3939
+ // shared/src/utils/removePathFromObject.ts
3940
+ function removePathFromObject(base, path) {
3941
+ if (typeof base !== "object" || base === null) return;
3942
+ if (path.length === 0) {
3943
+ for (const key of Object.keys(base)) {
3944
+ delete base[key];
3945
+ }
3946
+ return;
3947
+ }
3948
+ const keysUpToLastKey = path.slice(0, path.length - 1);
3949
+ let cur = base;
3950
+ const childToParentMapping = /* @__PURE__ */ new WeakMap();
3951
+ for (const key of keysUpToLastKey) {
3952
+ const parent2 = cur;
3953
+ const child = parent2[key];
3954
+ if (typeof child !== "object" || child === null) {
3955
+ return;
3956
+ } else {
3957
+ childToParentMapping.set(child, parent2);
3958
+ cur = child;
3959
+ }
3960
+ }
3961
+ const keysReversed = path.slice().reverse();
3962
+ for (const key of keysReversed) {
3963
+ delete cur[key];
3964
+ if (Object.keys(cur).length > 0) {
3965
+ return;
3966
+ } else {
3967
+ cur = childToParentMapping.get(cur);
3968
+ continue;
3969
+ }
3970
+ }
3968
3971
  }
3969
3972
 
3970
3973
  // shared/src/utils/transientPropPaths.ts
@@ -4226,43 +4229,6 @@ function* iteratePropType(conf, pathPrefix) {
4226
4229
  }
4227
4230
  }
4228
4231
 
4229
- // shared/src/utils/updateDeep.ts
4230
- function updateDeep(obj, path, reducer) {
4231
- if (path.length === 0) return reducer(obj);
4232
- return hoop(obj, path, reducer);
4233
- }
4234
- var hoop = (s2, path, reducer) => {
4235
- if (path.length === 0) {
4236
- return reducer(s2);
4237
- }
4238
- if (Array.isArray(s2)) {
4239
- let [index, ...restOfPath] = path;
4240
- index = parseInt(String(index), 10);
4241
- if (isNaN(index)) index = 0;
4242
- const oldVal = s2[index];
4243
- const newVal = hoop(oldVal, restOfPath, reducer);
4244
- if (oldVal === newVal) return s2;
4245
- const newS = [...s2];
4246
- newS.splice(index, 1, newVal);
4247
- return newS;
4248
- } else if (typeof s2 === "object" && s2 !== null) {
4249
- const [key, ...restOfPath] = path;
4250
- const oldVal = s2[key];
4251
- const newVal = hoop(oldVal, restOfPath, reducer);
4252
- if (oldVal === newVal) return s2;
4253
- const newS = { ...s2, [key]: newVal };
4254
- return newS;
4255
- } else {
4256
- const [key, ...restOfPath] = path;
4257
- return { [key]: hoop(void 0, restOfPath, reducer) };
4258
- }
4259
- };
4260
-
4261
- // shared/src/utils/setDeepImmutable.ts
4262
- function setDeepImmutable(obj, path, replace) {
4263
- return updateDeep(obj, path, () => replace);
4264
- }
4265
-
4266
4232
  // core/src/sequences/sequenceVariants.ts
4267
4233
  import { val as val3 } from "@unseenco/theatre-dataverse";
4268
4234
 
@@ -4416,64 +4382,196 @@ function validateSequenceVariantsOrThrow(variants, fnName) {
4416
4382
  return sanitized;
4417
4383
  }
4418
4384
 
4419
- // core/src/sheetObjects/SheetObject.ts
4420
- var SheetObject = class {
4421
- constructor(sheet, template, nativeObject) {
4422
- this.sheet = sheet;
4423
- this.template = template;
4424
- this.nativeObject = nativeObject;
4425
- __publicField(this, "$$isPointerToPrismProvider", true);
4426
- __publicField(this, "address");
4427
- __publicField(this, "publicApi");
4428
- __publicField(this, "_initialValue", new Atom3({}));
4429
- /**
4430
- * Highest-priority override layer, written to by `RemoteSync` when a value
4431
- * update arrives from a remote editor window (see `internal/RemoteSync.ts`).
4432
- * Empty (`{}`) unless a remote editor is actually connected, so it's a
4433
- * no-op merge for every app that never uses the remote-sync feature.
4434
- */
4435
- __publicField(this, "_remoteOverride", new Atom3({}));
4436
- /**
4437
- * Session-only overrides for props with `persist: false`. Not written to
4438
- * persisted project state and cleared on refresh.
4439
- */
4440
- __publicField(this, "_sessionOverrides", new Atom3({}));
4441
- __publicField(this, "_cache", new SimpleCache());
4442
- __publicField(this, "_logger");
4443
- __publicField(this, "_internalUtilCtx");
4444
- this._logger = sheet._logger.named(
4445
- "SheetObject",
4446
- template.address.objectKey
4385
+ // core/src/sheetObjects/sheetObjectSequencedFull.ts
4386
+ function trackIdToPrism(obj, trackId, trackVariant) {
4387
+ const activeVariant = val4(obj.sheet.effectiveActiveSequenceVariantD);
4388
+ const trackP = pointerToSequenceTrackData(
4389
+ obj.template.project.pointers.historic.sheetsById[obj.address.sheetId],
4390
+ trackVariant,
4391
+ obj.address.objectKey,
4392
+ trackId
4393
+ );
4394
+ const timeD = obj.sheet.getSequence(activeVariant).positionPrism;
4395
+ return interpolationTripleAtPosition(obj._internalUtilCtx, trackP, timeD);
4396
+ }
4397
+ function getSequencedValues(obj) {
4398
+ return prism4(() => {
4399
+ const activeVariant = val4(obj.sheet.effectiveActiveSequenceVariantD);
4400
+ const sequenceVariant = isSheetPropsObjectKey(obj.address.objectKey) ? DEFAULT_SEQUENCE_VARIANT : activeVariant;
4401
+ const tracksToProcessD = prism4.memo(
4402
+ "tracksToProcess",
4403
+ () => obj.template.getArrayOfValidSequenceTracks(sequenceVariant),
4404
+ [sequenceVariant]
4447
4405
  );
4448
- this._logger._trace("creating object");
4449
- this._internalUtilCtx = { logger: this._logger.utilFor.internal() };
4450
- this.address = {
4451
- ...template.address,
4452
- sheetInstanceId: sheet.address.sheetInstanceId
4453
- };
4454
- this.publicApi = new TheatreSheetObject(this);
4455
- }
4456
- get type() {
4457
- return "Theatre_SheetObject";
4458
- }
4459
- getValues() {
4460
- return this._cache.get(
4461
- "getValues()",
4462
- () => prism4(() => {
4463
- const defaults = val4(this.template.getDefaultValues());
4464
- const initial = val4(this._initialValue.pointer);
4465
- const withInitialCache = prism4.memo(
4466
- "withInitialCache",
4467
- () => /* @__PURE__ */ new WeakMap(),
4468
- []
4469
- );
4470
- const withInitial = deepMergeWithCache(
4471
- defaults,
4472
- initial,
4473
- withInitialCache
4406
+ const tracksToProcess = val4(tracksToProcessD);
4407
+ const valsAtom = new Atom3({});
4408
+ const config = val4(obj.template.configPointer);
4409
+ prism4.effect(
4410
+ "processTracks",
4411
+ () => {
4412
+ const untaps = [];
4413
+ for (const { trackId, pathToProp, trackVariant } of tracksToProcess) {
4414
+ if (obj.template.isNonSequencablePropPath(pathToProp)) continue;
4415
+ const pr = trackIdToPrism(obj, trackId, trackVariant);
4416
+ const propConfig = getPropConfigByPath(
4417
+ config,
4418
+ pathToProp
4419
+ );
4420
+ const deserializeAndSanitize = propConfig.deserializeAndSanitize;
4421
+ const interpolate = propConfig.interpolate;
4422
+ const updateSequenceValueFromItsPrism = () => {
4423
+ const triple = pr.getValue();
4424
+ if (!triple)
4425
+ return valsAtom.setByPointer(
4426
+ (p2) => pointerDeep(p2, pathToProp),
4427
+ void 0
4428
+ );
4429
+ const leftDeserialized = deserializeAndSanitize(triple.left);
4430
+ const left = leftDeserialized === void 0 ? propConfig.default : leftDeserialized;
4431
+ if (triple.right === void 0)
4432
+ return valsAtom.setByPointer(
4433
+ (p2) => pointerDeep(p2, pathToProp),
4434
+ left
4435
+ );
4436
+ const rightDeserialized = deserializeAndSanitize(triple.right);
4437
+ const right = rightDeserialized === void 0 ? propConfig.default : rightDeserialized;
4438
+ return valsAtom.setByPointer(
4439
+ (p2) => pointerDeep(p2, pathToProp),
4440
+ interpolate(left, right, triple.progression)
4441
+ );
4442
+ };
4443
+ const untap = pr.onStale(updateSequenceValueFromItsPrism);
4444
+ updateSequenceValueFromItsPrism();
4445
+ untaps.push(untap);
4446
+ }
4447
+ return () => {
4448
+ for (const untap of untaps) {
4449
+ untap();
4450
+ }
4451
+ };
4452
+ },
4453
+ [config, ...tracksToProcess]
4454
+ );
4455
+ return valsAtom.pointer;
4456
+ });
4457
+ }
4458
+ function mergeSequencedValuesIntoFinal(obj, base, withSeqsCache) {
4459
+ const pointerToSequencedValuesD = prism4.memo(
4460
+ "seq",
4461
+ () => getSequencedValues(obj),
4462
+ []
4463
+ );
4464
+ const sequenced = val4(val4(pointerToSequencedValuesD));
4465
+ return deepMergeWithCache(base, sequenced, withSeqsCache);
4466
+ }
4467
+
4468
+ // core/src/utils/isTheatreLiteMode.ts
4469
+ function isTheatreLiteMode() {
4470
+ if (false) {
4471
+ return true;
4472
+ }
4473
+ if (typeof globalThis !== "undefined") {
4474
+ return !!globalThis.__THEATRE_FORCE_LITE__;
4475
+ }
4476
+ return false;
4477
+ }
4478
+
4479
+ // shared/src/utils/updateDeep.ts
4480
+ function updateDeep(obj, path, reducer) {
4481
+ if (path.length === 0) return reducer(obj);
4482
+ return hoop(obj, path, reducer);
4483
+ }
4484
+ var hoop = (s2, path, reducer) => {
4485
+ if (path.length === 0) {
4486
+ return reducer(s2);
4487
+ }
4488
+ if (Array.isArray(s2)) {
4489
+ let [index, ...restOfPath] = path;
4490
+ index = parseInt(String(index), 10);
4491
+ if (isNaN(index)) index = 0;
4492
+ const oldVal = s2[index];
4493
+ const newVal = hoop(oldVal, restOfPath, reducer);
4494
+ if (oldVal === newVal) return s2;
4495
+ const newS = [...s2];
4496
+ newS.splice(index, 1, newVal);
4497
+ return newS;
4498
+ } else if (typeof s2 === "object" && s2 !== null) {
4499
+ const [key, ...restOfPath] = path;
4500
+ const oldVal = s2[key];
4501
+ const newVal = hoop(oldVal, restOfPath, reducer);
4502
+ if (oldVal === newVal) return s2;
4503
+ const newS = { ...s2, [key]: newVal };
4504
+ return newS;
4505
+ } else {
4506
+ const [key, ...restOfPath] = path;
4507
+ return { [key]: hoop(void 0, restOfPath, reducer) };
4508
+ }
4509
+ };
4510
+
4511
+ // shared/src/utils/setDeepImmutable.ts
4512
+ function setDeepImmutable(obj, path, replace) {
4513
+ return updateDeep(obj, path, () => replace);
4514
+ }
4515
+
4516
+ // core/src/sheetObjects/SheetObject.ts
4517
+ var SheetObject = class {
4518
+ constructor(sheet, template, nativeObject) {
4519
+ this.sheet = sheet;
4520
+ this.template = template;
4521
+ this.nativeObject = nativeObject;
4522
+ __publicField(this, "$$isPointerToPrismProvider", true);
4523
+ __publicField(this, "address");
4524
+ __publicField(this, "publicApi");
4525
+ __publicField(this, "_initialValue", new Atom4({}));
4526
+ /**
4527
+ * Highest-priority override layer, written to by `RemoteSync` when a value
4528
+ * update arrives from a remote editor window (see `internal/RemoteSync.ts`).
4529
+ * Empty (`{}`) unless a remote editor is actually connected, so it's a
4530
+ * no-op merge for every app that never uses the remote-sync feature.
4531
+ */
4532
+ __publicField(this, "_remoteOverride", new Atom4({}));
4533
+ /**
4534
+ * Session-only overrides for props with `persist: false`. Not written to
4535
+ * persisted project state and cleared on refresh.
4536
+ */
4537
+ __publicField(this, "_sessionOverrides", new Atom4({}));
4538
+ __publicField(this, "_cache", new SimpleCache());
4539
+ __publicField(this, "_logger");
4540
+ /** @internal Used by `sheetObjectSequencedFull`. */
4541
+ __publicField(this, "_internalUtilCtx");
4542
+ this._logger = sheet._logger.named(
4543
+ "SheetObject",
4544
+ template.address.objectKey
4545
+ );
4546
+ this._logger._trace("creating object");
4547
+ this._internalUtilCtx = { logger: this._logger.utilFor.internal() };
4548
+ this.address = {
4549
+ ...template.address,
4550
+ sheetInstanceId: sheet.address.sheetInstanceId
4551
+ };
4552
+ this.publicApi = new TheatreSheetObject(this);
4553
+ }
4554
+ get type() {
4555
+ return "Theatre_SheetObject";
4556
+ }
4557
+ getValues() {
4558
+ return this._cache.get(
4559
+ "getValues()",
4560
+ () => prism5(() => {
4561
+ const defaults = val5(this.template.getDefaultValues());
4562
+ const initial = val5(this._initialValue.pointer);
4563
+ const withInitialCache = prism5.memo(
4564
+ "withInitialCache",
4565
+ () => /* @__PURE__ */ new WeakMap(),
4566
+ []
4567
+ );
4568
+ const withInitial = deepMergeWithCache(
4569
+ defaults,
4570
+ initial,
4571
+ withInitialCache
4474
4572
  );
4475
- const ahistoricStatics = val4(this.template.getAhistoricStaticValues());
4476
- const withAhistoricStaticsCache = prism4.memo(
4573
+ const ahistoricStatics = val5(this.template.getAhistoricStaticValues());
4574
+ const withAhistoricStaticsCache = prism5.memo(
4477
4575
  "withAhistoricStatics",
4478
4576
  () => /* @__PURE__ */ new WeakMap(),
4479
4577
  []
@@ -4483,10 +4581,10 @@ var SheetObject = class {
4483
4581
  ahistoricStatics,
4484
4582
  withAhistoricStaticsCache
4485
4583
  );
4486
- const activeVariant = val4(this.sheet.effectiveActiveSequenceVariantD);
4584
+ const activeVariant = val5(this.sheet.effectiveActiveSequenceVariantD);
4487
4585
  const staticVariant = isSheetPropsObjectKey(this.address.objectKey) ? DEFAULT_SEQUENCE_VARIANT : activeVariant;
4488
- const statics = val4(this.template.getStaticValues(staticVariant));
4489
- const withStaticsCache = prism4.memo(
4586
+ const statics = val5(this.template.getStaticValues(staticVariant));
4587
+ const withStaticsCache = prism5.memo(
4490
4588
  "withStatics",
4491
4589
  () => /* @__PURE__ */ new WeakMap(),
4492
4590
  []
@@ -4497,24 +4595,16 @@ var SheetObject = class {
4497
4595
  withStaticsCache
4498
4596
  );
4499
4597
  let final = withStatics;
4500
- let sequenced;
4501
- {
4502
- const pointerToSequencedValuesD = prism4.memo(
4503
- "seq",
4504
- () => this.getSequencedValues(),
4505
- []
4506
- );
4507
- const withSeqsCache = prism4.memo(
4598
+ if (!isTheatreLiteMode()) {
4599
+ const withSeqsCache = prism5.memo(
4508
4600
  "withSeqsCache",
4509
4601
  () => /* @__PURE__ */ new WeakMap(),
4510
4602
  []
4511
4603
  );
4512
- sequenced = val4(val4(pointerToSequencedValuesD));
4513
- const withSeqs = deepMergeWithCache(final, sequenced, withSeqsCache);
4514
- final = withSeqs;
4604
+ final = mergeSequencedValuesIntoFinal(this, final, withSeqsCache);
4515
4605
  }
4516
- const sessionOverrides = val4(this._sessionOverrides.pointer);
4517
- const withSessionOverridesCache = prism4.memo(
4606
+ const sessionOverrides = val5(this._sessionOverrides.pointer);
4607
+ const withSessionOverridesCache = prism5.memo(
4518
4608
  "withSessionOverridesCache",
4519
4609
  () => /* @__PURE__ */ new WeakMap(),
4520
4610
  []
@@ -4524,8 +4614,8 @@ var SheetObject = class {
4524
4614
  sessionOverrides,
4525
4615
  withSessionOverridesCache
4526
4616
  );
4527
- const remoteOverride = val4(this._remoteOverride.pointer);
4528
- const withRemoteOverrideCache = prism4.memo(
4617
+ const remoteOverride = val5(this._remoteOverride.pointer);
4618
+ const withRemoteOverrideCache = prism5.memo(
4529
4619
  "withRemoteOverrideCache",
4530
4620
  () => /* @__PURE__ */ new WeakMap(),
4531
4621
  []
@@ -4540,106 +4630,31 @@ var SheetObject = class {
4540
4630
  })
4541
4631
  );
4542
4632
  }
4543
- getValueByPointer(pointer3) {
4544
- const allValuesP = val4(this.getValues());
4545
- const { path } = getPointerParts(pointer3);
4546
- return val4(
4633
+ getValueByPointer(pointer4) {
4634
+ const allValuesP = val5(this.getValues());
4635
+ const { path } = getPointerParts(pointer4);
4636
+ return val5(
4547
4637
  pointerDeep(allValuesP, path)
4548
4638
  );
4549
4639
  }
4550
- pointerToPrism(pointer3) {
4551
- const { path } = getPointerParts(pointer3);
4552
- return prism4(() => {
4553
- const allValuesP = val4(this.getValues());
4554
- return val4(pointerDeep(allValuesP, path));
4555
- });
4556
- }
4557
- /**
4558
- * Returns values of props that are sequenced.
4559
- */
4560
- getSequencedValues() {
4561
- return prism4(() => {
4562
- const activeVariant = val4(this.sheet.effectiveActiveSequenceVariantD);
4563
- const sequenceVariant = isSheetPropsObjectKey(this.address.objectKey) ? DEFAULT_SEQUENCE_VARIANT : activeVariant;
4564
- const tracksToProcessD = prism4.memo(
4565
- "tracksToProcess",
4566
- () => this.template.getArrayOfValidSequenceTracks(sequenceVariant),
4567
- [sequenceVariant]
4568
- );
4569
- const tracksToProcess = val4(tracksToProcessD);
4570
- const valsAtom = new Atom3({});
4571
- const config = val4(this.template.configPointer);
4572
- prism4.effect(
4573
- "processTracks",
4574
- () => {
4575
- const untaps = [];
4576
- for (const { trackId, pathToProp, trackVariant } of tracksToProcess) {
4577
- if (this.template.isNonSequencablePropPath(pathToProp)) continue;
4578
- const pr = this._trackIdToPrism(trackId, trackVariant);
4579
- const propConfig = getPropConfigByPath(
4580
- config,
4581
- pathToProp
4582
- );
4583
- const deserializeAndSanitize = propConfig.deserializeAndSanitize;
4584
- const interpolate = propConfig.interpolate;
4585
- const updateSequenceValueFromItsPrism = () => {
4586
- const triple = pr.getValue();
4587
- if (!triple)
4588
- return valsAtom.setByPointer(
4589
- (p2) => pointerDeep(p2, pathToProp),
4590
- void 0
4591
- );
4592
- const leftDeserialized = deserializeAndSanitize(triple.left);
4593
- const left = leftDeserialized === void 0 ? propConfig.default : leftDeserialized;
4594
- if (triple.right === void 0)
4595
- return valsAtom.setByPointer(
4596
- (p2) => pointerDeep(p2, pathToProp),
4597
- left
4598
- );
4599
- const rightDeserialized = deserializeAndSanitize(triple.right);
4600
- const right = rightDeserialized === void 0 ? propConfig.default : rightDeserialized;
4601
- return valsAtom.setByPointer(
4602
- (p2) => pointerDeep(p2, pathToProp),
4603
- interpolate(left, right, triple.progression)
4604
- );
4605
- };
4606
- const untap = pr.onStale(updateSequenceValueFromItsPrism);
4607
- updateSequenceValueFromItsPrism();
4608
- untaps.push(untap);
4609
- }
4610
- return () => {
4611
- for (const untap of untaps) {
4612
- untap();
4613
- }
4614
- };
4615
- },
4616
- [config, ...tracksToProcess]
4617
- );
4618
- return valsAtom.pointer;
4640
+ pointerToPrism(pointer4) {
4641
+ const { path } = getPointerParts(pointer4);
4642
+ return prism5(() => {
4643
+ const allValuesP = val5(this.getValues());
4644
+ return val5(pointerDeep(allValuesP, path));
4619
4645
  });
4620
4646
  }
4621
- _trackIdToPrism(trackId, trackVariant) {
4622
- const activeVariant = val4(this.sheet.effectiveActiveSequenceVariantD);
4623
- const trackP = pointerToSequenceTrackData(
4624
- this.template.project.pointers.historic.sheetsById[this.address.sheetId],
4625
- trackVariant,
4626
- this.address.objectKey,
4627
- trackId
4628
- );
4629
- const timeD = this.sheet.getSequence(activeVariant).positionPrism;
4630
- return interpolationTripleAtPosition(this._internalUtilCtx, trackP, timeD);
4631
- }
4632
4647
  get propsP() {
4633
4648
  return this._cache.get(
4634
4649
  "propsP",
4635
4650
  () => pointer({ root: this, path: [] })
4636
4651
  );
4637
4652
  }
4638
- validateValue(pointer3, value) {
4653
+ validateValue(pointer4, value) {
4639
4654
  }
4640
- setInitialValue(val13) {
4641
- this.validateValue(this.propsP, val13);
4642
- this._initialValue.set(val13);
4655
+ setInitialValue(val15) {
4656
+ this.validateValue(this.propsP, val15);
4657
+ this._initialValue.set(val15);
4643
4658
  }
4644
4659
  setSessionOverride(path, value) {
4645
4660
  const propConfig = getPropConfigByPath(this.template.staticConfig, path);
@@ -4659,8 +4674,8 @@ var SheetObject = class {
4659
4674
  * Internal: called by `RemoteSync` when a value update for this object
4660
4675
  * arrives from a remote editor window. Not exposed on the public API.
4661
4676
  */
4662
- setRemoteOverride(val13) {
4663
- this._remoteOverride.set(val13);
4677
+ setRemoteOverride(val15) {
4678
+ this._remoteOverride.set(val15);
4664
4679
  }
4665
4680
  /**
4666
4681
  * Internal: used by `RemoteSync` to subscribe to this object's fully
@@ -4669,7 +4684,7 @@ var SheetObject = class {
4669
4684
  */
4670
4685
  onFinalValueChange(fn2) {
4671
4686
  return onChange(
4672
- prism4(() => val4(this.getValues().getValue())),
4687
+ prism5(() => val5(this.getValues().getValue())),
4673
4688
  fn2
4674
4689
  );
4675
4690
  }
@@ -5240,9 +5255,9 @@ var SheetObjectTemplate = class {
5240
5255
  config,
5241
5256
  sheetTemplate.project
5242
5257
  );
5243
- this._config = new Atom4(configWithPrecisionDefaults);
5244
- this._temp_actions_atom = new Atom4(_temp_actions);
5245
- this.showPropsOf_atom = new Atom4([]);
5258
+ this._config = new Atom5(configWithPrecisionDefaults);
5259
+ this._temp_actions_atom = new Atom5(_temp_actions);
5260
+ this.showPropsOf_atom = new Atom5([]);
5246
5261
  this._transientPropPaths = normalizeTransientPropPaths(
5247
5262
  transient,
5248
5263
  config,
@@ -5299,7 +5314,7 @@ var SheetObjectTemplate = class {
5299
5314
  return this.showPropsOf_atom.pointer;
5300
5315
  }
5301
5316
  _stripNonPersistingPropsFromAhistoricState() {
5302
- const config = val5(this.configPointer);
5317
+ const config = val6(this.configPointer);
5303
5318
  this.project._stripNonPersistingPropsFromAhistoric(
5304
5319
  this.address.sheetId,
5305
5320
  this.address.objectKey,
@@ -5428,8 +5443,8 @@ var SheetObjectTemplate = class {
5428
5443
  getDefaultValues() {
5429
5444
  return this._cache.get(
5430
5445
  "getDefaultValues()",
5431
- () => prism5(() => {
5432
- const config = val5(this.configPointer);
5446
+ () => prism6(() => {
5447
+ const config = val6(this.configPointer);
5433
5448
  return getPropDefaultsOfSheetObject(config);
5434
5449
  })
5435
5450
  );
@@ -5441,14 +5456,14 @@ var SheetObjectTemplate = class {
5441
5456
  getStaticValues(sequenceVariant = DEFAULT_SEQUENCE_VARIANT) {
5442
5457
  return this._cache.get(
5443
5458
  "getStaticValues:".concat(sequenceVariant),
5444
- () => prism5(() => {
5445
- const sheetState = val5(this.pointerToSheetState);
5459
+ () => prism6(() => {
5460
+ const sheetState = val6(this.pointerToSheetState);
5446
5461
  const json = getEffectiveStaticOverrideForObject(
5447
5462
  sheetState,
5448
5463
  sequenceVariant,
5449
5464
  this.address.objectKey
5450
5465
  ) ?? {};
5451
- const config = val5(this.configPointer);
5466
+ const config = val6(this.configPointer);
5452
5467
  const deserialized = config.deserializeAndSanitize(json) || {};
5453
5468
  const withoutNonPersisting = stripNonPersistingPropValuesFromMap(
5454
5469
  deserialized,
@@ -5471,9 +5486,9 @@ var SheetObjectTemplate = class {
5471
5486
  getAhistoricStaticValues() {
5472
5487
  return this._cache.get(
5473
5488
  "getAhistoricStaticValues",
5474
- () => prism5(() => {
5475
- const json = val5(this.pointerToAhistoricStaticOverrides) ?? {};
5476
- const config = val5(this.configPointer);
5489
+ () => prism6(() => {
5490
+ const json = val6(this.pointerToAhistoricStaticOverrides) ?? {};
5491
+ const config = val6(this.configPointer);
5477
5492
  const deserialized = config.deserializeAndSanitize(json) || {};
5478
5493
  return stripNonPersistingPropValuesFromMap(deserialized, config);
5479
5494
  })
@@ -5488,13 +5503,13 @@ var SheetObjectTemplate = class {
5488
5503
  getArrayOfValidSequenceTracks(sequenceVariant) {
5489
5504
  return this._cache.get(
5490
5505
  "getArrayOfValidSequenceTracks:".concat(sequenceVariant),
5491
- () => prism5(
5506
+ () => prism6(
5492
5507
  () => {
5493
5508
  const effectiveSequenceVariant = isSheetPropsObjectKey(
5494
5509
  this.address.objectKey
5495
5510
  ) ? DEFAULT_SEQUENCE_VARIANT : sequenceVariant;
5496
5511
  const pointerToSheetState = this.project.pointers.historic.sheetsById[this.address.sheetId];
5497
- val5(pointerToSheetState.variantObjectOverrides);
5512
+ val6(pointerToSheetState.variantObjectOverrides);
5498
5513
  const defaultTrackIdByPropPath = valTrackIdByPropPathForObject(
5499
5514
  pointerToSheetState,
5500
5515
  DEFAULT_SEQUENCE_VARIANT,
@@ -5520,7 +5535,7 @@ var SheetObjectTemplate = class {
5520
5535
  return emptyArray;
5521
5536
  }
5522
5537
  const arrayOfIds = [];
5523
- const objectConfig = val5(this.configPointer);
5538
+ const objectConfig = val6(this.configPointer);
5524
5539
  for (const [pathToPropInString, effectiveTrack] of Object.entries(
5525
5540
  mergedTrackMap
5526
5541
  )) {
@@ -5570,8 +5585,8 @@ var SheetObjectTemplate = class {
5570
5585
  getMapOfValidSequenceTracks_forStudio(sequenceVariant) {
5571
5586
  return this._cache.get(
5572
5587
  "getMapOfValidSequenceTracks_forStudio:".concat(sequenceVariant),
5573
- () => prism5(() => {
5574
- const arr = val5(this.getArrayOfValidSequenceTracks(sequenceVariant));
5588
+ () => prism6(() => {
5589
+ const arr = val6(this.getArrayOfValidSequenceTracks(sequenceVariant));
5575
5590
  let map = {};
5576
5591
  for (const { pathToProp, trackId } of arr) {
5577
5592
  set_default(map, pathToProp, trackId);
@@ -5591,9 +5606,9 @@ var SheetObjectTemplate = class {
5591
5606
  getStaticButNotSequencedOverrides(sequenceVariant) {
5592
5607
  return this._cache.get(
5593
5608
  "getStaticButNotSequencedOverrides:".concat(sequenceVariant),
5594
- () => prism5(() => {
5595
- const staticOverrides = val5(this.getStaticValues(sequenceVariant));
5596
- const arrayOfValidSequenceTracks = val5(
5609
+ () => prism6(() => {
5610
+ const staticOverrides = val6(this.getStaticValues(sequenceVariant));
5611
+ const arrayOfValidSequenceTracks = val6(
5597
5612
  this.getArrayOfValidSequenceTracks(sequenceVariant)
5598
5613
  );
5599
5614
  const staticButNotSequencedOverrides = cloneDeep_default(staticOverrides);
@@ -5618,8 +5633,8 @@ var SheetObjectTemplate = class {
5618
5633
  })
5619
5634
  );
5620
5635
  }
5621
- getDefaultsAtPointer(pointer3) {
5622
- const { path } = getPointerParts2(pointer3);
5636
+ getDefaultsAtPointer(pointer4) {
5637
+ const { path } = getPointerParts2(pointer4);
5623
5638
  const defaults = this.getDefaultValues().getValue();
5624
5639
  const defaultsAtPath = getDeep(defaults, path);
5625
5640
  return defaultsAtPath;
@@ -5640,239 +5655,73 @@ function parsePathToProp(pathToPropInString) {
5640
5655
  }
5641
5656
 
5642
5657
  // core/src/sheets/SheetTemplate.ts
5643
- import { Atom as Atom10 } from "@unseenco/theatre-dataverse";
5644
-
5645
- // shared/src/utils/didYouMean.ts
5646
- var import_propose = __toESM(require_propose());
5647
- function didYouMean(str, dictionary, prepend = "Did you mean ", append = "?") {
5648
- const p2 = (0, import_propose.default)(str, dictionary, {
5649
- threshold: 0.7
5650
- });
5651
- if (p2) {
5652
- return prepend + JSON.stringify(p2) + append;
5653
- } else {
5654
- return "";
5655
- }
5656
- }
5657
-
5658
- // core/src/sequences/Sequence.ts
5659
- import { getPointerParts as getPointerParts3 } from "@unseenco/theatre-dataverse";
5660
- import { Atom as Atom8 } from "@unseenco/theatre-dataverse";
5661
- import { pointer as pointer2 } from "@unseenco/theatre-dataverse";
5662
- import { prism as prism6, val as val6 } from "@unseenco/theatre-dataverse";
5663
-
5664
- // shared/src/utils/defer.ts
5665
- function defer() {
5666
- let resolve;
5667
- let reject;
5668
- const promise = new Promise((rs, rj) => {
5669
- resolve = (v2) => {
5670
- rs(v2);
5671
- deferred.status = "resolved";
5672
- };
5673
- reject = (v2) => {
5674
- rj(v2);
5675
- deferred.status = "rejected";
5676
- };
5677
- });
5678
- const deferred = {
5679
- resolve,
5680
- reject,
5681
- promise,
5682
- status: "pending"
5683
- };
5684
- return deferred;
5685
- }
5658
+ import { Atom as Atom12 } from "@unseenco/theatre-dataverse";
5686
5659
 
5687
- // shared/src/utils/noop.ts
5688
- var noop = () => {
5689
- };
5690
- var noop_default = noop;
5660
+ // core/src/sequences/LiteSequence.ts
5661
+ import { prism as prism7 } from "@unseenco/theatre-dataverse";
5691
5662
 
5692
- // core/src/sequences/playbackControllers/DefaultPlaybackController.ts
5693
- import { Atom as Atom5 } from "@unseenco/theatre-dataverse";
5694
- var DefaultPlaybackController = class {
5663
+ // core/src/sequences/TheatreSequenceLite.ts
5664
+ import { Atom as Atom6, pointer as pointer2 } from "@unseenco/theatre-dataverse";
5665
+ var LITE_DEFAULT_LENGTH = 10;
5666
+ var TheatreSequenceLite = class {
5695
5667
  constructor() {
5696
- __publicField(this, "_stopPlayCallback", noop_default);
5697
- __publicField(this, "_state", new Atom5({
5698
- position: 0,
5699
- playing: false
5668
+ __publicField(this, "type", "Theatre_Sequence_PublicAPI");
5669
+ __publicField(this, "_state", new Atom6({
5670
+ playing: false,
5671
+ length: LITE_DEFAULT_LENGTH,
5672
+ position: 0
5700
5673
  }));
5701
- __publicField(this, "statePointer");
5702
- this.statePointer = this._state.pointer;
5674
+ __publicField(this, "pointer", pointer2({ root: this._state.pointer, path: [] }));
5703
5675
  }
5704
- destroy() {
5676
+ play() {
5677
+ return Promise.resolve(true);
5705
5678
  }
5706
5679
  pause() {
5707
- this._stopPlayCallback();
5708
- this.playing = false;
5709
- this._stopPlayCallback = noop_default;
5710
5680
  }
5711
- gotoPosition(time) {
5712
- this._updatePositionInState(time);
5681
+ get position() {
5682
+ return 0;
5713
5683
  }
5714
- _updatePositionInState(time) {
5715
- this._state.setByPointer((p2) => p2.position, time);
5684
+ set position(_position) {
5716
5685
  }
5717
- getCurrentPosition() {
5718
- return this._state.get().position;
5686
+ __experimental_getKeyframes(_prop) {
5687
+ return [];
5719
5688
  }
5720
- get playing() {
5721
- return this._state.get().playing;
5689
+ __experimental_getGsapClips() {
5690
+ return [];
5722
5691
  }
5723
- set playing(playing) {
5724
- this._state.setByPointer((p2) => p2.playing, playing);
5692
+ __experimental_getGsapScrollTriggers() {
5693
+ return [];
5725
5694
  }
5726
- play(iterationCount, range, rate, direction, ticker) {
5727
- if (this.playing) {
5728
- this.pause();
5729
- }
5730
- this.playing = true;
5731
- const iterationLength = range[1] - range[0];
5732
- {
5733
- const startPos = this.getCurrentPosition();
5734
- if (startPos < range[0] || startPos > range[1]) {
5735
- if (direction === "normal" || direction === "alternate") {
5736
- this._updatePositionInState(range[0]);
5737
- } else if (direction === "reverse" || direction === "alternateReverse") {
5738
- this._updatePositionInState(range[1]);
5739
- }
5740
- } else if (direction === "normal" || direction === "alternate") {
5741
- if (startPos === range[1]) {
5742
- this._updatePositionInState(range[0]);
5743
- }
5744
- } else {
5745
- if (startPos === range[0]) {
5746
- this._updatePositionInState(range[1]);
5747
- }
5748
- }
5749
- }
5750
- const deferred = defer();
5751
- const initialTickerTime = ticker.time;
5752
- const totalPlaybackLength = iterationLength * iterationCount;
5753
- let initialElapsedPos = this.getCurrentPosition() - range[0];
5754
- if (direction === "reverse" || direction === "alternateReverse") {
5755
- initialElapsedPos = range[1] - this.getCurrentPosition();
5756
- }
5757
- const tick = (currentTickerTime) => {
5758
- const elapsedTickerTime = Math.max(
5759
- currentTickerTime - initialTickerTime,
5760
- 0
5761
- );
5762
- const elapsedTickerTimeInSeconds = elapsedTickerTime / 1e3;
5763
- const elapsedPos = Math.min(
5764
- elapsedTickerTimeInSeconds * rate + initialElapsedPos,
5765
- totalPlaybackLength
5766
- );
5767
- if (elapsedPos !== totalPlaybackLength) {
5768
- const iterationNumber = Math.floor(elapsedPos / iterationLength);
5769
- let currentIterationPos = elapsedPos / iterationLength % 1 * iterationLength;
5770
- if (direction !== "normal") {
5771
- if (direction === "reverse") {
5772
- currentIterationPos = iterationLength - currentIterationPos;
5773
- } else {
5774
- const isCurrentIterationNumberEven = iterationNumber % 2 === 0;
5775
- if (direction === "alternate") {
5776
- if (!isCurrentIterationNumberEven) {
5777
- currentIterationPos = iterationLength - currentIterationPos;
5778
- }
5779
- } else {
5780
- if (isCurrentIterationNumberEven) {
5781
- currentIterationPos = iterationLength - currentIterationPos;
5782
- }
5783
- }
5784
- }
5785
- }
5786
- this._updatePositionInState(currentIterationPos + range[0]);
5787
- requestNextTick();
5788
- } else {
5789
- if (direction === "normal") {
5790
- this._updatePositionInState(range[1]);
5791
- } else if (direction === "reverse") {
5792
- this._updatePositionInState(range[0]);
5793
- } else {
5794
- const isLastIterationEven = (iterationCount - 1) % 2 === 0;
5795
- if (direction === "alternate") {
5796
- if (isLastIterationEven) {
5797
- this._updatePositionInState(range[1]);
5798
- } else {
5799
- this._updatePositionInState(range[0]);
5800
- }
5801
- } else {
5802
- if (isLastIterationEven) {
5803
- this._updatePositionInState(range[0]);
5804
- } else {
5805
- this._updatePositionInState(range[1]);
5806
- }
5807
- }
5808
- }
5809
- this.playing = false;
5810
- deferred.resolve(true);
5811
- }
5812
- };
5813
- this._stopPlayCallback = () => {
5814
- ticker.offThisOrNextTick(tick);
5815
- ticker.offNextTick(tick);
5816
- if (this.playing) deferred.resolve(false);
5817
- };
5818
- const requestNextTick = () => ticker.onNextTick(tick);
5819
- ticker.onThisOrNextTick(tick);
5820
- return deferred.promise;
5821
- }
5822
- playDynamicRange(rangeD, ticker) {
5823
- if (this.playing) {
5824
- this.pause();
5825
- }
5826
- this.playing = true;
5827
- const deferred = defer();
5828
- const untapFromRangeD = rangeD.keepHot();
5829
- void deferred.promise.then(untapFromRangeD, untapFromRangeD);
5830
- let lastTickerTime = ticker.time;
5831
- const tick = (currentTickerTime) => {
5832
- const elapsedSinceLastTick = Math.max(
5833
- currentTickerTime - lastTickerTime,
5834
- 0
5835
- );
5836
- lastTickerTime = currentTickerTime;
5837
- const elapsedSinceLastTickInSeconds = elapsedSinceLastTick / 1e3;
5838
- const lastPosition = this.getCurrentPosition();
5839
- const range = rangeD.getValue();
5840
- if (lastPosition < range[0] || lastPosition > range[1]) {
5841
- this.gotoPosition(range[0]);
5842
- } else {
5843
- let newPosition = lastPosition + elapsedSinceLastTickInSeconds;
5844
- if (newPosition > range[1]) {
5845
- newPosition = range[0] + (newPosition - range[1]);
5846
- }
5847
- this.gotoPosition(newPosition);
5848
- }
5849
- requestNextTick();
5850
- };
5851
- this._stopPlayCallback = () => {
5852
- ticker.offThisOrNextTick(tick);
5853
- ticker.offNextTick(tick);
5854
- deferred.resolve(false);
5855
- };
5856
- const requestNextTick = () => ticker.onNextTick(tick);
5857
- ticker.onThisOrNextTick(tick);
5858
- return deferred.promise;
5859
- }
5860
- };
5861
-
5862
- // core/src/sequences/playbackControllers/AudioPlaybackController.ts
5863
- import { Atom as Atom6 } from "@unseenco/theatre-dataverse";
5864
-
5865
- // shared/src/globalVariableNames.ts
5866
- var studioBundle = "__TheatreJS_StudioBundle";
5867
- var coreBundle = "__TheatreJS_CoreBundle";
5868
- var notifications = "__TheatreJS_Notifications";
5869
-
5870
- // shared/src/notify.ts
5871
- var createHandler = (type) => (...args) => {
5872
- switch (type) {
5873
- case "success": {
5874
- logger_default.debug(args.slice(0, 2).join("\n"));
5875
- break;
5695
+ attachAudio(_args) {
5696
+ return Promise.reject(
5697
+ new Error(
5698
+ "sequence.attachAudio() is not available in @unseenco/theatre-core-lite"
5699
+ )
5700
+ );
5701
+ }
5702
+ };
5703
+
5704
+ // core/src/sequences/LiteSequence.ts
5705
+ var LiteSequence = class {
5706
+ constructor() {
5707
+ __publicField(this, "publicApi", new TheatreSequenceLite());
5708
+ __publicField(this, "positionPrism", prism7(() => 0));
5709
+ }
5710
+ pause() {
5711
+ }
5712
+ };
5713
+
5714
+ // shared/src/globalVariableNames.ts
5715
+ var studioBundle = "__TheatreJS_StudioBundle";
5716
+ var coreBundle = "__TheatreJS_CoreBundle";
5717
+ var notifications = "__TheatreJS_Notifications";
5718
+
5719
+ // shared/src/notify.ts
5720
+ var createHandler = (type) => (...args) => {
5721
+ switch (type) {
5722
+ case "success": {
5723
+ logger_default.debug(args.slice(0, 2).join("\n"));
5724
+ break;
5876
5725
  }
5877
5726
  case "info": {
5878
5727
  logger_default.debug(args.slice(0, 2).join("\n"));
@@ -5911,100 +5760,635 @@ if (typeof window !== "undefined") {
5911
5760
  });
5912
5761
  }
5913
5762
 
5914
- // core/src/sequences/playbackControllers/AudioPlaybackController.ts
5915
- var AudioPlaybackController = class {
5916
- constructor(_decodedBuffer, _audioContext, _nodeDestination) {
5917
- this._decodedBuffer = _decodedBuffer;
5918
- this._audioContext = _audioContext;
5919
- this._nodeDestination = _nodeDestination;
5920
- __publicField(this, "_mainGain");
5921
- __publicField(this, "_state", new Atom6({
5922
- position: 0,
5923
- playing: false
5924
- }));
5925
- __publicField(this, "statePointer");
5926
- __publicField(this, "_stopPlayCallback", noop_default);
5927
- this.statePointer = this._state.pointer;
5928
- this._mainGain = this._audioContext.createGain();
5929
- this._mainGain.connect(this._nodeDestination);
5930
- }
5931
- playDynamicRange(rangeD, ticker) {
5932
- const deferred = defer();
5933
- if (this._playing) this.pause();
5934
- this._playing = true;
5935
- let stop = void 0;
5936
- const play = () => {
5937
- stop?.();
5938
- stop = this._loopInRange(rangeD.getValue(), ticker).stop;
5939
- };
5940
- const untapFromRangeD = rangeD.onStale(play);
5941
- play();
5942
- this._stopPlayCallback = () => {
5943
- stop?.();
5944
- untapFromRangeD();
5945
- deferred.resolve(false);
5946
- };
5947
- return deferred.promise;
5948
- }
5949
- _loopInRange(range, ticker) {
5950
- const rate = 1;
5951
- let startPos = this.getCurrentPosition();
5952
- const iterationLength = range[1] - range[0];
5953
- if (startPos < range[0] || startPos > range[1]) {
5954
- this._updatePositionInState(range[0]);
5955
- } else if (startPos === range[1]) {
5956
- this._updatePositionInState(range[0]);
5957
- }
5958
- startPos = this.getCurrentPosition();
5959
- const currentSource = this._audioContext.createBufferSource();
5960
- currentSource.buffer = this._decodedBuffer;
5961
- currentSource.connect(this._mainGain);
5962
- currentSource.playbackRate.value = rate;
5963
- currentSource.loop = true;
5964
- currentSource.loopStart = range[0];
5965
- currentSource.loopEnd = range[1];
5966
- const initialTickerTime = ticker.time;
5967
- let initialElapsedPos = startPos - range[0];
5968
- currentSource.start(0, startPos);
5969
- const tick = (currentTickerTime) => {
5970
- const elapsedTickerTime = Math.max(
5971
- currentTickerTime - initialTickerTime,
5972
- 0
5973
- );
5974
- const elapsedTickerTimeInSeconds = elapsedTickerTime / 1e3;
5975
- const elapsedPos = elapsedTickerTimeInSeconds * rate + initialElapsedPos;
5976
- let currentIterationPos = elapsedPos / iterationLength % 1 * iterationLength;
5977
- this._updatePositionInState(currentIterationPos + range[0]);
5978
- requestNextTick();
5979
- };
5980
- const requestNextTick = () => ticker.onNextTick(tick);
5981
- ticker.onThisOrNextTick(tick);
5982
- const stop = () => {
5983
- currentSource.stop();
5984
- currentSource.disconnect();
5985
- ticker.offThisOrNextTick(tick);
5986
- ticker.offNextTick(tick);
5987
- };
5988
- return { stop };
5989
- }
5990
- get _playing() {
5991
- return this._state.get().playing;
5992
- }
5993
- set _playing(playing) {
5994
- this._state.setByPointer((p2) => p2.playing, playing);
5995
- }
5996
- destroy() {
5763
+ // shared/src/utils/slashedPaths.ts
5764
+ var normalizeSlashedPath = (p2) => p2.replace(/^[\s\/]*/, "").replace(/[\s\/]*$/, "").replace(/\s*\/\s*/g, " / ");
5765
+ var getValidationErrorsOfSlashedPath = (p2) => {
5766
+ if (typeof p2 !== "string") return "it is not a string. (it is a ".concat(typeof p2, ")");
5767
+ const components = p2.split(/\//);
5768
+ if (components.length === 0) return "it is empty.";
5769
+ for (let i2 = 0; i2 < components.length; i2++) {
5770
+ const component = components[i2].trim();
5771
+ if (component.length === 0) return "the component #".concat(i2 + 1, " is empty.");
5772
+ if (component.length > 64)
5773
+ return "the component '".concat(component, "' must have 64 characters or less.");
5997
5774
  }
5998
- pause() {
5999
- this._stopPlayCallback();
6000
- this._playing = false;
6001
- this._stopPlayCallback = noop_default;
5775
+ };
5776
+ function validateAndSanitiseSlashedPathOrThrow(unsanitisedPath, fnName) {
5777
+ const sanitisedPath = normalizeSlashedPath(unsanitisedPath);
5778
+ if (process.env.NODE_ENV !== "development") {
5779
+ return sanitisedPath;
6002
5780
  }
6003
- gotoPosition(time) {
6004
- this._updatePositionInState(time);
5781
+ const validation = getValidationErrorsOfSlashedPath(sanitisedPath);
5782
+ if (validation) {
5783
+ throw new InvalidArgumentError(
5784
+ "The path in ".concat(fnName, "(").concat(typeof unsanitisedPath === "string" ? '"'.concat(unsanitisedPath, '"') : "", ") is invalid because ").concat(validation)
5785
+ );
6005
5786
  }
6006
- _updatePositionInState(time) {
6007
- this._state.reduce((s2) => ({ ...s2, position: time }));
5787
+ if (unsanitisedPath !== sanitisedPath) {
5788
+ notify.warning(
5789
+ "Invalid path provided to object",
5790
+ "The path in `".concat(fnName, '("').concat(unsanitisedPath, '")` was sanitized to `"').concat(sanitisedPath, '"`.\n\n') + "Please replace the path with the sanitized one, otherwise it will likely break in the future.",
5791
+ [
5792
+ {
5793
+ url: "https://unseen-theatre.netlify.app/docs/guide/manual/objects#creating-objects",
5794
+ title: "Sheet Objects"
5795
+ },
5796
+ {
5797
+ url: "https://unseen-theatre.netlify.app/docs/api/theatre-core#sheet.object",
5798
+ title: "API"
5799
+ }
5800
+ ]
5801
+ );
5802
+ }
5803
+ return sanitisedPath;
5804
+ }
5805
+
5806
+ // shared/src/utils/outlineNamespaces.ts
5807
+ function parseOutlineNamespacePath(namespacePath, fnName) {
5808
+ return validateAndSanitiseSlashedPathOrThrow(namespacePath, fnName).split(
5809
+ /\s*\/\s*/g
5810
+ );
5811
+ }
5812
+
5813
+ // core/src/sheets/TheatreSheet.ts
5814
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
5815
+ var TheatreSheet = class {
5816
+ get type() {
5817
+ return "Theatre_Sheet_PublicAPI";
5818
+ }
5819
+ /**
5820
+ * @internal
5821
+ */
5822
+ constructor(sheet) {
5823
+ setPrivateAPI(this, sheet);
5824
+ }
5825
+ object(key, config, opts) {
5826
+ const internal2 = privateAPI(this);
5827
+ const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(
5828
+ key,
5829
+ "sheet.object"
5830
+ );
5831
+ if (isSheetPropsObjectKey(sanitizedPath)) {
5832
+ throw new InvalidArgumentError(
5833
+ 'The key "'.concat(sanitizedPath, '" is reserved for sheet-level props. Use sheet.props() instead of sheet.object().')
5834
+ );
5835
+ }
5836
+ const existingObject = internal2.getObject(sanitizedPath);
5837
+ const nativeObject = null;
5838
+ const actions = opts?.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;
5839
+ if (existingObject) {
5840
+ if (process.env.NODE_ENV !== "production") {
5841
+ const prevConfig = getUnsanitizedObjectProps(existingObject);
5842
+ if (prevConfig) {
5843
+ if (!(0, import_fast_deep_equal2.default)(config, prevConfig)) {
5844
+ if (opts?.reconfigure === true) {
5845
+ const sanitizedConfig = compound(config);
5846
+ existingObject.template.reconfigure(sanitizedConfig);
5847
+ if (opts.transient !== void 0) {
5848
+ existingObject.template.setTransientPropPaths(
5849
+ opts.transient,
5850
+ sanitizedConfig
5851
+ );
5852
+ }
5853
+ if (opts.static !== void 0) {
5854
+ existingObject.template.setStaticPropPaths(
5855
+ opts.static,
5856
+ sanitizedConfig
5857
+ );
5858
+ }
5859
+ if (opts.showPropsOf !== void 0) {
5860
+ existingObject.template.setShowPropsOf(
5861
+ resolveShowPropsOfSources(
5862
+ existingObject,
5863
+ opts.showPropsOf,
5864
+ "sheet.object(..., {showPropsOf})"
5865
+ )
5866
+ );
5867
+ }
5868
+ setUnsanitizedObjectProps(existingObject, config);
5869
+ return existingObject.publicApi;
5870
+ } else {
5871
+ throw new Error(
5872
+ 'You seem to have called sheet.object("'.concat(key, '", config) twice, with different values for `config`. ') + "This is disallowed because changing the config of an object on the fly would make it difficult to reason about.\n\n" + 'You can fix this by either re-using the existing object, or calling sheet.object("'.concat(key, '", config) with the same config.\n\n') + "If you mean to reconfigure the object's config, set `{reconfigure: true}` in sheet.object(\"".concat(key, '", config, {reconfigure: true})')
5873
+ );
5874
+ }
5875
+ }
5876
+ }
5877
+ }
5878
+ if (actions) {
5879
+ existingObject.template._temp_setActions(actions);
5880
+ }
5881
+ if (opts?.visible !== void 0) {
5882
+ existingObject.template.setVisibleInOutline(opts.visible);
5883
+ }
5884
+ if (opts?.transient !== void 0) {
5885
+ existingObject.template.setTransientPropPaths(
5886
+ opts.transient,
5887
+ existingObject.template.staticConfig
5888
+ );
5889
+ }
5890
+ if (opts?.static !== void 0) {
5891
+ existingObject.template.setStaticPropPaths(
5892
+ opts.static,
5893
+ existingObject.template.staticConfig
5894
+ );
5895
+ }
5896
+ if (opts?.showPropsOf !== void 0) {
5897
+ existingObject.template.setShowPropsOf(
5898
+ resolveShowPropsOfSources(
5899
+ existingObject,
5900
+ opts.showPropsOf,
5901
+ "sheet.object(..., {showPropsOf})"
5902
+ )
5903
+ );
5904
+ }
5905
+ return existingObject.publicApi;
5906
+ } else {
5907
+ const sanitizedConfig = compound(config);
5908
+ const object = internal2.createObject(
5909
+ sanitizedPath,
5910
+ nativeObject,
5911
+ sanitizedConfig,
5912
+ actions,
5913
+ opts?.visible,
5914
+ opts?.transient,
5915
+ opts?.static
5916
+ );
5917
+ if (process.env.NODE_ENV !== "production") {
5918
+ setUnsanitizedObjectProps(object, config);
5919
+ }
5920
+ if (opts?.showPropsOf !== void 0) {
5921
+ object.template.setShowPropsOf(
5922
+ resolveShowPropsOfSources(
5923
+ object,
5924
+ opts.showPropsOf,
5925
+ "sheet.object(..., {showPropsOf})"
5926
+ )
5927
+ );
5928
+ }
5929
+ return object.publicApi;
5930
+ }
5931
+ }
5932
+ props(config, opts) {
5933
+ const internal2 = privateAPI(this);
5934
+ const objectKey = SHEET_PROPS_OBJECT_KEY;
5935
+ const existingObject = internal2.getSheetPropsObject();
5936
+ const nativeObject = null;
5937
+ const actions = opts?.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;
5938
+ if (existingObject) {
5939
+ if (process.env.NODE_ENV !== "production") {
5940
+ const prevConfig = getUnsanitizedObjectProps(existingObject);
5941
+ if (prevConfig) {
5942
+ if (!(0, import_fast_deep_equal2.default)(config, prevConfig)) {
5943
+ if (opts?.reconfigure === true) {
5944
+ const sanitizedConfig2 = compound(config);
5945
+ existingObject.template.reconfigure(sanitizedConfig2);
5946
+ if (opts.transient !== void 0) {
5947
+ existingObject.template.setTransientPropPaths(
5948
+ opts.transient,
5949
+ sanitizedConfig2
5950
+ );
5951
+ }
5952
+ if (opts.static !== void 0) {
5953
+ existingObject.template.setStaticPropPaths(
5954
+ opts.static,
5955
+ sanitizedConfig2
5956
+ );
5957
+ }
5958
+ setUnsanitizedObjectProps(existingObject, config);
5959
+ return existingObject.publicApi;
5960
+ } else {
5961
+ throw new Error(
5962
+ "You seem to have called sheet.props(config) twice, with different values for `config`. Use the same config on repeat calls, or pass `{reconfigure: true}` to change the schema."
5963
+ );
5964
+ }
5965
+ }
5966
+ }
5967
+ }
5968
+ if (actions) {
5969
+ existingObject.template._temp_setActions(actions);
5970
+ }
5971
+ if (opts?.transient !== void 0) {
5972
+ existingObject.template.setTransientPropPaths(
5973
+ opts.transient,
5974
+ existingObject.template.staticConfig
5975
+ );
5976
+ }
5977
+ if (opts?.static !== void 0) {
5978
+ existingObject.template.setStaticPropPaths(
5979
+ opts.static,
5980
+ existingObject.template.staticConfig
5981
+ );
5982
+ }
5983
+ return existingObject.publicApi;
5984
+ }
5985
+ const sanitizedConfig = compound(config);
5986
+ const object = internal2.createObject(
5987
+ objectKey,
5988
+ nativeObject,
5989
+ sanitizedConfig,
5990
+ actions,
5991
+ false,
5992
+ opts?.transient,
5993
+ opts?.static
5994
+ );
5995
+ if (process.env.NODE_ENV !== "production") {
5996
+ setUnsanitizedObjectProps(object, config);
5997
+ }
5998
+ return object.publicApi;
5999
+ }
6000
+ get sequence() {
6001
+ return privateAPI(this).getSequence().publicApi;
6002
+ }
6003
+ declareSequenceVariants(variants) {
6004
+ privateAPI(this).template.declareSequenceVariants(variants);
6005
+ }
6006
+ setActiveSequenceVariant(variant) {
6007
+ privateAPI(this).setActiveSequenceVariant(variant);
6008
+ }
6009
+ getActiveSequenceVariant() {
6010
+ return privateAPI(this).getActiveSequenceVariant();
6011
+ }
6012
+ getSequenceMode() {
6013
+ return privateAPI(this).getSequenceMode();
6014
+ }
6015
+ setSequenceMode(mode) {
6016
+ privateAPI(this).setSequenceMode(mode);
6017
+ }
6018
+ setPageScrollDriver(driver) {
6019
+ privateAPI(this).setPageScrollDriver(driver);
6020
+ }
6021
+ get project() {
6022
+ return privateAPI(this).project.publicApi;
6023
+ }
6024
+ get address() {
6025
+ return { ...privateAPI(this).address };
6026
+ }
6027
+ detachObject(key) {
6028
+ const internal2 = privateAPI(this);
6029
+ const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(
6030
+ key,
6031
+ 'sheet.deleteObject("'.concat(key, '")')
6032
+ );
6033
+ if (isSheetPropsObjectKey(sanitizedPath)) {
6034
+ throw new InvalidArgumentError(
6035
+ "Sheet props cannot be detached. They are removed when the sheet instance is unloaded."
6036
+ );
6037
+ }
6038
+ const obj = internal2.getObject(sanitizedPath);
6039
+ if (!obj) {
6040
+ notify.warning(
6041
+ "Couldn't delete object \"".concat(sanitizedPath, '"'),
6042
+ 'There is no object with key "'.concat(sanitizedPath, '".\n\nTo fix this, make sure you are calling `sheet.deleteObject("').concat(sanitizedPath, '")` with the correct key.')
6043
+ );
6044
+ console.warn('Object key "'.concat(sanitizedPath, '" does not exist.'));
6045
+ return;
6046
+ }
6047
+ internal2.deleteObject(sanitizedPath);
6048
+ }
6049
+ getObjects() {
6050
+ return privateAPI(this).getObjects().map((obj) => obj.publicApi);
6051
+ }
6052
+ unload() {
6053
+ privateAPI(this).unload();
6054
+ }
6055
+ declareOutlineNamespace(namespacePath, opts) {
6056
+ const internal2 = privateAPI(this);
6057
+ const parsedPath = parseOutlineNamespacePath(
6058
+ namespacePath,
6059
+ "sheet.declareOutlineNamespace"
6060
+ );
6061
+ internal2.template.setOutlineNamespaceConfig(parsedPath.join(" / "), {
6062
+ defaultCollapsed: opts?.collapsed
6063
+ });
6064
+ }
6065
+ setOutlineNamespaceCollapsed(namespacePath, collapsed) {
6066
+ const internal2 = privateAPI(this);
6067
+ const parsedPath = parseOutlineNamespacePath(
6068
+ namespacePath,
6069
+ "sheet.setOutlineNamespaceCollapsed"
6070
+ );
6071
+ internal2.template.setOutlineNamespaceConfig(parsedPath.join(" / "), {
6072
+ collapsed
6073
+ });
6074
+ }
6075
+ };
6076
+
6077
+ // core/src/sheets/Sheet.ts
6078
+ import { Atom as Atom11, prism as prism11, val as val11 } from "@unseenco/theatre-dataverse";
6079
+
6080
+ // shared/src/utils/didYouMean.ts
6081
+ var import_propose = __toESM(require_propose());
6082
+ function didYouMean(str, dictionary, prepend = "Did you mean ", append = "?") {
6083
+ const p2 = (0, import_propose.default)(str, dictionary, {
6084
+ threshold: 0.7
6085
+ });
6086
+ if (p2) {
6087
+ return prepend + JSON.stringify(p2) + append;
6088
+ } else {
6089
+ return "";
6090
+ }
6091
+ }
6092
+
6093
+ // core/src/sequences/Sequence.ts
6094
+ import { getPointerParts as getPointerParts3 } from "@unseenco/theatre-dataverse";
6095
+ import { Atom as Atom10 } from "@unseenco/theatre-dataverse";
6096
+ import { pointer as pointer3 } from "@unseenco/theatre-dataverse";
6097
+ import { prism as prism8, val as val7 } from "@unseenco/theatre-dataverse";
6098
+
6099
+ // shared/src/utils/defer.ts
6100
+ function defer() {
6101
+ let resolve;
6102
+ let reject;
6103
+ const promise = new Promise((rs, rj) => {
6104
+ resolve = (v2) => {
6105
+ rs(v2);
6106
+ deferred.status = "resolved";
6107
+ };
6108
+ reject = (v2) => {
6109
+ rj(v2);
6110
+ deferred.status = "rejected";
6111
+ };
6112
+ });
6113
+ const deferred = {
6114
+ resolve,
6115
+ reject,
6116
+ promise,
6117
+ status: "pending"
6118
+ };
6119
+ return deferred;
6120
+ }
6121
+
6122
+ // shared/src/utils/noop.ts
6123
+ var noop = () => {
6124
+ };
6125
+ var noop_default = noop;
6126
+
6127
+ // core/src/sequences/playbackControllers/DefaultPlaybackController.ts
6128
+ import { Atom as Atom7 } from "@unseenco/theatre-dataverse";
6129
+ var DefaultPlaybackController = class {
6130
+ constructor() {
6131
+ __publicField(this, "_stopPlayCallback", noop_default);
6132
+ __publicField(this, "_state", new Atom7({
6133
+ position: 0,
6134
+ playing: false
6135
+ }));
6136
+ __publicField(this, "statePointer");
6137
+ this.statePointer = this._state.pointer;
6138
+ }
6139
+ destroy() {
6140
+ }
6141
+ pause() {
6142
+ this._stopPlayCallback();
6143
+ this.playing = false;
6144
+ this._stopPlayCallback = noop_default;
6145
+ }
6146
+ gotoPosition(time) {
6147
+ this._updatePositionInState(time);
6148
+ }
6149
+ _updatePositionInState(time) {
6150
+ this._state.setByPointer((p2) => p2.position, time);
6151
+ }
6152
+ getCurrentPosition() {
6153
+ return this._state.get().position;
6154
+ }
6155
+ get playing() {
6156
+ return this._state.get().playing;
6157
+ }
6158
+ set playing(playing) {
6159
+ this._state.setByPointer((p2) => p2.playing, playing);
6160
+ }
6161
+ play(iterationCount, range, rate, direction, ticker) {
6162
+ if (this.playing) {
6163
+ this.pause();
6164
+ }
6165
+ this.playing = true;
6166
+ const iterationLength = range[1] - range[0];
6167
+ {
6168
+ const startPos = this.getCurrentPosition();
6169
+ if (startPos < range[0] || startPos > range[1]) {
6170
+ if (direction === "normal" || direction === "alternate") {
6171
+ this._updatePositionInState(range[0]);
6172
+ } else if (direction === "reverse" || direction === "alternateReverse") {
6173
+ this._updatePositionInState(range[1]);
6174
+ }
6175
+ } else if (direction === "normal" || direction === "alternate") {
6176
+ if (startPos === range[1]) {
6177
+ this._updatePositionInState(range[0]);
6178
+ }
6179
+ } else {
6180
+ if (startPos === range[0]) {
6181
+ this._updatePositionInState(range[1]);
6182
+ }
6183
+ }
6184
+ }
6185
+ const deferred = defer();
6186
+ const initialTickerTime = ticker.time;
6187
+ const totalPlaybackLength = iterationLength * iterationCount;
6188
+ let initialElapsedPos = this.getCurrentPosition() - range[0];
6189
+ if (direction === "reverse" || direction === "alternateReverse") {
6190
+ initialElapsedPos = range[1] - this.getCurrentPosition();
6191
+ }
6192
+ const tick = (currentTickerTime) => {
6193
+ const elapsedTickerTime = Math.max(
6194
+ currentTickerTime - initialTickerTime,
6195
+ 0
6196
+ );
6197
+ const elapsedTickerTimeInSeconds = elapsedTickerTime / 1e3;
6198
+ const elapsedPos = Math.min(
6199
+ elapsedTickerTimeInSeconds * rate + initialElapsedPos,
6200
+ totalPlaybackLength
6201
+ );
6202
+ if (elapsedPos !== totalPlaybackLength) {
6203
+ const iterationNumber = Math.floor(elapsedPos / iterationLength);
6204
+ let currentIterationPos = elapsedPos / iterationLength % 1 * iterationLength;
6205
+ if (direction !== "normal") {
6206
+ if (direction === "reverse") {
6207
+ currentIterationPos = iterationLength - currentIterationPos;
6208
+ } else {
6209
+ const isCurrentIterationNumberEven = iterationNumber % 2 === 0;
6210
+ if (direction === "alternate") {
6211
+ if (!isCurrentIterationNumberEven) {
6212
+ currentIterationPos = iterationLength - currentIterationPos;
6213
+ }
6214
+ } else {
6215
+ if (isCurrentIterationNumberEven) {
6216
+ currentIterationPos = iterationLength - currentIterationPos;
6217
+ }
6218
+ }
6219
+ }
6220
+ }
6221
+ this._updatePositionInState(currentIterationPos + range[0]);
6222
+ requestNextTick();
6223
+ } else {
6224
+ if (direction === "normal") {
6225
+ this._updatePositionInState(range[1]);
6226
+ } else if (direction === "reverse") {
6227
+ this._updatePositionInState(range[0]);
6228
+ } else {
6229
+ const isLastIterationEven = (iterationCount - 1) % 2 === 0;
6230
+ if (direction === "alternate") {
6231
+ if (isLastIterationEven) {
6232
+ this._updatePositionInState(range[1]);
6233
+ } else {
6234
+ this._updatePositionInState(range[0]);
6235
+ }
6236
+ } else {
6237
+ if (isLastIterationEven) {
6238
+ this._updatePositionInState(range[0]);
6239
+ } else {
6240
+ this._updatePositionInState(range[1]);
6241
+ }
6242
+ }
6243
+ }
6244
+ this.playing = false;
6245
+ deferred.resolve(true);
6246
+ }
6247
+ };
6248
+ this._stopPlayCallback = () => {
6249
+ ticker.offThisOrNextTick(tick);
6250
+ ticker.offNextTick(tick);
6251
+ if (this.playing) deferred.resolve(false);
6252
+ };
6253
+ const requestNextTick = () => ticker.onNextTick(tick);
6254
+ ticker.onThisOrNextTick(tick);
6255
+ return deferred.promise;
6256
+ }
6257
+ playDynamicRange(rangeD, ticker) {
6258
+ if (this.playing) {
6259
+ this.pause();
6260
+ }
6261
+ this.playing = true;
6262
+ const deferred = defer();
6263
+ const untapFromRangeD = rangeD.keepHot();
6264
+ void deferred.promise.then(untapFromRangeD, untapFromRangeD);
6265
+ let lastTickerTime = ticker.time;
6266
+ const tick = (currentTickerTime) => {
6267
+ const elapsedSinceLastTick = Math.max(
6268
+ currentTickerTime - lastTickerTime,
6269
+ 0
6270
+ );
6271
+ lastTickerTime = currentTickerTime;
6272
+ const elapsedSinceLastTickInSeconds = elapsedSinceLastTick / 1e3;
6273
+ const lastPosition = this.getCurrentPosition();
6274
+ const range = rangeD.getValue();
6275
+ if (lastPosition < range[0] || lastPosition > range[1]) {
6276
+ this.gotoPosition(range[0]);
6277
+ } else {
6278
+ let newPosition = lastPosition + elapsedSinceLastTickInSeconds;
6279
+ if (newPosition > range[1]) {
6280
+ newPosition = range[0] + (newPosition - range[1]);
6281
+ }
6282
+ this.gotoPosition(newPosition);
6283
+ }
6284
+ requestNextTick();
6285
+ };
6286
+ this._stopPlayCallback = () => {
6287
+ ticker.offThisOrNextTick(tick);
6288
+ ticker.offNextTick(tick);
6289
+ deferred.resolve(false);
6290
+ };
6291
+ const requestNextTick = () => ticker.onNextTick(tick);
6292
+ ticker.onThisOrNextTick(tick);
6293
+ return deferred.promise;
6294
+ }
6295
+ };
6296
+
6297
+ // core/src/sequences/playbackControllers/AudioPlaybackController.ts
6298
+ import { Atom as Atom8 } from "@unseenco/theatre-dataverse";
6299
+ var AudioPlaybackController = class {
6300
+ constructor(_decodedBuffer, _audioContext, _nodeDestination) {
6301
+ this._decodedBuffer = _decodedBuffer;
6302
+ this._audioContext = _audioContext;
6303
+ this._nodeDestination = _nodeDestination;
6304
+ __publicField(this, "_mainGain");
6305
+ __publicField(this, "_state", new Atom8({
6306
+ position: 0,
6307
+ playing: false
6308
+ }));
6309
+ __publicField(this, "statePointer");
6310
+ __publicField(this, "_stopPlayCallback", noop_default);
6311
+ this.statePointer = this._state.pointer;
6312
+ this._mainGain = this._audioContext.createGain();
6313
+ this._mainGain.connect(this._nodeDestination);
6314
+ }
6315
+ playDynamicRange(rangeD, ticker) {
6316
+ const deferred = defer();
6317
+ if (this._playing) this.pause();
6318
+ this._playing = true;
6319
+ let stop = void 0;
6320
+ const play = () => {
6321
+ stop?.();
6322
+ stop = this._loopInRange(rangeD.getValue(), ticker).stop;
6323
+ };
6324
+ const untapFromRangeD = rangeD.onStale(play);
6325
+ play();
6326
+ this._stopPlayCallback = () => {
6327
+ stop?.();
6328
+ untapFromRangeD();
6329
+ deferred.resolve(false);
6330
+ };
6331
+ return deferred.promise;
6332
+ }
6333
+ _loopInRange(range, ticker) {
6334
+ const rate = 1;
6335
+ let startPos = this.getCurrentPosition();
6336
+ const iterationLength = range[1] - range[0];
6337
+ if (startPos < range[0] || startPos > range[1]) {
6338
+ this._updatePositionInState(range[0]);
6339
+ } else if (startPos === range[1]) {
6340
+ this._updatePositionInState(range[0]);
6341
+ }
6342
+ startPos = this.getCurrentPosition();
6343
+ const currentSource = this._audioContext.createBufferSource();
6344
+ currentSource.buffer = this._decodedBuffer;
6345
+ currentSource.connect(this._mainGain);
6346
+ currentSource.playbackRate.value = rate;
6347
+ currentSource.loop = true;
6348
+ currentSource.loopStart = range[0];
6349
+ currentSource.loopEnd = range[1];
6350
+ const initialTickerTime = ticker.time;
6351
+ let initialElapsedPos = startPos - range[0];
6352
+ currentSource.start(0, startPos);
6353
+ const tick = (currentTickerTime) => {
6354
+ const elapsedTickerTime = Math.max(
6355
+ currentTickerTime - initialTickerTime,
6356
+ 0
6357
+ );
6358
+ const elapsedTickerTimeInSeconds = elapsedTickerTime / 1e3;
6359
+ const elapsedPos = elapsedTickerTimeInSeconds * rate + initialElapsedPos;
6360
+ let currentIterationPos = elapsedPos / iterationLength % 1 * iterationLength;
6361
+ this._updatePositionInState(currentIterationPos + range[0]);
6362
+ requestNextTick();
6363
+ };
6364
+ const requestNextTick = () => ticker.onNextTick(tick);
6365
+ ticker.onThisOrNextTick(tick);
6366
+ const stop = () => {
6367
+ currentSource.stop();
6368
+ currentSource.disconnect();
6369
+ ticker.offThisOrNextTick(tick);
6370
+ ticker.offNextTick(tick);
6371
+ };
6372
+ return { stop };
6373
+ }
6374
+ get _playing() {
6375
+ return this._state.get().playing;
6376
+ }
6377
+ set _playing(playing) {
6378
+ this._state.setByPointer((p2) => p2.playing, playing);
6379
+ }
6380
+ destroy() {
6381
+ }
6382
+ pause() {
6383
+ this._stopPlayCallback();
6384
+ this._playing = false;
6385
+ this._stopPlayCallback = noop_default;
6386
+ }
6387
+ gotoPosition(time) {
6388
+ this._updatePositionInState(time);
6389
+ }
6390
+ _updatePositionInState(time) {
6391
+ this._state.reduce((s2) => ({ ...s2, position: time }));
6008
6392
  }
6009
6393
  getCurrentPosition() {
6010
6394
  return this._state.get().position;
@@ -6263,8 +6647,8 @@ async function resolveAudioBuffer(args) {
6263
6647
  }
6264
6648
 
6265
6649
  // shared/src/gsap/gsapStudioRegistryRevision.ts
6266
- import { Atom as Atom7 } from "@unseenco/theatre-dataverse";
6267
- var revisionAtom = new Atom7(0);
6650
+ import { Atom as Atom9 } from "@unseenco/theatre-dataverse";
6651
+ var revisionAtom = new Atom9(0);
6268
6652
  var gsapStudioRegistryRevisionPointer = revisionAtom.pointer;
6269
6653
 
6270
6654
  // shared/src/gsap/scrollTriggerRegistry.ts
@@ -6329,7 +6713,7 @@ var Sequence = class {
6329
6713
  __publicField(this, "_positionD");
6330
6714
  __publicField(this, "_positionFormatterD");
6331
6715
  __publicField(this, "_playableRangeD");
6332
- __publicField(this, "pointer", pointer2({ root: this, path: [] }));
6716
+ __publicField(this, "pointer", pointer3({ root: this, path: [] }));
6333
6717
  __publicField(this, "$$isPointerToPrismProvider", true);
6334
6718
  __publicField(this, "_logger");
6335
6719
  __publicField(this, "closestGridPosition", (posInUnitSpace) => {
@@ -6342,35 +6726,35 @@ var Sequence = class {
6342
6726
  this._logger = _project._logger.named("Sheet", _sheet.address.sheetId).named("Instance", _sheet.address.sheetInstanceId).named("Variant", _sequenceVariant);
6343
6727
  this.address = { ...this._sheet.address, sequenceName: _sequenceVariant };
6344
6728
  this.publicApi = new TheatreSequence(this);
6345
- this._playbackControllerBox = new Atom8(
6729
+ this._playbackControllerBox = new Atom10(
6346
6730
  playbackController ?? new DefaultPlaybackController()
6347
6731
  );
6348
- this._prismOfStatePointer = prism6(
6732
+ this._prismOfStatePointer = prism8(
6349
6733
  () => this._playbackControllerBox.prism.getValue().statePointer
6350
6734
  );
6351
- this._positionD = prism6(() => {
6735
+ this._positionD = prism8(() => {
6352
6736
  const statePointer = this._prismOfStatePointer.getValue();
6353
- return val6(statePointer.position);
6737
+ return val7(statePointer.position);
6354
6738
  });
6355
- this._positionFormatterD = prism6(() => {
6356
- const subUnitsPerUnit = val6(this._subUnitsPerUnitD);
6739
+ this._positionFormatterD = prism8(() => {
6740
+ const subUnitsPerUnit = val7(this._subUnitsPerUnitD);
6357
6741
  if (this._sheet.getSequenceMode() === "page") {
6358
6742
  return new PercentBasedPositionFormatter(subUnitsPerUnit);
6359
6743
  }
6360
6744
  return new TimeBasedPositionFormatter(subUnitsPerUnit);
6361
6745
  });
6362
6746
  }
6363
- pointerToPrism(pointer3) {
6364
- const { path } = getPointerParts3(pointer3);
6747
+ pointerToPrism(pointer4) {
6748
+ const { path } = getPointerParts3(pointer4);
6365
6749
  if (path.length === 0) {
6366
- return prism6(() => ({
6367
- length: val6(this.pointer.length),
6368
- playing: val6(this.pointer.playing),
6369
- position: val6(this.pointer.position)
6750
+ return prism8(() => ({
6751
+ length: val7(this.pointer.length),
6752
+ playing: val7(this.pointer.playing),
6753
+ position: val7(this.pointer.position)
6370
6754
  }));
6371
6755
  }
6372
6756
  if (path.length > 1) {
6373
- return prism6(() => void 0);
6757
+ return prism8(() => void 0);
6374
6758
  }
6375
6759
  const [prop] = path;
6376
6760
  if (prop === "length") {
@@ -6378,11 +6762,11 @@ var Sequence = class {
6378
6762
  } else if (prop === "position") {
6379
6763
  return this._positionD;
6380
6764
  } else if (prop === "playing") {
6381
- return prism6(() => {
6382
- return val6(this._prismOfStatePointer.getValue().playing);
6765
+ return prism8(() => {
6766
+ return val7(this._prismOfStatePointer.getValue().playing);
6383
6767
  });
6384
6768
  } else {
6385
- return prism6(() => void 0);
6769
+ return prism8(() => void 0);
6386
6770
  }
6387
6771
  }
6388
6772
  /**
@@ -6397,7 +6781,7 @@ var Sequence = class {
6397
6781
  "Argument prop must be a pointer to a SheetObject property"
6398
6782
  );
6399
6783
  }
6400
- const sheetState = val6(
6784
+ const sheetState = val7(
6401
6785
  this._project.pointers.historic.sheetsById[this._sheet.address.sheetId]
6402
6786
  );
6403
6787
  const trackP = getSequenceStateFromSheet(sheetState, this._sequenceVariant)?.tracksByObject[root2.address.objectKey];
@@ -6420,7 +6804,7 @@ var Sequence = class {
6420
6804
  * @internal Used by the public sequence API.
6421
6805
  */
6422
6806
  getGsapClipsForObject(objectKey) {
6423
- const sheetState = val6(
6807
+ const sheetState = val7(
6424
6808
  this._project.pointers.historic.sheetsById[this._sheet.address.sheetId]
6425
6809
  );
6426
6810
  const tracksOfObject = getSequenceStateFromSheet(
@@ -6437,7 +6821,7 @@ var Sequence = class {
6437
6821
  return result.sort((a2, b2) => a2.clip.start - b2.clip.start);
6438
6822
  }
6439
6823
  getGsapClips() {
6440
- const sheetState = val6(
6824
+ const sheetState = val7(
6441
6825
  this._project.pointers.historic.sheetsById[this._sheet.address.sheetId]
6442
6826
  );
6443
6827
  const sequenceState = getSequenceStateFromSheet(
@@ -6453,649 +6837,377 @@ var Sequence = class {
6453
6837
  for (const [trackId, track] of Object.entries(tracksOfObject.trackData)) {
6454
6838
  if (track && isGsapClipTrack(track)) {
6455
6839
  result.push({
6456
- objectKey,
6457
- trackId,
6458
- clip: track
6459
- });
6460
- }
6461
- }
6462
- }
6463
- return result.sort((a2, b2) => a2.clip.start - b2.clip.start);
6464
- }
6465
- getGsapScrollTriggers() {
6466
- if (this._sheet.getSequenceMode() !== "page") {
6467
- return [];
6468
- }
6469
- const key = sheetAddressKey(this._sheet.address);
6470
- return listScrollTriggerEntriesForSheet(key).filter((entry) => entry.sheetObject != null).map((entry) => ({
6471
- objectKey: entry.sheetObject.address.objectKey,
6472
- scrollTriggerId: entry.id,
6473
- label: entry.label,
6474
- layout: entry.layout,
6475
- kind: entry.kind,
6476
- animationSpanSeconds: entry.animationSpanSeconds,
6477
- timelineChildren: entry.timelineChildren
6478
- }));
6479
- }
6480
- get positionFormatter() {
6481
- return this._positionFormatterD.getValue();
6482
- }
6483
- get prismOfStatePointer() {
6484
- return this._prismOfStatePointer;
6485
- }
6486
- get length() {
6487
- return this._lengthD.getValue();
6488
- }
6489
- get positionPrism() {
6490
- return this._positionD;
6491
- }
6492
- get position() {
6493
- return this._playbackControllerBox.get().getCurrentPosition();
6494
- }
6495
- get subUnitsPerUnit() {
6496
- return this._subUnitsPerUnitD.getValue();
6497
- }
6498
- get positionSnappedToGrid() {
6499
- return this.closestGridPosition(this.position);
6500
- }
6501
- set position(requestedPosition) {
6502
- let position = requestedPosition;
6503
- this.pause();
6504
- if (process.env.NODE_ENV !== "production") {
6505
- if (typeof position !== "number") {
6506
- console.error(
6507
- "value t in sequence.position = t must be a number. ".concat(typeof position, " given")
6508
- );
6509
- position = 0;
6510
- }
6511
- if (position < 0) {
6512
- console.error(
6513
- "sequence.position must be a positive number. ".concat(position, " given")
6514
- );
6515
- position = 0;
6516
- }
6517
- }
6518
- if (position > this.length) {
6519
- position = this.length;
6520
- }
6521
- const dur = this.length;
6522
- this._playbackControllerBox.get().gotoPosition(position > dur ? dur : position);
6523
- }
6524
- getDurationCold() {
6525
- return this._lengthD.getValue();
6526
- }
6527
- get playing() {
6528
- return val6(this._playbackControllerBox.get().statePointer.playing);
6529
- }
6530
- _makeRangeFromSequenceTemplate() {
6531
- return prism6(() => {
6532
- return [0, val6(this._lengthD)];
6533
- });
6534
- }
6535
- /**
6536
- * Controls the playback within a range. Repeats infinitely unless stopped.
6537
- *
6538
- * @remarks
6539
- * One use case for this is to play the playback within the focus range.
6540
- *
6541
- * @param rangeD - The prism that contains the range that will be used for the playback
6542
- *
6543
- * @returns a promise that gets rejected if the playback stopped for whatever reason
6544
- *
6545
- */
6546
- playDynamicRange(rangeD, ticker) {
6547
- return this._playbackControllerBox.get().playDynamicRange(rangeD, ticker);
6548
- }
6549
- async play(conf, ticker) {
6550
- if (this._sheet.getSequenceMode() === "page") {
6551
- notify.warning(
6552
- "Playback is disabled in page mode",
6553
- "The sequence is driven by page scroll. Scrub the playhead or scroll the page instead of calling sequence.play()."
6554
- );
6555
- return false;
6556
- }
6557
- const sequenceDuration = this.length;
6558
- const range = conf && conf.range ? conf.range : [0, sequenceDuration];
6559
- if (process.env.NODE_ENV !== "production") {
6560
- if (typeof range[0] !== "number" || range[0] < 0) {
6561
- throw new InvalidArgumentError(
6562
- "Argument conf.range[0] in sequence.play(conf) must be a positive number. ".concat(JSON.stringify(
6563
- range[0]
6564
- ), " given.")
6565
- );
6566
- }
6567
- if (range[0] >= sequenceDuration) {
6568
- throw new InvalidArgumentError(
6569
- "Argument conf.range[0] in sequence.play(conf) cannot be longer than the duration of the sequence, which is ".concat(sequenceDuration, "s. ").concat(JSON.stringify(
6570
- range[0]
6571
- ), " given.")
6572
- );
6573
- }
6574
- if (typeof range[1] !== "number" || range[1] <= 0) {
6575
- throw new InvalidArgumentError(
6576
- "Argument conf.range[1] in sequence.play(conf) must be a number larger than zero. ".concat(JSON.stringify(
6577
- range[1]
6578
- ), " given.")
6579
- );
6580
- }
6581
- if (range[1] > sequenceDuration) {
6582
- notify.warning(
6583
- "Couldn't play sequence in given range",
6584
- "Your animation will still play until the end of the sequence, however the argument `conf.range[1]` given in `sequence.play(conf)` (".concat(JSON.stringify(
6585
- range[1]
6586
- ), "s) is longer than the duration of the sequence (").concat(sequenceDuration, "s).\n\nTo fix this, either set `conf.range[1]` to be less the duration of the sequence, or adjust the sequence duration in the UI."),
6587
- [
6588
- {
6589
- url: "https://unseen-theatre.netlify.app/docs/guide/manual/sequences",
6590
- title: "Sequences"
6591
- },
6592
- {
6593
- url: "https://unseen-theatre.netlify.app/docs/guide/manual/sequences",
6594
- title: "Playback API"
6595
- }
6596
- ]
6597
- );
6598
- range[1] = sequenceDuration;
6599
- }
6600
- if (range[1] <= range[0]) {
6601
- throw new InvalidArgumentError(
6602
- "Argument conf.range[1] in sequence.play(conf) must be larger than conf.range[0]. ".concat(JSON.stringify(
6603
- range
6604
- ), " given.")
6605
- );
6606
- }
6607
- }
6608
- const iterationCount = conf && typeof conf.iterationCount === "number" ? conf.iterationCount : 1;
6609
- if (process.env.NODE_ENV !== "production") {
6610
- if (!(Number.isInteger(iterationCount) && iterationCount > 0) && iterationCount !== Infinity) {
6611
- throw new InvalidArgumentError(
6612
- "Argument conf.iterationCount in sequence.play(conf) must be an integer larger than 0. ".concat(JSON.stringify(
6613
- iterationCount
6614
- ), " given.")
6615
- );
6616
- }
6617
- }
6618
- const rate = conf && typeof conf.rate !== "undefined" ? conf.rate : 1;
6619
- if (process.env.NODE_ENV !== "production") {
6620
- if (typeof rate !== "number" || rate === 0) {
6621
- throw new InvalidArgumentError(
6622
- "Argument conf.rate in sequence.play(conf) must be a number larger than 0. ".concat(JSON.stringify(
6623
- rate
6624
- ), " given.")
6625
- );
6626
- }
6627
- if (rate < 0) {
6628
- throw new InvalidArgumentError(
6629
- "Argument conf.rate in sequence.play(conf) must be a number larger than 0. ".concat(JSON.stringify(
6630
- rate
6631
- ), " given. If you want the animation to play backwards, try setting conf.direction to 'reverse' or 'alternateReverse'.")
6632
- );
6633
- }
6634
- }
6635
- const direction = conf && conf.direction ? conf.direction : "normal";
6636
- if (process.env.NODE_ENV !== "production") {
6637
- if (possibleDirections.indexOf(direction) === -1) {
6638
- throw new InvalidArgumentError(
6639
- "Argument conf.direction in sequence.play(conf) must be one of ".concat(JSON.stringify(
6640
- possibleDirections
6641
- ), ". ").concat(JSON.stringify(direction), " given. ").concat(didYouMean(
6642
- direction,
6643
- possibleDirections
6644
- ))
6645
- );
6646
- }
6647
- }
6648
- return await this._play(
6649
- iterationCount,
6650
- [range[0], range[1]],
6651
- rate,
6652
- direction,
6653
- ticker
6654
- );
6655
- }
6656
- _play(iterationCount, range, rate, direction, ticker) {
6657
- return this._playbackControllerBox.get().play(iterationCount, range, rate, direction, ticker);
6658
- }
6659
- pause() {
6660
- this._playbackControllerBox.get().pause();
6661
- }
6662
- replacePlaybackController(playbackController) {
6663
- this.pause();
6664
- const oldController = this._playbackControllerBox.get();
6665
- this._playbackControllerBox.set(playbackController);
6666
- const time = oldController.getCurrentPosition();
6667
- oldController.destroy();
6668
- playbackController.gotoPosition(time);
6669
- }
6670
- };
6671
- var TimeBasedPositionFormatter = class {
6672
- constructor(_fps) {
6673
- this._fps = _fps;
6674
- }
6675
- formatSubUnitForGrid(posInUnitSpace) {
6676
- const subSecondPos = posInUnitSpace % 1;
6677
- const frame = 1 / this._fps;
6678
- const frames = Math.round(subSecondPos / frame);
6679
- return frames + "f";
6680
- }
6681
- formatFullUnitForGrid(posInUnitSpace) {
6682
- let p2 = posInUnitSpace;
6683
- let s2 = "";
6684
- if (p2 >= hour) {
6685
- const hours = Math.floor(p2 / hour);
6686
- s2 += hours + "h";
6687
- p2 = p2 % hour;
6688
- }
6689
- if (p2 >= minute) {
6690
- const minutes = Math.floor(p2 / minute);
6691
- s2 += minutes + "m";
6692
- p2 = p2 % minute;
6693
- }
6694
- if (p2 >= second) {
6695
- const seconds = Math.floor(p2 / second);
6696
- s2 += seconds + "s";
6697
- p2 = p2 % second;
6698
- }
6699
- const frame = 1 / this._fps;
6700
- if (p2 >= frame) {
6701
- const frames = Math.floor(p2 / frame);
6702
- s2 += frames + "f";
6703
- p2 = p2 % frame;
6840
+ objectKey,
6841
+ trackId,
6842
+ clip: track
6843
+ });
6844
+ }
6845
+ }
6704
6846
  }
6705
- return s2.length === 0 ? "0s" : s2;
6847
+ return result.sort((a2, b2) => a2.clip.start - b2.clip.start);
6706
6848
  }
6707
- formatForPlayhead(posInUnitSpace) {
6708
- let p2 = posInUnitSpace;
6709
- let s2 = "";
6710
- if (p2 >= hour) {
6711
- const hours = Math.floor(p2 / hour);
6712
- s2 += padStart_default(hours.toString(), 2, "0") + "h";
6713
- p2 = p2 % hour;
6714
- }
6715
- if (p2 >= minute) {
6716
- const minutes = Math.floor(p2 / minute);
6717
- s2 += padStart_default(minutes.toString(), 2, "0") + "m";
6718
- p2 = p2 % minute;
6719
- } else if (s2.length > 0) {
6720
- s2 += "00m";
6721
- }
6722
- if (p2 >= second) {
6723
- const seconds = Math.floor(p2 / second);
6724
- s2 += padStart_default(seconds.toString(), 2, "0") + "s";
6725
- p2 = p2 % second;
6726
- } else {
6727
- s2 += "00s";
6728
- }
6729
- const frameLength = 1 / this._fps;
6730
- if (p2 >= frameLength) {
6731
- const frames = Math.round(p2 / frameLength);
6732
- s2 += padStart_default(frames.toString(), 2, "0") + "f";
6733
- p2 = p2 % frameLength;
6734
- } else if (p2 / frameLength > 0.98) {
6735
- const frames = 1;
6736
- s2 += padStart_default(frames.toString(), 2, "0") + "f";
6737
- p2 = p2 % frameLength;
6738
- } else {
6739
- s2 += "00f";
6849
+ getGsapScrollTriggers() {
6850
+ if (this._sheet.getSequenceMode() !== "page") {
6851
+ return [];
6740
6852
  }
6741
- return s2.length === 0 ? "00s00f" : s2;
6853
+ const key = sheetAddressKey(this._sheet.address);
6854
+ return listScrollTriggerEntriesForSheet(key).filter((entry) => entry.sheetObject != null).map((entry) => ({
6855
+ objectKey: entry.sheetObject.address.objectKey,
6856
+ scrollTriggerId: entry.id,
6857
+ label: entry.label,
6858
+ layout: entry.layout,
6859
+ kind: entry.kind,
6860
+ animationSpanSeconds: entry.animationSpanSeconds,
6861
+ timelineChildren: entry.timelineChildren
6862
+ }));
6742
6863
  }
6743
- formatBasic(posInUnitSpace) {
6744
- return posInUnitSpace.toFixed(2) + "s";
6864
+ get positionFormatter() {
6865
+ return this._positionFormatterD.getValue();
6745
6866
  }
6746
- };
6747
- var PercentBasedPositionFormatter = class {
6748
- constructor(_subUnitsPerUnit) {
6749
- this._subUnitsPerUnit = _subUnitsPerUnit;
6867
+ get prismOfStatePointer() {
6868
+ return this._prismOfStatePointer;
6750
6869
  }
6751
- formatSubUnitForGrid(posInUnitSpace) {
6752
- const subUnitSize = 1 / this._subUnitsPerUnit;
6753
- const withinUnit = posInUnitSpace % 1;
6754
- const tenths = Math.round(withinUnit / subUnitSize);
6755
- return tenths + "t";
6870
+ get length() {
6871
+ return this._lengthD.getValue();
6756
6872
  }
6757
- formatFullUnitForGrid(posInUnitSpace) {
6758
- return Math.round(posInUnitSpace) + "%";
6873
+ get positionPrism() {
6874
+ return this._positionD;
6759
6875
  }
6760
- formatForPlayhead(posInUnitSpace) {
6761
- const whole = Math.floor(posInUnitSpace);
6762
- const subUnitSize = 1 / this._subUnitsPerUnit;
6763
- const withinUnit = posInUnitSpace - whole;
6764
- const tenths = Math.round(withinUnit / subUnitSize);
6765
- if (tenths <= 0) {
6766
- return whole + "%";
6767
- }
6768
- return whole + "." + tenths + "%";
6876
+ get position() {
6877
+ return this._playbackControllerBox.get().getCurrentPosition();
6769
6878
  }
6770
- formatBasic(posInUnitSpace) {
6771
- return posInUnitSpace.toFixed(1) + "%";
6879
+ get subUnitsPerUnit() {
6880
+ return this._subUnitsPerUnitD.getValue();
6772
6881
  }
6773
- };
6774
- var second = 1;
6775
- var minute = second * 60;
6776
- var hour = minute * 60;
6777
-
6778
- // shared/src/utils/slashedPaths.ts
6779
- var normalizeSlashedPath = (p2) => p2.replace(/^[\s\/]*/, "").replace(/[\s\/]*$/, "").replace(/\s*\/\s*/g, " / ");
6780
- var getValidationErrorsOfSlashedPath = (p2) => {
6781
- if (typeof p2 !== "string") return "it is not a string. (it is a ".concat(typeof p2, ")");
6782
- const components = p2.split(/\//);
6783
- if (components.length === 0) return "it is empty.";
6784
- for (let i2 = 0; i2 < components.length; i2++) {
6785
- const component = components[i2].trim();
6786
- if (component.length === 0) return "the component #".concat(i2 + 1, " is empty.");
6787
- if (component.length > 64)
6788
- return "the component '".concat(component, "' must have 64 characters or less.");
6882
+ get positionSnappedToGrid() {
6883
+ return this.closestGridPosition(this.position);
6789
6884
  }
6790
- };
6791
- function validateAndSanitiseSlashedPathOrThrow(unsanitisedPath, fnName) {
6792
- const sanitisedPath = normalizeSlashedPath(unsanitisedPath);
6793
- if (process.env.NODE_ENV !== "development") {
6794
- return sanitisedPath;
6885
+ set position(requestedPosition) {
6886
+ let position = requestedPosition;
6887
+ this.pause();
6888
+ if (process.env.NODE_ENV !== "production") {
6889
+ if (typeof position !== "number") {
6890
+ console.error(
6891
+ "value t in sequence.position = t must be a number. ".concat(typeof position, " given")
6892
+ );
6893
+ position = 0;
6894
+ }
6895
+ if (position < 0) {
6896
+ console.error(
6897
+ "sequence.position must be a positive number. ".concat(position, " given")
6898
+ );
6899
+ position = 0;
6900
+ }
6901
+ }
6902
+ if (position > this.length) {
6903
+ position = this.length;
6904
+ }
6905
+ const dur = this.length;
6906
+ this._playbackControllerBox.get().gotoPosition(position > dur ? dur : position);
6795
6907
  }
6796
- const validation = getValidationErrorsOfSlashedPath(sanitisedPath);
6797
- if (validation) {
6798
- throw new InvalidArgumentError(
6799
- "The path in ".concat(fnName, "(").concat(typeof unsanitisedPath === "string" ? '"'.concat(unsanitisedPath, '"') : "", ") is invalid because ").concat(validation)
6800
- );
6908
+ getDurationCold() {
6909
+ return this._lengthD.getValue();
6801
6910
  }
6802
- if (unsanitisedPath !== sanitisedPath) {
6803
- notify.warning(
6804
- "Invalid path provided to object",
6805
- "The path in `".concat(fnName, '("').concat(unsanitisedPath, '")` was sanitized to `"').concat(sanitisedPath, '"`.\n\n') + "Please replace the path with the sanitized one, otherwise it will likely break in the future.",
6806
- [
6807
- {
6808
- url: "https://unseen-theatre.netlify.app/docs/guide/manual/objects#creating-objects",
6809
- title: "Sheet Objects"
6810
- },
6811
- {
6812
- url: "https://unseen-theatre.netlify.app/docs/api/theatre-core#sheet.object",
6813
- title: "API"
6814
- }
6815
- ]
6816
- );
6911
+ get playing() {
6912
+ return val7(this._playbackControllerBox.get().statePointer.playing);
6817
6913
  }
6818
- return sanitisedPath;
6819
- }
6820
-
6821
- // shared/src/utils/outlineNamespaces.ts
6822
- function parseOutlineNamespacePath(namespacePath, fnName) {
6823
- return validateAndSanitiseSlashedPathOrThrow(namespacePath, fnName).split(
6824
- /\s*\/\s*/g
6825
- );
6826
- }
6827
-
6828
- // core/src/sheets/TheatreSheet.ts
6829
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
6830
- var TheatreSheet = class {
6831
- get type() {
6832
- return "Theatre_Sheet_PublicAPI";
6914
+ _makeRangeFromSequenceTemplate() {
6915
+ return prism8(() => {
6916
+ return [0, val7(this._lengthD)];
6917
+ });
6833
6918
  }
6834
6919
  /**
6835
- * @internal
6920
+ * Controls the playback within a range. Repeats infinitely unless stopped.
6921
+ *
6922
+ * @remarks
6923
+ * One use case for this is to play the playback within the focus range.
6924
+ *
6925
+ * @param rangeD - The prism that contains the range that will be used for the playback
6926
+ *
6927
+ * @returns a promise that gets rejected if the playback stopped for whatever reason
6928
+ *
6836
6929
  */
6837
- constructor(sheet) {
6838
- setPrivateAPI(this, sheet);
6930
+ playDynamicRange(rangeD, ticker) {
6931
+ return this._playbackControllerBox.get().playDynamicRange(rangeD, ticker);
6839
6932
  }
6840
- object(key, config, opts) {
6841
- const internal2 = privateAPI(this);
6842
- const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(
6843
- key,
6844
- "sheet.object"
6845
- );
6846
- if (isSheetPropsObjectKey(sanitizedPath)) {
6847
- throw new InvalidArgumentError(
6848
- 'The key "'.concat(sanitizedPath, '" is reserved for sheet-level props. Use sheet.props() instead of sheet.object().')
6849
- );
6850
- }
6851
- const existingObject = internal2.getObject(sanitizedPath);
6852
- const nativeObject = null;
6853
- const actions = opts?.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;
6854
- if (existingObject) {
6855
- if (process.env.NODE_ENV !== "production") {
6856
- const prevConfig = getUnsanitizedObjectProps(existingObject);
6857
- if (prevConfig) {
6858
- if (!(0, import_fast_deep_equal2.default)(config, prevConfig)) {
6859
- if (opts?.reconfigure === true) {
6860
- const sanitizedConfig = compound(config);
6861
- existingObject.template.reconfigure(sanitizedConfig);
6862
- if (opts.transient !== void 0) {
6863
- existingObject.template.setTransientPropPaths(
6864
- opts.transient,
6865
- sanitizedConfig
6866
- );
6867
- }
6868
- if (opts.static !== void 0) {
6869
- existingObject.template.setStaticPropPaths(
6870
- opts.static,
6871
- sanitizedConfig
6872
- );
6873
- }
6874
- if (opts.showPropsOf !== void 0) {
6875
- existingObject.template.setShowPropsOf(
6876
- resolveShowPropsOfSources(
6877
- existingObject,
6878
- opts.showPropsOf,
6879
- "sheet.object(..., {showPropsOf})"
6880
- )
6881
- );
6882
- }
6883
- setUnsanitizedObjectProps(existingObject, config);
6884
- return existingObject.publicApi;
6885
- } else {
6886
- throw new Error(
6887
- 'You seem to have called sheet.object("'.concat(key, '", config) twice, with different values for `config`. ') + "This is disallowed because changing the config of an object on the fly would make it difficult to reason about.\n\n" + 'You can fix this by either re-using the existing object, or calling sheet.object("'.concat(key, '", config) with the same config.\n\n') + "If you mean to reconfigure the object's config, set `{reconfigure: true}` in sheet.object(\"".concat(key, '", config, {reconfigure: true})')
6888
- );
6889
- }
6890
- }
6891
- }
6892
- }
6893
- if (actions) {
6894
- existingObject.template._temp_setActions(actions);
6895
- }
6896
- if (opts?.visible !== void 0) {
6897
- existingObject.template.setVisibleInOutline(opts.visible);
6898
- }
6899
- if (opts?.transient !== void 0) {
6900
- existingObject.template.setTransientPropPaths(
6901
- opts.transient,
6902
- existingObject.template.staticConfig
6933
+ async play(conf, ticker) {
6934
+ if (this._sheet.getSequenceMode() === "page") {
6935
+ notify.warning(
6936
+ "Playback is disabled in page mode",
6937
+ "The sequence is driven by page scroll. Scrub the playhead or scroll the page instead of calling sequence.play()."
6938
+ );
6939
+ return false;
6940
+ }
6941
+ const sequenceDuration = this.length;
6942
+ const range = conf && conf.range ? conf.range : [0, sequenceDuration];
6943
+ if (process.env.NODE_ENV !== "production") {
6944
+ if (typeof range[0] !== "number" || range[0] < 0) {
6945
+ throw new InvalidArgumentError(
6946
+ "Argument conf.range[0] in sequence.play(conf) must be a positive number. ".concat(JSON.stringify(
6947
+ range[0]
6948
+ ), " given.")
6903
6949
  );
6904
6950
  }
6905
- if (opts?.static !== void 0) {
6906
- existingObject.template.setStaticPropPaths(
6907
- opts.static,
6908
- existingObject.template.staticConfig
6951
+ if (range[0] >= sequenceDuration) {
6952
+ throw new InvalidArgumentError(
6953
+ "Argument conf.range[0] in sequence.play(conf) cannot be longer than the duration of the sequence, which is ".concat(sequenceDuration, "s. ").concat(JSON.stringify(
6954
+ range[0]
6955
+ ), " given.")
6909
6956
  );
6910
6957
  }
6911
- if (opts?.showPropsOf !== void 0) {
6912
- existingObject.template.setShowPropsOf(
6913
- resolveShowPropsOfSources(
6914
- existingObject,
6915
- opts.showPropsOf,
6916
- "sheet.object(..., {showPropsOf})"
6917
- )
6958
+ if (typeof range[1] !== "number" || range[1] <= 0) {
6959
+ throw new InvalidArgumentError(
6960
+ "Argument conf.range[1] in sequence.play(conf) must be a number larger than zero. ".concat(JSON.stringify(
6961
+ range[1]
6962
+ ), " given.")
6918
6963
  );
6919
6964
  }
6920
- return existingObject.publicApi;
6921
- } else {
6922
- const sanitizedConfig = compound(config);
6923
- const object = internal2.createObject(
6924
- sanitizedPath,
6925
- nativeObject,
6926
- sanitizedConfig,
6927
- actions,
6928
- opts?.visible,
6929
- opts?.transient,
6930
- opts?.static
6931
- );
6932
- if (process.env.NODE_ENV !== "production") {
6933
- setUnsanitizedObjectProps(object, config);
6965
+ if (range[1] > sequenceDuration) {
6966
+ notify.warning(
6967
+ "Couldn't play sequence in given range",
6968
+ "Your animation will still play until the end of the sequence, however the argument `conf.range[1]` given in `sequence.play(conf)` (".concat(JSON.stringify(
6969
+ range[1]
6970
+ ), "s) is longer than the duration of the sequence (").concat(sequenceDuration, "s).\n\nTo fix this, either set `conf.range[1]` to be less the duration of the sequence, or adjust the sequence duration in the UI."),
6971
+ [
6972
+ {
6973
+ url: "https://unseen-theatre.netlify.app/docs/guide/manual/sequences",
6974
+ title: "Sequences"
6975
+ },
6976
+ {
6977
+ url: "https://unseen-theatre.netlify.app/docs/guide/manual/sequences",
6978
+ title: "Playback API"
6979
+ }
6980
+ ]
6981
+ );
6982
+ range[1] = sequenceDuration;
6934
6983
  }
6935
- if (opts?.showPropsOf !== void 0) {
6936
- object.template.setShowPropsOf(
6937
- resolveShowPropsOfSources(
6938
- object,
6939
- opts.showPropsOf,
6940
- "sheet.object(..., {showPropsOf})"
6941
- )
6984
+ if (range[1] <= range[0]) {
6985
+ throw new InvalidArgumentError(
6986
+ "Argument conf.range[1] in sequence.play(conf) must be larger than conf.range[0]. ".concat(JSON.stringify(
6987
+ range
6988
+ ), " given.")
6942
6989
  );
6943
6990
  }
6944
- return object.publicApi;
6945
6991
  }
6946
- }
6947
- props(config, opts) {
6948
- const internal2 = privateAPI(this);
6949
- const objectKey = SHEET_PROPS_OBJECT_KEY;
6950
- const existingObject = internal2.getSheetPropsObject();
6951
- const nativeObject = null;
6952
- const actions = opts?.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;
6953
- if (existingObject) {
6954
- if (process.env.NODE_ENV !== "production") {
6955
- const prevConfig = getUnsanitizedObjectProps(existingObject);
6956
- if (prevConfig) {
6957
- if (!(0, import_fast_deep_equal2.default)(config, prevConfig)) {
6958
- if (opts?.reconfigure === true) {
6959
- const sanitizedConfig2 = compound(config);
6960
- existingObject.template.reconfigure(sanitizedConfig2);
6961
- if (opts.transient !== void 0) {
6962
- existingObject.template.setTransientPropPaths(
6963
- opts.transient,
6964
- sanitizedConfig2
6965
- );
6966
- }
6967
- if (opts.static !== void 0) {
6968
- existingObject.template.setStaticPropPaths(
6969
- opts.static,
6970
- sanitizedConfig2
6971
- );
6972
- }
6973
- setUnsanitizedObjectProps(existingObject, config);
6974
- return existingObject.publicApi;
6975
- } else {
6976
- throw new Error(
6977
- "You seem to have called sheet.props(config) twice, with different values for `config`. Use the same config on repeat calls, or pass `{reconfigure: true}` to change the schema."
6978
- );
6979
- }
6980
- }
6981
- }
6982
- }
6983
- if (actions) {
6984
- existingObject.template._temp_setActions(actions);
6992
+ const iterationCount = conf && typeof conf.iterationCount === "number" ? conf.iterationCount : 1;
6993
+ if (process.env.NODE_ENV !== "production") {
6994
+ if (!(Number.isInteger(iterationCount) && iterationCount > 0) && iterationCount !== Infinity) {
6995
+ throw new InvalidArgumentError(
6996
+ "Argument conf.iterationCount in sequence.play(conf) must be an integer larger than 0. ".concat(JSON.stringify(
6997
+ iterationCount
6998
+ ), " given.")
6999
+ );
6985
7000
  }
6986
- if (opts?.transient !== void 0) {
6987
- existingObject.template.setTransientPropPaths(
6988
- opts.transient,
6989
- existingObject.template.staticConfig
7001
+ }
7002
+ const rate = conf && typeof conf.rate !== "undefined" ? conf.rate : 1;
7003
+ if (process.env.NODE_ENV !== "production") {
7004
+ if (typeof rate !== "number" || rate === 0) {
7005
+ throw new InvalidArgumentError(
7006
+ "Argument conf.rate in sequence.play(conf) must be a number larger than 0. ".concat(JSON.stringify(
7007
+ rate
7008
+ ), " given.")
6990
7009
  );
6991
7010
  }
6992
- if (opts?.static !== void 0) {
6993
- existingObject.template.setStaticPropPaths(
6994
- opts.static,
6995
- existingObject.template.staticConfig
7011
+ if (rate < 0) {
7012
+ throw new InvalidArgumentError(
7013
+ "Argument conf.rate in sequence.play(conf) must be a number larger than 0. ".concat(JSON.stringify(
7014
+ rate
7015
+ ), " given. If you want the animation to play backwards, try setting conf.direction to 'reverse' or 'alternateReverse'.")
6996
7016
  );
6997
7017
  }
6998
- return existingObject.publicApi;
6999
7018
  }
7000
- const sanitizedConfig = compound(config);
7001
- const object = internal2.createObject(
7002
- objectKey,
7003
- nativeObject,
7004
- sanitizedConfig,
7005
- actions,
7006
- false,
7007
- opts?.transient,
7008
- opts?.static
7009
- );
7019
+ const direction = conf && conf.direction ? conf.direction : "normal";
7010
7020
  if (process.env.NODE_ENV !== "production") {
7011
- setUnsanitizedObjectProps(object, config);
7021
+ if (possibleDirections.indexOf(direction) === -1) {
7022
+ throw new InvalidArgumentError(
7023
+ "Argument conf.direction in sequence.play(conf) must be one of ".concat(JSON.stringify(
7024
+ possibleDirections
7025
+ ), ". ").concat(JSON.stringify(direction), " given. ").concat(didYouMean(
7026
+ direction,
7027
+ possibleDirections
7028
+ ))
7029
+ );
7030
+ }
7012
7031
  }
7013
- return object.publicApi;
7032
+ return await this._play(
7033
+ iterationCount,
7034
+ [range[0], range[1]],
7035
+ rate,
7036
+ direction,
7037
+ ticker
7038
+ );
7014
7039
  }
7015
- get sequence() {
7016
- return privateAPI(this).getSequence().publicApi;
7040
+ _play(iterationCount, range, rate, direction, ticker) {
7041
+ return this._playbackControllerBox.get().play(iterationCount, range, rate, direction, ticker);
7017
7042
  }
7018
- declareSequenceVariants(variants) {
7019
- privateAPI(this).template.declareSequenceVariants(variants);
7043
+ pause() {
7044
+ this._playbackControllerBox.get().pause();
7020
7045
  }
7021
- setActiveSequenceVariant(variant) {
7022
- privateAPI(this).setActiveSequenceVariant(variant);
7046
+ replacePlaybackController(playbackController) {
7047
+ this.pause();
7048
+ const oldController = this._playbackControllerBox.get();
7049
+ this._playbackControllerBox.set(playbackController);
7050
+ const time = oldController.getCurrentPosition();
7051
+ oldController.destroy();
7052
+ playbackController.gotoPosition(time);
7023
7053
  }
7024
- getActiveSequenceVariant() {
7025
- return privateAPI(this).getActiveSequenceVariant();
7054
+ };
7055
+ var TimeBasedPositionFormatter = class {
7056
+ constructor(_fps) {
7057
+ this._fps = _fps;
7026
7058
  }
7027
- getSequenceMode() {
7028
- return privateAPI(this).getSequenceMode();
7059
+ formatSubUnitForGrid(posInUnitSpace) {
7060
+ const subSecondPos = posInUnitSpace % 1;
7061
+ const frame = 1 / this._fps;
7062
+ const frames = Math.round(subSecondPos / frame);
7063
+ return frames + "f";
7064
+ }
7065
+ formatFullUnitForGrid(posInUnitSpace) {
7066
+ let p2 = posInUnitSpace;
7067
+ let s2 = "";
7068
+ if (p2 >= hour) {
7069
+ const hours = Math.floor(p2 / hour);
7070
+ s2 += hours + "h";
7071
+ p2 = p2 % hour;
7072
+ }
7073
+ if (p2 >= minute) {
7074
+ const minutes = Math.floor(p2 / minute);
7075
+ s2 += minutes + "m";
7076
+ p2 = p2 % minute;
7077
+ }
7078
+ if (p2 >= second) {
7079
+ const seconds = Math.floor(p2 / second);
7080
+ s2 += seconds + "s";
7081
+ p2 = p2 % second;
7082
+ }
7083
+ const frame = 1 / this._fps;
7084
+ if (p2 >= frame) {
7085
+ const frames = Math.floor(p2 / frame);
7086
+ s2 += frames + "f";
7087
+ p2 = p2 % frame;
7088
+ }
7089
+ return s2.length === 0 ? "0s" : s2;
7090
+ }
7091
+ formatForPlayhead(posInUnitSpace) {
7092
+ let p2 = posInUnitSpace;
7093
+ let s2 = "";
7094
+ if (p2 >= hour) {
7095
+ const hours = Math.floor(p2 / hour);
7096
+ s2 += padStart_default(hours.toString(), 2, "0") + "h";
7097
+ p2 = p2 % hour;
7098
+ }
7099
+ if (p2 >= minute) {
7100
+ const minutes = Math.floor(p2 / minute);
7101
+ s2 += padStart_default(minutes.toString(), 2, "0") + "m";
7102
+ p2 = p2 % minute;
7103
+ } else if (s2.length > 0) {
7104
+ s2 += "00m";
7105
+ }
7106
+ if (p2 >= second) {
7107
+ const seconds = Math.floor(p2 / second);
7108
+ s2 += padStart_default(seconds.toString(), 2, "0") + "s";
7109
+ p2 = p2 % second;
7110
+ } else {
7111
+ s2 += "00s";
7112
+ }
7113
+ const frameLength = 1 / this._fps;
7114
+ if (p2 >= frameLength) {
7115
+ const frames = Math.round(p2 / frameLength);
7116
+ s2 += padStart_default(frames.toString(), 2, "0") + "f";
7117
+ p2 = p2 % frameLength;
7118
+ } else if (p2 / frameLength > 0.98) {
7119
+ const frames = 1;
7120
+ s2 += padStart_default(frames.toString(), 2, "0") + "f";
7121
+ p2 = p2 % frameLength;
7122
+ } else {
7123
+ s2 += "00f";
7124
+ }
7125
+ return s2.length === 0 ? "00s00f" : s2;
7029
7126
  }
7030
- setSequenceMode(mode) {
7031
- privateAPI(this).setSequenceMode(mode);
7127
+ formatBasic(posInUnitSpace) {
7128
+ return posInUnitSpace.toFixed(2) + "s";
7032
7129
  }
7033
- setPageScrollDriver(driver) {
7034
- privateAPI(this).setPageScrollDriver(driver);
7130
+ };
7131
+ var PercentBasedPositionFormatter = class {
7132
+ constructor(_subUnitsPerUnit) {
7133
+ this._subUnitsPerUnit = _subUnitsPerUnit;
7035
7134
  }
7036
- get project() {
7037
- return privateAPI(this).project.publicApi;
7135
+ formatSubUnitForGrid(posInUnitSpace) {
7136
+ const subUnitSize = 1 / this._subUnitsPerUnit;
7137
+ const withinUnit = posInUnitSpace % 1;
7138
+ const tenths = Math.round(withinUnit / subUnitSize);
7139
+ return tenths + "t";
7038
7140
  }
7039
- get address() {
7040
- return { ...privateAPI(this).address };
7141
+ formatFullUnitForGrid(posInUnitSpace) {
7142
+ return Math.round(posInUnitSpace) + "%";
7041
7143
  }
7042
- detachObject(key) {
7043
- const internal2 = privateAPI(this);
7044
- const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(
7045
- key,
7046
- 'sheet.deleteObject("'.concat(key, '")')
7047
- );
7048
- if (isSheetPropsObjectKey(sanitizedPath)) {
7049
- throw new InvalidArgumentError(
7050
- "Sheet props cannot be detached. They are removed when the sheet instance is unloaded."
7051
- );
7052
- }
7053
- const obj = internal2.getObject(sanitizedPath);
7054
- if (!obj) {
7055
- notify.warning(
7056
- "Couldn't delete object \"".concat(sanitizedPath, '"'),
7057
- 'There is no object with key "'.concat(sanitizedPath, '".\n\nTo fix this, make sure you are calling `sheet.deleteObject("').concat(sanitizedPath, '")` with the correct key.')
7058
- );
7059
- console.warn('Object key "'.concat(sanitizedPath, '" does not exist.'));
7060
- return;
7144
+ formatForPlayhead(posInUnitSpace) {
7145
+ const whole = Math.floor(posInUnitSpace);
7146
+ const subUnitSize = 1 / this._subUnitsPerUnit;
7147
+ const withinUnit = posInUnitSpace - whole;
7148
+ const tenths = Math.round(withinUnit / subUnitSize);
7149
+ if (tenths <= 0) {
7150
+ return whole + "%";
7061
7151
  }
7062
- internal2.deleteObject(sanitizedPath);
7063
- }
7064
- getObjects() {
7065
- return privateAPI(this).getObjects().map((obj) => obj.publicApi);
7066
- }
7067
- unload() {
7068
- privateAPI(this).unload();
7069
- }
7070
- declareOutlineNamespace(namespacePath, opts) {
7071
- const internal2 = privateAPI(this);
7072
- const parsedPath = parseOutlineNamespacePath(
7073
- namespacePath,
7074
- "sheet.declareOutlineNamespace"
7075
- );
7076
- internal2.template.setOutlineNamespaceConfig(parsedPath.join(" / "), {
7077
- defaultCollapsed: opts?.collapsed
7078
- });
7152
+ return whole + "." + tenths + "%";
7079
7153
  }
7080
- setOutlineNamespaceCollapsed(namespacePath, collapsed) {
7081
- const internal2 = privateAPI(this);
7082
- const parsedPath = parseOutlineNamespacePath(
7083
- namespacePath,
7084
- "sheet.setOutlineNamespaceCollapsed"
7085
- );
7086
- internal2.template.setOutlineNamespaceConfig(parsedPath.join(" / "), {
7087
- collapsed
7088
- });
7154
+ formatBasic(posInUnitSpace) {
7155
+ return posInUnitSpace.toFixed(1) + "%";
7089
7156
  }
7090
7157
  };
7158
+ var second = 1;
7159
+ var minute = second * 60;
7160
+ var hour = minute * 60;
7091
7161
 
7092
- // core/src/sheets/Sheet.ts
7093
- import { Atom as Atom9, prism as prism8, val as val9 } from "@unseenco/theatre-dataverse";
7162
+ // core/src/sheets/sheetGetSequenceFull.ts
7163
+ import { prism as prism9, val as val8 } from "@unseenco/theatre-dataverse";
7094
7164
 
7095
7165
  // core/src/sheets/sheetSequenceMode.ts
7096
7166
  var PAGE_MODE_SEQUENCE_LENGTH = 100;
7097
7167
  var PAGE_MODE_SUB_UNITS_PER_UNIT = 10;
7098
7168
 
7169
+ // core/src/sheets/sheetGetSequenceFull.ts
7170
+ var sanitizeSequenceLength = (len) => typeof len === "number" && isFinite(len) && len > 0 ? len : 10;
7171
+ var sanitizeSequenceSubUnitsPerUnit = (subs) => typeof subs === "number" && isInteger_default(subs) && subs > 0 ? subs : 30;
7172
+ function getOrCreateFullSequence(sheet, sequences, variantId) {
7173
+ if (!sequences[variantId]) {
7174
+ const lengthD = prism9(() => {
7175
+ if (val8(sheet.sequenceModeP) === "page") {
7176
+ return PAGE_MODE_SEQUENCE_LENGTH;
7177
+ }
7178
+ const sheetState = val8(
7179
+ sheet.project.pointers.historic.sheetsById[sheet.address.sheetId]
7180
+ );
7181
+ const unsanitized = getSequenceStateFromSheet(
7182
+ sheetState,
7183
+ variantId
7184
+ )?.length;
7185
+ return sanitizeSequenceLength(unsanitized);
7186
+ });
7187
+ const subUnitsPerUnitD = prism9(() => {
7188
+ if (val8(sheet.sequenceModeP) === "page") {
7189
+ return PAGE_MODE_SUB_UNITS_PER_UNIT;
7190
+ }
7191
+ const sheetState = val8(
7192
+ sheet.project.pointers.historic.sheetsById[sheet.address.sheetId]
7193
+ );
7194
+ const unsanitized = getSequenceStateFromSheet(
7195
+ sheetState,
7196
+ variantId
7197
+ )?.subUnitsPerUnit;
7198
+ return sanitizeSequenceSubUnitsPerUnit(unsanitized);
7199
+ });
7200
+ sequences[variantId] = new Sequence(
7201
+ sheet.template.project,
7202
+ sheet,
7203
+ lengthD,
7204
+ subUnitsPerUnitD,
7205
+ variantId
7206
+ );
7207
+ }
7208
+ return sequences[variantId];
7209
+ }
7210
+
7099
7211
  // shared/src/gsap/applyTimelineChildTiming.ts
7100
7212
  function applyTimelineChildTimingToGsap(rootAnimation, timelineChildren, childById, onRebuild) {
7101
7213
  if (!timelineChildren.length) return true;
@@ -7224,7 +7336,7 @@ function getAnimationEntryBySheetAddressKey(sheetObjectAddressKey, animationId)
7224
7336
  }
7225
7337
 
7226
7338
  // shared/src/gsap/subscribeGsapClipSyncAtPlayhead.ts
7227
- import { pointerToPrism, prism as prism7, val as val7 } from "@unseenco/theatre-dataverse";
7339
+ import { pointerToPrism, prism as prism10, val as val9 } from "@unseenco/theatre-dataverse";
7228
7340
 
7229
7341
  // shared/src/gsap/syncGsapClipsAtSequencePosition.ts
7230
7342
  function syncGsapClipsAtSequencePosition(position, clips) {
@@ -7238,11 +7350,11 @@ function syncGsapClipsAtSequencePosition(position, clips) {
7238
7350
  function subscribeGsapClipSyncAtPlayhead(source) {
7239
7351
  const positionPointer = source.pointer.position;
7240
7352
  const positionPrism = pointerToPrism(positionPointer);
7241
- const clipsPrism = prism7(() => source.getGsapClipTimings());
7353
+ const clipsPrism = prism10(() => source.getGsapClipTimings());
7242
7354
  const syncNow = () => {
7243
7355
  const clips = clipsPrism.getValue();
7244
7356
  if (clips.length === 0) return;
7245
- syncGsapClipsAtSequencePosition(val7(positionPointer), clips);
7357
+ syncGsapClipsAtSequencePosition(val9(positionPointer), clips);
7246
7358
  };
7247
7359
  const untapPosition = positionPrism.onStale(syncNow);
7248
7360
  const untapClips = clipsPrism.onStale(syncNow);
@@ -7276,7 +7388,7 @@ function attachGsapSequenceBridge(sheet) {
7276
7388
  }
7277
7389
 
7278
7390
  // core/src/sheets/attachSheetScrollDriver.ts
7279
- import { val as val8 } from "@unseenco/theatre-dataverse";
7391
+ import { val as val10 } from "@unseenco/theatre-dataverse";
7280
7392
  var sheetScrollDrivers = /* @__PURE__ */ new WeakMap();
7281
7393
  var pageScrollDrivenSequencePositionListeners = /* @__PURE__ */ new Set();
7282
7394
  function onPageScrollDrivenSequencePosition(listener) {
@@ -7417,7 +7529,7 @@ function attachSheetScrollDriver(sheet, driver = createNativeDocumentScrollDrive
7417
7529
  rememberSheetScrollDriver(sheet, driver);
7418
7530
  const sequence = sheet.sequence;
7419
7531
  const syncPositionFromScroll = (progress) => {
7420
- const length = val8(sequence.pointer.length);
7532
+ const length = val10(sequence.pointer.length);
7421
7533
  if (length <= 0) return;
7422
7534
  sequence.position = progress * length;
7423
7535
  };
@@ -7431,12 +7543,12 @@ function attachSheetScrollDriver(sheet, driver = createNativeDocumentScrollDrive
7431
7543
  };
7432
7544
  }
7433
7545
  function pageScrollProgressFromSequence(sheet) {
7434
- const length = val8(sheet.sequence.pointer.length);
7546
+ const length = val10(sheet.sequence.pointer.length);
7435
7547
  if (length <= 0) return 0;
7436
7548
  return sheet.sequence.position / length;
7437
7549
  }
7438
7550
  function setPageScrollProgress(sheet, progress) {
7439
- const length = val8(sheet.sequence.pointer.length);
7551
+ const length = val10(sheet.sequence.pointer.length);
7440
7552
  if (length <= 0) return;
7441
7553
  const clamped = Math.max(0, Math.min(1, progress));
7442
7554
  sheet.sequence.position = clamped * length;
@@ -7449,14 +7561,46 @@ function syncNativeDocumentScrollToSequencePosition(sheet) {
7449
7561
  syncPageScrollToSequencePosition(sheet, createNativeDocumentScrollDriver());
7450
7562
  }
7451
7563
 
7564
+ // core/src/sheets/sheetPageScrollAndGsapFull.ts
7565
+ function syncPageScrollDriverForSheet(host) {
7566
+ host._pageScrollDisposer?.();
7567
+ host._pageScrollDisposer = void 0;
7568
+ if (host.getSequenceMode() === "page") {
7569
+ const driver = host._customPageScrollDriver ?? createNativeDocumentScrollDriver();
7570
+ host._pageScrollDisposer = attachSheetScrollDriver(host.publicApi, driver);
7571
+ }
7572
+ }
7573
+ function reattachGsapBridgeForSheet(host) {
7574
+ if (host._gsapBridgeDisposer) {
7575
+ host._gsapBridgeDisposer();
7576
+ host._gsapBridgeDisposer = attachGsapSequenceBridge(host.publicApi);
7577
+ }
7578
+ }
7579
+ function enableGsapSequenceBridgeForSheet(host) {
7580
+ if (host._gsapBridgeDisposer) return;
7581
+ host._gsapBridgeDisposer = attachGsapSequenceBridge(host.publicApi);
7582
+ syncPageScrollDriverForSheet(host);
7583
+ }
7584
+ function disposeRuntimeIntegrationsForSheet(host) {
7585
+ host._pageScrollDisposer?.();
7586
+ host._pageScrollDisposer = void 0;
7587
+ host._gsapBridgeDisposer?.();
7588
+ host._gsapBridgeDisposer = void 0;
7589
+ }
7590
+ function setPageScrollDriverForSheet(host, driver) {
7591
+ host._customPageScrollDriver = driver;
7592
+ syncPageScrollDriverForSheet(host);
7593
+ }
7594
+
7452
7595
  // core/src/sheets/Sheet.ts
7453
7596
  var Sheet = class {
7454
7597
  constructor(template, instanceId) {
7455
7598
  this.template = template;
7456
7599
  this.instanceId = instanceId;
7457
- __publicField(this, "_objects", new Atom9({}));
7600
+ __publicField(this, "_objects", new Atom11({}));
7458
7601
  __publicField(this, "_sequences", {});
7459
- __publicField(this, "_activeSequenceVariant", new Atom9(
7602
+ __publicField(this, "_liteSequences", {});
7603
+ __publicField(this, "_activeSequenceVariant", new Atom11(
7460
7604
  DEFAULT_SEQUENCE_VARIANT
7461
7605
  ));
7462
7606
  /**
@@ -7464,11 +7608,14 @@ var Sheet = class {
7464
7608
  * value resolution (preview). User code can still update `_activeSequenceVariant`
7465
7609
  * via `setActiveSequenceVariant()` without affecting the Studio preview.
7466
7610
  */
7467
- __publicField(this, "_studioPreviewVariantOverride", new Atom9(void 0));
7468
- __publicField(this, "_sequenceMode", new Atom9("time"));
7611
+ __publicField(this, "_studioPreviewVariantOverride", new Atom11(void 0));
7612
+ __publicField(this, "_sequenceMode", new Atom11("time"));
7469
7613
  __publicField(this, "sequenceModeP", this._sequenceMode.pointer);
7614
+ /** @internal Used by full-runtime scroll/GSAP helpers (`sheetPageScrollAndGsapFull`). */
7470
7615
  __publicField(this, "_pageScrollDisposer");
7616
+ /** @internal */
7471
7617
  __publicField(this, "_customPageScrollDriver");
7618
+ /** @internal */
7472
7619
  __publicField(this, "_gsapBridgeDisposer");
7473
7620
  __publicField(this, "activeSequenceVariantP", this._activeSequenceVariant.pointer);
7474
7621
  __publicField(this, "effectiveActiveSequenceVariantD");
@@ -7486,12 +7633,12 @@ var Sheet = class {
7486
7633
  sheetInstanceId: this.instanceId
7487
7634
  };
7488
7635
  this.publicApi = new TheatreSheet(this);
7489
- this.effectiveActiveSequenceVariantD = prism8(() => {
7490
- const studioOverride = val9(this._studioPreviewVariantOverride.pointer);
7636
+ this.effectiveActiveSequenceVariantD = prism11(() => {
7637
+ const studioOverride = val11(this._studioPreviewVariantOverride.pointer);
7491
7638
  if (studioOverride !== void 0) {
7492
7639
  return studioOverride;
7493
7640
  }
7494
- return val9(this._activeSequenceVariant.pointer);
7641
+ return val11(this._activeSequenceVariant.pointer);
7495
7642
  });
7496
7643
  }
7497
7644
  /**
@@ -7543,8 +7690,10 @@ var Sheet = class {
7543
7690
  */
7544
7691
  unload() {
7545
7692
  this.disposeRuntimeIntegrations();
7546
- for (const sequence of Object.values(this._sequences)) {
7547
- sequence.pause();
7693
+ if (!isTheatreLiteMode()) {
7694
+ for (const sequence of Object.values(this._sequences)) {
7695
+ sequence.pause();
7696
+ }
7548
7697
  }
7549
7698
  for (const objectKey of Object.keys(
7550
7699
  this._objects.get()
@@ -7554,43 +7703,14 @@ var Sheet = class {
7554
7703
  this.project._unloadSheetInstance(this);
7555
7704
  }
7556
7705
  getSequence(variant) {
7557
- const variantId = variant ?? val9(this._activeSequenceVariant.pointer);
7558
- if (!this._sequences[variantId]) {
7559
- const lengthD = prism8(() => {
7560
- if (val9(this._sequenceMode.pointer) === "page") {
7561
- return PAGE_MODE_SEQUENCE_LENGTH;
7562
- }
7563
- const sheetState = val9(
7564
- this.project.pointers.historic.sheetsById[this.address.sheetId]
7565
- );
7566
- const unsanitized = getSequenceStateFromSheet(
7567
- sheetState,
7568
- variantId
7569
- )?.length;
7570
- return sanitizeSequenceLength(unsanitized);
7571
- });
7572
- const subUnitsPerUnitD = prism8(() => {
7573
- if (val9(this._sequenceMode.pointer) === "page") {
7574
- return PAGE_MODE_SUB_UNITS_PER_UNIT;
7575
- }
7576
- const sheetState = val9(
7577
- this.project.pointers.historic.sheetsById[this.address.sheetId]
7578
- );
7579
- const unsanitized = getSequenceStateFromSheet(
7580
- sheetState,
7581
- variantId
7582
- )?.subUnitsPerUnit;
7583
- return sanitizeSequenceSubUnitsPerUnit(unsanitized);
7584
- });
7585
- this._sequences[variantId] = new Sequence(
7586
- this.template.project,
7587
- this,
7588
- lengthD,
7589
- subUnitsPerUnitD,
7590
- variantId
7591
- );
7706
+ const variantId = variant ?? val11(this._activeSequenceVariant.pointer);
7707
+ if (isTheatreLiteMode()) {
7708
+ if (!this._liteSequences[variantId]) {
7709
+ this._liteSequences[variantId] = new LiteSequence();
7710
+ }
7711
+ return this._liteSequences[variantId];
7592
7712
  }
7593
- return this._sequences[variantId];
7713
+ return getOrCreateFullSequence(this, this._sequences, variantId);
7594
7714
  }
7595
7715
  getActiveSequenceVariant() {
7596
7716
  return this._activeSequenceVariant.get();
@@ -7629,43 +7749,28 @@ var Sheet = class {
7629
7749
  return this._sequenceMode.get();
7630
7750
  }
7631
7751
  setSequenceMode(mode) {
7752
+ if (isTheatreLiteMode()) return;
7632
7753
  if (this._sequenceMode.get() === mode) return;
7633
7754
  this._sequenceMode.set(mode);
7634
- this.syncPageScrollDriver();
7635
- if (this._gsapBridgeDisposer) {
7636
- this._gsapBridgeDisposer();
7637
- this._gsapBridgeDisposer = attachGsapSequenceBridge(this.publicApi);
7638
- }
7755
+ syncPageScrollDriverForSheet(this);
7756
+ reattachGsapBridgeForSheet(this);
7639
7757
  }
7640
7758
  enableGsapSequenceBridge() {
7641
- if (this._gsapBridgeDisposer) return;
7642
- this._gsapBridgeDisposer = attachGsapSequenceBridge(this.publicApi);
7643
- this.syncPageScrollDriver();
7759
+ if (isTheatreLiteMode()) return;
7760
+ enableGsapSequenceBridgeForSheet(this);
7644
7761
  }
7645
7762
  disposeRuntimeIntegrations() {
7646
- this._pageScrollDisposer?.();
7647
- this._pageScrollDisposer = void 0;
7648
- this._gsapBridgeDisposer?.();
7649
- this._gsapBridgeDisposer = void 0;
7650
- }
7651
- syncPageScrollDriver() {
7652
- this._pageScrollDisposer?.();
7653
- this._pageScrollDisposer = void 0;
7654
- if (this.getSequenceMode() === "page") {
7655
- const driver = this._customPageScrollDriver ?? createNativeDocumentScrollDriver();
7656
- this._pageScrollDisposer = attachSheetScrollDriver(this.publicApi, driver);
7657
- }
7763
+ if (isTheatreLiteMode()) return;
7764
+ disposeRuntimeIntegrationsForSheet(this);
7658
7765
  }
7659
7766
  setPageScrollDriver(driver) {
7660
- this._customPageScrollDriver = driver;
7661
- this.syncPageScrollDriver();
7767
+ if (isTheatreLiteMode()) return;
7768
+ setPageScrollDriverForSheet(this, driver);
7662
7769
  }
7663
7770
  getPageScrollDriver() {
7664
7771
  return this._customPageScrollDriver;
7665
7772
  }
7666
7773
  };
7667
- var sanitizeSequenceLength = (len) => typeof len === "number" && isFinite(len) && len > 0 ? len : 10;
7668
- var sanitizeSequenceSubUnitsPerUnit = (subs) => typeof subs === "number" && isInteger_default(subs) && subs >= 1 && subs <= 1e3 ? subs : 30;
7669
7774
 
7670
7775
  // core/src/sheets/SheetTemplate.ts
7671
7776
  var SheetTemplate = class {
@@ -7673,13 +7778,13 @@ var SheetTemplate = class {
7673
7778
  this.project = project;
7674
7779
  __publicField(this, "type", "Theatre_SheetTemplate");
7675
7780
  __publicField(this, "address");
7676
- __publicField(this, "_instances", new Atom10({}));
7781
+ __publicField(this, "_instances", new Atom12({}));
7677
7782
  __publicField(this, "instancesP", this._instances.pointer);
7678
- __publicField(this, "_objectTemplates", new Atom10({}));
7783
+ __publicField(this, "_objectTemplates", new Atom12({}));
7679
7784
  __publicField(this, "objectTemplatesP", this._objectTemplates.pointer);
7680
7785
  __publicField(this, "_pendingOutlineNamespaces", {});
7681
7786
  __publicField(this, "_sequenceVariants", [DEFAULT_SEQUENCE_VARIANT]);
7682
- __publicField(this, "_visibleInOutline", new Atom10(true));
7787
+ __publicField(this, "_visibleInOutline", new Atom12(true));
7683
7788
  __publicField(this, "visibleInOutlineP", this._visibleInOutline.pointer);
7684
7789
  this.address = { ...project.address, sheetId };
7685
7790
  }
@@ -7762,7 +7867,7 @@ var SheetTemplate = class {
7762
7867
 
7763
7868
  // core/src/projects/Project.ts
7764
7869
  import { PointerProxy } from "@unseenco/theatre-dataverse";
7765
- import { Atom as Atom11 } from "@unseenco/theatre-dataverse";
7870
+ import { Atom as Atom13 } from "@unseenco/theatre-dataverse";
7766
7871
 
7767
7872
  // shared/src/utils/delay.ts
7768
7873
  var delay = (dur) => new Promise((resolve) => setTimeout(resolve, dur));
@@ -8330,7 +8435,7 @@ function setRemotePageScrollMetrics(metrics) {
8330
8435
  }
8331
8436
 
8332
8437
  // core/src/internal/RemoteSync.ts
8333
- import { pointerToPrism as pointerToPrism2, val as val10 } from "@unseenco/theatre-dataverse";
8438
+ import { pointerToPrism as pointerToPrism2, val as val12 } from "@unseenco/theatre-dataverse";
8334
8439
 
8335
8440
  // core/src/internal/createDebouncedCallback.ts
8336
8441
  function createDebouncedCallback(fn2, delayMs) {
@@ -8528,14 +8633,14 @@ var RemoteSync = class {
8528
8633
  _readHistoricSnapshotFromStudio() {
8529
8634
  if (!this.studio) return void 0;
8530
8635
  const projectId = this.project.address.projectId;
8531
- const historic = val10(
8636
+ const historic = val12(
8532
8637
  this.studio.atomP.historic.coreByProject[projectId]
8533
8638
  );
8534
8639
  if (!historic) return void 0;
8535
8640
  const data = {
8536
8641
  historic: JSON.parse(JSON.stringify(historic))
8537
8642
  };
8538
- const ahistoric = val10(
8643
+ const ahistoric = val12(
8539
8644
  this.studio.atomP.ahistoric.coreByProject[projectId]
8540
8645
  );
8541
8646
  if (ahistoric) {
@@ -8728,7 +8833,7 @@ function _coreLogger(config) {
8728
8833
  }
8729
8834
 
8730
8835
  // shared/src/utils/assets.ts
8731
- import { val as val11 } from "@unseenco/theatre-dataverse";
8836
+ import { val as val13 } from "@unseenco/theatre-dataverse";
8732
8837
 
8733
8838
  // shared/src/utils/forEachDeep.ts
8734
8839
  function forEachPropDeep(m, fn2, startingPath = []) {
@@ -8798,7 +8903,7 @@ var Project = class {
8798
8903
  __publicField(this, "_studioReadyDeferred");
8799
8904
  __publicField(this, "_assetStorageReadyDeferred");
8800
8905
  __publicField(this, "_readyPromise");
8801
- __publicField(this, "_sheetTemplates", new Atom11({}));
8906
+ __publicField(this, "_sheetTemplates", new Atom13({}));
8802
8907
  __publicField(this, "sheetTemplatesP", this._sheetTemplates.pointer);
8803
8908
  __publicField(this, "_studio");
8804
8909
  __publicField(this, "_onDiskStateAtom");
@@ -8811,7 +8916,7 @@ var Project = class {
8811
8916
  this._logger.traceDev("creating project");
8812
8917
  this.address = { projectId: id };
8813
8918
  this._remoteSync = new RemoteSync(this);
8814
- const onDiskStateAtom = new Atom11({
8919
+ const onDiskStateAtom = new Atom13({
8815
8920
  ahistoric: {
8816
8921
  ahistoricStuff: ""
8817
8922
  },
@@ -9218,13 +9323,13 @@ var Project = class {
9218
9323
  };
9219
9324
 
9220
9325
  // shared/src/utils/sanitizers.ts
9221
- var _validateSym = (val13, thingy, range) => {
9222
- if (typeof val13 !== "string") {
9223
- return "".concat(thingy, " must be a string. ").concat(userReadableTypeOfValue_default(val13), " given.");
9224
- } else if (val13.trim().length !== val13.length) {
9225
- return "".concat(thingy, " must not have leading or trailing spaces. '").concat(val13, "' given.");
9226
- } else if (val13.length < range[0] || val13.length > range[1]) {
9227
- return "".concat(thingy, " must have between ").concat(range[0], " and ").concat(range[1], " characters. '").concat(val13, "' given.");
9326
+ var _validateSym = (val15, thingy, range) => {
9327
+ if (typeof val15 !== "string") {
9328
+ return "".concat(thingy, " must be a string. ").concat(userReadableTypeOfValue_default(val15), " given.");
9329
+ } else if (val15.trim().length !== val15.length) {
9330
+ return "".concat(thingy, " must not have leading or trailing spaces. '").concat(val15, "' given.");
9331
+ } else if (val15.length < range[0] || val15.length > range[1]) {
9332
+ return "".concat(thingy, " must have between ").concat(range[0], " and ").concat(range[1], " characters. '").concat(val15, "' given.");
9228
9333
  }
9229
9334
  };
9230
9335
  var validateName = (name, thingy, shouldThrow = false) => {
@@ -9338,64 +9443,10 @@ var TheatreProject = class {
9338
9443
  }
9339
9444
  };
9340
9445
 
9341
- // core/src/coreExports.ts
9446
+ // core/src/coreExportsShared.ts
9342
9447
  var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
9343
9448
  import { isPointer } from "@unseenco/theatre-dataverse";
9344
9449
  import { isPrism, pointerToPrism as pointerToPrism3 } from "@unseenco/theatre-dataverse";
9345
-
9346
- // core/src/sheets/theatrePageScroll.ts
9347
- var pageScrollConfig = {};
9348
- function buildPageScrollContextFromConfig() {
9349
- return {
9350
- scroller: pageScrollConfig.scroller ?? defaultPageScrollContext.scroller,
9351
- axis: pageScrollConfig.axis ?? defaultPageScrollContext.axis
9352
- };
9353
- }
9354
- function configureTheatrePageScroll(config) {
9355
- const prev = pageScrollConfig;
9356
- pageScrollConfig = {
9357
- scroller: config.scroller ?? prev.scroller,
9358
- axis: config.axis ?? prev.axis
9359
- };
9360
- if (config.scroller !== void 0 || config.axis !== void 0) {
9361
- setActivePageScrollContext(buildPageScrollContextFromConfig());
9362
- }
9363
- return {
9364
- reset() {
9365
- pageScrollConfig = prev;
9366
- setActivePageScrollContext(
9367
- prev.scroller !== void 0 || prev.axis !== void 0 ? {
9368
- scroller: prev.scroller ?? defaultPageScrollContext.scroller,
9369
- axis: prev.axis ?? defaultPageScrollContext.axis
9370
- } : defaultPageScrollContext
9371
- );
9372
- }
9373
- };
9374
- }
9375
- function getTheatrePageScrollConfig() {
9376
- return pageScrollConfig;
9377
- }
9378
- function getTheatrePageScrollContext() {
9379
- const ctx = buildPageScrollContextFromConfig();
9380
- setActivePageScrollContext(ctx);
9381
- return ctx;
9382
- }
9383
- function createDefaultPageScrollDriver(scroller = getTheatrePageScrollContext().scroller, axis = resolvePageScrollAxis(getTheatrePageScrollContext())) {
9384
- if (typeof document !== "undefined" && scroller != null && !isNativeDocumentScroller(scroller) && scroller instanceof HTMLElement) {
9385
- return axis === "horizontal" ? createElementHorizontalScrollDriver(scroller) : createElementScrollDriver(scroller);
9386
- }
9387
- return axis === "horizontal" ? createNativeDocumentHorizontalScrollDriver() : createNativeDocumentScrollDriver();
9388
- }
9389
- function attachTheatrePageScroll(sheet, options = {}) {
9390
- const ctx = getTheatrePageScrollContext();
9391
- const driver = options.driver ?? createDefaultPageScrollDriver(ctx.scroller, resolvePageScrollAxis(ctx));
9392
- sheet.setPageScrollDriver(driver);
9393
- return () => {
9394
- sheet.setPageScrollDriver(void 0);
9395
- };
9396
- }
9397
-
9398
- // core/src/coreExports.ts
9399
9450
  function getProject(id, config = {}) {
9400
9451
  const existingProject = projectsSingleton_default.get(id);
9401
9452
  if (existingProject) {
@@ -9436,7 +9487,7 @@ var shallowValidateOnDiskState = (projectId, s2) => {
9436
9487
  throw new InvalidArgumentError(
9437
9488
  "Error validating conf.state in Theatre.getProject(".concat(JSON.stringify(
9438
9489
  projectId
9439
- ), ", conf). The state seems to be formatted in a way that is unreadable to Theatre.js. Read more at https://unseen-theatre.netlify.app/docs/guide/manual/projects#state")
9490
+ ), ", conf). The state seems to be formatted in a way that is unreadable to Theatre.js. Read more at https://www.theatrejs.com/docs/latest/manual/projects#state")
9440
9491
  );
9441
9492
  }
9442
9493
  };
@@ -9473,28 +9524,97 @@ var validateProjectIdOrThrow = (value) => {
9473
9524
  );
9474
9525
  }
9475
9526
  };
9476
- function onChange(pointer3, callback, rafDriver) {
9527
+ function onChange(pointer4, callback, rafDriver) {
9477
9528
  const ticker = rafDriver ? privateAPI(rafDriver).ticker : getCoreTicker();
9478
- if (isPointer(pointer3)) {
9479
- const pr = pointerToPrism3(pointer3);
9529
+ if (isPointer(pointer4)) {
9530
+ const pr = pointerToPrism3(pointer4);
9480
9531
  return pr.onChange(ticker, callback, true);
9481
- } else if (isPrism(pointer3)) {
9482
- return pointer3.onChange(ticker, callback, true);
9532
+ } else if (isPrism(pointer4)) {
9533
+ return pointer4.onChange(ticker, callback, true);
9483
9534
  } else {
9484
9535
  throw new Error(
9485
9536
  "Called onChange(p) where p is neither a pointer nor a prism."
9486
9537
  );
9487
9538
  }
9488
9539
  }
9489
- function val12(pointer3) {
9490
- if (isPointer(pointer3)) {
9491
- return pointerToPrism3(pointer3).getValue();
9540
+ function val14(pointer4) {
9541
+ if (isPointer(pointer4)) {
9542
+ return pointerToPrism3(pointer4).getValue();
9492
9543
  } else {
9493
9544
  throw new Error("Called val(p) where p is not a pointer.");
9494
9545
  }
9495
9546
  }
9496
9547
 
9548
+ // core/src/sheets/theatrePageScroll.ts
9549
+ var pageScrollConfig = {};
9550
+ function buildPageScrollContextFromConfig() {
9551
+ return {
9552
+ scroller: pageScrollConfig.scroller ?? defaultPageScrollContext.scroller,
9553
+ axis: pageScrollConfig.axis ?? defaultPageScrollContext.axis
9554
+ };
9555
+ }
9556
+ function configureTheatrePageScroll(config) {
9557
+ const prev = pageScrollConfig;
9558
+ pageScrollConfig = {
9559
+ scroller: config.scroller ?? prev.scroller,
9560
+ axis: config.axis ?? prev.axis
9561
+ };
9562
+ if (config.scroller !== void 0 || config.axis !== void 0) {
9563
+ setActivePageScrollContext(buildPageScrollContextFromConfig());
9564
+ }
9565
+ return {
9566
+ reset() {
9567
+ pageScrollConfig = prev;
9568
+ setActivePageScrollContext(
9569
+ prev.scroller !== void 0 || prev.axis !== void 0 ? {
9570
+ scroller: prev.scroller ?? defaultPageScrollContext.scroller,
9571
+ axis: prev.axis ?? defaultPageScrollContext.axis
9572
+ } : defaultPageScrollContext
9573
+ );
9574
+ }
9575
+ };
9576
+ }
9577
+ function getTheatrePageScrollConfig() {
9578
+ return pageScrollConfig;
9579
+ }
9580
+ function getTheatrePageScrollContext() {
9581
+ const ctx = buildPageScrollContextFromConfig();
9582
+ setActivePageScrollContext(ctx);
9583
+ return ctx;
9584
+ }
9585
+ function createDefaultPageScrollDriver(scroller = getTheatrePageScrollContext().scroller, axis = resolvePageScrollAxis(getTheatrePageScrollContext())) {
9586
+ if (typeof document !== "undefined" && scroller != null && !isNativeDocumentScroller(scroller) && scroller instanceof HTMLElement) {
9587
+ return axis === "horizontal" ? createElementHorizontalScrollDriver(scroller) : createElementScrollDriver(scroller);
9588
+ }
9589
+ return axis === "horizontal" ? createNativeDocumentHorizontalScrollDriver() : createNativeDocumentScrollDriver();
9590
+ }
9591
+ function attachTheatrePageScroll(sheet, options = {}) {
9592
+ const ctx = getTheatrePageScrollContext();
9593
+ const driver = options.driver ?? createDefaultPageScrollDriver(ctx.scroller, resolvePageScrollAxis(ctx));
9594
+ sheet.setPageScrollDriver(driver);
9595
+ return () => {
9596
+ sheet.setPageScrollDriver(void 0);
9597
+ };
9598
+ }
9599
+
9600
+ // core/src/coreExports-lite.ts
9601
+ var coreExports_lite_exports = {};
9602
+ __export(coreExports_lite_exports, {
9603
+ createRafDriver: () => createRafDriver,
9604
+ getProject: () => getProject,
9605
+ getTheatreCoreRafDriver: () => getTheatreCoreRafDriver,
9606
+ isRemoteEditorWindow: () => isRemoteEditorWindow,
9607
+ notify: () => notify,
9608
+ onChange: () => onChange,
9609
+ privateAPI: () => privateAPI,
9610
+ setCoreRafDriver: () => setCoreRafDriver,
9611
+ setPrivateAPI: () => setPrivateAPI,
9612
+ types: () => propTypes_exports,
9613
+ val: () => val14
9614
+ });
9615
+
9497
9616
  // core/src/CoreBundle.ts
9617
+ var coreExports = isTheatreLiteMode() ? coreExports_lite_exports : coreExports_exports;
9498
9618
  var CoreBundle = class {
9499
9619
  constructor() {
9500
9620
  __publicField(this, "_studio");
@@ -9503,7 +9623,7 @@ var CoreBundle = class {
9503
9623
  return "Theatre_CoreBundle";
9504
9624
  }
9505
9625
  get version() {
9506
- return "0.5.0";
9626
+ return "0.6.0";
9507
9627
  }
9508
9628
  getBitsForStudio(studio, callback) {
9509
9629
  if (this._studio) {
@@ -9515,7 +9635,7 @@ var CoreBundle = class {
9515
9635
  const bits = {
9516
9636
  projectsP: projectsSingleton_default.atom.pointer.projects,
9517
9637
  privateAPI,
9518
- coreExports: coreExports_exports,
9638
+ coreExports,
9519
9639
  getCoreRafDriver
9520
9640
  };
9521
9641
  callback(bits);
@@ -9526,6 +9646,15 @@ var CoreBundle = class {
9526
9646
  registerCoreBundle();
9527
9647
  function registerCoreBundle() {
9528
9648
  if (typeof window == "undefined") return;
9649
+ if (globalThis.__THEATRE_FORCE_LITE__) {
9650
+ const liteBundle = (
9651
+ // @ts-ignore ignore
9652
+ window[coreBundle]
9653
+ );
9654
+ if (liteBundle) {
9655
+ return;
9656
+ }
9657
+ }
9529
9658
  const existingBundle = (
9530
9659
  // @ts-ignore ignore
9531
9660
  window[coreBundle]
@@ -9589,7 +9718,7 @@ export {
9589
9718
  syncNativeDocumentScrollToSequencePosition,
9590
9719
  syncPageScrollToSequencePosition,
9591
9720
  propTypes_exports as types,
9592
- val12 as val
9721
+ val14 as val
9593
9722
  };
9594
9723
  /*! Bundled license information:
9595
9724