floor-editor-ts 1.3.12 → 1.3.13

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.
@@ -71141,16 +71141,29 @@ function App($$anchor, $$props) {
71141
71141
  }).join("&");
71142
71142
  }).filter(Boolean).sort().join("|");
71143
71143
  }
71144
+ function clearAssignedSyncTimer() {
71145
+ if (assignedSyncTimer != null) {
71146
+ clearTimeout(assignedSyncTimer);
71147
+ assignedSyncTimer = null;
71148
+ }
71149
+ }
71150
+ /**
71151
+ * viewOnly must never run assignedCameras sync.
71152
+ * Otherwise `assignedCameras: []` + leftover module `lastSyncedSerials`
71153
+ * (from an edit session / other instance) strips cameras loaded from floorData.
71154
+ */
71144
71155
  function scheduleAssignedCamerasSync(_reason) {
71145
71156
  var _$$get;
71157
+ if (get(config).viewOnly) return;
71146
71158
  const aKey = assignedKey(latestAssigned);
71147
71159
  const fKey = `${(_$$get = get(activeFloorId)) !== null && _$$get !== void 0 ? _$$get : ""}:${get(activeFloorWallCount)}`;
71148
71160
  if (aKey === lastScheduledAssignKey && fKey === lastScheduledFloorKey && assignedSyncTimer != null) return;
71149
71161
  lastScheduledAssignKey = aKey;
71150
71162
  lastScheduledFloorKey = fKey;
71151
- if (assignedSyncTimer != null) clearTimeout(assignedSyncTimer);
71163
+ clearAssignedSyncTimer();
71152
71164
  assignedSyncTimer = setTimeout(() => {
71153
71165
  assignedSyncTimer = null;
71166
+ if (get(config).viewOnly) return;
71154
71167
  syncAssignedCameras(latestAssigned);
71155
71168
  }, 0);
71156
71169
  }
@@ -71169,12 +71182,13 @@ function App($$anchor, $$props) {
71169
71182
  lastScheduledFloorKey = "";
71170
71183
  currentProject.set(normalizeFloorData(v));
71171
71184
  markClean();
71172
- scheduleAssignedCamerasSync("floor");
71185
+ if (!get(config).viewOnly) scheduleAssignedCamerasSync("floor");
71173
71186
  }
71174
71187
  (_$$props$stores = $$props.stores) === null || _$$props$stores === void 0 || _$$props$stores.floorData.subscribe((v) => applyFloorData(v));
71175
71188
  (_$$props$stores2 = $$props.stores) === null || _$$props$stores2 === void 0 || _$$props$stores2.config.subscribe((v) => {
71176
71189
  var _next$assignedCameras;
71177
71190
  const next = normalizeConfig(v);
71191
+ const wasViewOnly = get(config).viewOnly;
71178
71192
  set(config, next, true);
71179
71193
  latestAssigned = (_next$assignedCameras = next.assignedCameras) !== null && _next$assignedCameras !== void 0 ? _next$assignedCameras : [];
71180
71194
  if (next.cameraThumbnailOpacity != null && get$1(cameraThumbnailOpacity) !== next.cameraThumbnailOpacity) cameraThumbnailOpacity.set(next.cameraThumbnailOpacity);
@@ -71185,6 +71199,17 @@ function App($$anchor, $$props) {
71185
71199
  name: next.projectName
71186
71200
  } : p);
71187
71201
  }
71202
+ if (next.viewOnly) {
71203
+ resetAssignedCamerasSyncState();
71204
+ lastScheduledAssignKey = "";
71205
+ lastScheduledFloorKey = "";
71206
+ clearAssignedSyncTimer();
71207
+ return;
71208
+ }
71209
+ if (wasViewOnly && !next.viewOnly) {
71210
+ lastScheduledAssignKey = "";
71211
+ lastScheduledFloorKey = "";
71212
+ }
71188
71213
  scheduleAssignedCamerasSync("config");
71189
71214
  });
71190
71215
  activeFloor.subscribe((f) => {
@@ -71194,7 +71219,7 @@ function App($$anchor, $$props) {
71194
71219
  const floorChanged = id !== get(activeFloorId) || walls !== get(activeFloorWallCount);
71195
71220
  if (id !== get(activeFloorId)) set(activeFloorId, id, true);
71196
71221
  if (walls !== get(activeFloorWallCount)) set(activeFloorWallCount, walls, true);
71197
- if (floorChanged) scheduleAssignedCamerasSync("floor");
71222
+ if (floorChanged && !get(config).viewOnly) scheduleAssignedCamerasSync("floor");
71198
71223
  });
71199
71224
  user_effect(() => {
71200
71225
  setFloorCallbackDispatcher($$props.onDispatch ? (eventName, detail) => $$props.onDispatch(eventName, detail) : null);
@@ -71219,7 +71244,7 @@ function App($$anchor, $$props) {
71219
71244
  return () => {
71220
71245
  unsub();
71221
71246
  clearTimeout(saveTimeout);
71222
- if (assignedSyncTimer != null) clearTimeout(assignedSyncTimer);
71247
+ clearAssignedSyncTimer();
71223
71248
  };
71224
71249
  });
71225
71250
  var fragment = root();
@@ -71587,7 +71612,11 @@ var FloorEditor = class extends HTMLElement {
71587
71612
  _classPrivateFieldInitSpec(this, _wrapper, null);
71588
71613
  _classPrivateFieldInitSpec(this, _store, {
71589
71614
  floorData: writable(null),
71590
- config: writable(DEFAULT_CONFIG)
71615
+ /** Default viewOnly — host sets viewOnly:false for the editor instance. */
71616
+ config: writable({
71617
+ ...DEFAULT_CONFIG,
71618
+ viewOnly: true
71619
+ })
71591
71620
  });
71592
71621
  }
71593
71622
  connectedCallback() {