@unseenco/theatre-core 0.1.1 → 0.1.3

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.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from './coreExports';
2
- export { IProject, IProjectConfig } from './projects/TheatreProject';
2
+ export { IProject, IProjectConfig, ISheetOptions } from './projects/TheatreProject';
3
3
  export { ISequence } from './sequences/TheatreSequence';
4
4
  export { ISheetObject } from './sheetObjects/TheatreSheetObject';
5
- export { ISheet } from './sheets/TheatreSheet';
5
+ export { ISheet, ISheetObjectOptions } from './sheets/TheatreSheet';
6
6
  export { UnknownShorthandCompoundProps } from './propTypes/index';
7
7
  import { OnDiskState } from './projects/store/storeTypes';
8
8
 
package/dist/index.js CHANGED
@@ -272,6 +272,7 @@ var src_exports = {};
272
272
  __export(src_exports, {
273
273
  createRafDriver: () => createRafDriver,
274
274
  getProject: () => getProject,
275
+ isRemoteEditorWindow: () => isRemoteEditorWindow,
275
276
  notify: () => notify,
276
277
  onChange: () => onChange,
277
278
  setCoreRafDriver: () => setCoreRafDriver,
@@ -285,6 +286,7 @@ var coreExports_exports = {};
285
286
  __export(coreExports_exports, {
286
287
  createRafDriver: () => createRafDriver,
287
288
  getProject: () => getProject,
289
+ isRemoteEditorWindow: () => isRemoteEditorWindow,
288
290
  notify: () => notify,
289
291
  onChange: () => onChange,
290
292
  setCoreRafDriver: () => setCoreRafDriver,
@@ -4112,6 +4114,7 @@ var SheetObjectTemplate = class {
4112
4114
  __publicField(this, "pointerToStaticOverrides");
4113
4115
  __publicField(this, "pointerToAhistoricSheetState");
4114
4116
  __publicField(this, "pointerToAhistoricStaticOverrides");
4117
+ __publicField(this, "_visibleInOutline", true);
4115
4118
  this.address = __spreadProps(__spreadValues({}, sheetTemplate.address), { objectKey });
4116
4119
  this._config = new import_theatre_dataverse7.Atom(config);
4117
4120
  this._temp_actions_atom = new import_theatre_dataverse7.Atom(_temp_actions);
@@ -4146,6 +4149,12 @@ var SheetObjectTemplate = class {
4146
4149
  _temp_setActions(actions) {
4147
4150
  this._temp_actions_atom.set(actions);
4148
4151
  }
4152
+ setVisibleInOutline(visible) {
4153
+ this._visibleInOutline = visible;
4154
+ }
4155
+ isVisibleInOutline() {
4156
+ return this._visibleInOutline;
4157
+ }
4149
4158
  /**
4150
4159
  * Returns the default values (all defaults are read from the config)
4151
4160
  */
@@ -6080,6 +6089,9 @@ var TheatreSheet = class {
6080
6089
  if (actions) {
6081
6090
  existingObject.template._temp_setActions(actions);
6082
6091
  }
6092
+ if ((opts == null ? void 0 : opts.visible) !== void 0) {
6093
+ existingObject.template.setVisibleInOutline(opts.visible);
6094
+ }
6083
6095
  return existingObject.publicApi;
6084
6096
  } else {
6085
6097
  const sanitizedConfig = compound(config);
@@ -6087,7 +6099,8 @@ var TheatreSheet = class {
6087
6099
  sanitizedPath,
6088
6100
  nativeObject,
6089
6101
  sanitizedConfig,
6090
- actions
6102
+ actions,
6103
+ opts == null ? void 0 : opts.visible
6091
6104
  );
6092
6105
  if (process.env.NODE_ENV !== "production") {
6093
6106
  weakMapOfUnsanitizedProps.set(object, config);
@@ -6196,13 +6209,16 @@ var Sheet = class {
6196
6209
  * @remarks At some point, we have to reconcile the concept of "an object"
6197
6210
  * with that of "an element."
6198
6211
  */
6199
- createObject(objectKey, nativeObject, config, actions = {}) {
6212
+ createObject(objectKey, nativeObject, config, actions = {}, visibleInOutline) {
6200
6213
  const objTemplate = this.template.getObjectTemplate(
6201
6214
  objectKey,
6202
6215
  nativeObject,
6203
6216
  config,
6204
6217
  actions
6205
6218
  );
6219
+ if (visibleInOutline !== void 0) {
6220
+ objTemplate.setVisibleInOutline(visibleInOutline);
6221
+ }
6206
6222
  const object = objTemplate.createInstance(this, nativeObject, config);
6207
6223
  this._objects.setByPointer((p2) => p2[objectKey], object);
6208
6224
  this.project._remoteSync.registerObject(object);
@@ -6302,6 +6318,7 @@ var SheetTemplate = class {
6302
6318
  __publicField(this, "objectTemplatesP", this._objectTemplates.pointer);
6303
6319
  __publicField(this, "_pendingOutlineNamespaces", {});
6304
6320
  __publicField(this, "_sequenceVariants", [DEFAULT_SEQUENCE_VARIANT]);
6321
+ __publicField(this, "_visibleInOutline", true);
6305
6322
  this.address = __spreadProps(__spreadValues({}, project.address), { sheetId });
6306
6323
  }
6307
6324
  getInstance(instanceId) {
@@ -6346,6 +6363,12 @@ var SheetTemplate = class {
6346
6363
  "sheet.declareSequenceVariants"
6347
6364
  );
6348
6365
  }
6366
+ setVisibleInOutline(visible) {
6367
+ this._visibleInOutline = visible;
6368
+ }
6369
+ isVisibleInOutline() {
6370
+ return this._visibleInOutline;
6371
+ }
6349
6372
  };
6350
6373
 
6351
6374
  // core/src/projects/Project.ts
@@ -6752,13 +6775,13 @@ var globals_default = globals;
6752
6775
  async function initialiseProjectState(studio, project, onDiskState) {
6753
6776
  await delay_default(0);
6754
6777
  studio.transaction(({ drafts }) => {
6755
- var _a;
6778
+ var _a, _b, _c;
6756
6779
  const projectId = project.address.projectId;
6757
6780
  drafts.ephemeral.coreByProject[projectId] = {
6758
6781
  lastExportedObject: null,
6759
6782
  loadingState: { type: "loading" }
6760
6783
  };
6761
- drafts.ahistoric.coreByProject[projectId] = {
6784
+ (_b = (_a = drafts.ahistoric.coreByProject)[projectId]) != null ? _b : _a[projectId] = {
6762
6785
  ahistoricStuff: ""
6763
6786
  };
6764
6787
  function useInitialState() {
@@ -6788,7 +6811,7 @@ async function initialiseProjectState(studio, project, onDiskState) {
6788
6811
  onDiskState: onDiskState2
6789
6812
  };
6790
6813
  }
6791
- const browserState = (_a = e(drafts.historic)) == null ? void 0 : _a.coreByProject[project.address.projectId];
6814
+ const browserState = (_c = e(drafts.historic)) == null ? void 0 : _c.coreByProject[project.address.projectId];
6792
6815
  if (!browserState) {
6793
6816
  if (!onDiskState) {
6794
6817
  useInitialState();
@@ -7152,12 +7175,15 @@ var Project = class {
7152
7175
  isReady() {
7153
7176
  return this._studioReadyDeferred.status === "resolved" && this._assetStorageReadyDeferred.status === "resolved";
7154
7177
  }
7155
- getOrCreateSheet(sheetId, instanceId = "default") {
7178
+ getOrCreateSheet(sheetId, instanceId = "default", opts) {
7156
7179
  let template = this._sheetTemplates.get()[sheetId];
7157
7180
  if (!template) {
7158
7181
  template = new SheetTemplate(this, sheetId);
7159
7182
  this._sheetTemplates.reduce((s2) => __spreadProps(__spreadValues({}, s2), { [sheetId]: template }));
7160
7183
  }
7184
+ if ((opts == null ? void 0 : opts.visible) !== void 0) {
7185
+ template.setVisibleInOutline(opts.visible);
7186
+ }
7161
7187
  const sheet = template.getInstance(instanceId);
7162
7188
  this._remoteSync.registerSheet(sheet);
7163
7189
  return sheet;
@@ -7268,11 +7294,19 @@ var TheatreProject = class {
7268
7294
  }
7269
7295
  return asset.id ? privateAPI(this).assetStorage.getAssetUrl(asset.id) : void 0;
7270
7296
  }
7271
- sheet(sheetId, instanceId = "default") {
7297
+ sheet(sheetId, instanceIdOrOpts = "default", opts) {
7272
7298
  const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(
7273
7299
  sheetId,
7274
7300
  "project.sheet"
7275
7301
  );
7302
+ let instanceId = "default";
7303
+ let sheetOpts;
7304
+ if (typeof instanceIdOrOpts === "string") {
7305
+ instanceId = instanceIdOrOpts;
7306
+ sheetOpts = opts;
7307
+ } else {
7308
+ sheetOpts = instanceIdOrOpts;
7309
+ }
7276
7310
  if (process.env.NODE_ENV !== "production") {
7277
7311
  validateInstanceId(
7278
7312
  instanceId,
@@ -7282,7 +7316,8 @@ var TheatreProject = class {
7282
7316
  }
7283
7317
  return privateAPI(this).getOrCreateSheet(
7284
7318
  sanitizedPath,
7285
- instanceId
7319
+ instanceId,
7320
+ sheetOpts
7286
7321
  ).publicApi;
7287
7322
  }
7288
7323
  };
@@ -7385,7 +7420,7 @@ var CoreBundle = class {
7385
7420
  return "Theatre_CoreBundle";
7386
7421
  }
7387
7422
  get version() {
7388
- return "0.1.1";
7423
+ return "0.1.3";
7389
7424
  }
7390
7425
  getBitsForStudio(studio, callback) {
7391
7426
  if (this._studio) {