@forgeax/app-shell 0.66.0 → 0.67.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.
@@ -264,7 +264,8 @@ function createDockLayoutPersistence(adapter) {
264
264
  }
265
265
  function installDockLayoutObservation(source, adapter) {
266
266
  let active = true;
267
- const subscription = source.onDidLayoutChange(() => {
267
+ let subscription;
268
+ const onDidLayoutChange = () => {
268
269
  if (!active) return;
269
270
  let scope;
270
271
  try {
@@ -285,12 +286,21 @@ function installDockLayoutObservation(source, adapter) {
285
286
  adapter.onCommitted();
286
287
  } catch {
287
288
  }
288
- });
289
+ };
290
+ try {
291
+ subscription = source.onDidLayoutChange(onDidLayoutChange);
292
+ } catch {
293
+ active = false;
294
+ try {
295
+ subscription?.dispose();
296
+ } catch {
297
+ }
298
+ }
289
299
  return () => {
290
300
  if (!active) return;
291
301
  active = false;
292
302
  try {
293
- subscription.dispose();
303
+ subscription?.dispose();
294
304
  } catch {
295
305
  }
296
306
  };
package/dist/dock.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  replaceDockReadyAdapters,
29
29
  resolveRegion,
30
30
  trackDockPanelVisibility
31
- } from "./chunk-MYY2LEZI.js";
31
+ } from "./chunk-ZRVT36QD.js";
32
32
  export {
33
33
  DOCK_REGIONS,
34
34
  REGIONS,
package/dist/react.d.ts CHANGED
@@ -286,6 +286,28 @@ interface ViewportResizeObservationOptions {
286
286
  /** Observe viewport resize without owning the caller's geometry policy. */
287
287
  declare function installViewportResizeObservation(options: ViewportResizeObservationOptions): () => void;
288
288
 
289
+ interface ElementResizeObserver {
290
+ observe(target: Element): void;
291
+ disconnect(): void;
292
+ }
293
+ interface ElementResizeObservationOptions {
294
+ /** Read the complete live element set whenever the source changes. */
295
+ readonly getElements: () => Iterable<Element>;
296
+ /** Subscribe to element-set replacement. */
297
+ readonly subscribeElements: (listener: () => void) => () => void;
298
+ /** Receive size changes without transferring geometry policy. */
299
+ readonly onResize: () => void;
300
+ /** Receive element-set changes after the observer has rebound. */
301
+ readonly onElementsChanged?: () => void;
302
+ readonly createObserver?: (listener: () => void) => ElementResizeObserver;
303
+ }
304
+ /**
305
+ * Observe a replaceable set of elements without owning their identity or layout.
306
+ * The caller supplies the source and effects; App Shell owns observer rebinding,
307
+ * source subscription balance, stale-listener fencing, and failure isolation.
308
+ */
309
+ declare function installElementResizeObservation(options: ElementResizeObservationOptions): () => void;
310
+
289
311
  interface CustomEventObservationTarget {
290
312
  addEventListener(type: string, listener: EventListener): void;
291
313
  removeEventListener(type: string, listener: EventListener): void;
@@ -507,4 +529,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
507
529
  /** Structural shell marker that preserves the caller's semantic element. */
508
530
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
509
531
 
510
- export { type ActivePanelObservationOptions, type ActivePanelObservationSubscription, type AnchoredResizeDirection, AnchoredResizeHandle, type AnchoredResizeHandleProps, type AnchoredResizeSession, type BoundedFrameRetryLifecycleOptions, type CaptureInteractionEventTarget, type CaptureInteractionObservationOptions, type CoalescedFrameTaskLifecycle, type CoalescedFrameTaskLifecycleOptions, type CustomEventObservationOptions, type CustomEventObservationTarget, DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, DockLayoutMenu, type DockLayoutMenuPanel, type DockLayoutMenuProps, DockTabAction, type DockTabActionProps, DockTabFrame, type DockTabFrameProps, DockTabIcon, type DockTabIconProps, DockTabStatusSummary, type DockTabStatusSummaryItem, type DockTabStatusSummaryProps, type DockTabStatusTone, DockTabTitle, type DockTabTitleProps, type DragPresenceEventTarget, type DragPresenceLifecycleOptions, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type LayoutFromJsonObservationOptions, type LayoutFromJsonObservationSubscription, type LiveTabPlacement, type LiveTabPlacementSource, type LiveTabTitleSource, OWNED_INTERACTION_SURFACE_SELECTOR, type OutsideDismissEventTarget, type OutsideDismissLifecycleOptions, type OutsideDismissReason, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, type PanelMembershipObservationOptions, type PanelMembershipObservationSubscription, PanelSurface, type PanelSurfaceProps, type PersistentSizeStorage, type PersistentSizeStore, type PersistentSizeStoreOptions, type PersistentSizeUpdate, type PointerDragFinishReason, type PointerDragSessionOptions, type PointerReorderFinishReason, type PointerReorderSession, type PointerReorderSessionOptions, type ReplaceableObservationSetLifecycle, type ReplaceableObservationSetOptions, type ReplaceableObservationSubscription, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, type TabCloseInteractions, type TabCloseInteractionsOptions, type TabPinnedStateSource, type ThresholdPointerDragFinishReason, type ThresholdPointerDragSession, type ThresholdPointerDragSessionOptions, type ViewportResizeEventTarget, type ViewportResizeObservationOptions, type WillDropObservationOptions, type WillDropObservationSubscription, applyAnchoredResizeDelta, beginAnchoredResize, createCoalescedFrameTaskLifecycle, createPersistentSizeStore, createReplaceableObservationSetLifecycle, hashSlotHue, installActivePanelObservation, installBoundedFrameRetryLifecycle, installCaptureInteractionObservation, installCustomEventObservation, installDragPresenceLifecycle, installLayoutFromJsonObservation, installOutsideDismissLifecycle, installPanelMembershipObservation, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, installViewportResizeObservation, installWillDropObservation, isDismissExemptInteractionTarget, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions, useTabPinnedState };
532
+ export { type ActivePanelObservationOptions, type ActivePanelObservationSubscription, type AnchoredResizeDirection, AnchoredResizeHandle, type AnchoredResizeHandleProps, type AnchoredResizeSession, type BoundedFrameRetryLifecycleOptions, type CaptureInteractionEventTarget, type CaptureInteractionObservationOptions, type CoalescedFrameTaskLifecycle, type CoalescedFrameTaskLifecycleOptions, type CustomEventObservationOptions, type CustomEventObservationTarget, DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, DockLayoutMenu, type DockLayoutMenuPanel, type DockLayoutMenuProps, DockTabAction, type DockTabActionProps, DockTabFrame, type DockTabFrameProps, DockTabIcon, type DockTabIconProps, DockTabStatusSummary, type DockTabStatusSummaryItem, type DockTabStatusSummaryProps, type DockTabStatusTone, DockTabTitle, type DockTabTitleProps, type DragPresenceEventTarget, type DragPresenceLifecycleOptions, type ElementResizeObservationOptions, type ElementResizeObserver, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type LayoutFromJsonObservationOptions, type LayoutFromJsonObservationSubscription, type LiveTabPlacement, type LiveTabPlacementSource, type LiveTabTitleSource, OWNED_INTERACTION_SURFACE_SELECTOR, type OutsideDismissEventTarget, type OutsideDismissLifecycleOptions, type OutsideDismissReason, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, type PanelMembershipObservationOptions, type PanelMembershipObservationSubscription, PanelSurface, type PanelSurfaceProps, type PersistentSizeStorage, type PersistentSizeStore, type PersistentSizeStoreOptions, type PersistentSizeUpdate, type PointerDragFinishReason, type PointerDragSessionOptions, type PointerReorderFinishReason, type PointerReorderSession, type PointerReorderSessionOptions, type ReplaceableObservationSetLifecycle, type ReplaceableObservationSetOptions, type ReplaceableObservationSubscription, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, type TabCloseInteractions, type TabCloseInteractionsOptions, type TabPinnedStateSource, type ThresholdPointerDragFinishReason, type ThresholdPointerDragSession, type ThresholdPointerDragSessionOptions, type ViewportResizeEventTarget, type ViewportResizeObservationOptions, type WillDropObservationOptions, type WillDropObservationSubscription, applyAnchoredResizeDelta, beginAnchoredResize, createCoalescedFrameTaskLifecycle, createPersistentSizeStore, createReplaceableObservationSetLifecycle, hashSlotHue, installActivePanelObservation, installBoundedFrameRetryLifecycle, installCaptureInteractionObservation, installCustomEventObservation, installDragPresenceLifecycle, installElementResizeObservation, installLayoutFromJsonObservation, installOutsideDismissLifecycle, installPanelMembershipObservation, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, installViewportResizeObservation, installWillDropObservation, isDismissExemptInteractionTarget, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions, useTabPinnedState };
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createDockLayoutPanelControl,
3
3
  installDockLayoutControlToggle
4
- } from "./chunk-MYY2LEZI.js";
4
+ } from "./chunk-ZRVT36QD.js";
5
5
  import {
6
6
  shouldShowDetachedPlaceholder
7
7
  } from "./chunk-QMT4V6XC.js";
@@ -1546,6 +1546,118 @@ function installViewportResizeObservation(options) {
1546
1546
  };
1547
1547
  }
