@forgeax/app-shell 0.46.0 → 0.48.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
@@ -143,6 +143,24 @@ interface LiveTabTitleSource {
143
143
  */
144
144
  declare function useLiveTabTitle(source: LiveTabTitleSource): string | undefined;
145
145
 
146
+ interface LiveTabPlacement {
147
+ readonly isEdge: boolean;
148
+ readonly groupId: string;
149
+ }
150
+ interface LiveTabPlacementSource {
151
+ getPlacement(): LiveTabPlacement;
152
+ subscribe(listener: () => void): () => void;
153
+ }
154
+ /** Observe one tab's live edge/group placement without owning host identities. */
155
+ declare function useLiveTabPlacement(source: LiveTabPlacementSource): LiveTabPlacement | undefined;
156
+
157
+ interface TabPinnedStateSource {
158
+ pinnedIn(groupId: string): string | undefined;
159
+ subscribe(listener: () => void): () => void;
160
+ }
161
+ /** Observe whether one product-supplied panel identity is pinned in a group. */
162
+ declare function useTabPinnedState(source: TabPinnedStateSource, groupId: string, panelId: string): boolean;
163
+
146
164
  type PanelContentPadding = 'none' | 'sm' | 'md';
147
165
  type PanelContentScroll = 'none' | 'auto';
148
166
  type PanelContentTone = 'default' | 'surface' | 'tool';
@@ -284,4 +302,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
284
302
  /** Structural shell marker that preserves the caller's semantic element. */
285
303
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
286
304
 
287
- 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, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type LiveTabTitleSource, 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 ThresholdPointerDragFinishReason, type ThresholdPointerDragSession, type ThresholdPointerDragSessionOptions, applyAnchoredResizeDelta, beginAnchoredResize, createPersistentSizeStore, hashSlotHue, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions };
305
+ 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, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type LiveTabPlacement, type LiveTabPlacementSource, type LiveTabTitleSource, 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, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions, useTabPinnedState };
package/dist/react.js CHANGED
@@ -1302,6 +1302,144 @@ function useLiveTabTitle(source) {
1302
1302
  );
1303
1303
  }
1304
1304
 
1305
+ // src/tab-placement.tsx
1306
+ import { useMemo as useMemo2, useSyncExternalStore as useSyncExternalStore3 } from "react";
1307
+ function samePlacement(left, right) {
1308
+ return left?.isEdge === right?.isEdge && left?.groupId === right?.groupId;
1309
+ }
1310
+ function stabilizeLiveTabPlacementSource(source) {
1311
+ let snapshot;
1312
+ try {
1313
+ const initial = source.getPlacement();
1314
+ snapshot = Object.freeze({ isEdge: initial.isEdge, groupId: initial.groupId });
1315
+ } catch {
1316
+ snapshot = void 0;
1317
+ }
1318
+ const synchronize = () => {
1319
+ let next;
1320
+ try {
1321
+ next = source.getPlacement();
1322
+ } catch {
1323
+ return false;
1324
+ }
1325
+ if (samePlacement(snapshot, next)) return false;
1326
+ snapshot = Object.freeze({ isEdge: next.isEdge, groupId: next.groupId });
1327
+ return true;
1328
+ };
1329
+ return {
1330
+ getSnapshot: () => {
1331
+ synchronize();
1332
+ return snapshot;
1333
+ },
1334
+ subscribe: (listener) => {
1335
+ let active = true;
1336
+ const notify = () => {
1337
+ if (!active || !synchronize()) return;
1338
+ try {
1339
+ listener();
1340
+ } catch {
1341
+ }
1342
+ };
1343
+ let dispose = () => {
1344
+ };
1345
+ try {
1346
+ dispose = source.subscribe(notify);
1347
+ } catch {
1348
+ notify();
1349
+ return () => {
1350
+ if (!active) return;
1351
+ active = false;
1352
+ };
1353
+ }
1354
+ notify();
1355
+ return () => {
1356
+ if (!active) return;
1357
+ active = false;
1358
+ try {
1359
+ dispose();
1360
+ } catch {
1361
+ }
1362
+ };
1363
+ }
1364
+ };
1365
+ }
1366
+ function useLiveTabPlacement(source) {
1367
+ const stable = useMemo2(() => stabilizeLiveTabPlacementSource(source), [source]);
1368
+ return useSyncExternalStore3(
1369
+ stable.subscribe,
1370
+ stable.getSnapshot,
1371
+ stable.getSnapshot
1372
+ );
1373
+ }
1374
+
1375
+ // src/tab-pinned-state.tsx
1376
+ import { useMemo as useMemo3, useSyncExternalStore as useSyncExternalStore4 } from "react";
1377
+ function stabilizeTabPinnedStateSource(source, groupId, panelId) {
1378
+ let snapshot = false;
1379
+ try {
1380
+ snapshot = source.pinnedIn(groupId) === panelId;
1381
+ } catch {
1382
+ }
1383
+ const synchronize = () => {
1384
+ let next;
1385
+ try {
1386
+ next = source.pinnedIn(groupId) === panelId;
1387
+ } catch {
1388
+ return false;
1389
+ }
1390
+ if (next === snapshot) return false;
1391
+ snapshot = next;
1392
+ return true;
1393
+ };
1394
+ return {
1395
+ getSnapshot: () => {
1396
+ synchronize();
1397
+ return snapshot;
1398
+ },
1399
+ subscribe: (listener) => {
1400
+ let active = true;
1401
+ const notify = () => {
1402
+ if (!active || !synchronize()) return;
1403
+ try {
1404
+ listener();
1405
+ } catch {
1406
+ }
1407
+ };
1408
+ let dispose = () => {
1409
+ };
1410
+ try {
1411
+ dispose = source.subscribe(notify);
1412
+ } catch {
1413
+ notify();
1414
+ return () => {
1415
+ if (!active) return;
1416
+ active = false;
1417
+ };
1418
+ }
1419
+ notify();
1420
+ return () => {
1421
+ if (!active) return;
1422
+ active = false;
1423
+ try {
1424
+ dispose();
1425
+ } catch {
1426
+ }
1427
+ };
1428
+ }
1429
+ };
1430
+ }
1431
+ function useTabPinnedState(source, groupId, panelId) {
1432
+ const stable = useMemo3(
1433
+ () => stabilizeTabPinnedStateSource(source, groupId, panelId),
1434
+ [source, groupId, panelId]
1435
+ );
1436
+ return useSyncExternalStore4(
1437
+ stable.subscribe,
1438
+ stable.getSnapshot,
1439
+ stable.getSnapshot
1440
+ );
1441
+ }
1442
+
1305
1443
  // src/panel.tsx
