@forgeax/app-shell 0.14.0 → 0.16.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.
@@ -0,0 +1,270 @@
1
+ // src/window.ts
2
+ function canOpenPanelWindow(capability, carrierAvailable) {
3
+ return capability !== void 0 && carrierAvailable;
4
+ }
5
+ function shouldShowDetachedPlaceholder(floatingSurfaces, surface) {
6
+ return floatingSurfaces[surfaceKey(surface)] === true;
7
+ }
8
+ function createPanelWindowingController() {
9
+ const detachedPanels = /* @__PURE__ */ new Map();
10
+ return {
11
+ async openPanelWindow(panelId, capability, options) {
12
+ if (!capability) return false;
13
+ let target;
14
+ try {
15
+ target = capability.createTarget();
16
+ } catch {
17
+ return false;
18
+ }
19
+ const key = surfaceKey(target.surface);
20
+ const closesPlacement = target.dockBehavior === "close";
21
+ let reservation;
22
+ if (closesPlacement) {
23
+ if (!options.closeDockPanel || detachedPanels.has(key)) return false;
24
+ reservation = { panelId, state: "pending" };
25
+ detachedPanels.set(key, reservation);
26
+ }
27
+ let opened;
28
+ try {
29
+ opened = await options.detachSurface(target.surface, {
30
+ title: target.title,
31
+ width: target.width,
32
+ height: target.height,
33
+ ...options.position
34
+ });
35
+ } catch {
36
+ if (reservation && detachedPanels.get(key) === reservation) detachedPanels.delete(key);
37
+ return false;
38
+ }
39
+ if (!opened) {
40
+ if (reservation && detachedPanels.get(key) === reservation) detachedPanels.delete(key);
41
+ return false;
42
+ }
43
+ if (closesPlacement) {
44
+ if (detachedPanels.get(key) !== reservation) return false;
45
+ try {
46
+ options.closeDockPanel();
47
+ } catch {
48
+ if (detachedPanels.get(key) === reservation) detachedPanels.delete(key);
49
+ return false;
50
+ }
51
+ reservation.state = "leased";
52
+ }
53
+ return true;
54
+ },
55
+ panelForClosedSurface(surface) {
56
+ const key = surfaceKey(surface);
57
+ const lease = detachedPanels.get(key);
58
+ if (lease?.state === "pending") {
59
+ detachedPanels.delete(key);
60
+ return void 0;
61
+ }
62
+ if (lease?.state === "leased") {
63
+ queueMicrotask(() => {
64
+ if (detachedPanels.get(key) === lease) detachedPanels.delete(key);
65
+ });
66
+ }
67
+ return lease?.state === "leased" ? lease.panelId : void 0;
68
+ }
69
+ };
70
+ }
71
+ function currentBrowserHost() {
72
+ if (typeof window === "undefined" || typeof window.open !== "function") return void 0;
73
+ return {
74
+ screen: window.screen,
75
+ open: (url, target, features) => window.open(url, target, features),
76
+ setInterval: (callback, delayMs) => window.setInterval(callback, delayMs),
77
+ clearInterval: (handle) => window.clearInterval(handle)
78
+ };
79
+ }
80
+ function createBrowserWindowManager(options) {
81
+ const host = options.host ?? currentBrowserHost();
82
+ const windows = /* @__PURE__ */ new Map();
83
+ const closePolls = /* @__PURE__ */ new Map();
84
+ const closeListeners = /* @__PURE__ */ new Set();
85
+ const forget = (surface) => {
86
+ const key = surfaceWindowLabel(surface);
87
+ const poll = closePolls.get(key);
88
+ if (poll !== void 0) host?.clearInterval(poll);
89
+ closePolls.delete(key);
90
+ windows.delete(key);
91
+ };
92
+ const notifyClosed = (surface) => {
93
+ for (const listener of closeListeners) {
94
+ try {
95
+ listener(surface);
96
+ } catch {
97
+ }
98
+ }
99
+ };
100
+ return {
101
+ canDetach: () => host !== void 0,
102
+ async openSurfaceWindow(surface, detachOptions) {
103
+ if (!host) return false;
104
+ const label = surfaceWindowLabel(surface);
105
+ const existing = windows.get(label);
106
+ if (existing !== void 0 && !existing.closed) {
107
+ existing.focus();
108
+ return true;
109
+ }
110
+ if (existing !== void 0) forget(surface);
111
+ const width = detachOptions?.width ?? 960;
112
+ const height = detachOptions?.height ?? 720;
113
+ const left = detachOptions?.x ?? Math.max(0, Math.round((host.screen.width - width) / 2));
114
+ const top = detachOptions?.y ?? Math.max(0, Math.round((host.screen.height - height) / 2));
115
+ const popup = host.open(
116
+ options.surfaceUrl(surface),
117
+ label,
118
+ `popup=yes,width=${width},height=${height},left=${left},top=${top},resizable=yes`
119
+ );
120
+ if (popup === null) return false;
121
+ windows.set(label, popup);
122
+ const poll = host.setInterval(() => {
123
+ if (!popup.closed) return;
124
+ forget(surface);
125
+ notifyClosed(surface);
126
+ }, options.closePollIntervalMs ?? 250);
127
+ closePolls.set(label, poll);
128
+ return true;
129
+ },
130
+ async closeSurfaceWindow(surface) {
131
+ const popup = windows.get(surfaceWindowLabel(surface));
132
+ if (popup !== void 0 && !popup.closed) popup.close();
133
+ forget(surface);
134
+ },
135
+ async isSurfaceWindowOpen(surface) {
136
+ const popup = windows.get(surfaceWindowLabel(surface));
137
+ return popup !== void 0 && !popup.closed;
138
+ },
139
+ onSurfaceWindowClosed(listener) {
140
+ closeListeners.add(listener);
141
+ return () => {
142
+ closeListeners.delete(listener);
143
+ };
144
+ }
145
+ };
146
+ }
147
+ function createExternalWindowManager(options) {
148
+ const closeListeners = /* @__PURE__ */ new Set();
149
+ const notifyClosed = (surface) => {
150
+ for (const listener of closeListeners) {
151
+ try {
152
+ listener(surface);
153
+ } catch {
154
+ }
155
+ }
156
+ };
157
+ return {
158
+ canDetach: options.canDetach,
159
+ async openSurfaceWindow(surface, detachOptions) {
160
+ const host = await options.loadHost();
161
+ if (!host) return false;
162
+ const label = surfaceWindowLabel(surface);
163
+ const existing = await host.getByLabel(label);
164
+ if (existing) {
165
+ try {
166
+ await existing.show();
167
+ await existing.focus();
168
+ return true;
169
+ } catch {
170
+ }
171
+ }
172
+ return new Promise((resolve) => {
173
+ let settled = false;
174
+ const finish = (result) => {
175
+ if (settled) return;
176
+ settled = true;
177
+ clearTimeout(timeout);
178
+ resolve(result);
179
+ };
180
+ const timeout = setTimeout(() => finish(true), options.createdTimeoutMs ?? 2e3);
181
+ void host.create(label, surface, detachOptions, {
182
+ created: () => finish(true),
183
+ error: () => finish(false),
184
+ destroyed: () => notifyClosed(surface)
185
+ }).catch(() => finish(false));
186
+ });
187
+ },
188
+ async closeSurfaceWindow(surface) {
189
+ const host = await options.loadHost();
190
+ if (!host) return;
191
+ const existing = await host.getByLabel(surfaceWindowLabel(surface));
192
+ if (!existing) return;
193
+ try {
194
+ await existing.close();
195
+ } catch {
196
+ }
197
+ },
198
+ async isSurfaceWindowOpen(surface) {
199
+ const host = await options.loadHost();
200
+ if (!host) return false;
201
+ return await host.getByLabel(surfaceWindowLabel(surface)) !== null;
202
+ },
203
+ onSurfaceWindowClosed(listener) {
204
+ closeListeners.add(listener);
205
+ return () => {
206
+ closeListeners.delete(listener);
207
+ };
208
+ }
209
+ };
210
+ }
211
+ function surfaceKey(surface) {
212
+ const id = surface.id.includes(":") || surface.id.startsWith("~") ? `~${encodeURIComponent(surface.id)}` : surface.id;
213
+ const pane = surface.pane ? `:${surface.pane}` : "";
214
+ const instance = surface.instance ? `:instance=${encodeURIComponent(surface.instance)}` : "";
215
+ return `${surface.kind}:${id}${pane}${instance}`;
216
+ }
217
+ var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
218
+ function utf8ToBase64Url(value) {
219
+ const bytes = new TextEncoder().encode(value);
220
+ let encoded = "";
221
+ for (let index = 0; index < bytes.length; index += 3) {
222
+ const first = bytes[index];
223
+ const second = bytes[index + 1];
224
+ const third = bytes[index + 2];
225
+ encoded += BASE64URL_ALPHABET[first >> 2];
226
+ encoded += BASE64URL_ALPHABET[(first & 3) << 4 | (second ?? 0) >> 4];
227
+ if (second !== void 0) {
228
+ encoded += BASE64URL_ALPHABET[(second & 15) << 2 | (third ?? 0) >> 6];
229
+ }
230
+ if (third !== void 0) encoded += BASE64URL_ALPHABET[third & 63];
231
+ }
232
+ return encoded;
233
+ }
234
+ function surfaceWindowLabel(surface) {
235
+ return `fx-surface-${utf8ToBase64Url(surfaceKey(surface))}`;
236
+ }
237
+ function encodeSurfaceQuery(surface) {
238
+ const params = new URLSearchParams();
239
+ params.set("surface", surface.kind);
240
+ params.set("id", surface.id);
241
+ if (surface.pane) params.set("pane", surface.pane);
242
+ if (surface.instance) params.set("instance", surface.instance);
243
+ return params.toString();
244
+ }
245
+ function decodeSurfaceFromLocation(search = typeof window !== "undefined" ? window.location.search : "") {
246
+ const params = new URLSearchParams(search);
247
+ const kind = params.get("surface");
248
+ const id = params.get("id");
249
+ if (!id || kind !== "plugin" && kind !== "panel") return null;
250
+ const pane = params.get("pane");
251
+ const instance = params.get("instance");
252
+ return {
253
+ kind,
254
+ id,
255
+ pane: pane === "left" || pane === "center" ? pane : void 0,
256
+ instance: instance || void 0
257
+ };
258
+ }
259
+
260
+ export {
261
+ canOpenPanelWindow,
262
+ shouldShowDetachedPlaceholder,
263
+ createPanelWindowingController,
264
+ createBrowserWindowManager,
265
+ createExternalWindowManager,
266
+ surfaceKey,
267
+ surfaceWindowLabel,
268
+ encodeSurfaceQuery,
269
+ decodeSurfaceFromLocation
270
+ };
package/dist/react.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement, HTMLAttributes, ReactNode } from 'react';
3
+ import { DetachedWindowCapability } from './window.js';
3
4
 