1548
1548
 
1549
+ // src/element-resize-observation.ts
1550
+ function installElementResizeObservation(options) {
1551
+ const createObserver = options.createObserver ?? (typeof ResizeObserver === "undefined" ? void 0 : (listener) => new ResizeObserver(listener));
1552
+ let active = true;
1553
+ let observer;
1554
+ let unsubscribe;
1555
+ let rebinding = false;
1556
+ let rebindPending = false;
1557
+ let rebindGeneration = 0;
1558
+ const disconnect = () => {
1559
+ try {
1560
+ observer?.disconnect();
1561
+ } catch {
1562
+ }
1563
+ };
1564
+ const observeCurrent = (clearExisting = true) => {
1565
+ if (!active) return false;
1566
+ rebindPending = true;
1567
+ if (rebinding) {
1568
+ rebindGeneration++;
1569
+ return false;
1570
+ }
1571
+ rebinding = true;
1572
+ let clearBeforePass = clearExisting;
1573
+ let committed = false;
1574
+ try {
1575
+ while (active && rebindPending) {
1576
+ rebindPending = false;
1577
+ committed = false;
1578
+ const generation = ++rebindGeneration;
1579
+ if (!observer) {
1580
+ committed = true;
1581
+ continue;
1582
+ }
1583
+ if (clearBeforePass) disconnect();
1584
+ clearBeforePass = true;
1585
+ if (!active || generation !== rebindGeneration || rebindPending) continue;
1586
+ let elements;
1587
+ try {
1588
+ elements = options.getElements();
1589
+ } catch {
1590
+ continue;
1591
+ }
1592
+ if (!active || generation !== rebindGeneration || rebindPending) continue;
1593
+ try {
1594
+ for (const element of elements) {
1595
+ if (!active || generation !== rebindGeneration || rebindPending) break;
1596
+ try {
1597
+ observer.observe(element);
1598
+ } catch {
1599
+ }
1600
+ }
1601
+ } catch {
1602
+ }
1603
+ if (!active || generation !== rebindGeneration || rebindPending) continue;
1604
+ committed = true;
1605
+ }
1606
+ } finally {
1607
+ rebinding = false;
1608
+ }
1609
+ return active && committed && !rebindPending;
1610
+ };
1611
+ const onResize = () => {
1612
+ if (!active) return;
1613
+ try {
1614
+ options.onResize();
1615
+ } catch {
1616
+ }
1617
+ };
1618
+ const onElementsChanged = () => {
1619
+ if (!active) return;
1620
+ if (!observeCurrent()) return;
1621
+ try {
1622
+ options.onElementsChanged?.();
1623
+ } catch {
1624
+ }
1625
+ };
1626
+ if (createObserver) {
1627
+ try {
1628
+ observer = createObserver(onResize);
1629
+ } catch {
1630
+ observer = void 0;
1631
+ }
1632
+ }
1633
+ observeCurrent(false);
1634
+ try {
1635
+ unsubscribe = options.subscribeElements(onElementsChanged);
1636
+ if (typeof unsubscribe !== "function") {
1637
+ throw new TypeError("element source subscription must return a disposer");
1638
+ }
1639
+ } catch {
1640
+ active = false;
1641
+ disconnect();
1642
+ try {
1643
+ unsubscribe?.();
1644
+ } catch {
1645
+ }
1646
+ unsubscribe = void 0;
1647
+ }
1648
+ return () => {
1649
+ if (!active) return;
1650
+ active = false;
1651
+ try {
1652
+ unsubscribe?.();
1653
+ } catch {
1654
+ }
1655
+ unsubscribe = void 0;
1656
+ disconnect();
1657
+ observer = void 0;
1658
+ };
1659
+ }
1660
+
1549
1661
  // src/custom-event-observation.ts
1550
1662
  function installCustomEventObservation(options) {
1551
1663
  const target = options.target ?? (typeof window === "undefined" ? void 0 : window);
@@ -2218,6 +2330,7 @@ export {
2218
2330
  installCaptureInteractionObservation,
2219
2331
  installCustomEventObservation,
2220
2332
  installDragPresenceLifecycle,
2333
+ installElementResizeObservation,
2221
2334
  installLayoutFromJsonObservation,
2222
2335
  installOutsideDismissLifecycle,
2223
2336
  installPanelMembershipObservation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.66.0",
3
+ "version": "0.67.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",