@forgeax/app-shell 0.54.0 → 0.55.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/react.d.ts CHANGED
@@ -232,6 +232,20 @@ interface OutsideDismissLifecycleOptions {
232
232
  */
233
233
  declare function installOutsideDismissLifecycle(options: OutsideDismissLifecycleOptions): () => void;
234
234
 
235
+ interface BoundedFrameRetryLifecycleOptions {
236
+ readonly attempt: () => boolean;
237
+ readonly onSuccess?: () => void;
238
+ readonly maxFrames?: number;
239
+ readonly requestFrame?: (callback: FrameRequestCallback) => number;
240
+ readonly cancelFrame?: (handle: number) => void;
241
+ }
242
+ /**
243
+ * Attempt immediately, then retry on a bounded number of animation frames.
244
+ * Products own the work and success predicate; App Shell owns scheduling,
245
+ * cancellation, stale-callback fencing and best-effort exception isolation.
246
+ */
247
+ declare function installBoundedFrameRetryLifecycle(options: BoundedFrameRetryLifecycleOptions): () => void;
248
+
235
249
  type PanelContentPadding = 'none' | 'sm' | 'md';
236
250
  type PanelContentScroll = 'none' | 'auto';
237
251
  type PanelContentTone = 'default' | 'surface' | 'tool';
@@ -373,4 +387,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
373
387
  /** Structural shell marker that preserves the caller's semantic element. */
374
388
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
375
389
 
376
- export { type AnchoredResizeDirection, AnchoredResizeHandle, type AnchoredResizeHandleProps, type AnchoredResizeSession, 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, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, 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, PanelSurface, type PanelSurfaceProps, type PersistentSizeStorage, type PersistentSizeStore, type PersistentSizeStoreOptions, type PersistentSizeUpdate, type PointerDragFinishReason, type PointerDragSessionOptions, type PointerReorderFinishReason, type PointerReorderSession, type PointerReorderSessionOptions, 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, applyAnchoredResizeDelta, beginAnchoredResize, createPersistentSizeStore, hashSlotHue, installOutsideDismissLifecycle, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, isDismissExemptInteractionTarget, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions, useTabPinnedState };
390
+ export { type AnchoredResizeDirection, AnchoredResizeHandle, type AnchoredResizeHandleProps, type AnchoredResizeSession, type BoundedFrameRetryLifecycleOptions, 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, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, 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, PanelSurface, type PanelSurfaceProps, type PersistentSizeStorage, type PersistentSizeStore, type PersistentSizeStoreOptions, type PersistentSizeUpdate, type PointerDragFinishReason, type PointerDragSessionOptions, type PointerReorderFinishReason, type PointerReorderSession, type PointerReorderSessionOptions, 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, applyAnchoredResizeDelta, beginAnchoredResize, createPersistentSizeStore, hashSlotHue, installBoundedFrameRetryLifecycle, installOutsideDismissLifecycle, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, isDismissExemptInteractionTarget, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions, useTabPinnedState };
package/dist/react.js CHANGED
@@ -1568,6 +1568,7 @@ function installOutsideDismissLifecycle(options) {
1568
1568
  };
1569
1569
  let disposed = false;
1570
1570
  let dismissRequested = false;
1571
+ let rearmWhenUnpinned = false;
1571
1572
  let frameHandle = null;
1572
1573
  let frameGeneration = 0;
1573
1574
  const removeListener = (target, type, listener, options2) => {
@@ -1586,14 +1587,21 @@ function installOutsideDismissLifecycle(options) {
1586
1587
  }
1587
1588
  if (!open) {
1588
1589
  dismissRequested = false;
1590
+ rearmWhenUnpinned = false;
1589
1591
  return "inactive";
1590
1592
  }
1591
- if (dismissRequested) return "inactive";
1593
+ let pinned;
1592
1594
  try {
1593
- if (options.isPinned()) return "inactive";
1595
+ pinned = options.isPinned();
1594
1596
  } catch {
1595
1597
  return "inactive";
1596
1598
  }
1599
+ if (dismissRequested) {
1600
+ if (!rearmWhenUnpinned || pinned) return "inactive";
1601
+ dismissRequested = false;
1602
+ rearmWhenUnpinned = false;
1603
+ }
1604
+ if (pinned) return "inactive";
1597
1605
  if (target) {
1598
1606
  try {
1599
1607
  if (options.containsTarget(target)) return "contained";
@@ -1611,10 +1619,19 @@ function installOutsideDismissLifecycle(options) {
1611
1619
  const requestDismiss = (reason) => {
1612
1620
  if (dismissRequested || disposed) return;
1613
1621
  dismissRequested = true;
1622
+ rearmWhenUnpinned = false;
1614
1623
  try {
1615
1624
  options.dismiss(reason);
1616
1625
  } catch {
1617
1626
  dismissRequested = false;
1627
+ return;
1628
+ }
1629
+ if (disposed) return;
1630
+ try {
1631
+ rearmWhenUnpinned = options.isOpen() && options.isPinned();
1632
+ } catch {
1633
+ dismissRequested = false;
1634
+ rearmWhenUnpinned = false;
1618
1635
  }
1619
1636
  };
1620
1637
  const onPointerDown = (event) => {
@@ -1708,6 +1725,75 @@ function installOutsideDismissLifecycle(options) {
1708
1725
  };
1709
1726
  }
1710
1727
 
1728
+ // src/frame-retry.ts
1729
+ function installBoundedFrameRetryLifecycle(options) {
1730
+ const requestFrame = options.requestFrame ?? (typeof requestAnimationFrame === "undefined" ? void 0 : requestAnimationFrame.bind(globalThis));
1731
+ const cancelFrame = options.cancelFrame ?? (typeof cancelAnimationFrame === "undefined" ? void 0 : cancelAnimationFrame.bind(globalThis));
1732
+ const requestedMaxFrames = options.maxFrames ?? 240;
1733
+ const maxFrames = Number.isFinite(requestedMaxFrames) ? Math.max(0, Math.floor(requestedMaxFrames)) : 0;
1734
+ let disposed = false;
1735
+ let completed = false;
1736
+ let attemptedFrames = 0;
1737
+ let frameHandle = null;
1738
+ let frameGeneration = 0;
1739
+ const attempt = () => {
1740
+ if (disposed || completed) return true;
1741
+ let succeeded = false;
1742
+ try {
1743
+ succeeded = options.attempt() === true;
1744
+ } catch {
1745
+ }
1746
+ if (disposed || !succeeded) return disposed;
1747
+ completed = true;
1748
+ frameGeneration++;
1749
+ try {
1750
+ options.onSuccess?.();
1751
+ } catch {
1752
+ }
1753
+ return true;
1754
+ };
1755
+ const schedule = () => {
1756
+ if (disposed || completed || !requestFrame || attemptedFrames >= maxFrames) return;
1757
+ attemptedFrames++;
1758
+ const generation = ++frameGeneration;
1759
+ let callbackRan = false;
1760
+ let handle;
1761
+ try {
1762
+ handle = requestFrame(() => {
1763
+ callbackRan = true;
1764
+ if (disposed || completed || generation !== frameGeneration) return;
1765
+ frameGeneration++;
1766
+ frameHandle = null;
1767
+ if (!attempt()) schedule();
1768
+ });
1769
+ } catch {
1770
+ if (generation === frameGeneration) frameGeneration++;
1771
+ return;
1772
+ }
1773
+ if (callbackRan || disposed || completed || generation !== frameGeneration) {
1774
+ try {
1775
+ cancelFrame?.(handle);
1776
+ } catch {
1777
+ }
1778
+ return;
1779
+ }
1780
+ frameHandle = handle;
1781
+ };
1782
+ if (!attempt()) schedule();
1783
+ return () => {
1784
+ if (disposed) return;
1785
+ disposed = true;
1786
+ frameGeneration++;
1787
+ if (frameHandle !== null) {
1788
+ try {
1789
+ cancelFrame?.(frameHandle);
1790
+ } catch {
1791
+ }
1792
+ frameHandle = null;
1793
+ }
1794
+ };
1795
+ }
1796
+
1711
1797
  // src/panel.tsx
1712
1798
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1713
1799
  function PanelEmptyState({
@@ -2081,6 +2167,7 @@ export {
2081
2167
  beginAnchoredResize,
2082
2168
  createPersistentSizeStore,
2083
2169
  hashSlotHue,
2170
+ installBoundedFrameRetryLifecycle,
2084
2171
  installOutsideDismissLifecycle,
2085
2172
  installPointerDragSession,
2086
2173
  installPointerReorderSession,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",