@forgeax/app-shell 0.31.0 → 0.32.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/dock.d.ts CHANGED
@@ -128,6 +128,27 @@ interface DockLayoutObservationAdapter<Scope> {
128
128
  * Product callers retain concrete event, scope, snapshot, persistence, and UI adapters.
129
129
  */
130
130
  declare function installDockLayoutObservation<Scope>(source: DockLayoutObservationSource, adapter: DockLayoutObservationAdapter<Scope>): () => void;
131
+ interface DockLayoutResetSource {
132
+ onReset(listener: () => void): {
133
+ dispose(): void;
134
+ };
135
+ }
136
+ interface DockLayoutResetAdapter<Scope, Live> {
137
+ /** Resolve the current product-owned scope at reset time. */
138
+ getCurrentScope(): Scope | null;
139
+ /** Remove the persisted layout for a concrete product-owned scope. */
140
+ clear(scope: Scope): void;
141
+ /** Resolve the currently published dock value without retaining it here. */
142
+ getLive(): Live | null;
143
+ /** Reapply the current product-owned scope after persistence is cleared. */
144
+ apply(live: Live, scope: Scope | null): void;
145
+ }
146
+ /**
147
+ * Own one reset subscription and clear-before-reapply sequencing. Reentrant
148
+ * requests are serialized so the newest reset is applied last; product callers
149
+ * retain the concrete event, scope, persistence, live dock, and layout adapters.
150
+ */
151
+ declare function installDockLayoutReset<Scope, Live>(source: DockLayoutResetSource, adapter: DockLayoutResetAdapter<Scope, Live>): () => void;
131
152
  interface SerializedDockPanelLike {
132
153
  readonly contentComponent?: string;
133
154
  }
@@ -233,4 +254,4 @@ declare function handleCrossInstanceDrop(event: CrossInstanceDropEvent, targetRe
233
254
  titleFor?: (panelId: string) => string | undefined;
234
255
  }): void;
235
256
 
236
- export { type AuthoredDockLayoutLike, type AuthoredDockNodeLike, type CrossInstanceDropEvent, DOCK_REGIONS, type DesignedDockPanelPosition, type DockCommandPanel, type DockLayoutObservationAdapter, type DockLayoutObservationSource, type DockLayoutOrientation, type DockLayoutPersistence, type DockLayoutPersistenceAdapter, type DockLayoutPersistenceScope, type DockPanelCommandAdapter, type DockPanelCommands, type DockPanelVisibilityEventSource, type DockPanelVisibilityHooks, type DockReadyActivation, type DockReadyAdapterInstaller, type DockReadyAdapterSession, type DockReadyCleanup, type DockRegion, type DockRegionEntry, type DockReopenDirection, type DockScopeTransition, type DockScopeTransitionAdapter, type DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, createDockPanelCommands, createDockReadyActivation, createDockReadyCleanup, createDockScopeTransition, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockLayoutObservation, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
257
+ export { type AuthoredDockLayoutLike, type AuthoredDockNodeLike, type CrossInstanceDropEvent, DOCK_REGIONS, type DesignedDockPanelPosition, type DockCommandPanel, type DockLayoutObservationAdapter, type DockLayoutObservationSource, type DockLayoutOrientation, type DockLayoutPersistence, type DockLayoutPersistenceAdapter, type DockLayoutPersistenceScope, type DockLayoutResetAdapter, type DockLayoutResetSource, type DockPanelCommandAdapter, type DockPanelCommands, type DockPanelVisibilityEventSource, type DockPanelVisibilityHooks, type DockReadyActivation, type DockReadyAdapterInstaller, type DockReadyAdapterSession, type DockReadyCleanup, type DockRegion, type DockRegionEntry, type DockReopenDirection, type DockScopeTransition, type DockScopeTransitionAdapter, type DockviewApiLike, type PanelDescriptorLite, REGIONS, type RectLike, type Region, type SerializedDockLayoutLike, type SerializedDockPanelLike, type SideEdge, createDockLayoutPersistence, createDockPanelCommands, createDockReadyActivation, createDockReadyCleanup, createDockScopeTransition, designedDockPanelPosition, getDockRegions, getDockviewApi, handleCrossInstanceDrop, hasMountedPanelPlacement, installDockLayoutObservation, installDockLayoutReset, installDockPanelVisibilityTracking, isDockPanelVisible, isDockRegion, isOnSideEdge, nearerSideEdge, pruneSerializedDockLayout, registerDockRegion, registerDockviewApi, replaceDockReadyAdapters, resolveRegion, trackDockPanelVisibility };
package/dist/dock.js CHANGED
@@ -295,6 +295,65 @@ function installDockLayoutObservation(source, adapter) {
295
295
  }
296
296
  };
297
297
  }
298
+ function installDockLayoutReset(source, adapter) {
299
+ let active = true;
300
+ let processing = false;
301
+ let pending = false;
302
+ const reset = () => {
303
+ if (!active) return;
304
+ pending = true;
305
+ if (processing) return;
306
+ processing = true;
307
+ try {
308
+ while (active && pending) {
309
+ pending = false;
310
+ let scope;
311
+ try {
312
+ scope = adapter.getCurrentScope();
313
+ } catch {
314
+ continue;
315
+ }
316
+ if (!active) break;
317
+ if (pending) continue;
318
+ if (scope !== null) {
319
+ try {
320
+ adapter.clear(scope);
321
+ } catch {
322
+ continue;
323
+ }
324
+ if (!active) break;
325
+ if (pending) continue;
326
+ }
327
+ let live;
328
+ try {
329
+ live = adapter.getLive();
330
+ } catch {
331
+ continue;
332
+ }
333
+ if (!active) break;
334
+ if (pending) continue;
335
+ if (live) {
336
+ try {
337
+ adapter.apply(live, scope);
338
+ } catch {
339
+ }
340
+ }
341
+ }
342
+ } finally {
343
+ processing = false;
344
+ }
345
+ };
346
+ const subscription = source.onReset(reset);
347
+ return () => {
348
+ if (!active) return;
349
+ active = false;
350
+ pending = false;
351
+ try {
352
+ subscription.dispose();
353
+ } catch {
354
+ }
355
+ };
356
+ }
298
357
  function pruneSerializedDockLayout(layout, knownComponents, allowedPanelIds) {
299
358
  if (!layout.panels) return layout;
300
359
  const removed = new Set(Object.entries(layout.panels).filter(([id, panel]) => !knownComponents.has(panel.contentComponent ?? id) || allowedPanelIds !== void 0 && !allowedPanelIds.has(id)).map(([id]) => id));
@@ -523,6 +582,7 @@ export {
523
582
  handleCrossInstanceDrop,
524
583
  hasMountedPanelPlacement,
525
584
  installDockLayoutObservation,
585
+ installDockLayoutReset,
526
586
  installDockPanelVisibilityTracking,
527
587
  isDockPanelVisible,
528
588
  isDockRegion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",