4
5
  /** Stable FNV-1a color bucket for a shell slot name. */
5
6
  declare function hashSlotHue(name: string): number;
@@ -39,6 +40,25 @@ interface PanelSurfaceProps extends Omit<HTMLAttributes<HTMLElement>, 'children'
39
40
  /** Product-neutral panel section and content presentation. */
40
41
  declare function PanelSurface({ id, registered, singleTab, header, content, children, className, ...props }: PanelSurfaceProps): ReactElement;
41
42
 
43
+ interface DetachedPanelBoundaryProps {
44
+ readonly capability?: DetachedWindowCapability;
45
+ readonly floatingSurfaces: Readonly<Record<string, true>>;
46
+ readonly placeholder: ReactNode;
47
+ readonly children: ReactNode;
48
+ }
49
+ /** Product-neutral presentation switch for a keep-anchor detached surface. */
50
+ declare function DetachedPanelBoundary({ capability, floatingSurfaces, placeholder, children, }: DetachedPanelBoundaryProps): ReactNode;
51
+
52
+ interface DetachedSurfaceFrameProps {
53
+ children: ReactNode;
54
+ /** Apply the established product-shell hooks used by detached dock panels. */
55
+ panel?: boolean;
56
+ /** Center caller-owned status content inside the full-window frame. */
57
+ centered?: boolean;
58
+ }
59
+ /** Product-neutral presentation frame for content mounted in a detached window. */
60
+ declare function DetachedSurfaceFrame({ children, panel, centered, }: DetachedSurfaceFrameProps): ReactElement;
61
+
42
62
  type ShellSlotElement = 'aside' | 'div' | 'main' | 'section';
