@dimina-kit/electron-deck 0.1.0-dev.20260618090552 → 0.1.0-dev.20260624040247
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/README.md +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/dock-react/dock-view.d.ts.map +1 -1
- package/dist/dock-react/index.js +5 -4
- package/dist/dock-react/index.js.map +1 -1
- package/dist/{electron-deck-CW6gkGS-.js → electron-deck-C9_Yu3fd.js} +53 -59
- package/dist/electron-deck-C9_Yu3fd.js.map +1 -0
- package/dist/electron-deck.d.ts +2 -2
- package/dist/host/capability.d.ts +1 -1
- package/dist/host/control-bus.d.ts +3 -3
- package/dist/host/index.d.ts +1 -1
- package/dist/host/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/deck-app.d.ts +54 -60
- package/dist/internal/deck-app.d.ts.map +1 -1
- package/dist/internal/electron-types.d.ts +3 -3
- package/dist/internal/trust-set.d.ts +3 -3
- package/dist/internal/wire-transport.d.ts +5 -5
- package/dist/internal/wire-transport.d.ts.map +1 -1
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/layout/types.d.ts +8 -2
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/layout/user-actions.d.ts +9 -0
- package/dist/layout/user-actions.d.ts.map +1 -0
- package/dist/{layout-WI8y1hxP.js → layout-oJQ9hind.js} +20 -2
- package/dist/layout-oJQ9hind.js.map +1 -0
- package/dist/view-handle-CR-yWNfr.js.map +1 -1
- package/package.json +4 -2
- package/dist/electron-deck-CW6gkGS-.js.map +0 -1
- package/dist/layout-WI8y1hxP.js.map +0 -1
package/dist/host/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as WireTransport, c as InMemoryTypedIpcRegistry, i as createControlBus, l as EventBus, o as createCapabilityRegistry, r as validateConfig, s as createTrustSet } from "../electron-deck-
|
|
1
|
+
import { a as WireTransport, c as InMemoryTypedIpcRegistry, i as createControlBus, l as EventBus, o as createCapabilityRegistry, r as validateConfig, s as createTrustSet } from "../electron-deck-C9_Yu3fd.js";
|
|
2
2
|
export { EventBus, InMemoryTypedIpcRegistry, WireTransport, createCapabilityRegistry, createControlBus, createTrustSet, validateConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as UndeclaredHostEventError, n as DeckRemoteError, r as EventNotBoundError, t as DeckClientNotReadyError } from "./errors-NE2ig7L5.js";
|
|
2
|
-
import { n as startElectronDeck, t as electronDeck, u as defineEvent } from "./electron-deck-
|
|
2
|
+
import { n as startElectronDeck, t as electronDeck, u as defineEvent } from "./electron-deck-C9_Yu3fd.js";
|
|
3
3
|
export { DeckClientNotReadyError, DeckRemoteError, EventNotBoundError, UndeclaredHostEventError, defineEvent, electronDeck, startElectronDeck };
|
|
@@ -5,28 +5,28 @@ import { type Scope } from '../main/scope.js';
|
|
|
5
5
|
import { type CapabilityPolicy } from '../host/capability.js';
|
|
6
6
|
import { type MinimalIpcMain, type MinimalWebContents } from './wire-transport.js';
|
|
7
7
|
/**
|
|
8
|
-
* Optional dependencies for {@link DeckApp} ——
|
|
8
|
+
* Optional dependencies for {@link DeckApp} —— 用于注入真 (或
|
|
9
9
|
* mock) Electron `ipcMain` + trusted webContents 集合,让 framework 接通跨进程
|
|
10
|
-
* wire transport。不注入则保持
|
|
10
|
+
* wire transport。不注入则保持 main-internal-only 行为。
|
|
11
11
|
*
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
export interface DeckAppOptions {
|
|
15
15
|
readonly wireTransport?: {
|
|
16
16
|
readonly ipcMain: MinimalIpcMain;
|
|
17
|
-
/** 默认返回 framework 内部维护的 trusted set
|
|
17
|
+
/** 默认返回 framework 内部维护的 trusted set(由 windows.trust 填)。 */
|
|
18
18
|
readonly trustedWebContents?: () => readonly MinimalWebContents[];
|
|
19
19
|
/** 自定义 senderPolicy(默认按 trusted set 判断)。 */
|
|
20
20
|
readonly senderPolicy?: SenderPolicy;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 注入真 (或 fake) Electron `BrowserWindow` / `WebContentsView`
|
|
24
24
|
* 构造器;提供后 framework 会装配 mainWindow / toolbarView / declared
|
|
25
|
-
* windows,否则保持
|
|
25
|
+
* windows,否则保持 electron-unavailable 行为。
|
|
26
26
|
*/
|
|
27
27
|
readonly electron?: MinimalElectron;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 领域 backend。提供后 framework 在 whenReady 前跑 `beforeReady`,
|
|
30
30
|
* 在 setup 阶段跑 `assemble(runtime)`。不提供则退化为纯框架(桩 context,
|
|
31
31
|
* 仅测试/演示用)。
|
|
32
32
|
*/
|
|
@@ -34,8 +34,8 @@ export interface DeckAppOptions {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Framework-internal "app" object —— `electronDeck(config)` 顶层入口的 plain-class
|
|
37
|
-
*
|
|
38
|
-
* 后可接真 ipcMain
|
|
37
|
+
* 形态,便于测试驱动 lifecycle 转换。加 wireTransport 注入
|
|
38
|
+
* 后可接真 ipcMain;加 electron 注入后可装配 mainWindow / toolbarView
|
|
39
39
|
* / declared windows。两者都不注入时退化为同进程内存 fake。
|
|
40
40
|
*
|
|
41
41
|
* @internal
|
|
@@ -48,21 +48,21 @@ export declare class DeckApp {
|
|
|
48
48
|
private readonly ipc;
|
|
49
49
|
private readonly fwListeners;
|
|
50
50
|
private readonly trustSet;
|
|
51
|
-
/**
|
|
51
|
+
/** Privileged-command grant registry. The policy gates
|
|
52
52
|
* ControlBus.dispatch; grants are minted via `runtime.grants.issue`. */
|
|
53
53
|
private readonly capability;
|
|
54
|
-
/**
|
|
54
|
+
/** The grant-gated command bus for PRIVILEGED `layout.*`
|
|
55
55
|
* commands. Constructed in `bindWireTransport` with the capability policy
|
|
56
56
|
* injected, so `dispatch` default-DENIES any command lacking a live grant.
|
|
57
57
|
* Privileged commands are registered via `runtime.layout.command`; ordinary
|
|
58
58
|
* domain APIs stay on the un-gated `InMemoryTypedIpcRegistry`. */
|
|
59
59
|
private controlBus;
|
|
60
|
-
/**
|
|
60
|
+
/** Per-webContents backend `onWindowTrusted` Disposable, so a window's
|
|
61
61
|
* trust mirror is undone when THAT window closes (not only at teardown). */
|
|
62
62
|
private readonly backendTrustDisposables;
|
|
63
63
|
private readonly options;
|
|
64
64
|
private wireTransport;
|
|
65
|
-
/**
|
|
65
|
+
/** The live wire senderPolicy, reused by buildRuntime so
|
|
66
66
|
* `context._senderPolicy` reflects real trust instead of a `() => true` stub. */
|
|
67
67
|
private wireSenderPolicy;
|
|
68
68
|
private mainWindow;
|
|
@@ -70,23 +70,19 @@ export declare class DeckApp {
|
|
|
70
70
|
private readonly declaredWindows;
|
|
71
71
|
private readonly trackedWindows;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* window's webContents, carrying a per-window child Scope. P0 is PURELY
|
|
76
|
-
* OBSERVATIONAL: these windowScopes own NO resources (no destroy/trust/wire is
|
|
77
|
-
* moved onto them), so `rootScope.close()` during shutdown is a no-op for app
|
|
78
|
-
* behaviour — it exists only to lay the foundation P1 will take over. The
|
|
73
|
+
* The root lifetime scope of the app + a shadow map mirroring `trackedWindows`,
|
|
74
|
+
* keyed by each window's webContents, carrying a per-window child Scope. The
|
|
79
75
|
* shadow's key set is kept in lock-step with `trackedWindows` at every
|
|
80
76
|
* maintenance point.
|
|
81
77
|
*/
|
|
82
78
|
private readonly rootScope;
|
|
83
79
|
private readonly lifetimeShadow;
|
|
84
80
|
/**
|
|
85
|
-
*
|
|
81
|
+
* Per-trusted-webContents trust record. `wcScope` is a
|
|
86
82
|
* child of the owning window's `windowScope`; it OWNS the wc's trust ref-count
|
|
87
83
|
* lease(s). When the window closes, `windowScope.close()` cascades into this
|
|
88
84
|
* `wcScope` (children-first LIFO), disposing every lease → ref-count hits 0 →
|
|
89
|
-
* the wc leaves the trust set.
|
|
85
|
+
* the wc leaves the trust set.
|
|
90
86
|
* A wc can be trusted more than once (framework auto-trust + host
|
|
91
87
|
* `windows.trust`), so `leases` is a Set.
|
|
92
88
|
*/
|
|
@@ -94,13 +90,13 @@ export declare class DeckApp {
|
|
|
94
90
|
private readonly pendingWindowCreated;
|
|
95
91
|
private readonly pendingLoadFailed;
|
|
96
92
|
/**
|
|
97
|
-
*
|
|
93
|
+
* Per-window native-view substrate, keyed by the window's
|
|
98
94
|
* webContents (same key discipline as `lifetimeShadow`). Created at both
|
|
99
95
|
* window-construction sites; dropped in `handleSubWindowClosed`.
|
|
100
96
|
*/
|
|
101
97
|
private readonly windowSubstrates;
|
|
102
98
|
/**
|
|
103
|
-
*
|
|
99
|
+
* Per-adopted-window registration handle, keyed by the adopted window's
|
|
104
100
|
* webContents. `runtime.windows.adopt` is idempotent by wc identity: a second
|
|
105
101
|
* adopt of the same window returns this stored Disposable (no double-admit, no
|
|
106
102
|
* second substrate). The entry is removed when the registration is disposed
|
|
@@ -108,7 +104,7 @@ export declare class DeckApp {
|
|
|
108
104
|
*/
|
|
109
105
|
private readonly adoptedWindows;
|
|
110
106
|
/**
|
|
111
|
-
*
|
|
107
|
+
* Per-registered-window {@link DeckWindow} facade + its per-window
|
|
112
108
|
* close deciders, keyed by the window's control wc. Populated by
|
|
113
109
|
* {@link registerWindow} for framework-created and adopted windows, plus the
|
|
114
110
|
* framework-built main window. `deciders` is an ORDERED list run in
|
|
@@ -116,13 +112,13 @@ export declare class DeckApp {
|
|
|
116
112
|
* decision latch (mirrors the main-window `closingDecisionPromise`).
|
|
117
113
|
*/
|
|
118
114
|
private readonly windowRegistrations;
|
|
119
|
-
/**
|
|
115
|
+
/** The framework-built main window's control wc, so `runtime.windows.main`
|
|
120
116
|
* can resolve its {@link DeckWindow}. Null under an `ownsWindows:true` backend. */
|
|
121
117
|
private mainControlWc;
|
|
122
|
-
/**
|
|
118
|
+
/** Monotonic id source for `runtime.view` native views. */
|
|
123
119
|
private viewSeq;
|
|
124
120
|
/**
|
|
125
|
-
*
|
|
121
|
+
* Provenance map for `runtime.scopes.create()` sessions: maps an opaque
|
|
126
122
|
* {@link DeckSession} to its internal `rootScope.child()` Scope. A WeakMap so a
|
|
127
123
|
* dropped session is GC'd; the framework holds the scope's lifetime via
|
|
128
124
|
* rootScope anyway (the session scope is a rootScope child). `runtime.view`
|
|
@@ -139,7 +135,7 @@ export declare class DeckApp {
|
|
|
139
135
|
* without `keepAlive` never participate.
|
|
140
136
|
*/
|
|
141
137
|
private readonly keepAliveGroups;
|
|
142
|
-
/**
|
|
138
|
+
/** Wcs that already have the `did-start-navigation` grant-reset hook bound,
|
|
143
139
|
* so {@link bindNavigationGrantReset} is idempotent — a wc admitted to trust
|
|
144
140
|
* more than once (e.g. constructed `autoTrust:false` then `windows.trust()`ed,
|
|
145
141
|
* or un-adopted then re-adopted) never accumulates duplicate nav listeners. */
|
|
@@ -159,9 +155,9 @@ export declare class DeckApp {
|
|
|
159
155
|
/** Set when shutdown is driven by the `will-quit` handler — the app is already
|
|
160
156
|
* quitting, so `doShutdown()` must NOT re-`app.quit()` (re-entrant quit). */
|
|
161
157
|
private quitInitiated;
|
|
162
|
-
/**
|
|
158
|
+
/** Close machine: non-null while a close decision is awaiting (in-flight latch). */
|
|
163
159
|
private closingDecisionPromise;
|
|
164
|
-
/**
|
|
160
|
+
/** Close machine: set once a 'close' decision is committed (guards the
|
|
165
161
|
* window between decision-resolve and the 'closed' event). Never resets. */
|
|
166
162
|
private shuttingDown;
|
|
167
163
|
/** Idempotency latch for {@link runShutdownCleanup}: the cleanup body
|
|
@@ -192,7 +188,7 @@ export declare class DeckApp {
|
|
|
192
188
|
private bindAppLifecycle;
|
|
193
189
|
shutdown(): Promise<void>;
|
|
194
190
|
/**
|
|
195
|
-
* @internal
|
|
191
|
+
* @internal windows.trust() / framework 内部添加 trusted webContents.
|
|
196
192
|
* Backend-owned / untracked-window fallback: there is no framework windowScope
|
|
197
193
|
* for these (the backend manages their lifetime), so the trust lease is owned
|
|
198
194
|
* by `rootScope` as an app-shutdown backstop. The backend still disposes the
|
|
@@ -200,18 +196,18 @@ export declare class DeckApp {
|
|
|
200
196
|
*/
|
|
201
197
|
_trustWebContents(wc: MinimalWebContents): Disposable;
|
|
202
198
|
/**
|
|
203
|
-
*
|
|
199
|
+
* Admit `wc` to the trust set under `windowScope`. Gets
|
|
204
200
|
* or creates the wc's `wcScope` (a child of `windowScope`), takes a fresh
|
|
205
201
|
* `trustSet.admit(wc, wcScope)` ref-count lease OWNED BY that wcScope, and returns a
|
|
206
202
|
* one-shot host-facing Disposable that releases just THIS lease early. On
|
|
207
203
|
* `wcScope.close()` (window-close cascade) every still-held lease is disposed
|
|
208
|
-
* → ref-count zeroes → the wc leaves the set (
|
|
209
|
-
*
|
|
210
|
-
*
|
|
204
|
+
* → ref-count zeroes → the wc leaves the set (driven by Scope teardown,
|
|
205
|
+
* covering partially-built windows too). Idempotent registry cleanup is owned
|
|
206
|
+
* by the wcScope.
|
|
211
207
|
*/
|
|
212
208
|
private admitTrust;
|
|
213
209
|
/**
|
|
214
|
-
*
|
|
210
|
+
* Bind the main-frame cross-document navigation grant-reset
|
|
215
211
|
* hook on a control `wc`. On a MAIN-FRAME CROSS-DOCUMENT navigation
|
|
216
212
|
* (`isMainFrame && !isInPlace`) this SYNCHRONOUSLY revokes the wc's capability
|
|
217
213
|
* grants (`capability.revokeBySenderId`) and slot tokens, so the navigated-to
|
|
@@ -227,7 +223,7 @@ export declare class DeckApp {
|
|
|
227
223
|
*/
|
|
228
224
|
private bindNavigationGrantReset;
|
|
229
225
|
/**
|
|
230
|
-
*
|
|
226
|
+
* Build the {@link DeckWindow} facade over a registered window and record
|
|
231
227
|
* it (so `runtime.windows.create()` / `runtime.windows.main` can return it and
|
|
232
228
|
* the per-window close machine can find its deciders). `newSession()` mints a
|
|
233
229
|
* window-rooted {@link DeckSession} (a `windowScope.child()` registered in the
|
|
@@ -238,7 +234,7 @@ export declare class DeckApp {
|
|
|
238
234
|
/**
|
|
239
235
|
* Resolve a window argument that may be either a raw `BrowserWindow` (the
|
|
240
236
|
* historical `runtime.view().placeIn(window)` shape) OR a {@link DeckWindow}
|
|
241
|
-
* handle (the
|
|
237
|
+
* handle (the `runtime.windows.create()` return). A DeckWindow exposes the
|
|
242
238
|
* underlying window via `.window` and has no `.webContents` of its own; a raw
|
|
243
239
|
* window has `.webContents`. Unwrap so the substrate lookup keys off the real
|
|
244
240
|
* control webContents either way — keeping the `placeIn(deckWindow)` and
|
|
@@ -246,7 +242,7 @@ export declare class DeckApp {
|
|
|
246
242
|
*/
|
|
247
243
|
private resolveWindowArg;
|
|
248
244
|
/**
|
|
249
|
-
*
|
|
245
|
+
* Run a registered window's per-window close deciders (registration order;
|
|
250
246
|
* any `'keep'` vetoes), with an in-flight latch so a re-entrant close during a
|
|
251
247
|
* pending decision decides ONCE. A throw / rejection fails CLOSED. Returns the
|
|
252
248
|
* committed decision, or `null` when the decision is still in flight / there are
|
|
@@ -254,7 +250,7 @@ export declare class DeckApp {
|
|
|
254
250
|
*/
|
|
255
251
|
private runWindowCloseDeciders;
|
|
256
252
|
/**
|
|
257
|
-
*
|
|
253
|
+
* Arm the per-window cancelable close-decision machine on a CREATED /
|
|
258
254
|
* adopted window. On a `close` attempt: `preventDefault`, dispatch the
|
|
259
255
|
* per-window deciders behind an in-flight latch (re-entrant closes swallowed),
|
|
260
256
|
* and on a `'close'` decision `win.destroy()` (→ `'closed'` → revoke +
|
|
@@ -265,44 +261,43 @@ export declare class DeckApp {
|
|
|
265
261
|
*/
|
|
266
262
|
private armSubWindowCloseMachine;
|
|
267
263
|
/**
|
|
268
|
-
* @internal
|
|
269
|
-
*
|
|
264
|
+
* @internal Lifetime accessors. The live shadow map mirroring `trackedWindows`,
|
|
265
|
+
* the root Scope, and a consistency assertion.
|
|
270
266
|
*/
|
|
271
267
|
__lifetimeShadow(): Map<MinimalWebContents, {
|
|
272
268
|
window: MinimalBrowserWindow;
|
|
273
269
|
windowScope: Scope;
|
|
274
270
|
}>;
|
|
275
|
-
/** @internal
|
|
271
|
+
/** @internal The root lifetime Scope. */
|
|
276
272
|
__rootScope(): Scope;
|
|
277
|
-
/** @internal
|
|
273
|
+
/** @internal The per-trusted-wc trust records. */
|
|
278
274
|
__wcRecords(): Map<MinimalWebContents, {
|
|
279
275
|
wcScope: Scope;
|
|
280
276
|
leases: Set<Disposable>;
|
|
281
277
|
windowScope: Scope;
|
|
282
278
|
}>;
|
|
283
|
-
/** @internal
|
|
279
|
+
/** @internal The live capability policy (grant gate reads it). */
|
|
284
280
|
__capabilityPolicy(): CapabilityPolicy;
|
|
285
281
|
/**
|
|
286
|
-
* @internal
|
|
282
|
+
* @internal Lifetime invariant: the shadow's per-window set
|
|
287
283
|
* (the `window` of each entry) must equal `trackedWindows` membership. Throws
|
|
288
284
|
* if violated; no-op otherwise.
|
|
289
285
|
*/
|
|
290
286
|
__assertLifetimeConsistent(): void;
|
|
291
287
|
private bindDeclarativeFields;
|
|
292
288
|
/**
|
|
293
|
-
*
|
|
289
|
+
* Build a per-window {@link ViewSubstrate}. The
|
|
294
290
|
* `ContentViewHost` adapts `win.contentView` and tracks the Compositor-managed
|
|
295
291
|
* z-order in `order` (the minimal `contentView` has no `children()`). The
|
|
296
292
|
* substrate's `detachAll` is owned on `windowScope` AFTER the window's
|
|
297
|
-
* `win.destroy` own, so LIFO teardown runs detachAll
|
|
298
|
-
* (STEP4) — the A4 ordering.
|
|
293
|
+
* `win.destroy` own, so LIFO teardown runs detachAll BEFORE destroy.
|
|
299
294
|
*/
|
|
300
295
|
private createWindowSubstrate;
|
|
301
296
|
private assembleElectron;
|
|
302
|
-
/**
|
|
297
|
+
/** 在 wireTransport.start 之后再 loadURL/loadFile,避免 preload 先于 ipcMain handler 注册触发 invoke。 */
|
|
303
298
|
private loadAssembledSources;
|
|
304
299
|
/**
|
|
305
|
-
*
|
|
300
|
+
* Load is best-effort: log + emit `load-failed` if it rejects,
|
|
306
301
|
* but never let start() reject because of a renderer load issue (we'd
|
|
307
302
|
* leave the host blocked indefinitely while the framework is otherwise
|
|
308
303
|
* happy).
|
|
@@ -323,7 +318,7 @@ export declare class DeckApp {
|
|
|
323
318
|
*/
|
|
324
319
|
private isPrivilegedCommandName;
|
|
325
320
|
/**
|
|
326
|
-
*
|
|
321
|
+
* Warn ONCE about an invalid `keepAlive.max` (negative / non-integer /
|
|
327
322
|
* NaN). Such a view is not keep-alive-managed (the group is skipped); warning
|
|
328
323
|
* once avoids log spam when many views share the same bad config.
|
|
329
324
|
*/
|
|
@@ -331,7 +326,7 @@ export declare class DeckApp {
|
|
|
331
326
|
private warnInvalidKeepAliveMax;
|
|
332
327
|
private constructWindow;
|
|
333
328
|
/**
|
|
334
|
-
*
|
|
329
|
+
* Register an EXTERNALLY-created window into the framework so
|
|
335
330
|
* `runtime.view().placeIn(win)` works for it: a `rootScope.child()`
|
|
336
331
|
* windowScope, a per-window {@link ViewSubstrate}, and the TRUST lifecycle —
|
|
337
332
|
* mirroring {@link constructWindow}'s registration, but for a window the host
|
|
@@ -345,7 +340,7 @@ export declare class DeckApp {
|
|
|
345
340
|
* windowScope so app shutdown destroys the window; for `'observe'` the host
|
|
346
341
|
* keeps lifetime control (the framework never destroys it),
|
|
347
342
|
* 4) arm trust+grant+slot-token revocation as the FIRST `'closed'` listener via
|
|
348
|
-
* `prependListener` (
|
|
343
|
+
* `prependListener` (runs before any external `'closed'` listener),
|
|
349
344
|
* 5) `admitTrust` AFTER the revoke listener is registered (constructWindow order).
|
|
350
345
|
*
|
|
351
346
|
* Idempotent by webContents identity: a second adopt of the same window returns
|
|
@@ -353,12 +348,11 @@ export declare class DeckApp {
|
|
|
353
348
|
*/
|
|
354
349
|
private adoptWindow;
|
|
355
350
|
/**
|
|
356
|
-
*
|
|
351
|
+
* Synchronously revoke BOTH trust leases AND capability
|
|
357
352
|
* grants for every wc admitted under `windowScope` (the window's control wc +
|
|
358
353
|
* any siblings like the toolbar wc). Called from the window's 'closed' handler
|
|
359
|
-
* so both authorizations are gone the instant the window is destroyed
|
|
360
|
-
*
|
|
361
|
-
* async-cascade race (a destroyed wc can never be observed trusted OR granted
|
|
354
|
+
* so both authorizations are gone the instant the window is destroyed,
|
|
355
|
+
* closing every async-cascade race (a destroyed wc can never be observed trusted OR granted
|
|
362
356
|
* by a later shutdown/beforeClose, nor by a NEW window that reuses the same
|
|
363
357
|
* wc.id before the async scope cascade revokes it). The leases are ALSO owned
|
|
364
358
|
* by their wcScope, so the async `windowScope.close()` still runs (it disposes
|
|
@@ -371,8 +365,8 @@ export declare class DeckApp {
|
|
|
371
365
|
*/
|
|
372
366
|
private revokeWindowTrust;
|
|
373
367
|
/**
|
|
374
|
-
* Arm the wire's slot-token inbound channels (idempotent).
|
|
375
|
-
*
|
|
368
|
+
* Arm the wire's slot-token inbound channels (idempotent). Called once at
|
|
369
|
+
* framework start() (bindWireTransport, right after
|
|
376
370
|
* transport.start()) so a layout client can subscribe before the first
|
|
377
371
|
* anchored placeIn; the anchored `placeIn` call site is now a redundant no-op
|
|
378
372
|
* (kept for safety). No-op when there's no wire transport (main-internal-only
|
|
@@ -396,7 +390,7 @@ export declare class DeckApp {
|
|
|
396
390
|
private revokeSlotTokensForWc;
|
|
397
391
|
private handleSubWindowClosed;
|
|
398
392
|
/**
|
|
399
|
-
*
|
|
393
|
+
* Notify the backend that the framework has edge-trusted one of its
|
|
400
394
|
* (framework-built) webContents, so the backend can mirror it into the domain
|
|
401
395
|
* trust set. The returned Disposable is disposed when THAT window closes
|
|
402
396
|
* ({@link handleSubWindowClosed}) — honouring the contract "framework disposes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deck-app.d.ts","sourceRoot":"","sources":["../../src/internal/deck-app.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,UAAU,EAIV,cAAc,EACd,OAAO,EACP,YAAY,EAIZ,UAAU,EASV,MAAM,aAAa,CAAA;AAIpB,OAAO,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ACH,OAAO,CAAC,eAAe;IAQvB;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAM7B,oFAAoF;IACpF,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,qBAAqB;IAuC7B;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,kBAAkB;YAiBZ,cAAc;YAOd,UAAU;IA8BxB,OAAO,CAAC,kBAAkB;YAYZ,iBAAiB;IA+E/B,OAAO,CAAC,YAAY;CAspBpB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Minimal structural typing for the Electron surface the electron-deck
|
|
3
3
|
* framework needs to assemble its real windows / views. Tests inject a plain
|
|
4
4
|
* object satisfying these shapes via {@link DeckAppOptions.electron};
|
|
5
5
|
* the framework does **not** import 'electron' directly.
|
|
@@ -57,8 +57,8 @@ export interface MinimalContentView {
|
|
|
57
57
|
addChildView(view: MinimalWebContentsView): void;
|
|
58
58
|
removeChildView(view: MinimalWebContentsView): void;
|
|
59
59
|
/** The window's live child views (real Electron `View.children`). Used by the
|
|
60
|
-
* moveTo rollback to guard against removing a child the dest never added
|
|
61
|
-
*
|
|
60
|
+
* moveTo rollback to guard against removing a child the dest never added.
|
|
61
|
+
* Optional so existing fakes stay valid; an absent
|
|
62
62
|
* array is treated as "membership unknown" by the guard's `?? []`. */
|
|
63
63
|
readonly children?: readonly MinimalWebContentsView[];
|
|
64
64
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TrustSet — SEALED refcount membership of trusted webContents
|
|
2
|
+
* TrustSet — SEALED refcount membership of trusted webContents.
|
|
3
3
|
*
|
|
4
|
-
* Refcount membership
|
|
5
|
-
*
|
|
4
|
+
* Refcount membership (Map<wc, refcount>) factored into a standalone primitive
|
|
5
|
+
* so it can back both `DeckApp` and the
|
|
6
6
|
* domain-neutral `ControlBus` facade.
|
|
7
7
|
*
|
|
8
8
|
* SEALED WRITE MODEL: there is exactly ONE writer — `admit(wc, owner)`. It forces
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WireTransport — main 端的真 Electron wire
|
|
2
|
+
* WireTransport — main 端的真 Electron wire 桥接。
|
|
3
3
|
*
|
|
4
4
|
* 责任:
|
|
5
5
|
* - 在 `ipcMain.handle('__electron-deck:invoke')` / `'__electron-deck:probe'` 上路由
|
|
@@ -26,7 +26,7 @@ export declare const DECK_CODE: {
|
|
|
26
26
|
readonly UntrustedFrame: "DECK_UNTRUSTED_FRAME";
|
|
27
27
|
readonly UnknownKind: "DECK_UNKNOWN_KIND";
|
|
28
28
|
readonly BadRequest: "DECK_BAD_REQUEST";
|
|
29
|
-
/**
|
|
29
|
+
/** The grant gate denied a privileged command for this sender. */
|
|
30
30
|
readonly Forbidden: "DECK_FORBIDDEN";
|
|
31
31
|
};
|
|
32
32
|
/** Minimal RenderFrameHost identity used for main-frame discrimination. */
|
|
@@ -38,8 +38,8 @@ export interface FrameRef {
|
|
|
38
38
|
* Per-invoke context threaded from {@link WireTransport.handleInvoke} into the
|
|
39
39
|
* host/simulator invoke seams. Constructed ONLY after the wire's trust gate +
|
|
40
40
|
* main-frame gate have both passed, so `senderId` is a real trusted webContents
|
|
41
|
-
* id (never undefined).
|
|
42
|
-
* this;
|
|
41
|
+
* id (never undefined). The grant gate (in `ControlBus.dispatch`) reads
|
|
42
|
+
* this; it is a REQUIRED param so a missing call
|
|
43
43
|
* site is a COMPILE error, not a silent security downgrade.
|
|
44
44
|
*/
|
|
45
45
|
export interface InvokeCtx {
|
|
@@ -70,7 +70,7 @@ export interface WireTransportDeps {
|
|
|
70
70
|
/** 取当前 trusted webContents 快照;用于 event push 广播。lazy:每次 publish 重调。 */
|
|
71
71
|
readonly trustedWebContents: () => readonly MinimalWebContents[];
|
|
72
72
|
/** 路由 host kind 调用;handler 抛错由 WireTransport 接住 → InvokeFailure。
|
|
73
|
-
* `ctx` 必填:携带已过 trust + main-frame gate 的 senderId
|
|
73
|
+
* `ctx` 必填:携带已过 trust + main-frame gate 的 senderId(授权门读它)。 */
|
|
74
74
|
readonly invokeHost: (name: string, args: readonly JsonValue[], ctx: InvokeCtx) => Promise<JsonValue>;
|
|
75
75
|
/** 路由 simulator kind 调用;同上(`ctx` 必填)。 */
|
|
76
76
|
readonly invokeSimulator: (name: string, args: readonly JsonValue[], ctx: InvokeCtx) => Promise<JsonValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-transport.d.ts","sourceRoot":"","sources":["../../src/internal/wire-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH,OAAO,KAAK,EAAc,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;IAKrB
|
|
1
|
+
{"version":3,"file":"wire-transport.d.ts","sourceRoot":"","sources":["../../src/internal/wire-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH,OAAO,KAAK,EAAc,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;IAKrB,kEAAkE;;CAEzD,CAAA;AAEV,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACzB,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,kGAAkG;IAClG,QAAQ,CAAC,WAAW,EAAE,QAAQ,GAAG,IAAI,CAAA;CACrC;AAED,MAAM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parseLayout, validateTree } from './serialize.js';
|
|
|
11
11
|
export { sanitizeFlexibleWeights } from './sanitize.js';
|
|
12
12
|
export { setSizes, setConstraint, setActive, movePanel, splitPanel, closePanel, extractPanel, insertPanel, } from './mutations.js';
|
|
13
13
|
export { createLayoutModel } from './model.js';
|
|
14
|
+
export { closePanelForUser } from './user-actions.js';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACX,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,GACX,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EACN,QAAQ,EACR,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACX,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACX,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,GACX,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EACN,QAAQ,EACR,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACX,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/layout/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { closePanel, createLayoutModel, createPanelRegistry, extractPanel, insertPanel, movePanel, parseLayout, sanitizeFlexibleWeights, serializeLayout, setActive, setConstraint, setSizes, splitPanel, validateTree };
|
|
1
|
+
import { a as insertPanel, c as setConstraint, d as sanitizeFlexibleWeights, f as parseLayout, h as createPanelRegistry, i as extractPanel, l as setSizes, m as validateTree, n as createLayoutModel, o as movePanel, p as serializeLayout, r as closePanel, s as setActive, t as closePanelForUser, u as splitPanel } from "../layout-oJQ9hind.js";
|
|
2
|
+
export { closePanel, closePanelForUser, createLayoutModel, createPanelRegistry, extractPanel, insertPanel, movePanel, parseLayout, sanitizeFlexibleWeights, serializeLayout, setActive, setConstraint, setSizes, splitPanel, validateTree };
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -57,9 +57,10 @@ export interface LayoutTree {
|
|
|
57
57
|
/**
|
|
58
58
|
* Per-panel drag/drop capability policy. All fields are OPTIONAL and
|
|
59
59
|
* DEFAULT-PERMISSIVE, so existing registrations keep today's behavior (a fully
|
|
60
|
-
* draggable panel that may move/split freely). The
|
|
60
|
+
* draggable, closable panel that may move/split freely). The fields are orthogonal:
|
|
61
61
|
* `draggable` governs whether the panel is a drag SOURCE / drop ANCHOR at all;
|
|
62
|
-
* `dropPolicy` governs where a draggable panel may LAND
|
|
62
|
+
* `dropPolicy` governs where a draggable panel may LAND; `closable` governs
|
|
63
|
+
* whether DockView exposes the panel's close affordance.
|
|
63
64
|
*/
|
|
64
65
|
export interface PanelCapabilities {
|
|
65
66
|
/**
|
|
@@ -77,6 +78,11 @@ export interface PanelCapabilities {
|
|
|
77
78
|
* `undefined` is treated as `'free'`.
|
|
78
79
|
*/
|
|
79
80
|
readonly dropPolicy?: 'free' | 'reorder-only';
|
|
81
|
+
/**
|
|
82
|
+
* When `false`, DockView does not render a close affordance for this panel.
|
|
83
|
+
* `undefined` is treated as `true`.
|
|
84
|
+
*/
|
|
85
|
+
readonly closable?: boolean;
|
|
80
86
|
/**
|
|
81
87
|
* When `true`, this panel contributes NO tab to the group's tab strip. A
|
|
82
88
|
* group whose every panel hides its tab renders no tab strip at all (its body
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAA;IACxC,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS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A;AAExE,MAAM,WAAW,UAAU;IAC1B,OAAO,IAAI,IAAI,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,CAAC,EAAE,eAAe,GAAG,UAAU,CAAA;IACxC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAA;IAC5C,IAAI,IAAI,SAAS,eAAe,EAAE,CAAA;CAClC;AAID,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC3B,GAAG,IAAI,UAAU,CAAA;IACjB,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,UAAU,GAAG,IAAI,CAAA;IAC/C,SAAS,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CACzD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LayoutTree, PanelRegistry } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Close a panel only when its descriptor permits user closure.
|
|
4
|
+
*
|
|
5
|
+
* Missing descriptors and an omitted `closable` capability retain the historic
|
|
6
|
+
* close behavior. Only an explicit `closable:false` blocks the operation.
|
|
7
|
+
*/
|
|
8
|
+
export declare function closePanelForUser(tree: LayoutTree, panelId: string, registry: PanelRegistry): LayoutTree;
|
|
9
|
+
//# sourceMappingURL=user-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-actions.d.ts","sourceRoot":"","sources":["../../src/layout/user-actions.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE3D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,GACrB,UAAU,CAEZ"}
|
|
@@ -566,6 +566,24 @@ function createLayoutModel(initial) {
|
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
568
|
//#endregion
|
|
569
|
-
|
|
569
|
+
//#region src/layout/user-actions.ts
|
|
570
|
+
/**
|
|
571
|
+
* Capability-aware layout operations for user-triggered interactions.
|
|
572
|
+
*
|
|
573
|
+
* Keep these separate from the pure mutations: callers may still use
|
|
574
|
+
* `closePanel` for restore/migration/programmatic layout transforms, while UI
|
|
575
|
+
* entry points consistently honor registry capabilities.
|
|
576
|
+
*/
|
|
577
|
+
/**
|
|
578
|
+
* Close a panel only when its descriptor permits user closure.
|
|
579
|
+
*
|
|
580
|
+
* Missing descriptors and an omitted `closable` capability retain the historic
|
|
581
|
+
* close behavior. Only an explicit `closable:false` blocks the operation.
|
|
582
|
+
*/
|
|
583
|
+
function closePanelForUser(tree, panelId, registry) {
|
|
584
|
+
return registry.get(panelId)?.closable === false ? tree : closePanel(tree, panelId);
|
|
585
|
+
}
|
|
586
|
+
//#endregion
|
|
587
|
+
export { insertPanel as a, setConstraint as c, sanitizeFlexibleWeights as d, parseLayout as f, createPanelRegistry as h, extractPanel as i, setSizes as l, validateTree as m, createLayoutModel as n, movePanel as o, serializeLayout as p, closePanel as r, setActive as s, closePanelForUser as t, splitPanel as u };
|
|
570
588
|
|
|
571
|
-
//# sourceMappingURL=layout-
|
|
589
|
+
//# sourceMappingURL=layout-oJQ9hind.js.map
|