@forgeax/app-shell 0.45.0 → 0.47.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
@@ -130,6 +130,30 @@ interface TabCloseInteractions<TabElement extends HTMLElement = HTMLElement> {
130
130
  */
131
131
  declare function useTabCloseInteractions<TabElement extends HTMLElement = HTMLElement>(options: TabCloseInteractionsOptions<TabElement>): TabCloseInteractions<TabElement>;
132
132
 
133
+ interface LiveTabTitleSource {
134
+ getTitle(): string | undefined;
135
+ subscribe(listener: () => void): () => void;
136
+ }
137
+ /**
138
+ * Observe one live tab title without owning its identity or display policy.
139
+ *
140
+ * The post-subscription read closes the gap between render and listener
141
+ * installation. A generation fence prevents retained listeners from a
142
+ * replaced source from publishing stale values.
143
+ */
144
+ declare function useLiveTabTitle(source: LiveTabTitleSource): string | undefined;
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
+
133
157
  type PanelContentPadding = 'none' | 'sm' | 'md';
134
158
  type PanelContentScroll = 'none' | 'auto';
135
159
  type PanelContentTone = 'default' | 'surface' | 'tool';
@@ -271,4 +295,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
271
295
  /** Structural shell marker that preserves the caller's semantic element. */
272
296
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
273
297
 
274
- 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 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, useLocalSize, usePersistentSizeStore, useTabCloseInteractions };
298
+ 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 ThresholdPointerDragFinishReason, type ThresholdPointerDragSession, type ThresholdPointerDragSessionOptions, applyAnchoredResizeDelta, beginAnchoredResize, createPersistentSizeStore, hashSlotHue, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, isSlotDebugEnabled, useDockLayoutControlBinding, useLiveTabPlacement, useLiveTabTitle, useLocalSize, usePersistentSizeStore, useTabCloseInteractions };
package/dist/react.js CHANGED
@@ -1236,6 +1236,142 @@ function useTabCloseInteractions(options) {
1236
1236
  return { closeRef, onPointerDown, onPointerUp, onPointerLeave };
1237
1237
  }
1238
1238
 
1239
+ // src/tab-title.tsx
1240
+ import { useMemo, useSyncExternalStore as useSyncExternalStore2 } from "react";
1241
+ function stabilizeLiveTabTitleSource(source) {
1242
+ let snapshot;
1243
+ try {
1244
+ snapshot = source.getTitle();
1245
+ } catch {
1246
+ snapshot = void 0;
1247
+ }
1248
+ const synchronize = () => {
1249
+ let next;
1250
+ try {
1251
+ next = source.getTitle();
1252
+ } catch {
1253
+ return false;
1254
+ }
1255
+ if (Object.is(snapshot, next)) return false;
1256
+ snapshot = next;
1257
+ return true;
1258
+ };
1259
+ return {
1260
+ getSnapshot: () => {
1261
+ synchronize();
1262
+ return snapshot;
1263
+ },
1264
+ subscribe: (listener) => {
1265
+ let active = true;
1266
+ const notify = () => {
1267
+ if (!active || !synchronize()) return;
1268
+ try {
1269
+ listener();
1270
+ } catch {
1271
+ }
1272
+ };
1273
+ let dispose = () => {
1274
+ };
1275
+ try {
1276
+ dispose = source.subscribe(notify);
1277
+ } catch {
1278
+ notify();
1279
+ return () => {
1280
+ if (!active) return;
1281
+ active = false;
1282
+ };
1283
+ }
1284
+ notify();
1285
+ return () => {
1286
+ if (!active) return;
1287
+ active = false;
1288
+ try {
1289
+ dispose();
1290
+ } catch {
1291
+ }
1292
+ };
1293
+ }
1294
+ };
1295
+ }
1296
+ function useLiveTabTitle(source) {
1297
+ const stable = useMemo(() => stabilizeLiveTabTitleSource(source), [source]);
1298
+ return useSyncExternalStore2(
1299
+ stable.subscribe,
1300
+ stable.getSnapshot,
1301
+ stable.getSnapshot
1302
+ );
1303
+ }
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
+
1239
1375
  // src/panel.tsx
1240
1376
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
1241
1377
  function PanelEmptyState({
@@ -1378,7 +1514,7 @@ var SurfaceRegion = forwardRef(
1378
1514
  );
1379
1515
 
1380
1516
  // src/dock-layout-control.ts
1381
- import { useEffect as useEffect4, useMemo, useSyncExternalStore as useSyncExternalStore2 } from "react";
1517
+ import { useEffect as useEffect4, useMemo as useMemo3, useSyncExternalStore as useSyncExternalStore4 } from "react";
1382
1518
  function useDockLayoutControlBinding({
1383
1519
  state,
1384
1520
  onToggle,
@@ -1386,18 +1522,18 @@ function useDockLayoutControlBinding({
1386
1522
  closePanel,
1387
1523
  reopenPanel
1388
1524
  }) {
1389
- const snapshot = useSyncExternalStore2(
1525
+ const snapshot = useSyncExternalStore4(
1390
1526
  state.subscribe,
1391
1527
  state.getSnapshot,
1392
1528
  state.getSnapshot
1393
1529
  );
1394
1530
  useEffect4(() => installDockLayoutControlToggle({ onToggle }, state), [onToggle, state]);
1395
- const panelControl = useMemo(() => createDockLayoutPanelControl({
1531
+ const panelControl = useMemo3(() => createDockLayoutPanelControl({
1396
1532
  isOpen: isPanelOpen,
1397
1533
  close: closePanel,
1398
1534
  reopen: reopenPanel
1399
1535
  }), [closePanel, isPanelOpen, reopenPanel]);
1400
- return useMemo(() => ({ snapshot, panelControl }), [panelControl, snapshot]);
1536
+ return useMemo3(() => ({ snapshot, panelControl }), [panelControl, snapshot]);
1401
1537
  }
1402
1538
 
1403
1539
  // src/floating-menu.tsx
@@ -1608,6 +1744,8 @@ export {
1608
1744
  installThresholdPointerDragSession,
1609
1745
  isSlotDebugEnabled,
1610
1746
  useDockLayoutControlBinding,
1747
+ useLiveTabPlacement,
1748
+ useLiveTabTitle,
1611
1749
  useLocalSize,
1612
1750
  usePersistentSizeStore,
1613
1751
  useTabCloseInteractions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",