43
63
  interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
44
64
  as?: ShellSlotElement;
@@ -47,4 +67,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
47
67
  /** Structural shell marker that preserves the caller's semantic element. */
48
68
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
49
69
 
50
- export { type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, hashSlotHue, isSlotDebugEnabled, useLocalSize };
70
+ export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, hashSlotHue, isSlotDebugEnabled, useLocalSize };
package/dist/react.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ shouldShowDetachedPlaceholder
3
+ } from "./chunk-ZYCR2LSP.js";
4
+
1
5
  // src/react.tsx
2
6
  import { createElement } from "react";
3
7
 
@@ -293,6 +297,47 @@ function PanelSurface({
293
297
  );
294
298
  }
295
299
 
300
+ // src/detached-panel.tsx
301
+ function DetachedPanelBoundary({
302
+ capability,
303
+ floatingSurfaces,
304
+ placeholder,
305
+ children
306
+ }) {
307
+ if (!capability) return children;
308
+ try {
309
+ const target = capability.createTarget();
310
+ if (target.dockBehavior === "keep-anchor" && shouldShowDetachedPlaceholder(floatingSurfaces, target.surface)) {
311
+ return placeholder;
312
+ }
313
+ } catch {
314
+ }
315
+ return children;
316
+ }
317
+
318
+ // src/detached-surface-frame.tsx
319
+ import { jsx as jsx4 } from "react/jsx-runtime";
320
+ var fill = { position: "fixed", inset: 0 };
321
+ var centeredContent = {
322
+ display: "flex",
323
+ alignItems: "center",
324
+ justifyContent: "center"
325
+ };
326
+ function DetachedSurfaceFrame({
327
+ children,
328
+ panel = false,
329
+ centered = false
330
+ }) {
331
+ return /* @__PURE__ */ jsx4(
332
+ "div",
333
+ {
334
+ className: panel ? "fx-detached-surface fx-detached-panel main-area" : "fx-detached-surface",
335
+ style: fill,
336
+ children: centered ? /* @__PURE__ */ jsx4("div", { className: "fx-detached-surface-status", style: centeredContent, children }) : children
337
+ }
338
+ );
339
+ }
340
+
296
341
  // src/react.tsx