1306
1444
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
1307
1445
  function PanelEmptyState({
@@ -1444,7 +1582,7 @@ var SurfaceRegion = forwardRef(
1444
1582
  );
1445
1583
 
1446
1584
  // src/dock-layout-control.ts
1447
- import { useEffect as useEffect4, useMemo as useMemo2, useSyncExternalStore as useSyncExternalStore3 } from "react";
1585
+ import { useEffect as useEffect4, useMemo as useMemo4, useSyncExternalStore as useSyncExternalStore5 } from "react";
1448
1586
  function useDockLayoutControlBinding({
1449
1587
  state,
1450
1588
  onToggle,
@@ -1452,18 +1590,18 @@ function useDockLayoutControlBinding({
1452
1590
  closePanel,
1453
1591
  reopenPanel
1454
1592
  }) {
1455
- const snapshot = useSyncExternalStore3(
1593
+ const snapshot = useSyncExternalStore5(
1456
1594
  state.subscribe,
1457
1595
  state.getSnapshot,
1458
1596
  state.getSnapshot
1459
1597
  );
1460
1598
  useEffect4(() => installDockLayoutControlToggle({ onToggle }, state), [onToggle, state]);
1461
- const panelControl = useMemo2(() => createDockLayoutPanelControl({
1599
+ const panelControl = useMemo4(() => createDockLayoutPanelControl({
1462
1600
  isOpen: isPanelOpen,
1463
1601
  close: closePanel,
1464
1602
  reopen: reopenPanel
1465
1603
  }), [closePanel, isPanelOpen, reopenPanel]);
1466
- return useMemo2(() => ({ snapshot, panelControl }), [panelControl, snapshot]);
1604
+ return useMemo4(() => ({ snapshot, panelControl }), [panelControl, snapshot]);
1467
1605
  }
1468
1606
 
1469
1607
  // src/floating-menu.tsx
@@ -1674,10 +1812,12 @@ export {
1674
1812
  installThresholdPointerDragSession,
1675
1813
  isSlotDebugEnabled,
1676
1814
  useDockLayoutControlBinding,
1815
+ useLiveTabPlacement,
1677
1816
  useLiveTabTitle,
1678
1817
  useLocalSize,
1679
1818
  usePersistentSizeStore,
1680
- useTabCloseInteractions
1819
+ useTabCloseInteractions,
1820
+ useTabPinnedState
1681
1821
  };
1682
1822
  /*! Bundled license information:
1683
1823
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.46.0",
3
+ "version": "0.48.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",