@forgeax/app-shell 0.21.0 → 0.23.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/{chunk-ZYCR2LSP.js → chunk-QMT4V6XC.js} +97 -0
- package/dist/react.js +1 -1
- package/dist/window.d.ts +23 -1
- package/dist/window.js +5 -1
- package/package.json +1 -1
|
@@ -1,4 +1,43 @@
|
|
|
1
1
|
// src/window.ts
|
|
2
|
+
function createEdgePinStore() {
|
|
3
|
+
const emptySnapshot = Object.freeze({});
|
|
4
|
+
const pinnedByGroup = /* @__PURE__ */ new Map();
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
let snapshot = emptySnapshot;
|
|
7
|
+
const publish = () => {
|
|
8
|
+
snapshot = pinnedByGroup.size === 0 ? emptySnapshot : Object.freeze(Object.fromEntries([...pinnedByGroup.entries()].sort(([a], [b]) => a.localeCompare(b))));
|
|
9
|
+
for (const listener of listeners) {
|
|
10
|
+
try {
|
|
11
|
+
listener();
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
snapshot: () => snapshot,
|
|
18
|
+
onChange(listener) {
|
|
19
|
+
listeners.add(listener);
|
|
20
|
+
return () => {
|
|
21
|
+
listeners.delete(listener);
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
pinnedIn: (groupId) => pinnedByGroup.get(groupId),
|
|
25
|
+
setPinned(groupId, panelId) {
|
|
26
|
+
if (panelId === void 0) {
|
|
27
|
+
if (!pinnedByGroup.delete(groupId)) return;
|
|
28
|
+
} else {
|
|
29
|
+
if (pinnedByGroup.get(groupId) === panelId) return;
|
|
30
|
+
pinnedByGroup.set(groupId, panelId);
|
|
31
|
+
}
|
|
32
|
+
publish();
|
|
33
|
+
},
|
|
34
|
+
clear() {
|
|
35
|
+
if (pinnedByGroup.size === 0) return;
|
|
36
|
+
pinnedByGroup.clear();
|
|
37
|
+
publish();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
2
41
|
function canOpenPanelWindow(capability, carrierAvailable) {
|
|
3
42
|
return capability !== void 0 && carrierAvailable;
|
|
4
43
|
}
|
|
@@ -68,6 +107,62 @@ function createPanelWindowingController() {
|
|
|
68
107
|
}
|
|
69
108
|
};
|
|
70
109
|
}
|
|
110
|
+
function createSurfaceWindowingController(options) {
|
|
111
|
+
const emptySnapshot = Object.freeze({});
|
|
112
|
+
const floating = /* @__PURE__ */ new Set();
|
|
113
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
114
|
+
let snapshot = emptySnapshot;
|
|
115
|
+
const publish = () => {
|
|
116
|
+
snapshot = floating.size === 0 ? emptySnapshot : Object.freeze(Object.fromEntries([...floating].sort().map((key) => [key, true])));
|
|
117
|
+
for (const listener of listeners) {
|
|
118
|
+
try {
|
|
119
|
+
listener();
|
|
120
|
+
} catch {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const markFloating = (surface) => {
|
|
125
|
+
const key = surfaceKey(surface);
|
|
126
|
+
if (floating.has(key)) return;
|
|
127
|
+
floating.add(key);
|
|
128
|
+
publish();
|
|
129
|
+
};
|
|
130
|
+
const markDocked = (surface) => {
|
|
131
|
+
if (!floating.delete(surfaceKey(surface))) return;
|
|
132
|
+
publish();
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
snapshot: () => snapshot,
|
|
136
|
+
onChange(listener) {
|
|
137
|
+
listeners.add(listener);
|
|
138
|
+
return () => {
|
|
139
|
+
listeners.delete(listener);
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
async detachSurface(surface, detachOptions) {
|
|
143
|
+
if (!options.manager.canDetach()) return false;
|
|
144
|
+
try {
|
|
145
|
+
options.beforeDetach?.(surface);
|
|
146
|
+
} catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
markFloating(surface);
|
|
150
|
+
let opened = false;
|
|
151
|
+
try {
|
|
152
|
+
opened = await options.manager.openSurfaceWindow(surface, detachOptions);
|
|
153
|
+
} catch {
|
|
154
|
+
opened = false;
|
|
155
|
+
}
|
|
156
|
+
if (!opened) markDocked(surface);
|
|
157
|
+
return opened;
|
|
158
|
+
},
|
|
159
|
+
async redockSurface(surface) {
|
|
160
|
+
await options.manager.closeSurfaceWindow(surface);
|
|
161
|
+
markDocked(surface);
|
|
162
|
+
},
|
|
163
|
+
markSurfaceDocked: markDocked
|
|
164
|
+
};
|
|
165
|
+
}
|
|
71
166
|
function currentBrowserHost() {
|
|
72
167
|
if (typeof window === "undefined" || typeof window.open !== "function") return void 0;
|
|
73
168
|
return {
|
|
@@ -258,9 +353,11 @@ function decodeSurfaceFromLocation(search = typeof window !== "undefined" ? wind
|
|
|
258
353
|
}
|
|
259
354
|
|
|
260
355
|
export {
|
|
356
|
+
createEdgePinStore,
|
|
261
357
|
canOpenPanelWindow,
|
|
262
358
|
shouldShowDetachedPlaceholder,
|
|
263
359
|
createPanelWindowingController,
|
|
360
|
+
createSurfaceWindowingController,
|
|
264
361
|
createBrowserWindowManager,
|
|
265
362
|
createExternalWindowManager,
|
|
266
363
|
surfaceKey,
|
package/dist/react.js
CHANGED
package/dist/window.d.ts
CHANGED
|
@@ -82,10 +82,32 @@ 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
|
+
}
|
|
96
|
+
interface EdgePinStore {
|
|
97
|
+
snapshot(): Readonly<Record<string, string>>;
|
|
98
|
+
onChange(listener: () => void): () => void;
|
|
99
|
+
pinnedIn(groupId: string): string | undefined;
|
|
100
|
+
setPinned(groupId: string, panelId: string | undefined): void;
|
|
101
|
+
clear(): void;
|
|
102
|
+
}
|
|
103
|
+
/** Product-neutral state for one mutually-exclusive pinned item per edge group. */
|
|
104
|
+
declare function createEdgePinStore(): EdgePinStore;
|
|
85
105
|
declare function canOpenPanelWindow(capability: DetachedWindowCapability | undefined, carrierAvailable: boolean): capability is DetachedWindowCapability;
|
|
86
106
|
declare function shouldShowDetachedPlaceholder(floatingSurfaces: Readonly<Record<string, true>>, surface: SurfaceDescriptor): boolean;
|
|
87
107
|
/** Product-neutral transaction joining a dock placement to a detached carrier. */
|
|
88
108
|
declare function createPanelWindowingController(): PanelWindowingController;
|
|
109
|
+
/** Product-neutral state machine joining floating presentation to a carrier. */
|
|
110
|
+
declare function createSurfaceWindowingController(options: CreateSurfaceWindowingControllerOptions): SurfaceWindowingController;
|
|
89
111
|
/** Product-neutral browser popup carrier with injected surface URL policy. */
|
|
90
112
|
declare function createBrowserWindowManager(options: CreateBrowserWindowManagerOptions): WindowManager;
|
|
91
113
|
/** Event-driven external-window lifecycle with all native policy injected. */
|
|
@@ -99,4 +121,4 @@ declare function encodeSurfaceQuery(surface: SurfaceDescriptor): string;
|
|
|
99
121
|
/** Decode structural identity, or null for a normal shell/invalid entry. */
|
|
100
122
|
declare function decodeSurfaceFromLocation(search?: string): SurfaceDescriptor | null;
|
|
101
123
|
|
|
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 };
|
|
124
|
+
export { type BrowserPopupWindow, type BrowserWindowHost, type CreateBrowserWindowManagerOptions, type CreateExternalWindowManagerOptions, type CreateSurfaceWindowingControllerOptions, type DetachWindowOptions, type DetachedWindowCapability, type DetachedWindowTarget, type EdgePinStore, type ExternalWindowHandle, type ExternalWindowHost, type ExternalWindowLifecycle, type OpenPanelWindowOptions, type PanelWindowingController, type SurfaceDescriptor, type SurfaceKind, type SurfacePane, type SurfaceWindowingController, type WindowManager, canOpenPanelWindow, createBrowserWindowManager, createEdgePinStore, createExternalWindowManager, createPanelWindowingController, createSurfaceWindowingController, decodeSurfaceFromLocation, encodeSurfaceQuery, shouldShowDetachedPlaceholder, surfaceKey, surfaceWindowLabel };
|
package/dist/window.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canOpenPanelWindow,
|
|
3
3
|
createBrowserWindowManager,
|
|
4
|
+
createEdgePinStore,
|
|
4
5
|
createExternalWindowManager,
|
|
5
6
|
createPanelWindowingController,
|
|
7
|
+
createSurfaceWindowingController,
|
|
6
8
|
decodeSurfaceFromLocation,
|
|
7
9
|
encodeSurfaceQuery,
|
|
8
10
|
shouldShowDetachedPlaceholder,
|
|
9
11
|
surfaceKey,
|
|
10
12
|
surfaceWindowLabel
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QMT4V6XC.js";
|
|
12
14
|
export {
|
|
13
15
|
canOpenPanelWindow,
|
|
14
16
|
createBrowserWindowManager,
|
|
17
|
+
createEdgePinStore,
|
|
15
18
|
createExternalWindowManager,
|
|
16
19
|
createPanelWindowingController,
|
|
20
|
+
createSurfaceWindowingController,
|
|
17
21
|
decodeSurfaceFromLocation,
|
|
18
22
|
encodeSurfaceQuery,
|
|
19
23
|
shouldShowDetachedPlaceholder,
|