297
342
  function ShellSlot({
298
343
  as = "div",
@@ -302,6 +347,8 @@ function ShellSlot({
302
347
  return createElement(as, { ...props, "data-fx-slot": name });
303
348
  }
304
349
  export {
350
+ DetachedPanelBoundary,
351
+ DetachedSurfaceFrame,
305
352
  PanelSurface,
306
353
  ResizeHandle,
307
354
  ShellSlot,
package/dist/window.js CHANGED
@@ -1,261 +1,14 @@
1
- // src/window.ts
2
- function canOpenPanelWindow(capability, carrierAvailable) {
3
- return capability !== void 0 && carrierAvailable;
4
- }
5
- function shouldShowDetachedPlaceholder(floatingSurfaces, surface) {
6
- return floatingSurfaces[surfaceKey(surface)] === true;
7
- }
8
- function createPanelWindowingController() {
9
- const detachedPanels = /* @__PURE__ */ new Map();
10
- return {
11
- async openPanelWindow(panelId, capability, options) {
12
- if (!capability) return false;
13
- let target;
14
- try {
15
- target = capability.createTarget();
16
- } catch {
17
- return false;
18
- }
19
- const key = surfaceKey(target.surface);
20
- const closesPlacement = target.dockBehavior === "close";
21
- let reservation;
22
- if (closesPlacement) {
23
- if (!options.closeDockPanel || detachedPanels.has(key)) return false;
24
- reservation = { panelId, state: "pending" };
25
- detachedPanels.set(key, reservation);
26
- }
27
- let opened;
28
- try {
29
- opened = await options.detachSurface(target.surface, {
30
- title: target.title,
31
- width: target.width,
32
- height: target.height,
33
- ...options.position
34
- });
35
- } catch {
36
- if (reservation && detachedPanels.get(key) === reservation) detachedPanels.delete(key);
37
- return false;
38
- }
39
- if (!opened) {
40
- if (reservation && detachedPanels.get(key) === reservation) detachedPanels.delete(key);
41
- return false;
42
- }
43
- if (closesPlacement) {
44
- if (detachedPanels.get(key) !== reservation) return false;
45
- try {
46
- options.closeDockPanel();
47
- } catch {
48
- if (detachedPanels.get(key) === reservation) detachedPanels.delete(key);
49
- return false;
50
- }
51
- reservation.state = "leased";
52
- }
53
- return true;
54
- },
55
- panelForClosedSurface(surface) {
56
- const key = surfaceKey(surface);
57
- const lease = detachedPanels.get(key);
58
- if (lease?.state === "pending") {
59
- detachedPanels.delete(key);
60
- return void 0;
61
- }
62
- if (lease?.state === "leased") {
63
- queueMicrotask(() => {
64
- if (detachedPanels.get(key) === lease) detachedPanels.delete(key);
65
- });
66
- }
67
- return lease?.state === "leased" ? lease.panelId : void 0;
68
- }
69
- };
70
- }
71
- function currentBrowserHost() {
72
- if (typeof window === "undefined" || typeof window.open !== "function") return void 0;
73
- return {
74
- screen: window.screen,
75
- open: (url, target, features) => window.open(url, target, features),
76
- setInterval: (callback, delayMs) => window.setInterval(callback, delayMs),
77
- clearInterval: (handle) => window.clearInterval(handle)
78
- };
79
- }
80
- function createBrowserWindowManager(options) {
81
- const host = options.host ?? currentBrowserHost();
82
- const windows = /* @__PURE__ */ new Map();
83
- const closePolls = /* @__PURE__ */ new Map();
84
- const closeListeners = /* @__PURE__ */ new Set();
85
- const forget = (surface) => {
86
- const key = surfaceWindowLabel(surface);
87
- const poll = closePolls.get(key);
88
- if (poll !== void 0) host?.clearInterval(poll);
89
- closePolls.delete(key);
90
- windows.delete(key);
91
- };
92
- const notifyClosed = (surface) => {
93
- for (const listener of closeListeners) {
94
- try {
95
- listener(surface);
96
- } catch {
97
- }
98
- }
99
- };
100
- return {
101
- canDetach: () => host !== void 0,
102
- async openSurfaceWindow(surface, detachOptions) {
103
- if (!host) return false;
104
- const label = surfaceWindowLabel(surface);
105
- const existing = windows.get(label);
106
- if (existing !== void 0 && !existing.closed) {
107
- existing.focus();
108
- return true;
109
- }
110
- if (existing !== void 0) forget(surface);
111
- const width = detachOptions?.width ?? 960;
112
- const height = detachOptions?.height ?? 720;
113
- const left = detachOptions?.x ?? Math.max(0, Math.round((host.screen.width - width) / 2));
114
- const top = detachOptions?.y ?? Math.max(0, Math.round((host.screen.height - height) / 2));
115
- const popup = host.open(
116
- options.surfaceUrl(surface),
117
- label,
118
- `popup=yes,width=${width},height=${height},left=${left},top=${top},resizable=yes`
119
- );
120
- if (popup === null) return false;
121
- windows.set(label, popup);
122
- const poll = host.setInterval(() => {
123
- if (!popup.closed) return;
124
- forget(surface);
125
- notifyClosed(surface);
126
- }, options.closePollIntervalMs ?? 250);
127
- closePolls.set(label, poll);
128
- return true;
129
- },
130
- async closeSurfaceWindow(surface) {
131
- const popup = windows.get(surfaceWindowLabel(surface));
132
- if (popup !== void 0 && !popup.closed) popup.close();
133
- forget(surface);
134
- },
135
- async isSurfaceWindowOpen(surface) {
136
- const popup = windows.get(surfaceWindowLabel(surface));
137
- return popup !== void 0 && !popup.closed;
138
- },
139
- onSurfaceWindowClosed(listener) {
140
- closeListeners.add(listener);
141
- return () => {
142
- closeListeners.delete(listener);
143
- };
144
- }
145
- };
146
- }
147
- function createExternalWindowManager(options) {
148
- const closeListeners = /* @__PURE__ */ new Set();
149
- const notifyClosed = (surface) => {
150
- for (const listener of closeListeners) {
151
- try {
152
- listener(surface);
153
- } catch {
154
- }
155
- }
156
- };
157
- return {
158
- canDetach: options.canDetach,
159
- async openSurfaceWindow(surface, detachOptions) {
160
- const host = await options.loadHost();
161
- if (!host) return false;
162
- const label = surfaceWindowLabel(surface);
163
- const existing = await host.getByLabel(label);
164
- if (existing) {
165
- try {
166
- await existing.show();
167
- await existing.focus();
168
- return true;
169
- } catch {
170
- }
171
- }
172
- return new Promise((resolve) => {
173
- let settled = false;
174
- const finish = (result) => {
175
- if (settled) return;
176
- settled = true;
177
- clearTimeout(timeout);
178
- resolve(result);
179
- };
180
- const timeout = setTimeout(() => finish(true), options.createdTimeoutMs ?? 2e3);
181
- void host.create(label, surface, detachOptions, {
182
- created: () => finish(true),
183
- error: () => finish(false),
184
- destroyed: () => notifyClosed(surface)
185
- }).catch(() => finish(false));
186
- });
187
- },
188
- async closeSurfaceWindow(surface) {
189
- const host = await options.loadHost();
190
- if (!host) return;
191
- const existing = await host.getByLabel(surfaceWindowLabel(surface));
192
- if (!existing) return;
193
- try {
194
- await existing.close();
195
- } catch {
196
- }
197
- },
198
- async isSurfaceWindowOpen(surface) {
199
- const host = await options.loadHost();
200
- if (!host) return false;
201
- return await host.getByLabel(surfaceWindowLabel(surface)) !== null;
202
- },
203
- onSurfaceWindowClosed(listener) {
204
- closeListeners.add(listener);
205
- return () => {
206
- closeListeners.delete(listener);
207
- };
208
- }
209
- };
210
- }
211
- function surfaceKey(surface) {
212
- const id = surface.id.includes(":") || surface.id.startsWith("~") ? `~${encodeURIComponent(surface.id)}` : surface.id;
213
- const pane = surface.pane ? `:${surface.pane}` : "";
214
- const instance = surface.instance ? `:instance=${encodeURIComponent(surface.instance)}` : "";
215
- return `${surface.kind}:${id}${pane}${instance}`;
216
- }
217
- var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
218
- function utf8ToBase64Url(value) {
219
- const bytes = new TextEncoder().encode(value);
220
- let encoded = "";
221
- for (let index = 0; index < bytes.length; index += 3) {
222
- const first = bytes[index];
223
- const second = bytes[index + 1];
224
- const third = bytes[index + 2];
225
- encoded += BASE64URL_ALPHABET[first >> 2];
226
- encoded += BASE64URL_ALPHABET[(first & 3) << 4 | (second ?? 0) >> 4];
227
- if (second !== void 0) {
228
- encoded += BASE64URL_ALPHABET[(second & 15) << 2 | (third ?? 0) >> 6];
229
- }
230
- if (third !== void 0) encoded += BASE64URL_ALPHABET[third & 63];
231
- }
232
- return encoded;
233
- }
234
- function surfaceWindowLabel(surface) {
235
- return `fx-surface-${utf8ToBase64Url(surfaceKey(surface))}`;
236
- }
237
- function encodeSurfaceQuery(surface) {
238
- const params = new URLSearchParams();
239
- params.set("surface", surface.kind);
240
- params.set("id", surface.id);
241
- if (surface.pane) params.set("pane", surface.pane);
242
- if (surface.instance) params.set("instance", surface.instance);
243
- return params.toString();
244
- }
245
- function decodeSurfaceFromLocation(search = typeof window !== "undefined" ? window.location.search : "") {
246
- const params = new URLSearchParams(search);
247
- const kind = params.get("surface");
248
- const id = params.get("id");
249
- if (!id || kind !== "plugin" && kind !== "panel") return null;
250
- const pane = params.get("pane");
251
- const instance = params.get("instance");
252
- return {
253
- kind,
254
- id,
255
- pane: pane === "left" || pane === "center" ? pane : void 0,
256
- instance: instance || void 0
257
- };
258
- }
1
+ import {
2
+ canOpenPanelWindow,
3
+ createBrowserWindowManager,
4
+ createExternalWindowManager,
5
+ createPanelWindowingController,
6
+ decodeSurfaceFromLocation,
7
+ encodeSurfaceQuery,
8
+ shouldShowDetachedPlaceholder,
9
+ surfaceKey,
10
+ surfaceWindowLabel
11
+ } from "./chunk-ZYCR2LSP.js";
259
12
  export {
260
13
  canOpenPanelWindow,
261
14
  createBrowserWindowManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",