@forgeax/app-shell 0.20.0 → 0.22.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.
@@ -68,6 +68,62 @@ function createPanelWindowingController() {
68
68
  }
69
69
  };
70
70
  }
71
+ function createSurfaceWindowingController(options) {
72
+ const emptySnapshot = Object.freeze({});
73
+ const floating = /* @__PURE__ */ new Set();
74
+ const listeners = /* @__PURE__ */ new Set();
75
+ let snapshot = emptySnapshot;
76
+ const publish = () => {
77
+ snapshot = floating.size === 0 ? emptySnapshot : Object.freeze(Object.fromEntries([...floating].sort().map((key) => [key, true])));
78
+ for (const listener of listeners) {
79
+ try {
80
+ listener();
81
+ } catch {
82
+ }
83
+ }
84
+ };
85
+ const markFloating = (surface) => {
86
+ const key = surfaceKey(surface);
87
+ if (floating.has(key)) return;
88
+ floating.add(key);
89
+ publish();
90
+ };
91
+ const markDocked = (surface) => {
92
+ if (!floating.delete(surfaceKey(surface))) return;
93
+ publish();
94
+ };
95
+ return {
96
+ snapshot: () => snapshot,
97
+ onChange(listener) {
98
+ listeners.add(listener);
99
+ return () => {
100
+ listeners.delete(listener);
101
+ };
102
+ },
103
+ async detachSurface(surface, detachOptions) {
104
+ if (!options.manager.canDetach()) return false;
105
+ try {
106
+ options.beforeDetach?.(surface);
107
+ } catch {
108
+ return false;
109
+ }
110
+ markFloating(surface);
111
+ let opened = false;
112
+ try {
113
+ opened = await options.manager.openSurfaceWindow(surface, detachOptions);
114
+ } catch {
115
+ opened = false;
116
+ }
117
+ if (!opened) markDocked(surface);
118
+ return opened;
119
+ },
120
+ async redockSurface(surface) {
121
+ await options.manager.closeSurfaceWindow(surface);
122
+ markDocked(surface);
123
+ },
124
+ markSurfaceDocked: markDocked
125
+ };
126
+ }
71
127
  function currentBrowserHost() {
72
128
  if (typeof window === "undefined" || typeof window.open !== "function") return void 0;
73
129
  return {
@@ -261,6 +317,7 @@ export {
261
317
  canOpenPanelWindow,
262
318
  shouldShowDetachedPlaceholder,
263
319
  createPanelWindowingController,
320
+ createSurfaceWindowingController,
264
321
  createBrowserWindowManager,
265
322
  createExternalWindowManager,
266
323
  surfaceKey,
package/dist/panel.css CHANGED
@@ -39,3 +39,28 @@
39
39
  .fx-panel-content[data-tone="tool"] {
40
40
  background: var(--color-background-base, #191919);
41
41
  }
42
+
43
+ .fx-panel-empty {
44
+ height: 100%;
45
+ min-height: 120px;
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ justify-content: center;
50
+ gap: 6px;
51
+ padding: 16px;
52
+ color: var(--color-text-tertiary, #778);
53
+ text-align: center;
54
+ }
55
+
56
+ .fx-panel-empty-title {
57
+ color: var(--color-text-secondary, #aab);
58
+ font-size: 13px;
59
+ font-weight: 600;
60
+ }
61
+
62
+ .fx-panel-empty-detail {
63
+ font-family: var(--font-mono, monospace);
64
+ font-size: 11px;
65
+ opacity: 0.72;
66
+ }
package/dist/react.d.ts CHANGED
@@ -37,6 +37,12 @@ interface PanelSurfaceProps extends Omit<HTMLAttributes<HTMLElement>, 'children'
37
37
  readonly content?: PanelContentPolicy;
38
38
  readonly children?: ReactNode;
39
39
  }
40
+ interface PanelEmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {
41
+ readonly title: ReactNode;
42
+ readonly detail?: ReactNode;
43
+ }
44
+ /** Product-neutral empty panel presentation with caller-owned content. */
45
+ declare function PanelEmptyState({ title, detail, className, ...props }: PanelEmptyStateProps): ReactElement;
40
46
  /** Product-neutral panel section and content presentation. */
41
47
  declare function PanelSurface({ id, registered, singleTab, header, content, children, className, ...props }: PanelSurfaceProps): ReactElement;
42
48
 
@@ -92,4 +98,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
92
98
  /** Structural shell marker that preserves the caller's semantic element. */
93
99
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
94
100
 
95
- export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, hashSlotHue, isSlotDebugEnabled, useLocalSize };
101
+ export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, hashSlotHue, isSlotDebugEnabled, useLocalSize };
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  shouldShowDetachedPlaceholder
3
- } from "./chunk-ZYCR2LSP.js";
3
+ } from "./chunk-EEPX63DF.js";
4
4
 
5
5
  // src/react.tsx
6
6
  import { createElement } from "react";
@@ -261,6 +261,24 @@ function ResizeHandle({
261
261
 
262
262
  // src/panel.tsx
263
263
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
264
+ function PanelEmptyState({
265
+ title,
266
+ detail,
267
+ className,
268
+ ...props
269
+ }) {
270
+ return /* @__PURE__ */ jsxs(
271
+ "div",
272
+ {
273
+ ...props,
274
+ className: className ? `fx-panel-empty ${className}` : "fx-panel-empty",
275
+ children: [
276
+ /* @__PURE__ */ jsx3("div", { className: "fx-panel-empty-title", children: title }),
277
+ detail == null ? null : /* @__PURE__ */ jsx3("div", { className: "fx-panel-empty-detail", children: detail })
278
+ ]
279
+ }
280
+ );
281
+ }
264
282
  function PanelSurface({
265
283
  id,
266
284
  registered = false,
@@ -394,6 +412,7 @@ export {
394
412
  DetachedPanelBoundary,
395
413
  DetachedSurfaceFrame,
396
414
  DetachedSurfaceStatus,
415
+ PanelEmptyState,
397
416
  PanelSurface,
398
417
  ResizeHandle,
399
418
  ShellSlot,
package/dist/window.d.ts CHANGED
@@ -82,10 +82,23 @@ interface PanelWindowingController {
82
82
  openPanelWindow(panelId: string, capability: DetachedWindowCapability | undefined, options: OpenPanelWindowOptions): Promise<boolean>;
83
83
  panelForClosedSurface(surface: SurfaceDescriptor): string | undefined;
84
84
  }
85
+ interface CreateSurfaceWindowingControllerOptions {
86
+ readonly manager: WindowManager;
87
+ readonly beforeDetach?: (surface: SurfaceDescriptor) => void;
88
+ }
89
+ interface SurfaceWindowingController {
90
+ snapshot(): Readonly<Record<string, true>>;
91
+ onChange(listener: () => void): () => void;
92
+ detachSurface(surface: SurfaceDescriptor, options?: DetachWindowOptions): Promise<boolean>;
93
+ redockSurface(surface: SurfaceDescriptor): Promise<void>;
94
+ markSurfaceDocked(surface: SurfaceDescriptor): void;
95
+ }
85
96
  declare function canOpenPanelWindow(capability: DetachedWindowCapability | undefined, carrierAvailable: boolean): capability is DetachedWindowCapability;
86
97
  declare function shouldShowDetachedPlaceholder(floatingSurfaces: Readonly<Record<string, true>>, surface: SurfaceDescriptor): boolean;
87
98
  /** Product-neutral transaction joining a dock placement to a detached carrier. */
88
99
  declare function createPanelWindowingController(): PanelWindowingController;
100
+ /** Product-neutral state machine joining floating presentation to a carrier. */
101
+ declare function createSurfaceWindowingController(options: CreateSurfaceWindowingControllerOptions): SurfaceWindowingController;
89
102
  /** Product-neutral browser popup carrier with injected surface URL policy. */
90
103
  declare function createBrowserWindowManager(options: CreateBrowserWindowManagerOptions): WindowManager;
91
104
  /** Event-driven external-window lifecycle with all native policy injected. */
@@ -99,4 +112,4 @@ declare function encodeSurfaceQuery(surface: SurfaceDescriptor): string;
99
112
  /** Decode structural identity, or null for a normal shell/invalid entry. */
100
113
  declare function decodeSurfaceFromLocation(search?: string): SurfaceDescriptor | null;
101
114
 
102
- export { type BrowserPopupWindow, type BrowserWindowHost, type CreateBrowserWindowManagerOptions, type CreateExternalWindowManagerOptions, type DetachWindowOptions, type DetachedWindowCapability, type DetachedWindowTarget, type ExternalWindowHandle, type ExternalWindowHost, type ExternalWindowLifecycle, type OpenPanelWindowOptions, type PanelWindowingController, type SurfaceDescriptor, type SurfaceKind, type SurfacePane, type WindowManager, canOpenPanelWindow, createBrowserWindowManager, createExternalWindowManager, createPanelWindowingController, decodeSurfaceFromLocation, encodeSurfaceQuery, shouldShowDetachedPlaceholder, surfaceKey, surfaceWindowLabel };
115
+ export { type BrowserPopupWindow, type BrowserWindowHost, type CreateBrowserWindowManagerOptions, type CreateExternalWindowManagerOptions, type CreateSurfaceWindowingControllerOptions, type DetachWindowOptions, type DetachedWindowCapability, type DetachedWindowTarget, type ExternalWindowHandle, type ExternalWindowHost, type ExternalWindowLifecycle, type OpenPanelWindowOptions, type PanelWindowingController, type SurfaceDescriptor, type SurfaceKind, type SurfacePane, type SurfaceWindowingController, type WindowManager, canOpenPanelWindow, createBrowserWindowManager, createExternalWindowManager, createPanelWindowingController, createSurfaceWindowingController, decodeSurfaceFromLocation, encodeSurfaceQuery, shouldShowDetachedPlaceholder, surfaceKey, surfaceWindowLabel };
package/dist/window.js CHANGED
@@ -3,17 +3,19 @@ import {
3
3
  createBrowserWindowManager,
4
4
  createExternalWindowManager,
5
5
  createPanelWindowingController,
6
+ createSurfaceWindowingController,
6
7
  decodeSurfaceFromLocation,
7
8
  encodeSurfaceQuery,
8
9
  shouldShowDetachedPlaceholder,
9
10
  surfaceKey,
10
11
  surfaceWindowLabel
11
- } from "./chunk-ZYCR2LSP.js";
12
+ } from "./chunk-EEPX63DF.js";
12
13
  export {
13
14
  canOpenPanelWindow,
14
15
  createBrowserWindowManager,
15
16
  createExternalWindowManager,
16
17
  createPanelWindowingController,
18
+ createSurfaceWindowingController,
17
19
  decodeSurfaceFromLocation,
18
20
  encodeSurfaceQuery,
19
21
  shouldShowDetachedPlaceholder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",