@forgeax/app-shell 0.53.0 → 0.54.1
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 +27 -1
- package/dist/react.js +169 -0
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -206,6 +206,32 @@ declare const OWNED_INTERACTION_SURFACE_SELECTOR = "[data-fx-interaction-scope]"
|
|
|
206
206
|
*/
|
|
207
207
|
declare function isDismissExemptInteractionTarget(target: Element | null, additionalSelectors?: readonly string[]): boolean;
|
|
208
208
|
|
|
209
|
+
type OutsideDismissReason = 'pointer' | 'focus' | 'iframe-focus';
|
|
210
|
+
interface OutsideDismissEventTarget {
|
|
211
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
212
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
213
|
+
}
|
|
214
|
+
interface OutsideDismissLifecycleOptions {
|
|
215
|
+
readonly isOpen: () => boolean;
|
|
216
|
+
readonly isPinned: () => boolean;
|
|
217
|
+
readonly containsTarget: (target: Element) => boolean;
|
|
218
|
+
readonly isDismissExempt: (target: Element | null) => boolean;
|
|
219
|
+
readonly onContainedPointerDown?: (target: Element) => void;
|
|
220
|
+
readonly dismiss: (reason: OutsideDismissReason) => void;
|
|
221
|
+
readonly documentTarget?: OutsideDismissEventTarget;
|
|
222
|
+
readonly windowTarget?: OutsideDismissEventTarget;
|
|
223
|
+
readonly getActiveElement?: () => Element | null;
|
|
224
|
+
readonly requestFrame?: (callback: FrameRequestCallback) => number;
|
|
225
|
+
readonly cancelFrame?: (handle: number) => void;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Own the browser listener lifecycle for outside pointer/focus dismissal.
|
|
229
|
+
* Products inject live state, containment, exemptions and the close operation;
|
|
230
|
+
* App Shell only balances listeners, coalesces deferred iframe focus, and fences
|
|
231
|
+
* callbacks after disposal.
|
|
232
|
+
*/
|
|
233
|
+
declare function installOutsideDismissLifecycle(options: OutsideDismissLifecycleOptions): () => void;
|
|
234
|
+
|
|
209
235
|
type PanelContentPadding = 'none' | 'sm' | 'md';
|
|
210
236
|
type PanelContentScroll = 'none' | 'auto';
|
|
211
237
|
type PanelContentTone = 'default' | 'surface' | 'tool';
|
|
@@ -347,4 +373,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
|
|
|
347
373
|
/** Structural shell marker that preserves the caller's semantic element. */
|
|
348
374
|
declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
|
|
349
375
|
|
|
350
|
-
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 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, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, isDismissExemptInteractionTarget, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions, useTabPinnedState };
|
|
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 };
|
package/dist/react.js
CHANGED
|
@@ -1557,6 +1557,174 @@ function isDismissExemptInteractionTarget(target, additionalSelectors = []) {
|
|
|
1557
1557
|
return false;
|
|
1558
1558
|
}
|
|
1559
1559
|
|
|
1560
|
+
// src/outside-dismiss.ts
|
|
1561
|
+
function installOutsideDismissLifecycle(options) {
|
|
1562
|
+
const documentTarget = options.documentTarget ?? (typeof document === "undefined" ? void 0 : document);
|
|
1563
|
+
const windowTarget = options.windowTarget ?? (typeof window === "undefined" ? void 0 : window);
|
|
1564
|
+
const getActiveElement = options.getActiveElement ?? (() => typeof document === "undefined" ? null : document.activeElement);
|
|
1565
|
+
const requestFrame = options.requestFrame ?? (typeof requestAnimationFrame === "undefined" ? void 0 : requestAnimationFrame.bind(globalThis));
|
|
1566
|
+
const cancelFrame = options.cancelFrame ?? (typeof cancelAnimationFrame === "undefined" ? void 0 : cancelAnimationFrame.bind(globalThis));
|
|
1567
|
+
if (!documentTarget || !windowTarget) return () => {
|
|
1568
|
+
};
|
|
1569
|
+
let disposed = false;
|
|
1570
|
+
let dismissRequested = false;
|
|
1571
|
+
let rearmWhenUnpinned = false;
|
|
1572
|
+
let frameHandle = null;
|
|
1573
|
+
let frameGeneration = 0;
|
|
1574
|
+
const removeListener = (target, type, listener, options2) => {
|
|
1575
|
+
try {
|
|
1576
|
+
target.removeEventListener(type, listener, options2);
|
|
1577
|
+
} catch {
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
const disposition = (target) => {
|
|
1581
|
+
if (disposed) return "inactive";
|
|
1582
|
+
let open;
|
|
1583
|
+
try {
|
|
1584
|
+
open = options.isOpen();
|
|
1585
|
+
} catch {
|
|
1586
|
+
return "inactive";
|
|
1587
|
+
}
|
|
1588
|
+
if (!open) {
|
|
1589
|
+
dismissRequested = false;
|
|
1590
|
+
rearmWhenUnpinned = false;
|
|
1591
|
+
return "inactive";
|
|
1592
|
+
}
|
|
1593
|
+
let pinned;
|
|
1594
|
+
try {
|
|
1595
|
+
pinned = options.isPinned();
|
|
1596
|
+
} catch {
|
|
1597
|
+
return "inactive";
|
|
1598
|
+
}
|
|
1599
|
+
if (dismissRequested) {
|
|
1600
|
+
if (!rearmWhenUnpinned || pinned) return "inactive";
|
|
1601
|
+
dismissRequested = false;
|
|
1602
|
+
rearmWhenUnpinned = false;
|
|
1603
|
+
}
|
|
1604
|
+
if (pinned) return "inactive";
|
|
1605
|
+
if (target) {
|
|
1606
|
+
try {
|
|
1607
|
+
if (options.containsTarget(target)) return "contained";
|
|
1608
|
+
} catch {
|
|
1609
|
+
return "inactive";
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
try {
|
|
1613
|
+
if (options.isDismissExempt(target)) return "exempt";
|
|
1614
|
+
} catch {
|
|
1615
|
+
return "inactive";
|
|
1616
|
+
}
|
|
1617
|
+
return "outside";
|
|
1618
|
+
};
|
|
1619
|
+
const requestDismiss = (reason) => {
|
|
1620
|
+
if (dismissRequested || disposed) return;
|
|
1621
|
+
dismissRequested = true;
|
|
1622
|
+
rearmWhenUnpinned = false;
|
|
1623
|
+
try {
|
|
1624
|
+
options.dismiss(reason);
|
|
1625
|
+
} catch {
|
|
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;
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
const onPointerDown = (event) => {
|
|
1638
|
+
const target = event.target;
|
|
1639
|
+
const result = disposition(target);
|
|
1640
|
+
if (result === "contained" && target) {
|
|
1641
|
+
try {
|
|
1642
|
+
options.onContainedPointerDown?.(target);
|
|
1643
|
+
} catch {
|
|
1644
|
+
}
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
if (result === "outside") requestDismiss("pointer");
|
|
1648
|
+
};
|
|
1649
|
+
const onFocusIn = (event) => {
|
|
1650
|
+
if (disposition(event.target) === "outside") {
|
|
1651
|
+
requestDismiss("focus");
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
const onWindowBlur = () => {
|
|
1655
|
+
if (disposed || frameHandle !== null || !requestFrame) return;
|
|
1656
|
+
let open;
|
|
1657
|
+
try {
|
|
1658
|
+
open = options.isOpen();
|
|
1659
|
+
} catch {
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
if (!open) {
|
|
1663
|
+
dismissRequested = false;
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
const generation = ++frameGeneration;
|
|
1667
|
+
let callbackRan = false;
|
|
1668
|
+
let handle;
|
|
1669
|
+
try {
|
|
1670
|
+
handle = requestFrame(() => {
|
|
1671
|
+
callbackRan = true;
|
|
1672
|
+
if (disposed || generation !== frameGeneration) return;
|
|
1673
|
+
frameHandle = null;
|
|
1674
|
+
let active;
|
|
1675
|
+
try {
|
|
1676
|
+
active = getActiveElement();
|
|
1677
|
+
} catch {
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
if (!active || active.tagName !== "IFRAME") return;
|
|
1681
|
+
if (disposition(active) === "outside") requestDismiss("iframe-focus");
|
|
1682
|
+
});
|
|
1683
|
+
} catch {
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
if (callbackRan || disposed || generation !== frameGeneration) {
|
|
1687
|
+
try {
|
|
1688
|
+
cancelFrame?.(handle);
|
|
1689
|
+
} catch {
|
|
1690
|
+
}
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
frameHandle = handle;
|
|
1694
|
+
};
|
|
1695
|
+
let pointerRegistered = false;
|
|
1696
|
+
let focusRegistered = false;
|
|
1697
|
+
let blurRegistered = false;
|
|
1698
|
+
try {
|
|
1699
|
+
documentTarget.addEventListener("pointerdown", onPointerDown, true);
|
|
1700
|
+
pointerRegistered = true;
|
|
1701
|
+
documentTarget.addEventListener("focusin", onFocusIn);
|
|
1702
|
+
focusRegistered = true;
|
|
1703
|
+
windowTarget.addEventListener("blur", onWindowBlur);
|
|
1704
|
+
blurRegistered = true;
|
|
1705
|
+
} catch {
|
|
1706
|
+
if (pointerRegistered) removeListener(documentTarget, "pointerdown", onPointerDown, true);
|
|
1707
|
+
if (focusRegistered) removeListener(documentTarget, "focusin", onFocusIn);
|
|
1708
|
+
if (blurRegistered) removeListener(windowTarget, "blur", onWindowBlur);
|
|
1709
|
+
disposed = true;
|
|
1710
|
+
}
|
|
1711
|
+
return () => {
|
|
1712
|
+
if (disposed) return;
|
|
1713
|
+
disposed = true;
|
|
1714
|
+
frameGeneration++;
|
|
1715
|
+
if (frameHandle !== null) {
|
|
1716
|
+
try {
|
|
1717
|
+
cancelFrame?.(frameHandle);
|
|
1718
|
+
} catch {
|
|
1719
|
+
}
|
|
1720
|
+
frameHandle = null;
|
|
1721
|
+
}
|
|
1722
|
+
if (pointerRegistered) removeListener(documentTarget, "pointerdown", onPointerDown, true);
|
|
1723
|
+
if (focusRegistered) removeListener(documentTarget, "focusin", onFocusIn);
|
|
1724
|
+
if (blurRegistered) removeListener(windowTarget, "blur", onWindowBlur);
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1560
1728
|
// src/panel.tsx
|
|
1561
1729
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1562
1730
|
function PanelEmptyState({
|
|
@@ -1930,6 +2098,7 @@ export {
|
|
|
1930
2098
|
beginAnchoredResize,
|
|
1931
2099
|
createPersistentSizeStore,
|
|
1932
2100
|
hashSlotHue,
|
|
2101
|
+
installOutsideDismissLifecycle,
|
|
1933
2102
|
installPointerDragSession,
|
|
1934
2103
|
installPointerReorderSession,
|
|
1935
2104
|
installThresholdPointerDragSession,
|