@dimina-kit/electron-deck 0.1.0-dev.20260701083540 → 0.1.0-dev.20260702145840
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/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +92 -12
- package/dist/client/index.js.map +1 -1
- package/dist/client/layout-client.d.ts +35 -14
- package/dist/client/layout-client.d.ts.map +1 -1
- package/dist/client/placement-publisher.d.ts +14 -0
- package/dist/client/placement-publisher.d.ts.map +1 -0
- package/dist/dock-react/index.js +1 -1
- package/dist/{electron-deck-C9_Yu3fd.js → electron-deck-B9fun93z.js} +105 -78
- package/dist/electron-deck-B9fun93z.js.map +1 -0
- package/dist/host/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/deck-app.d.ts +43 -11
- package/dist/internal/deck-app.d.ts.map +1 -1
- package/dist/internal/wire-transport.d.ts +17 -14
- package/dist/internal/wire-transport.d.ts.map +1 -1
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/layout/placement-reconcile.d.ts +50 -0
- package/dist/layout/placement-reconcile.d.ts.map +1 -0
- package/dist/layout/snapshot-reconcile.d.ts +28 -0
- package/dist/layout/snapshot-reconcile.d.ts.map +1 -0
- package/dist/{layout-B1t15b_q.js → layout-ByOiOdnc.js} +267 -2
- package/dist/layout-ByOiOdnc.js.map +1 -0
- package/dist/main/index.js +1 -1
- package/dist/main/view-handle.d.ts.map +1 -1
- package/dist/preload/index.cjs +4 -4
- package/dist/preload/index.cjs.map +1 -1
- package/dist/preload/index.d.ts +1 -1
- package/dist/preload/index.js +4 -4
- package/dist/preload/index.js.map +1 -1
- package/dist/{protocol-BJqo-vP2.js → protocol-B6TOT9AP.js} +2 -2
- package/dist/protocol-B6TOT9AP.js.map +1 -0
- package/dist/shared/protocol.d.ts +1 -1
- package/dist/{view-handle-CR-yWNfr.js → view-handle-DDhpBuW-.js} +2 -2
- package/dist/{view-handle-CR-yWNfr.js.map → view-handle-DDhpBuW-.js.map} +1 -1
- package/package.json +2 -2
- package/dist/electron-deck-C9_Yu3fd.js.map +0 -1
- package/dist/layout-B1t15b_q.js.map +0 -1
- package/dist/protocol-BJqo-vP2.js.map +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { Disposable, HostEvent, JsonValue } from '../types.js';
|
|
|
5
5
|
export { DeckClientNotReadyError, DeckRemoteError };
|
|
6
6
|
export { createDeckLayoutClient } from './layout-client.js';
|
|
7
7
|
export type { SlotGrant, LayoutBridge, LayoutClientDeps, } from './layout-client.js';
|
|
8
|
+
export { createPlacementPublisher } from './placement-publisher.js';
|
|
9
|
+
export type { PlacementPublisher, PlacementPublisherDeps, } from './placement-publisher.js';
|
|
8
10
|
export interface CreateDeckClientOptions {
|
|
9
11
|
/** 默认 `__electronDeckBridge`;必须与 host preload 对齐 */
|
|
10
12
|
readonly globalName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,uBAAuB,EACvB,eAAe,EACf,MAAM,cAAc,CAAA;AACrB,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEnE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,CAAA;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,YAAY,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,GAChB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,WAAW,uBAAuB;IACvC,oDAAoD;IACpD,QAAQ,CAA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C,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,IAAI,GACnE,UAAU,CAAA;CACb;AAED,wBAAgB,gBAAgB,CAE/B,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,EACxD,EAAE,SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,EAAE,EACzC,OAAO,CAAC,EAAE,uBAAuB,GAAG,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CA+DvD;AAED,wBAAgB,oBAAoB,CACnC,UAAU,GAAE,MAA8B,GACxC,UAAU,GAAG,SAAS,CAKxB;AASD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,CAAA"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as DeckRemoteError, t as DeckClientNotReadyError } from "../errors-NE2ig7L5.js";
|
|
2
|
-
import { n as DEFAULT_BRIDGE_GLOBAL, t as BRIDGE_PROTOCOL_VERSION } from "../protocol-
|
|
2
|
+
import { n as DEFAULT_BRIDGE_GLOBAL, t as BRIDGE_PROTOCOL_VERSION } from "../protocol-B6TOT9AP.js";
|
|
3
3
|
//#region ../view-anchor/src/view-anchor.ts
|
|
4
4
|
var clampRect = (r) => ({
|
|
5
5
|
x: Math.round(r.x),
|
|
@@ -62,6 +62,7 @@ function createPlacementAnchor(target, opts) {
|
|
|
62
62
|
let rafId = null;
|
|
63
63
|
let steadyFrames = 0;
|
|
64
64
|
const STEADY_CLOSE_FRAMES = 2;
|
|
65
|
+
const MAX_HIDDEN_FOLLOW_FRAMES = 30;
|
|
65
66
|
let pointerHeld = false;
|
|
66
67
|
let sentinelDeadline = null;
|
|
67
68
|
const computePlacement = () => {
|
|
@@ -76,6 +77,10 @@ function createPlacementAnchor(target, opts) {
|
|
|
76
77
|
lastPublished = p;
|
|
77
78
|
publish(p);
|
|
78
79
|
};
|
|
80
|
+
const shouldCloseOnHiddenPoll = () => {
|
|
81
|
+
if (lastPublished?.visible === false) return true;
|
|
82
|
+
return steadyFrames++ >= MAX_HIDDEN_FOLLOW_FRAMES;
|
|
83
|
+
};
|
|
79
84
|
const sentinelFrame = () => {
|
|
80
85
|
rafId = null;
|
|
81
86
|
if (disposed || !visible) {
|
|
@@ -87,6 +92,14 @@ function createPlacementAnchor(target, opts) {
|
|
|
87
92
|
return;
|
|
88
93
|
}
|
|
89
94
|
const p = computePlacement();
|
|
95
|
+
if (!p.visible) {
|
|
96
|
+
if (shouldCloseOnHiddenPoll()) {
|
|
97
|
+
sentinelDeadline = null;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
rafId = requestAnimationFrame(sentinelFrame);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
90
103
|
if (lastPublished && samePlacement(lastPublished, p)) {
|
|
91
104
|
steadyFrames++;
|
|
92
105
|
if (steadyFrames >= STEADY_CLOSE_FRAMES && !pointerHeld) {
|
|
@@ -201,45 +214,111 @@ function createPlacementAnchor(target, opts) {
|
|
|
201
214
|
};
|
|
202
215
|
}
|
|
203
216
|
//#endregion
|
|
217
|
+
//#region src/client/placement-publisher.ts
|
|
218
|
+
function createPlacementPublisher(deps) {
|
|
219
|
+
const requestFrame = deps.requestFrame ?? ((cb) => requestAnimationFrame(cb));
|
|
220
|
+
const cancelFrame = deps.cancelFrame ?? ((id) => cancelAnimationFrame(id));
|
|
221
|
+
const readGeneration = typeof deps.generation === "function" ? deps.generation : () => deps.generation;
|
|
222
|
+
const views = /* @__PURE__ */ new Map();
|
|
223
|
+
let dirty = false;
|
|
224
|
+
let frameId = null;
|
|
225
|
+
let epoch = 0;
|
|
226
|
+
let disposed = false;
|
|
227
|
+
function schedule() {
|
|
228
|
+
if (disposed || frameId !== null) return;
|
|
229
|
+
frameId = requestFrame(flush);
|
|
230
|
+
}
|
|
231
|
+
function flush() {
|
|
232
|
+
frameId = null;
|
|
233
|
+
if (disposed || !dirty) return;
|
|
234
|
+
dirty = false;
|
|
235
|
+
deps.publish({
|
|
236
|
+
generation: readGeneration(),
|
|
237
|
+
epoch: epoch++,
|
|
238
|
+
views: [...views.values()]
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
set(view) {
|
|
243
|
+
if (disposed) return;
|
|
244
|
+
views.set(view.viewId, view);
|
|
245
|
+
dirty = true;
|
|
246
|
+
schedule();
|
|
247
|
+
},
|
|
248
|
+
remove(viewId) {
|
|
249
|
+
if (disposed) return;
|
|
250
|
+
if (!views.delete(viewId)) return;
|
|
251
|
+
dirty = true;
|
|
252
|
+
schedule();
|
|
253
|
+
},
|
|
254
|
+
dispose() {
|
|
255
|
+
if (disposed) return;
|
|
256
|
+
disposed = true;
|
|
257
|
+
if (frameId !== null) {
|
|
258
|
+
cancelFrame(frameId);
|
|
259
|
+
frameId = null;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
204
265
|
//#region src/client/layout-client.ts
|
|
205
266
|
/**
|
|
206
|
-
* Renderer half of the slot-token handshake
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
267
|
+
* Renderer half of the slot-token handshake. Subscribes to main's `slot-grant`
|
|
268
|
+
* pushes FIRST (so a grant replayed synchronously by `subscribe()` cannot be
|
|
269
|
+
* missed), then on each grant anchors the granted DOM slot with this session's
|
|
270
|
+
* hardening opts (followScroll / followGeometry / guardDisplayNone). Each anchor's
|
|
271
|
+
* measured `Placement` is written into a CENTRAL placement publisher keyed by
|
|
272
|
+
* `viewId` — NOT sent per-view. The publisher coalesces every anchor's writes into
|
|
273
|
+
* ONE window-level snapshot per animation frame, so a transient relayout that
|
|
274
|
+
* momentarily measures 0×0 is overwritten before it is ever published. This is the
|
|
275
|
+
* producer half of the level-triggered reconcile design (see
|
|
276
|
+
* ../layout/placement-reconcile.ts); a per-view edge stream cannot self-correct a
|
|
277
|
+
* lost or spurious frame, which is what caused a stuck detached (white-screen)
|
|
278
|
+
* view.
|
|
212
279
|
*/
|
|
213
280
|
function createDeckLayoutClient(deps) {
|
|
214
281
|
const resolveSlot = deps.resolveSlot ?? ((id) => document.querySelector(id));
|
|
215
282
|
const createAnchor = deps.createAnchor ?? createPlacementAnchor;
|
|
283
|
+
let maxGeneration = 0;
|
|
284
|
+
const publisher = createPlacementPublisher({
|
|
285
|
+
generation: () => maxGeneration,
|
|
286
|
+
publish: (snapshot) => deps.bridge.sendSnapshot(snapshot),
|
|
287
|
+
requestFrame: deps.requestFrame,
|
|
288
|
+
cancelFrame: deps.cancelFrame
|
|
289
|
+
});
|
|
216
290
|
const byViewId = /* @__PURE__ */ new Map();
|
|
217
291
|
let disposed = false;
|
|
218
292
|
const unsub = deps.bridge.onSlotGrant((grant) => {
|
|
219
293
|
if (disposed) return;
|
|
294
|
+
if (grant.generation > maxGeneration) maxGeneration = grant.generation;
|
|
220
295
|
const existing = byViewId.get(grant.viewId);
|
|
221
296
|
if (existing && existing.token === grant.slotToken) return;
|
|
222
297
|
if (existing) try {
|
|
223
298
|
existing.anchor.dispose();
|
|
224
299
|
} finally {
|
|
225
300
|
byViewId.delete(grant.viewId);
|
|
301
|
+
publisher.remove(grant.viewId);
|
|
226
302
|
}
|
|
227
303
|
const el = resolveSlot(grant.slotId);
|
|
228
304
|
if (!el) return;
|
|
305
|
+
const token = grant.slotToken;
|
|
229
306
|
const anchor = createAnchor(el, {
|
|
230
307
|
visible: true,
|
|
231
308
|
followScroll: true,
|
|
232
309
|
followGeometry: true,
|
|
233
310
|
guardDisplayNone: true,
|
|
234
311
|
publish: (placement) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
placement
|
|
312
|
+
publisher.set({
|
|
313
|
+
viewId: grant.viewId,
|
|
314
|
+
placement,
|
|
315
|
+
layer: 0,
|
|
316
|
+
extra: { slotToken: token }
|
|
238
317
|
});
|
|
239
318
|
}
|
|
240
319
|
});
|
|
241
320
|
byViewId.set(grant.viewId, {
|
|
242
|
-
token
|
|
321
|
+
token,
|
|
243
322
|
anchor
|
|
244
323
|
});
|
|
245
324
|
});
|
|
@@ -250,6 +329,7 @@ function createDeckLayoutClient(deps) {
|
|
|
250
329
|
unsub();
|
|
251
330
|
for (const { anchor } of byViewId.values()) anchor.dispose();
|
|
252
331
|
byViewId.clear();
|
|
332
|
+
publisher.dispose();
|
|
253
333
|
} };
|
|
254
334
|
}
|
|
255
335
|
//#endregion
|
|
@@ -305,6 +385,6 @@ function parseMajor(version) {
|
|
|
305
385
|
return Number.isNaN(n) ? NaN : n;
|
|
306
386
|
}
|
|
307
387
|
//#endregion
|
|
308
|
-
export { BRIDGE_PROTOCOL_VERSION, DEFAULT_BRIDGE_GLOBAL, DeckClientNotReadyError, DeckRemoteError, createDeckClient, createDeckLayoutClient, readBridgeFromGlobal };
|
|
388
|
+
export { BRIDGE_PROTOCOL_VERSION, DEFAULT_BRIDGE_GLOBAL, DeckClientNotReadyError, DeckRemoteError, createDeckClient, createDeckLayoutClient, createPlacementPublisher, readBridgeFromGlobal };
|
|
309
389
|
|
|
310
390
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../view-anchor/src/view-anchor.ts","../../src/client/layout-client.ts","../../src/client/index.ts"],"sourcesContent":["import type {\n Bounds,\n Placement,\n ViewAnchorOptions,\n ViewAnchorHandle,\n} from './types.js'\n\nconst ZERO: Bounds = { x: 0, y: 0, width: 0, height: 0 }\n\n// Round to integers (setBounds rejects fractionals). Width/height are clamped\n// to ≥0 (negative area is meaningless and `0` is the canonical \"hidden\"\n// signal). x/y are NOT clamped: a position is a position — an anchored overlay\n// scrolled past the top/left edge has a legitimately NEGATIVE origin, and\n// flooring it to 0 would pin the native view at the edge instead of letting it\n// track its element off-screen. (Each consumer's IPC schema enforces its own\n// origin policy — the simulator's allows negative; the DevTools placeholder\n// never goes negative, so its NonNegInt schema is unaffected.)\nconst clampRect = (r: {\n x: number\n y: number\n width: number\n height: number\n}): Bounds => ({\n x: Math.round(r.x),\n y: Math.round(r.y),\n width: Math.max(0, Math.round(r.width)),\n height: Math.max(0, Math.round(r.height)),\n})\n\n/**\n * Create an anchor binding ONE native view's bounds to `target`'s geometry.\n *\n * Imperative core — no React, no Electron. Behaviour:\n * - `present === true`: publish `target.getBoundingClientRect()` (x/y rounded,\n * width/height `Math.max(0, Math.round(...))`) immediately, then re-publish\n * SYNCHRONOUSLY on every `ResizeObserver` tick and window `resize`.\n * - `present === false`: publish `{0,0,0,0}` immediately; do not observe.\n * - `update(opts)`: re-apply synchronously.\n * - `dispose()`: stop observing, never publish again.\n *\n * Synchronous, NOT RAF-deferred: the native overlay is a cross-process\n * `WebContentsView` whose `setBounds` already lands ~1 compositor frame behind\n * the renderer's DOM paint (the two processes composite on different frames).\n * Deferring the measure+publish to a RAF stacked a SECOND frame on top — during\n * a height/splitter drag that read as the overlay visibly trailing the region\n * edge (worst when GROWING, where the not-yet-followed edge exposes background).\n * Publishing in the observer tick itself removes that self-inflicted frame and\n * leaves only the unavoidable cross-process frame (masked by matching the\n * placeholder/desk background colour). The anti-flood role the RAF used to play\n * — collapsing a burst of RO+resize ticks in one frame into one publish — is now\n * served by `lastPublished` dedup: a tick whose measured rect is byte-identical\n * to the last published one is dropped, so a continuous drag still emits at most\n * one publish per distinct rect.\n *\n * Teardown safety: there is no queued frame to outrun a state change — every\n * emit reads `disposed`/`present` synchronously, so a tick after\n * `update`/`dispose` can never write a stale rect over the live one.\n */\nexport function createViewAnchor(\n target: HTMLElement,\n opts: ViewAnchorOptions,\n): ViewAnchorHandle {\n let present = opts.present\n let publish = opts.publish\n let observer: ResizeObserver | null = null\n // The last rect handed to `publish`, for dedup-coalescing (see header). Reset\n // to `null` on every `apply()` so a state change (e.g. zoom, which rides in\n // the `publish` closure, not in `Bounds`) always forces one fresh publish\n // even when the geometry is unchanged.\n let lastPublished: Bounds | null = null\n let disposed = false\n\n const measure = (): Bounds => {\n const r = target.getBoundingClientRect()\n return clampRect({ x: r.left, y: r.top, width: r.width, height: r.height })\n }\n\n const sameRect = (a: Bounds, b: Bounds): boolean =>\n a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height\n\n // Measure + publish SYNCHRONOUSLY on the triggering tick — no RAF defer (see\n // header for why). Bail if torn down or detached, and dedup a rect\n // byte-identical to the last published one (collapses a same-frame RO+resize\n // burst, and a steady drag that re-fires the same final rect, into one).\n const emit = (): void => {\n if (disposed || !present) return\n const m = measure()\n if (lastPublished && sameRect(lastPublished, m)) return\n lastPublished = m\n publish(m)\n }\n\n const startObserving = (): void => {\n if (observer) return\n observer = new ResizeObserver(emit)\n observer.observe(target)\n window.addEventListener('resize', emit)\n }\n\n const stopObserving = (): void => {\n if (observer) {\n observer.disconnect()\n observer = null\n }\n window.removeEventListener('resize', emit)\n }\n\n // Apply the current (present, publish) synchronously. Reset `lastPublished`\n // first so the publish below is never dedup-skipped — a state change (zoom,\n // present flip, new publish target) must always re-emit even if the geometry\n // is byte-identical to the previous emit.\n const apply = (): void => {\n lastPublished = null\n if (present) {\n startObserving()\n lastPublished = measure()\n publish(lastPublished)\n } else {\n stopObserving()\n publish(ZERO)\n }\n }\n\n apply()\n\n return {\n update(next: ViewAnchorOptions): void {\n if (disposed) return\n publish = next.publish\n present = next.present\n apply()\n },\n dispose(): void {\n if (disposed) return\n disposed = true\n stopObserving()\n },\n }\n}\n\n// ── Explicit Placement API ────────────────────────────────────────────\n//\n// The modern surface that replaces the magic-`{0,0,0,0}` \"hidden\" value.\n// Visibility is an explicit discriminant, NEVER inferred from geometry — a\n// real 0×0-but-on-screen view is `{ visible:true, bounds:{...,width:0} }`\n// and a hidden one is `{ visible:false }` (no `bounds`). See `Placement`.\n\nexport interface PlacementAnchorOptions {\n /**\n * Caller's INTENT: should the native view be on-screen? `true` →\n * publish the measured rect as `{ visible:true, bounds }`; `false` →\n * publish `{ visible:false }`. Crucially, hiddenness comes from this\n * flag, not from a measured zero size — so a legitimately 0-sized but\n * visible target still publishes `visible:true`.\n */\n visible: boolean\n /** Receives each explicit Placement. Owns IPC → host. */\n publish: (placement: Placement) => void\n /**\n * Opt-in geometry detach. When true, a measured zero-area target (no\n * geometry box — display:none / unmounted / unstable first layout) publishes\n * `{ visible:false }` (detach-but-keep) instead of `{ visible:true,\n * bounds:0×0 }`, and an IntersectionObserver is attached so a display:none\n * transition (which ResizeObserver does not report) re-publishes. Default\n * false keeps the legitimate 0×0-visible semantics.\n */\n guardDisplayNone?: boolean\n /**\n * Opt-in capture-phase ancestor-scroll follow. When true, the anchor\n * listens for `scroll` on `window` in the CAPTURE phase (scroll events don't\n * bubble, but reach `window` while capturing), so an ancestor scroll\n * container scrolling the target re-measures and re-publishes. With\n * `followGeometry` off, the scroll callback does a single synchronous\n * `emit()`; with it on, the scroll OPENS the RAF sentinel window so the\n * follow tracks every frame of a scroll burst. Default false.\n */\n followScroll?: boolean\n /**\n * Opt-in windowed RAF geometry sentinel. Catches ancestor\n * transform / reflow moves that no DOM event reports. The sentinel is\n * NON-resident: it is OPENED on demand (a scroll burst, a `[role=\"separator\"]`\n * splitter pointerdown, or an explicit `pulse()`), polls geometry once per\n * animation frame publishing IN-FRAME, and AUTO-CLOSES once the rect goes\n * steady (a few unchanged frames). While closed it schedules no frame, so the\n * static cost when idle is exactly zero. Default false.\n */\n followGeometry?: boolean\n}\n\nexport interface PlacementAnchorHandle {\n /** Apply new options; re-publishes immediately (mirrors `createViewAnchor`). */\n update(opts: PlacementAnchorOptions): void\n /** Stop observing; never publish again. */\n dispose(): void\n /**\n * Open the RAF sentinel window (animation follow); auto-closes after going\n * steady or after `durationMs`. No-op when `followGeometry` is false.\n */\n pulse(durationMs?: number): void\n}\n\n/**\n * Pure measure: read `target`'s rect and wrap it as an explicit visible\n * Placement. Always `{ visible:true }` — hiddenness is a caller decision\n * (see `createPlacementAnchor`), so this never returns `{ visible:false }`\n * and never infers visibility from a 0 size. A collapsed (0×0) but present\n * element therefore yields `{ visible:true, bounds:{...,width:0,height:0} }`,\n * distinct from any hidden Placement.\n */\nexport function measurePlacement(target: HTMLElement): Placement {\n const r = target.getBoundingClientRect()\n return {\n visible: true,\n bounds: clampRect({ x: r.left, y: r.top, width: r.width, height: r.height }),\n }\n}\n\nconst samePlacement = (a: Placement, b: Placement): boolean => {\n // Discriminant-aware dedup: a visibility flip is always a change, even when\n // the geometry would otherwise look identical.\n if (a.visible !== b.visible) return false\n if (a.visible && b.visible) {\n return (\n a.bounds.x === b.bounds.x &&\n a.bounds.y === b.bounds.y &&\n a.bounds.width === b.bounds.width &&\n a.bounds.height === b.bounds.height\n )\n }\n return true\n}\n\n/**\n * The explicit-Placement mirror of `createViewAnchor`. Same observer/dedup/\n * teardown machinery, but the sink receives a `Placement`:\n * - `visible === true` → publish `measurePlacement(target)` and re-publish\n * SYNCHRONOUSLY on every `ResizeObserver`/`resize` tick.\n * - `visible === false` → publish `{ visible:false }` (NOT a ZERO bounds);\n * do not observe.\n *\n * Dedup carries the discriminant (`samePlacement`), so a visibility flip is\n * never coalesced away.\n *\n * Opt-in `guardDisplayNone` (default false): when on, a measured zero-area\n * target (display:none / unmounted / unstable first layout) publishes\n * `{ visible:false }` instead of `{ visible:true, bounds:0×0 }`, and an\n * IntersectionObserver is attached so a display:none transition (which\n * ResizeObserver does not report) re-publishes.\n */\nexport function createPlacementAnchor(\n target: HTMLElement,\n opts: PlacementAnchorOptions,\n): PlacementAnchorHandle {\n let visible = opts.visible\n let publish = opts.publish\n const guardDisplayNone = opts.guardDisplayNone ?? false\n // Captured at creation; the follow options are never re-set via update().\n const followScroll = opts.followScroll ?? false\n const followGeometry = opts.followGeometry ?? false\n let observer: ResizeObserver | null = null\n let io: IntersectionObserver | null = null\n let lastPublished: Placement | null = null\n let disposed = false\n\n // ── Windowed RAF geometry sentinel state ──────────────────\n // The sentinel is a windowed poll, opened on demand and auto-closing once\n // the geometry goes steady. It publishes IN-FRAME (no nested defer): each\n // frame measures, and either publishes a changed rect synchronously or\n // counts toward the steady-close threshold. While closed `rafId` is null\n // and no frame is scheduled — zero static cost when idle.\n let rafId: number | null = null\n let steadyFrames = 0\n const STEADY_CLOSE_FRAMES = 2\n // True while a [role=\"separator\"] splitter drag is in progress: set on the\n // capture-phase pointerdown that opened the window, cleared on pointerup.\n // A held pointer means the drag may still resume after a static pause, so a\n // steady run while held must NOT close the sentinel — it only closes once the\n // pointer is released. Without this gate a press that pauses a couple of\n // frames before the drag actually moves would close mid-press and drop the\n // entire subsequent drag.\n let pointerHeld = false\n // Absolute time (performance.now()) past which a `pulse(durationMs)` window\n // force-closes even if the geometry is still changing — the upper bound that\n // prevents a perpetually-animating target from keeping the sentinel resident.\n // null = no time bound (scroll/splitter opens rely on steady-close instead).\n let sentinelDeadline: number | null = null\n\n // Measure the target, applying the opt-in first-frame / display:none guard:\n // a zero-area box (no geometry to anchor) becomes a detach instead of a\n // 0×0-visible Placement. Default off → byte-for-byte the plain measure.\n const computePlacement = (): Placement => {\n const p = measurePlacement(target)\n if (\n guardDisplayNone &&\n p.visible &&\n (p.bounds.width === 0 || p.bounds.height === 0)\n ) {\n return { visible: false }\n }\n return p\n }\n\n const emit = (): void => {\n if (disposed || !visible) return\n const p = computePlacement()\n if (lastPublished && samePlacement(lastPublished, p)) return\n lastPublished = p\n publish(p)\n }\n\n // One sentinel frame: measure, publish-in-frame if changed, else count toward\n // the steady-close threshold. A changed frame re-arms; a steady frame re-arms\n // until STEADY_CLOSE_FRAMES consecutive unchanged frames, then closes (no\n // re-arm). Reads `disposed`/`visible` live so a frame outliving teardown is\n // inert.\n const sentinelFrame = (): void => {\n rafId = null\n if (disposed || !visible) {\n sentinelDeadline = null\n return\n }\n // Upper bound: a pulse window past its deadline closes regardless of\n // motion, so a target that changes every frame can't keep the sentinel alive.\n if (sentinelDeadline !== null && performance.now() >= sentinelDeadline) {\n sentinelDeadline = null\n return // duration elapsed → close (no re-arm)\n }\n const p = computePlacement()\n if (lastPublished && samePlacement(lastPublished, p)) {\n steadyFrames++\n // Steady-close only fires once the pointer is RELEASED: while a\n // splitter drag is held, a static pause is a hesitation, not the end of\n // the drag, so we keep polling (re-arm below) and let `steadyFrames`\n // accrue — it converges to a close within N frames after pointerup.\n if (steadyFrames >= STEADY_CLOSE_FRAMES && !pointerHeld) {\n sentinelDeadline = null\n return // steady (and released) → close\n }\n } else {\n lastPublished = p\n publish(p) // publish synchronously in THIS frame\n steadyFrames = 0\n }\n // `publish` may have synchronously disposed (or hidden) the anchor; re-read\n // live state so a re-entrant teardown leaves ZERO scheduled frames.\n if (!disposed && visible) {\n rafId = requestAnimationFrame(sentinelFrame) // keep polling\n } else {\n sentinelDeadline = null\n }\n }\n\n const openSentinel = (): void => {\n if (!followGeometry || disposed) return\n steadyFrames = 0\n if (rafId === null) rafId = requestAnimationFrame(sentinelFrame)\n }\n\n const closeSentinel = (): void => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId)\n rafId = null\n }\n steadyFrames = 0\n sentinelDeadline = null\n pointerHeld = false\n }\n\n // An ancestor scroll moved the target's screen rect. With the sentinel on,\n // open the window so the whole scroll burst is followed frame-by-frame;\n // without it, a single synchronous emit() follows the new rect.\n const onScroll = (): void => {\n if (followGeometry) openSentinel()\n else emit()\n }\n\n // A capture-phase pointerdown on a [role=\"separator\"] splitter handle marks\n // the start of a drag that moves the target via ancestor reflow (no RO tick)\n // → open the sentinel.\n const onPointerDown = (e: Event): void => {\n const t = e.target as Element | null\n if (t && t.closest && t.closest('[role=\"separator\"]')) {\n pointerHeld = true\n openSentinel()\n }\n }\n\n // Pointer released: the drag is over, so a steady run may now close the\n // sentinel. Re-open it (a no-op if already polling) so the steady-close\n // threshold is reached even if the geometry was already static at release.\n const onPointerUp = (): void => {\n if (!pointerHeld) return\n pointerHeld = false\n openSentinel()\n }\n\n const startObserving = (): void => {\n if (observer) return\n observer = new ResizeObserver(emit)\n observer.observe(target)\n window.addEventListener('resize', emit)\n // A display:none transition is invisible to ResizeObserver; an\n // IntersectionObserver re-fires `emit`, which re-measures via\n // `computePlacement` (now-zero box → detach, restored box → visible).\n if (guardDisplayNone && typeof IntersectionObserver !== 'undefined') {\n io = new IntersectionObserver(emit)\n io.observe(target)\n }\n if (followScroll) {\n window.addEventListener('scroll', onScroll, {\n capture: true,\n passive: true,\n })\n }\n if (followGeometry) {\n window.addEventListener('pointerdown', onPointerDown, { capture: true })\n window.addEventListener('pointerup', onPointerUp, { capture: true })\n }\n }\n\n const stopObserving = (): void => {\n if (observer) {\n observer.disconnect()\n observer = null\n }\n if (io) {\n io.disconnect()\n io = null\n }\n window.removeEventListener('resize', emit)\n window.removeEventListener('scroll', onScroll, {\n capture: true,\n } as EventListenerOptions)\n window.removeEventListener('pointerdown', onPointerDown, {\n capture: true,\n } as EventListenerOptions)\n window.removeEventListener('pointerup', onPointerUp, {\n capture: true,\n } as EventListenerOptions)\n closeSentinel()\n }\n\n const apply = (): void => {\n lastPublished = null\n if (visible) {\n startObserving()\n lastPublished = computePlacement()\n publish(lastPublished)\n } else {\n stopObserving()\n const hidden: Placement = { visible: false }\n lastPublished = hidden\n publish(hidden)\n }\n }\n\n apply()\n\n return {\n update(next: PlacementAnchorOptions): void {\n if (disposed) return\n publish = next.publish\n visible = next.visible\n apply()\n },\n dispose(): void {\n if (disposed) return\n disposed = true\n stopObserving()\n },\n pulse(durationMs?: number): void {\n // Imperative window open: start the animation-follow window. It\n // closes on steady (N=2 unchanged frames) OR, when `durationMs` is given,\n // at that deadline — whichever comes first. The deadline is the upper bound\n // that guarantees a still-animating target cannot keep the sentinel\n // resident; without it, only steady-close applies.\n if (disposed || !followGeometry) return\n if (durationMs !== undefined && durationMs > 0) {\n const next = performance.now() + durationMs\n // Extend (never shorten) an existing window's deadline.\n sentinelDeadline = sentinelDeadline === null ? next : Math.max(sentinelDeadline, next)\n }\n openSentinel()\n },\n }\n}\n","import { createPlacementAnchor } from '@dimina-kit/view-anchor'\nimport type { Placement } from '@dimina-kit/view-anchor'\n\n/** One main→renderer slot grant: a native view (`viewId`) wants to follow the\n * DOM slot `slotId`; `slotToken` is the capability the renderer threads back on\n * every `place` so main can match a placement to the granted slot. */\nexport interface SlotGrant {\n\tviewId: string\n\tslotId: string\n\tslotToken: string\n}\n\n/** The renderer-side transport for the slot-token handshake. `onSlotGrant`\n * registers the grant listener (returns an unsubscribe); `subscribe` asks main\n * to (re)play buffered grants AFTER the listener is attached; `sendPlace`\n * forwards a measured placement carrying its slot's token. */\nexport interface LayoutBridge {\n\tonSlotGrant(cb: (grant: SlotGrant) => void): () => void\n\tsendPlace(msg: { slotToken: string; placement: Placement }): void\n\tsubscribe(): void\n}\n\nexport interface LayoutClientDeps {\n\tbridge: LayoutBridge\n\t/** Resolve a grant's `slotId` to its DOM element. Default:\n\t * `document.querySelector(slotId)`. Returns `null` when the slot is not\n\t * mounted (graceful no-op). */\n\tresolveSlot?(slotId: string): HTMLElement | null\n\t/** Anchor factory. Default: view-anchor's `createPlacementAnchor`. Injected\n\t * in tests to capture `(target, opts)` without real RO/IO/RAF. */\n\tcreateAnchor?: (\n\t\ttarget: HTMLElement,\n\t\topts: {\n\t\t\tvisible: boolean\n\t\t\tpublish: (p: Placement) => void\n\t\t\tfollowScroll?: boolean\n\t\t\tfollowGeometry?: boolean\n\t\t\tguardDisplayNone?: boolean\n\t\t},\n\t) => { dispose(): void }\n}\n\n/**\n * Renderer half of the slot-token handshake (capability-and-lifecycle.md「原子下发握手协议」). Subscribes to main's\n * `slot-grant` pushes FIRST (so a grant replayed synchronously by `subscribe()`\n * cannot be missed), then on each grant anchors the granted DOM slot with this\n * session's hardening opts (followScroll / followGeometry / guardDisplayNone)\n * and threads each measured `Placement` back to main as a `place` carrying that\n * grant's `slotToken`.\n */\nexport function createDeckLayoutClient(deps: LayoutClientDeps): {\n\tdispose(): void\n} {\n\tconst resolveSlot =\n\t\tdeps.resolveSlot ??\n\t\t((id: string): HTMLElement | null => document.querySelector(id))\n\tconst createAnchor = deps.createAnchor ?? createPlacementAnchor\n\n // One live anchor per `viewId`. Main intentionally re-delivers a grant on\n // per-wc replay, so we dedup: a same-token replay is a no-op (keep the live\n // anchor); a new token for an existing `viewId` replaces it (dispose old,\n // create new). The map holds only CURRENTLY-LIVE anchors — a replaced anchor\n // is disposed at replacement time and removed, so `dispose()` never\n // double-disposes it.\n const byViewId = new Map<string, { token: string; anchor: { dispose(): void } }>()\n let disposed = false\n\n // Register the grant listener BEFORE requesting replay (handshake):\n // a grant the main side replays synchronously inside `subscribe()` must find\n // the listener already attached.\n const unsub = deps.bridge.onSlotGrant((grant) => {\n if (disposed) return\n const existing = byViewId.get(grant.viewId)\n // Same viewId+token re-delivered (per-wc replay) → pure no-op: keep the\n // live anchor, do not create a second, do not dispose the first.\n if (existing && existing.token === grant.slotToken) return\n // A new token for this viewId → REVOKE the stale anchor FIRST:\n // dispose + drop it BEFORE resolving the new slot, so a stale\n // anchor can never keep publishing a revoked token even when the new slot\n // isn't mounted yet. Deleting before `createAnchor` also means a throw in\n // `createAnchor` can't leave an already-disposed anchor in the map (which a\n // later `dispose()` would double-dispose).\n if (existing) {\n // try/finally: the `delete` MUST run even if the old\n // anchor's dispose throws — otherwise the disposed-but-still-mapped anchor\n // keeps publishing the revoked token AND a later client.dispose() would\n // dispose it a second time.\n try {\n existing.anchor.dispose()\n }\n finally {\n byViewId.delete(grant.viewId)\n }\n }\n const el = resolveSlot(grant.slotId)\n if (!el) return // new slot not mounted → graceful no-op; old anchor already revoked\n const anchor = createAnchor(el, {\n visible: true,\n followScroll: true,\n followGeometry: true,\n guardDisplayNone: true,\n // Capture THIS grant's slotToken in the closure so each anchor publishes\n // to its own token (no cross-talk between slots).\n publish: (placement) => {\n deps.bridge.sendPlace({ slotToken: grant.slotToken, placement })\n },\n })\n byViewId.set(grant.viewId, { token: grant.slotToken, anchor })\n })\n\n // Request replay AFTER the listener is attached.\n deps.bridge.subscribe()\n\n return {\n dispose(): void {\n if (disposed) return\n disposed = true\n unsub()\n for (const { anchor } of byViewId.values()) anchor.dispose()\n byViewId.clear()\n },\n }\n}\n","import {\n\tDeckClientNotReadyError,\n\tDeckRemoteError,\n} from '../errors.js'\nimport {\n\tBRIDGE_PROTOCOL_VERSION,\n\tDEFAULT_BRIDGE_GLOBAL,\n} from '../shared/protocol.js'\nimport type { EventEnvelope, DeckBridge } from '../shared/protocol.js'\nimport type { Disposable, HostEvent, JsonValue } from '../types.js'\n\nexport { DeckClientNotReadyError, DeckRemoteError }\n\nexport { createDeckLayoutClient } from './layout-client.js'\nexport type {\n\tSlotGrant,\n\tLayoutBridge,\n\tLayoutClientDeps,\n} from './layout-client.js'\n\nexport interface CreateDeckClientOptions {\n\t/** 默认 `__electronDeckBridge`;必须与 host preload 对齐 */\n\treadonly globalName?: string\n}\n\n// HS / EV 使用 `any` 而非 `JsonValue[]` 约束:\n// (1) host 侧 HostServiceHandler 同样是 `(...args: any[]) => unknown`,两侧对称;\n// (2) JsonValue 索引签名挡掉常见 host 写法(`(p: { code: string }) => ...`),\n// 强迫 rest-only 签名时 `Parameters<HS[K]>` 推不出真实参数类型;\n// (3) Electron IPC 实际走 structured clone(非 JSON),原约束的\"前提\"本就错;\n// (4) 真要 runtime 校验,在 transport 边界用 `runtime.ipc.handle({ validator })`\n// 与 protocol envelope(`InvokeRequest.args: readonly JsonValue[]`)已经够。\nexport interface DeckClient<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tHS extends Record<keyof HS, (...args: any[]) => unknown>,\n\tEV extends readonly HostEvent<JsonValue>[],\n> {\n\tready(): Promise<void>\n\tinvoke<K extends keyof HS & string>(\n\t\tname: K,\n\t\t...args: Parameters<HS[K]>\n\t): Promise<Awaited<ReturnType<HS[K]>>>\n\ton<E extends EV[number]>(\n\t\tevent: E,\n\t\tlistener: (payload: E extends HostEvent<infer P> ? P : never) => void,\n\t): Disposable\n}\n\nexport function createDeckClient<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tHS extends Record<keyof HS, (...args: any[]) => unknown>,\n\tEV extends readonly HostEvent<JsonValue>[],\n>(options?: CreateDeckClientOptions): DeckClient<HS, EV> {\n\tconst globalName = options?.globalName ?? DEFAULT_BRIDGE_GLOBAL\n\n\tfunction getBridge(): DeckBridge {\n\t\tconst bridge = readBridgeFromGlobal(globalName)\n\t\tif (bridge === undefined) {\n\t\t\tthrow new DeckClientNotReadyError(\n\t\t\t\t`Deck framework bridge is missing on window[\"${globalName}\"] — did the host preload call exposeDeckBridge()?`,\n\t\t\t)\n\t\t}\n\t\treturn bridge\n\t}\n\n\treturn {\n\t\tasync ready(): Promise<void> {\n\t\t\tconst bridge = getBridge()\n\t\t\tconst remoteMajor = parseMajor(bridge.version)\n\t\t\tconst localMajor = parseMajor(BRIDGE_PROTOCOL_VERSION)\n\t\t\tif (remoteMajor !== localMajor) {\n\t\t\t\tthrow new DeckClientNotReadyError(\n\t\t\t\t\t`Deck bridge protocol version mismatch: bridge=${String(bridge.version)}, client expected major ${localMajor}.x.x (${BRIDGE_PROTOCOL_VERSION})`,\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\n\t\tasync invoke<K extends keyof HS & string>(\n\t\t\tname: K,\n\t\t\t...args: Parameters<HS[K]>\n\t\t): Promise<Awaited<ReturnType<HS[K]>>> {\n\t\t\tconst bridge = getBridge()\n\t\t\tconst response = await bridge.invoke({\n\t\t\t\tkind: 'host',\n\t\t\t\tname,\n\t\t\t\targs: args as readonly JsonValue[],\n\t\t\t})\n\t\t\tif (response.ok) {\n\t\t\t\treturn response.result as Awaited<ReturnType<HS[K]>>\n\t\t\t}\n\t\t\tconst { remoteName, message, code } = response.error\n\t\t\tthrow new DeckRemoteError(remoteName, message, code)\n\t\t},\n\n\t\ton<E extends EV[number]>(\n\t\t\tevent: E,\n\t\t\tlistener: (payload: E extends HostEvent<infer P> ? P : never) => void,\n\t\t): Disposable {\n\t\t\tconst bridge = getBridge()\n\t\t\tconst wrapped = (env: EventEnvelope): void => {\n\t\t\t\tif (env.name === event.name) {\n\t\t\t\t\tlistener(env.payload as E extends HostEvent<infer P> ? P : never)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst unsubscribe = bridge.onEvent(wrapped)\n\t\t\tlet disposed = false\n\t\t\treturn {\n\t\t\t\tdispose: () => {\n\t\t\t\t\tif (disposed) return\n\t\t\t\t\tdisposed = true\n\t\t\t\t\tunsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t}\n}\n\nexport function readBridgeFromGlobal(\n\tglobalName: string = DEFAULT_BRIDGE_GLOBAL,\n): DeckBridge | undefined {\n\tconst g = globalThis as unknown as Record<string, unknown>\n\tconst bridge = g[globalName]\n\tif (bridge === undefined || bridge === null) return undefined\n\treturn bridge as DeckBridge\n}\n\nfunction parseMajor(version: unknown): number {\n\tif (typeof version !== 'string') return Number.NaN\n\tconst head = version.split('.')[0] ?? ''\n\tconst n = Number.parseInt(head, 10)\n\treturn Number.isNaN(n) ? Number.NaN : n\n}\n\nexport { BRIDGE_PROTOCOL_VERSION, DEFAULT_BRIDGE_GLOBAL }\n"],"mappings":";;;AAiBA,IAAM,aAAa,OAKJ;CACb,GAAG,KAAK,MAAM,EAAE,CAAC;CACjB,GAAG,KAAK,MAAM,EAAE,CAAC;CACjB,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,EAAE,KAAK,CAAC;CACtC,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,EAAE,MAAM,CAAC;AAC1C;;;;;;;;;AAsLA,SAAgB,iBAAiB,QAAgC;CAC/D,MAAM,IAAI,OAAO,sBAAsB;CACvC,OAAO;EACL,SAAS;EACT,QAAQ,UAAU;GAAE,GAAG,EAAE;GAAM,GAAG,EAAE;GAAK,OAAO,EAAE;GAAO,QAAQ,EAAE;EAAO,CAAC;CAC7E;AACF;AAEA,IAAM,iBAAiB,GAAc,MAA0B;CAG7D,IAAI,EAAE,YAAY,EAAE,SAAS,OAAO;CACpC,IAAI,EAAE,WAAW,EAAE,SACjB,OACE,EAAE,OAAO,M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AM,MACtB,SAAS,IAAI,OAAmD;GAElE;GACA,MAAM,cAAc,OAAO,QAAQ,OAAO;GAC1C,IAAI,WAAW;GACf,OAAO,EACN,eAAe;IACd,IAAI,UAAU;IACd,WAAW;IACX,YAAY;GACb,EACD;EACD;CACD;AACD;AAEA,SAAgB,qBACf,aAAqB,uBACI;CAEzB,MAAM,SAAS,WAAE;CACjB,IAAI,WAAW,KAAA,KAAa,WAAW,MAAM,OAAO,KAAA;CACpD,OAAO;AACR;AAEA,SAAS,WAAW,SAA0B;CAC7C,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,MAAM,OAAO,QAAQ,MAAM,GAAG,EAAE,MAAM;CACtC,MAAM,IAAI,OAAO,SAAS,MAAM,EAAE;CAClC,OAAO,OAAO,MAAM,CAAC,IAAI,MAAa;AACvC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../view-anchor/src/view-anchor.ts","../../src/client/placement-publisher.ts","../../src/client/layout-client.ts","../../src/client/index.ts"],"sourcesContent":["import type {\n Bounds,\n Placement,\n ViewAnchorOptions,\n ViewAnchorHandle,\n} from './types.js'\n\nconst ZERO: Bounds = { x: 0, y: 0, width: 0, height: 0 }\n\n// Round to integers (setBounds rejects fractionals). Width/height are clamped\n// to ≥0 (negative area is meaningless and `0` is the canonical \"hidden\"\n// signal). x/y are NOT clamped: a position is a position — an anchored overlay\n// scrolled past the top/left edge has a legitimately NEGATIVE origin, and\n// flooring it to 0 would pin the native view at the edge instead of letting it\n// track its element off-screen. (Each consumer's IPC schema enforces its own\n// origin policy — the simulator's allows negative; the DevTools placeholder\n// never goes negative, so its NonNegInt schema is unaffected.)\nconst clampRect = (r: {\n x: number\n y: number\n width: number\n height: number\n}): Bounds => ({\n x: Math.round(r.x),\n y: Math.round(r.y),\n width: Math.max(0, Math.round(r.width)),\n height: Math.max(0, Math.round(r.height)),\n})\n\n/**\n * Create an anchor binding ONE native view's bounds to `target`'s geometry.\n *\n * Imperative core — no React, no Electron. Behaviour:\n * - `present === true`: publish `target.getBoundingClientRect()` (x/y rounded,\n * width/height `Math.max(0, Math.round(...))`) immediately, then re-publish\n * SYNCHRONOUSLY on every `ResizeObserver` tick and window `resize`.\n * - `present === false`: publish `{0,0,0,0}` immediately; do not observe.\n * - `update(opts)`: re-apply synchronously.\n * - `dispose()`: stop observing, never publish again.\n *\n * Synchronous, NOT RAF-deferred: the native overlay is a cross-process\n * `WebContentsView` whose `setBounds` already lands ~1 compositor frame behind\n * the renderer's DOM paint (the two processes composite on different frames).\n * Deferring the measure+publish to a RAF stacked a SECOND frame on top — during\n * a height/splitter drag that read as the overlay visibly trailing the region\n * edge (worst when GROWING, where the not-yet-followed edge exposes background).\n * Publishing in the observer tick itself removes that self-inflicted frame and\n * leaves only the unavoidable cross-process frame (masked by matching the\n * placeholder/desk background colour). The anti-flood role the RAF used to play\n * — collapsing a burst of RO+resize ticks in one frame into one publish — is now\n * served by `lastPublished` dedup: a tick whose measured rect is byte-identical\n * to the last published one is dropped, so a continuous drag still emits at most\n * one publish per distinct rect.\n *\n * Teardown safety: there is no queued frame to outrun a state change — every\n * emit reads `disposed`/`present` synchronously, so a tick after\n * `update`/`dispose` can never write a stale rect over the live one.\n */\nexport function createViewAnchor(\n target: HTMLElement,\n opts: ViewAnchorOptions,\n): ViewAnchorHandle {\n let present = opts.present\n let publish = opts.publish\n let observer: ResizeObserver | null = null\n // The last rect handed to `publish`, for dedup-coalescing (see header). Reset\n // to `null` on every `apply()` so a state change (e.g. zoom, which rides in\n // the `publish` closure, not in `Bounds`) always forces one fresh publish\n // even when the geometry is unchanged.\n let lastPublished: Bounds | null = null\n let disposed = false\n\n const measure = (): Bounds => {\n const r = target.getBoundingClientRect()\n return clampRect({ x: r.left, y: r.top, width: r.width, height: r.height })\n }\n\n const sameRect = (a: Bounds, b: Bounds): boolean =>\n a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height\n\n // Measure + publish SYNCHRONOUSLY on the triggering tick — no RAF defer (see\n // header for why). Bail if torn down or detached, and dedup a rect\n // byte-identical to the last published one (collapses a same-frame RO+resize\n // burst, and a steady drag that re-fires the same final rect, into one).\n const emit = (): void => {\n if (disposed || !present) return\n const m = measure()\n if (lastPublished && sameRect(lastPublished, m)) return\n lastPublished = m\n publish(m)\n }\n\n const startObserving = (): void => {\n if (observer) return\n observer = new ResizeObserver(emit)\n observer.observe(target)\n window.addEventListener('resize', emit)\n }\n\n const stopObserving = (): void => {\n if (observer) {\n observer.disconnect()\n observer = null\n }\n window.removeEventListener('resize', emit)\n }\n\n // Apply the current (present, publish) synchronously. Reset `lastPublished`\n // first so the publish below is never dedup-skipped — a state change (zoom,\n // present flip, new publish target) must always re-emit even if the geometry\n // is byte-identical to the previous emit.\n const apply = (): void => {\n lastPublished = null\n if (present) {\n startObserving()\n lastPublished = measure()\n publish(lastPublished)\n } else {\n stopObserving()\n publish(ZERO)\n }\n }\n\n apply()\n\n return {\n update(next: ViewAnchorOptions): void {\n if (disposed) return\n publish = next.publish\n present = next.present\n apply()\n },\n dispose(): void {\n if (disposed) return\n disposed = true\n stopObserving()\n },\n }\n}\n\n// ── Explicit Placement API ────────────────────────────────────────────\n//\n// The modern surface that replaces the magic-`{0,0,0,0}` \"hidden\" value.\n// Visibility is an explicit discriminant, NEVER inferred from geometry — a\n// real 0×0-but-on-screen view is `{ visible:true, bounds:{...,width:0} }`\n// and a hidden one is `{ visible:false }` (no `bounds`). See `Placement`.\n\nexport interface PlacementAnchorOptions {\n /**\n * Caller's INTENT: should the native view be on-screen? `true` →\n * publish the measured rect as `{ visible:true, bounds }`; `false` →\n * publish `{ visible:false }`. Crucially, hiddenness comes from this\n * flag, not from a measured zero size — so a legitimately 0-sized but\n * visible target still publishes `visible:true`.\n */\n visible: boolean\n /** Receives each explicit Placement. Owns IPC → host. */\n publish: (placement: Placement) => void\n /**\n * Opt-in geometry detach. When true, a measured zero-area target (no\n * geometry box — display:none / unmounted / unstable first layout) publishes\n * `{ visible:false }` (detach-but-keep) instead of `{ visible:true,\n * bounds:0×0 }`, and an IntersectionObserver is attached so a display:none\n * transition (which ResizeObserver does not report) re-publishes. Default\n * false keeps the legitimate 0×0-visible semantics.\n */\n guardDisplayNone?: boolean\n /**\n * Opt-in capture-phase ancestor-scroll follow. When true, the anchor\n * listens for `scroll` on `window` in the CAPTURE phase (scroll events don't\n * bubble, but reach `window` while capturing), so an ancestor scroll\n * container scrolling the target re-measures and re-publishes. With\n * `followGeometry` off, the scroll callback does a single synchronous\n * `emit()`; with it on, the scroll OPENS the RAF sentinel window so the\n * follow tracks every frame of a scroll burst. Default false.\n */\n followScroll?: boolean\n /**\n * Opt-in windowed RAF geometry sentinel. Catches ancestor\n * transform / reflow moves that no DOM event reports. The sentinel is\n * NON-resident: it is OPENED on demand (a scroll burst, a `[role=\"separator\"]`\n * splitter pointerdown, or an explicit `pulse()`), polls geometry once per\n * animation frame publishing IN-FRAME, and AUTO-CLOSES once the rect goes\n * steady (a few unchanged frames). While closed it schedules no frame, so the\n * static cost when idle is exactly zero. Default false.\n */\n followGeometry?: boolean\n}\n\nexport interface PlacementAnchorHandle {\n /** Apply new options; re-publishes immediately (mirrors `createViewAnchor`). */\n update(opts: PlacementAnchorOptions): void\n /** Stop observing; never publish again. */\n dispose(): void\n /**\n * Open the RAF sentinel window (animation follow); auto-closes after going\n * steady or after `durationMs`. No-op when `followGeometry` is false.\n */\n pulse(durationMs?: number): void\n}\n\n/**\n * Pure measure: read `target`'s rect and wrap it as an explicit visible\n * Placement. Always `{ visible:true }` — hiddenness is a caller decision\n * (see `createPlacementAnchor`), so this never returns `{ visible:false }`\n * and never infers visibility from a 0 size. A collapsed (0×0) but present\n * element therefore yields `{ visible:true, bounds:{...,width:0,height:0} }`,\n * distinct from any hidden Placement.\n */\nexport function measurePlacement(target: HTMLElement): Placement {\n const r = target.getBoundingClientRect()\n return {\n visible: true,\n bounds: clampRect({ x: r.left, y: r.top, width: r.width, height: r.height }),\n }\n}\n\nconst samePlacement = (a: Placement, b: Placement): boolean => {\n // Discriminant-aware dedup: a visibility flip is always a change, even when\n // the geometry would otherwise look identical.\n if (a.visible !== b.visible) return false\n if (a.visible && b.visible) {\n return (\n a.bounds.x === b.bounds.x &&\n a.bounds.y === b.bounds.y &&\n a.bounds.width === b.bounds.width &&\n a.bounds.height === b.bounds.height\n )\n }\n return true\n}\n\n/**\n * The explicit-Placement mirror of `createViewAnchor`. Same observer/dedup/\n * teardown machinery, but the sink receives a `Placement`:\n * - `visible === true` → publish `measurePlacement(target)` and re-publish\n * SYNCHRONOUSLY on every `ResizeObserver`/`resize` tick.\n * - `visible === false` → publish `{ visible:false }` (NOT a ZERO bounds);\n * do not observe.\n *\n * Dedup carries the discriminant (`samePlacement`), so a visibility flip is\n * never coalesced away.\n *\n * Opt-in `guardDisplayNone` (default false): when on, a measured zero-area\n * target (display:none / unmounted / unstable first layout) publishes\n * `{ visible:false }` instead of `{ visible:true, bounds:0×0 }`, and an\n * IntersectionObserver is attached so a display:none transition (which\n * ResizeObserver does not report) re-publishes.\n */\nexport function createPlacementAnchor(\n target: HTMLElement,\n opts: PlacementAnchorOptions,\n): PlacementAnchorHandle {\n let visible = opts.visible\n let publish = opts.publish\n const guardDisplayNone = opts.guardDisplayNone ?? false\n // Captured at creation; the follow options are never re-set via update().\n const followScroll = opts.followScroll ?? false\n const followGeometry = opts.followGeometry ?? false\n let observer: ResizeObserver | null = null\n let io: IntersectionObserver | null = null\n let lastPublished: Placement | null = null\n let disposed = false\n\n // ── Windowed RAF geometry sentinel state ──────────────────\n // The sentinel is a windowed poll, opened on demand and auto-closing once\n // the geometry goes steady. It publishes IN-FRAME (no nested defer): each\n // frame measures, and either publishes a changed rect synchronously or\n // counts toward the steady-close threshold. While closed `rafId` is null\n // and no frame is scheduled — zero static cost when idle.\n let rafId: number | null = null\n let steadyFrames = 0\n const STEADY_CLOSE_FRAMES = 2\n // Bounds hidden polls the sentinel FOLLOWS so a no-deadline window can't spin.\n const MAX_HIDDEN_FOLLOW_FRAMES = 30\n // True while a [role=\"separator\"] splitter drag is in progress: set on the\n // capture-phase pointerdown that opened the window, cleared on pointerup.\n // A held pointer means the drag may still resume after a static pause, so a\n // steady run while held must NOT close the sentinel — it only closes once the\n // pointer is released. Without this gate a press that pauses a couple of\n // frames before the drag actually moves would close mid-press and drop the\n // entire subsequent drag.\n let pointerHeld = false\n // Absolute time (performance.now()) past which a `pulse(durationMs)` window\n // force-closes even if the geometry is still changing — the upper bound that\n // prevents a perpetually-animating target from keeping the sentinel resident.\n // null = no time bound (scroll/splitter opens rely on steady-close instead).\n let sentinelDeadline: number | null = null\n\n // Measure the target, applying the opt-in first-frame / display:none guard:\n // a zero-area box (no geometry to anchor) becomes a detach instead of a\n // 0×0-visible Placement. Default off → byte-for-byte the plain measure.\n const computePlacement = (): Placement => {\n const p = measurePlacement(target)\n if (\n guardDisplayNone &&\n p.visible &&\n (p.bounds.width === 0 || p.bounds.height === 0)\n ) {\n return { visible: false }\n }\n return p\n }\n\n const emit = (): void => {\n if (disposed || !visible) return\n const p = computePlacement()\n if (lastPublished && samePlacement(lastPublished, p)) return\n lastPublished = p\n publish(p)\n }\n\n // Hidden sentinel poll → close (true) once RO/IO recorded the real hide or the\n // bounded follow run elapsed, else keep following (false); never publishes.\n const shouldCloseOnHiddenPoll = (): boolean => {\n if (lastPublished?.visible === false) return true\n return steadyFrames++ >= MAX_HIDDEN_FOLLOW_FRAMES\n }\n\n // One sentinel frame: measure, publish-in-frame if changed, else count toward\n // the steady-close threshold. Reads `disposed`/`visible` live so a frame\n // outliving teardown is inert.\n const sentinelFrame = (): void => {\n rafId = null\n if (disposed || !visible) {\n sentinelDeadline = null\n return\n }\n // Upper bound: a pulse window past its deadline closes regardless of\n // motion, so a target that changes every frame can't keep the sentinel alive.\n if (sentinelDeadline !== null && performance.now() >= sentinelDeadline) {\n sentinelDeadline = null\n return // duration elapsed → close (no re-arm)\n }\n const p = computePlacement()\n // The sentinel FOLLOWS visible geometry and NEVER publishes a detach — a\n // hidden poll is a relayout transient to follow until restore (the fix).\n if (!p.visible) {\n if (shouldCloseOnHiddenPoll()) { sentinelDeadline = null; return }\n rafId = requestAnimationFrame(sentinelFrame)\n return\n }\n if (lastPublished && samePlacement(lastPublished, p)) {\n steadyFrames++\n // Steady-close only fires once the pointer is RELEASED: while a\n // splitter drag is held, a static pause is a hesitation, not the end of\n // the drag, so we keep polling (re-arm below) and let `steadyFrames`\n // accrue — it converges to a close within N frames after pointerup.\n if (steadyFrames >= STEADY_CLOSE_FRAMES && !pointerHeld) {\n sentinelDeadline = null\n return // steady (and released) → close\n }\n } else {\n lastPublished = p\n publish(p) // publish synchronously in THIS frame\n steadyFrames = 0\n }\n // `publish` may have synchronously disposed (or hidden) the anchor; re-read\n // live state so a re-entrant teardown leaves ZERO scheduled frames.\n if (!disposed && visible) {\n rafId = requestAnimationFrame(sentinelFrame) // keep polling\n } else {\n sentinelDeadline = null\n }\n }\n\n const openSentinel = (): void => {\n if (!followGeometry || disposed) return\n steadyFrames = 0\n if (rafId === null) rafId = requestAnimationFrame(sentinelFrame)\n }\n\n const closeSentinel = (): void => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId)\n rafId = null\n }\n steadyFrames = 0\n sentinelDeadline = null\n pointerHeld = false\n }\n\n // An ancestor scroll moved the target's screen rect. With the sentinel on,\n // open the window so the whole scroll burst is followed frame-by-frame;\n // without it, a single synchronous emit() follows the new rect.\n const onScroll = (): void => {\n if (followGeometry) openSentinel()\n else emit()\n }\n\n // A capture-phase pointerdown on a [role=\"separator\"] splitter handle marks\n // the start of a drag that moves the target via ancestor reflow (no RO tick)\n // → open the sentinel.\n const onPointerDown = (e: Event): void => {\n const t = e.target as Element | null\n if (t && t.closest && t.closest('[role=\"separator\"]')) {\n pointerHeld = true\n openSentinel()\n }\n }\n\n // Pointer released: the drag is over, so a steady run may now close the\n // sentinel. Re-open it (a no-op if already polling) so the steady-close\n // threshold is reached even if the geometry was already static at release.\n const onPointerUp = (): void => {\n if (!pointerHeld) return\n pointerHeld = false\n openSentinel()\n }\n\n const startObserving = (): void => {\n if (observer) return\n observer = new ResizeObserver(emit)\n observer.observe(target)\n window.addEventListener('resize', emit)\n // A display:none transition is invisible to ResizeObserver; an\n // IntersectionObserver re-fires `emit`, which re-measures via\n // `computePlacement` (now-zero box → detach, restored box → visible).\n if (guardDisplayNone && typeof IntersectionObserver !== 'undefined') {\n io = new IntersectionObserver(emit)\n io.observe(target)\n }\n if (followScroll) {\n window.addEventListener('scroll', onScroll, {\n capture: true,\n passive: true,\n })\n }\n if (followGeometry) {\n window.addEventListener('pointerdown', onPointerDown, { capture: true })\n window.addEventListener('pointerup', onPointerUp, { capture: true })\n }\n }\n\n const stopObserving = (): void => {\n if (observer) {\n observer.disconnect()\n observer = null\n }\n if (io) {\n io.disconnect()\n io = null\n }\n window.removeEventListener('resize', emit)\n window.removeEventListener('scroll', onScroll, {\n capture: true,\n } as EventListenerOptions)\n window.removeEventListener('pointerdown', onPointerDown, {\n capture: true,\n } as EventListenerOptions)\n window.removeEventListener('pointerup', onPointerUp, {\n capture: true,\n } as EventListenerOptions)\n closeSentinel()\n }\n\n const apply = (): void => {\n lastPublished = null\n if (visible) {\n startObserving()\n lastPublished = computePlacement()\n publish(lastPublished)\n } else {\n stopObserving()\n const hidden: Placement = { visible: false }\n lastPublished = hidden\n publish(hidden)\n }\n }\n\n apply()\n\n return {\n update(next: PlacementAnchorOptions): void {\n if (disposed) return\n publish = next.publish\n visible = next.visible\n apply()\n },\n dispose(): void {\n if (disposed) return\n disposed = true\n stopObserving()\n },\n pulse(durationMs?: number): void {\n // Imperative window open: start the animation-follow window. It\n // closes on steady (N=2 unchanged frames) OR, when `durationMs` is given,\n // at that deadline — whichever comes first. The deadline is the upper bound\n // that guarantees a still-animating target cannot keep the sentinel\n // resident; without it, only steady-close applies.\n if (disposed || !followGeometry) return\n if (durationMs !== undefined && durationMs > 0) {\n const next = performance.now() + durationMs\n // Extend (never shorten) an existing window's deadline.\n sentinelDeadline = sentinelDeadline === null ? next : Math.max(sentinelDeadline, next)\n }\n openSentinel()\n },\n }\n}\n","import type { DesiredView, PlacementSnapshot } from '../layout/index.js'\n\n// Renderer-side single source of truth for native-view placement. Every anchor\n// writes its view's desired placement here instead of invoking IPC directly; a\n// central scheduler reads the WHOLE table once per animation frame and publishes\n// one window-level snapshot (a monotonic epoch shared by all views in the tick).\n//\n// Coalescing a level stream is safe: many set()/remove() calls in one frame\n// collapse to the latest level, so a transient (e.g. a relayout that momentarily\n// measures 0×0 then restores) is overwritten before it is ever published. This\n// is what a per-view edge stream cannot do — it is the producer half of the\n// reconcile design (see ../layout/placement-reconcile.ts).\n\nexport interface PlacementPublisherDeps<Extra = unknown> {\n // Renderer lifetime id stamped on every snapshot; a fresh renderer uses a\n // higher generation so the main reconciler resets its table. A function is\n // re-read on EVERY flush, so a host whose generation is assigned by main (via a\n // grant that can arrive after the publisher is created) can hand a getter and\n // have later snapshots pick up the newer value.\n generation: number | (() => number)\n publish: (snapshot: PlacementSnapshot<Extra>) => void\n // Injectable for tests; default to requestAnimationFrame / cancelAnimationFrame.\n requestFrame?: (cb: () => void) => number\n cancelFrame?: (id: number) => void\n}\n\nexport interface PlacementPublisher<Extra = unknown> {\n // Upsert one view's desired placement and schedule a coalesced publish.\n set(view: DesiredView<Extra>): void\n // Drop a view from the desired table and schedule a coalesced publish.\n remove(viewId: string): void\n dispose(): void\n}\n\nexport function createPlacementPublisher<Extra = unknown>(\n deps: PlacementPublisherDeps<Extra>,\n): PlacementPublisher<Extra> {\n const requestFrame =\n deps.requestFrame ?? ((cb: () => void): number => requestAnimationFrame(cb))\n const cancelFrame = deps.cancelFrame ?? ((id: number): void => cancelAnimationFrame(id))\n const readGeneration =\n typeof deps.generation === 'function' ? deps.generation : (): number => deps.generation as number\n\n const views = new Map<string, DesiredView<Extra>>()\n let dirty = false\n let frameId: number | null = null\n let epoch = 0\n let disposed = false\n\n function schedule(): void {\n if (disposed || frameId !== null) return\n frameId = requestFrame(flush)\n }\n\n function flush(): void {\n frameId = null\n // A frame that fires with nothing dirty (or after dispose) publishes\n // nothing — coalescing means only a real change reaches the wire.\n if (disposed || !dirty) return\n dirty = false\n deps.publish({\n generation: readGeneration(),\n epoch: epoch++,\n views: [...views.values()],\n })\n }\n\n return {\n set(view: DesiredView<Extra>): void {\n if (disposed) return\n views.set(view.viewId, view)\n dirty = true\n schedule()\n },\n remove(viewId: string): void {\n if (disposed) return\n // Removing an absent id is not a change — don't arm a redundant frame.\n if (!views.delete(viewId)) return\n dirty = true\n schedule()\n },\n dispose(): void {\n if (disposed) return\n disposed = true\n if (frameId !== null) {\n cancelFrame(frameId)\n frameId = null\n }\n },\n }\n}\n","import { createPlacementAnchor } from '@dimina-kit/view-anchor'\nimport type { Placement } from '@dimina-kit/view-anchor'\nimport { createPlacementPublisher } from './placement-publisher.js'\nimport type { PlacementSnapshot } from '../layout/index.js'\n\n/** Per-view host extra threaded on every DesiredView: the slot's capability\n * token. Main derives the view's identity + z-order from this token (never from\n * the renderer-reported viewId), so a valid token can't be spliced onto a forged\n * viewId. */\nexport interface SlotExtra {\n\tslotToken: string\n}\n\n/** One main→renderer slot grant: a native view (`viewId`) wants to follow the\n * DOM slot `slotId`; `slotToken` is the capability the renderer threads back\n * (as a per-view extra) so main can match a placement to the granted slot.\n * `generation` is a main-assigned, strictly-monotonic-per-wc renderer-lifetime\n * id: it is stamped onto every published snapshot so a reload (new grants at a\n * higher generation) resets main's reconciler regardless of IPC ordering. */\nexport interface SlotGrant {\n\tviewId: string\n\tslotId: string\n\tslotToken: string\n\tgeneration: number\n}\n\n/** The renderer-side transport for the slot-token handshake. `onSlotGrant`\n * registers the grant listener (returns an unsubscribe); `subscribe` asks main\n * to (re)play buffered grants AFTER the listener is attached; `sendSnapshot`\n * forwards the whole window-level desired-placement table (one coalesced frame),\n * each view carrying its slot's token as an extra. */\nexport interface LayoutBridge {\n\tonSlotGrant(cb: (grant: SlotGrant) => void): () => void\n\tsendSnapshot(snapshot: PlacementSnapshot<SlotExtra>): void\n\tsubscribe(): void\n}\n\nexport interface LayoutClientDeps {\n\tbridge: LayoutBridge\n\t/** Resolve a grant's `slotId` to its DOM element. Default:\n\t * `document.querySelector(slotId)`. Returns `null` when the slot is not\n\t * mounted (graceful no-op). */\n\tresolveSlot?(slotId: string): HTMLElement | null\n\t/** Anchor factory. Default: view-anchor's `createPlacementAnchor`. Injected\n\t * in tests to capture `(target, opts)` without real RO/IO/RAF. */\n\tcreateAnchor?: (\n\t\ttarget: HTMLElement,\n\t\topts: {\n\t\t\tvisible: boolean\n\t\t\tpublish: (p: Placement) => void\n\t\t\tfollowScroll?: boolean\n\t\t\tfollowGeometry?: boolean\n\t\t\tguardDisplayNone?: boolean\n\t\t},\n\t) => { dispose(): void }\n\t/** Frame scheduler for the internal placement publisher. Default:\n\t * requestAnimationFrame / cancelAnimationFrame. Injected in tests to drive\n\t * coalesced publishes deterministically. */\n\trequestFrame?: (cb: () => void) => number\n\tcancelFrame?: (id: number) => void\n}\n\n/**\n * Renderer half of the slot-token handshake. Subscribes to main's `slot-grant`\n * pushes FIRST (so a grant replayed synchronously by `subscribe()` cannot be\n * missed), then on each grant anchors the granted DOM slot with this session's\n * hardening opts (followScroll / followGeometry / guardDisplayNone). Each anchor's\n * measured `Placement` is written into a CENTRAL placement publisher keyed by\n * `viewId` — NOT sent per-view. The publisher coalesces every anchor's writes into\n * ONE window-level snapshot per animation frame, so a transient relayout that\n * momentarily measures 0×0 is overwritten before it is ever published. This is the\n * producer half of the level-triggered reconcile design (see\n * ../layout/placement-reconcile.ts); a per-view edge stream cannot self-correct a\n * lost or spurious frame, which is what caused a stuck detached (white-screen)\n * view.\n */\nexport function createDeckLayoutClient(deps: LayoutClientDeps): {\n\tdispose(): void\n} {\n\tconst resolveSlot =\n\t\tdeps.resolveSlot ??\n\t\t((id: string): HTMLElement | null => document.querySelector(id))\n\tconst createAnchor = deps.createAnchor ?? createPlacementAnchor\n\n\t// Max generation seen across all grants. Main assigns strictly-monotonic\n\t// generations, so taking the max means a reload's higher-generation grants\n\t// bump every subsequent snapshot's generation → main's reconciler resets.\n\tlet maxGeneration = 0\n\n\t// Central publisher: every anchor writes its view's desired placement here; the\n\t// publisher reads the whole table once per frame and publishes one snapshot.\n\tconst publisher = createPlacementPublisher<SlotExtra>({\n\t\tgeneration: () => maxGeneration,\n\t\tpublish: snapshot => deps.bridge.sendSnapshot(snapshot),\n\t\trequestFrame: deps.requestFrame,\n\t\tcancelFrame: deps.cancelFrame,\n\t})\n\n\t// One live anchor per `viewId`. Main intentionally re-delivers a grant on\n\t// per-wc replay, so we dedup: a same-token replay is a no-op (keep the live\n\t// anchor); a new token for an existing `viewId` replaces it (dispose old,\n\t// create new). The map holds only CURRENTLY-LIVE anchors — a replaced anchor\n\t// is disposed at replacement time and removed, so `dispose()` never\n\t// double-disposes it.\n\tconst byViewId = new Map<string, { token: string; anchor: { dispose(): void } }>()\n\tlet disposed = false\n\n\t// Register the grant listener BEFORE requesting replay (handshake):\n\t// a grant the main side replays synchronously inside `subscribe()` must find\n\t// the listener already attached.\n\tconst unsub = deps.bridge.onSlotGrant((grant) => {\n\t\tif (disposed) return\n\t\tif (grant.generation > maxGeneration) maxGeneration = grant.generation\n\t\tconst existing = byViewId.get(grant.viewId)\n\t\t// Same viewId+token re-delivered (per-wc replay) → pure no-op: keep the\n\t\t// live anchor, do not create a second, do not dispose the first.\n\t\tif (existing && existing.token === grant.slotToken) return\n\t\t// A new token for this viewId → REVOKE the stale anchor FIRST: dispose it,\n\t\t// drop it from the publisher table, and remove it from the map BEFORE\n\t\t// resolving the new slot, so a stale anchor can never keep contributing a\n\t\t// revoked token even when the new slot isn't mounted yet.\n\t\tif (existing) {\n\t\t\t// try/finally: the map delete + publisher.remove MUST run even if the old\n\t\t\t// anchor's dispose throws — otherwise the disposed-but-still-mapped anchor\n\t\t\t// keeps its snapshot entry AND a later client.dispose() would dispose it a\n\t\t\t// second time.\n\t\t\ttry {\n\t\t\t\texisting.anchor.dispose()\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tbyViewId.delete(grant.viewId)\n\t\t\t\tpublisher.remove(grant.viewId)\n\t\t\t}\n\t\t}\n\t\tconst el = resolveSlot(grant.slotId)\n\t\tif (!el) return // new slot not mounted → graceful no-op; old anchor already revoked\n\t\tconst token = grant.slotToken\n\t\tconst anchor = createAnchor(el, {\n\t\t\tvisible: true,\n\t\t\tfollowScroll: true,\n\t\t\tfollowGeometry: true,\n\t\t\tguardDisplayNone: true,\n\t\t\t// Capture THIS grant's viewId + slotToken so the measured placement lands\n\t\t\t// in the central publisher under the right key with its own token (no\n\t\t\t// cross-talk between slots). layer is 0: z-order is host-controlled\n\t\t\t// (compositor zone), not renderer-driven.\n\t\t\tpublish: (placement) => {\n\t\t\t\tpublisher.set({ viewId: grant.viewId, placement, layer: 0, extra: { slotToken: token } })\n\t\t\t},\n\t\t})\n\t\tbyViewId.set(grant.viewId, { token, anchor })\n\t})\n\n\t// Request replay AFTER the listener is attached.\n\tdeps.bridge.subscribe()\n\n\treturn {\n\t\tdispose(): void {\n\t\t\tif (disposed) return\n\t\t\tdisposed = true\n\t\t\tunsub()\n\t\t\tfor (const { anchor } of byViewId.values()) anchor.dispose()\n\t\t\tbyViewId.clear()\n\t\t\t// Dispose the publisher LAST so no anchor teardown races a pending frame.\n\t\t\tpublisher.dispose()\n\t\t},\n\t}\n}\n","import {\n\tDeckClientNotReadyError,\n\tDeckRemoteError,\n} from '../errors.js'\nimport {\n\tBRIDGE_PROTOCOL_VERSION,\n\tDEFAULT_BRIDGE_GLOBAL,\n} from '../shared/protocol.js'\nimport type { EventEnvelope, DeckBridge } from '../shared/protocol.js'\nimport type { Disposable, HostEvent, JsonValue } from '../types.js'\n\nexport { DeckClientNotReadyError, DeckRemoteError }\n\nexport { createDeckLayoutClient } from './layout-client.js'\nexport type {\n\tSlotGrant,\n\tLayoutBridge,\n\tLayoutClientDeps,\n} from './layout-client.js'\n\nexport { createPlacementPublisher } from './placement-publisher.js'\nexport type {\n\tPlacementPublisher,\n\tPlacementPublisherDeps,\n} from './placement-publisher.js'\n\nexport interface CreateDeckClientOptions {\n\t/** 默认 `__electronDeckBridge`;必须与 host preload 对齐 */\n\treadonly globalName?: string\n}\n\n// HS / EV 使用 `any` 而非 `JsonValue[]` 约束:\n// (1) host 侧 HostServiceHandler 同样是 `(...args: any[]) => unknown`,两侧对称;\n// (2) JsonValue 索引签名挡掉常见 host 写法(`(p: { code: string }) => ...`),\n// 强迫 rest-only 签名时 `Parameters<HS[K]>` 推不出真实参数类型;\n// (3) Electron IPC 实际走 structured clone(非 JSON),原约束的\"前提\"本就错;\n// (4) 真要 runtime 校验,在 transport 边界用 `runtime.ipc.handle({ validator })`\n// 与 protocol envelope(`InvokeRequest.args: readonly JsonValue[]`)已经够。\nexport interface DeckClient<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tHS extends Record<keyof HS, (...args: any[]) => unknown>,\n\tEV extends readonly HostEvent<JsonValue>[],\n> {\n\tready(): Promise<void>\n\tinvoke<K extends keyof HS & string>(\n\t\tname: K,\n\t\t...args: Parameters<HS[K]>\n\t): Promise<Awaited<ReturnType<HS[K]>>>\n\ton<E extends EV[number]>(\n\t\tevent: E,\n\t\tlistener: (payload: E extends HostEvent<infer P> ? P : never) => void,\n\t): Disposable\n}\n\nexport function createDeckClient<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tHS extends Record<keyof HS, (...args: any[]) => unknown>,\n\tEV extends readonly HostEvent<JsonValue>[],\n>(options?: CreateDeckClientOptions): DeckClient<HS, EV> {\n\tconst globalName = options?.globalName ?? DEFAULT_BRIDGE_GLOBAL\n\n\tfunction getBridge(): DeckBridge {\n\t\tconst bridge = readBridgeFromGlobal(globalName)\n\t\tif (bridge === undefined) {\n\t\t\tthrow new DeckClientNotReadyError(\n\t\t\t\t`Deck framework bridge is missing on window[\"${globalName}\"] — did the host preload call exposeDeckBridge()?`,\n\t\t\t)\n\t\t}\n\t\treturn bridge\n\t}\n\n\treturn {\n\t\tasync ready(): Promise<void> {\n\t\t\tconst bridge = getBridge()\n\t\t\tconst remoteMajor = parseMajor(bridge.version)\n\t\t\tconst localMajor = parseMajor(BRIDGE_PROTOCOL_VERSION)\n\t\t\tif (remoteMajor !== localMajor) {\n\t\t\t\tthrow new DeckClientNotReadyError(\n\t\t\t\t\t`Deck bridge protocol version mismatch: bridge=${String(bridge.version)}, client expected major ${localMajor}.x.x (${BRIDGE_PROTOCOL_VERSION})`,\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\n\t\tasync invoke<K extends keyof HS & string>(\n\t\t\tname: K,\n\t\t\t...args: Parameters<HS[K]>\n\t\t): Promise<Awaited<ReturnType<HS[K]>>> {\n\t\t\tconst bridge = getBridge()\n\t\t\tconst response = await bridge.invoke({\n\t\t\t\tkind: 'host',\n\t\t\t\tname,\n\t\t\t\targs: args as readonly JsonValue[],\n\t\t\t})\n\t\t\tif (response.ok) {\n\t\t\t\treturn response.result as Awaited<ReturnType<HS[K]>>\n\t\t\t}\n\t\t\tconst { remoteName, message, code } = response.error\n\t\t\tthrow new DeckRemoteError(remoteName, message, code)\n\t\t},\n\n\t\ton<E extends EV[number]>(\n\t\t\tevent: E,\n\t\t\tlistener: (payload: E extends HostEvent<infer P> ? P : never) => void,\n\t\t): Disposable {\n\t\t\tconst bridge = getBridge()\n\t\t\tconst wrapped = (env: EventEnvelope): void => {\n\t\t\t\tif (env.name === event.name) {\n\t\t\t\t\tlistener(env.payload as E extends HostEvent<infer P> ? P : never)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst unsubscribe = bridge.onEvent(wrapped)\n\t\t\tlet disposed = false\n\t\t\treturn {\n\t\t\t\tdispose: () => {\n\t\t\t\t\tif (disposed) return\n\t\t\t\t\tdisposed = true\n\t\t\t\t\tunsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t}\n}\n\nexport function readBridgeFromGlobal(\n\tglobalName: string = DEFAULT_BRIDGE_GLOBAL,\n): DeckBridge | undefined {\n\tconst g = globalThis as unknown as Record<string, unknown>\n\tconst bridge = g[globalName]\n\tif (bridge === undefined || bridge === null) return undefined\n\treturn bridge as DeckBridge\n}\n\nfunction parseMajor(version: unknown): number {\n\tif (typeof version !== 'string') return Number.NaN\n\tconst head = version.split('.')[0] ?? ''\n\tconst n = Number.parseInt(head, 10)\n\treturn Number.isNaN(n) ? Number.NaN : n\n}\n\nexport { BRIDGE_PROTOCOL_VERSION, DEFAULT_BRIDGE_GLOBAL }\n"],"mappings":";;;AAiBA,IAAM,aAAa,OAKJ;CACb,GAAG,KAAK,MAAM,EAAE,CAAC;CACjB,GAAG,KAAK,MAAM,EAAE,CAAC;CACjB,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,EAAE,KAAK,CAAC;CACtC,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,EAAE,MAAM,CAAC;AAC1C;;;;;;;;;AAsLA,SAAgB,iBAAiB,QAAgC;CAC/D,MAAM,IAAI,OAAO,sBAAsB;CACvC,OAAO;EACL,SAAS;EACT,QAAQ,UAAU;GAAE,GAAG,EAAE;GAAM,GAAG,EAAE;GAAK,OAAO,EAAE;GAAO,QAAQ,EAAE;EAAO,CAAC;CAC7E;AACF;AAEA,IAAM,iBAAiB,GAAc,MAA0B;CAG7D,IAAI,EAAE,YAAY,EAAE,SAAS,OAAO;CACpC,IAAI,EAAE,WAAW,EAAE,SACjB,OACE,EAAE,OAAO,MAAM,EAAE,OAAO,KACxB,EAAE,OAAO,MAAM,EAAE,OAAO,KACxB,EAAE,OAAO,UAAU,EAAE,OAAO,SAC5B,EAAE,OAAO,WAAW,EAAE,OAAO;CAGjC,OAAO;AACT;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,sBACd,QACA,MACuB;CACvB,IAAI,UAAU,KAAK;CACnB,IAAI,UAAU,KAAK;CACnB,MAAM,mBAAmB,KAAK,oBAAoB;CAElD,MAAM,eAAe,KAAK,gBAAgB;CAC1C,MAAM,iBAAiB,KAAK,kBAAkB;CAC9C,IAAI,WA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;GACb,EACD;EACD;CACD;AACD;AAEA,SAAgB,qBACf,aAAqB,uBACI;CAEzB,MAAM,SAAS,WAAE;CACjB,IAAI,WAAW,KAAA,KAAa,WAAW,MAAM,OAAO,KAAA;CACpD,OAAO;AACR;AAEA,SAAS,WAAW,SAA0B;CAC7C,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,MAAM,OAAO,QAAQ,MAAM,GAAG,EAAE,MAAM;CACtC,MAAM,IAAI,OAAO,SAAS,MAAM,EAAE;CAClC,OAAO,OAAO,MAAM,CAAC,IAAI,MAAa;AACvC"}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import type { Placement } from '@dimina-kit/view-anchor';
|
|
2
|
+
import type { PlacementSnapshot } from '../layout/index.js';
|
|
3
|
+
/** Per-view host extra threaded on every DesiredView: the slot's capability
|
|
4
|
+
* token. Main derives the view's identity + z-order from this token (never from
|
|
5
|
+
* the renderer-reported viewId), so a valid token can't be spliced onto a forged
|
|
6
|
+
* viewId. */
|
|
7
|
+
export interface SlotExtra {
|
|
8
|
+
slotToken: string;
|
|
9
|
+
}
|
|
2
10
|
/** One main→renderer slot grant: a native view (`viewId`) wants to follow the
|
|
3
|
-
* DOM slot `slotId`; `slotToken` is the capability the renderer threads back
|
|
4
|
-
*
|
|
11
|
+
* DOM slot `slotId`; `slotToken` is the capability the renderer threads back
|
|
12
|
+
* (as a per-view extra) so main can match a placement to the granted slot.
|
|
13
|
+
* `generation` is a main-assigned, strictly-monotonic-per-wc renderer-lifetime
|
|
14
|
+
* id: it is stamped onto every published snapshot so a reload (new grants at a
|
|
15
|
+
* higher generation) resets main's reconciler regardless of IPC ordering. */
|
|
5
16
|
export interface SlotGrant {
|
|
6
17
|
viewId: string;
|
|
7
18
|
slotId: string;
|
|
8
19
|
slotToken: string;
|
|
20
|
+
generation: number;
|
|
9
21
|
}
|
|
10
22
|
/** The renderer-side transport for the slot-token handshake. `onSlotGrant`
|
|
11
23
|
* registers the grant listener (returns an unsubscribe); `subscribe` asks main
|
|
12
|
-
* to (re)play buffered grants AFTER the listener is attached; `
|
|
13
|
-
* forwards
|
|
24
|
+
* to (re)play buffered grants AFTER the listener is attached; `sendSnapshot`
|
|
25
|
+
* forwards the whole window-level desired-placement table (one coalesced frame),
|
|
26
|
+
* each view carrying its slot's token as an extra. */
|
|
14
27
|
export interface LayoutBridge {
|
|
15
28
|
onSlotGrant(cb: (grant: SlotGrant) => void): () => void;
|
|
16
|
-
|
|
17
|
-
slotToken: string;
|
|
18
|
-
placement: Placement;
|
|
19
|
-
}): void;
|
|
29
|
+
sendSnapshot(snapshot: PlacementSnapshot<SlotExtra>): void;
|
|
20
30
|
subscribe(): void;
|
|
21
31
|
}
|
|
22
32
|
export interface LayoutClientDeps {
|
|
@@ -36,14 +46,25 @@ export interface LayoutClientDeps {
|
|
|
36
46
|
}) => {
|
|
37
47
|
dispose(): void;
|
|
38
48
|
};
|
|
49
|
+
/** Frame scheduler for the internal placement publisher. Default:
|
|
50
|
+
* requestAnimationFrame / cancelAnimationFrame. Injected in tests to drive
|
|
51
|
+
* coalesced publishes deterministically. */
|
|
52
|
+
requestFrame?: (cb: () => void) => number;
|
|
53
|
+
cancelFrame?: (id: number) => void;
|
|
39
54
|
}
|
|
40
55
|
/**
|
|
41
|
-
* Renderer half of the slot-token handshake
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
56
|
+
* Renderer half of the slot-token handshake. Subscribes to main's `slot-grant`
|
|
57
|
+
* pushes FIRST (so a grant replayed synchronously by `subscribe()` cannot be
|
|
58
|
+
* missed), then on each grant anchors the granted DOM slot with this session's
|
|
59
|
+
* hardening opts (followScroll / followGeometry / guardDisplayNone). Each anchor's
|
|
60
|
+
* measured `Placement` is written into a CENTRAL placement publisher keyed by
|
|
61
|
+
* `viewId` — NOT sent per-view. The publisher coalesces every anchor's writes into
|
|
62
|
+
* ONE window-level snapshot per animation frame, so a transient relayout that
|
|
63
|
+
* momentarily measures 0×0 is overwritten before it is ever published. This is the
|
|
64
|
+
* producer half of the level-triggered reconcile design (see
|
|
65
|
+
* ../layout/placement-reconcile.ts); a per-view edge stream cannot self-correct a
|
|
66
|
+
* lost or spurious frame, which is what caused a stuck detached (white-screen)
|
|
67
|
+
* view.
|
|
47
68
|
*/
|
|
48
69
|
export declare function createDeckLayoutClient(deps: LayoutClientDeps): {
|
|
49
70
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-client.d.ts","sourceRoot":"","sources":["../../src/client/layout-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD
|
|
1
|
+
{"version":3,"file":"layout-client.d.ts","sourceRoot":"","sources":["../../src/client/layout-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE3D;;;cAGc;AACd,MAAM,WAAW,SAAS;IACzB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED;;;;;8EAK8E;AAC9E,MAAM,WAAW,SAAS;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CAClB;AAED;;;;uDAIuD;AACvD,MAAM,WAAW,YAAY;IAC5B,WAAW,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;IACvD,YAAY,CAAC,QAAQ,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;IAC1D,SAAS,IAAI,IAAI,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB;;oCAEgC;IAChC,WAAW,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAA;IAChD;uEACmE;IACnE,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;QACL,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,CAAA;QAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAC1B,KACG;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE,CAAA;IACxB;;iDAE6C;IAC7C,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,MAAM,CAAA;IACzC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG;IAC/D,OAAO,IAAI,IAAI,CAAA;CACf,CAyFA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DesiredView, PlacementSnapshot } from '../layout/index.js';
|
|
2
|
+
export interface PlacementPublisherDeps<Extra = unknown> {
|
|
3
|
+
generation: number | (() => number);
|
|
4
|
+
publish: (snapshot: PlacementSnapshot<Extra>) => void;
|
|
5
|
+
requestFrame?: (cb: () => void) => number;
|
|
6
|
+
cancelFrame?: (id: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface PlacementPublisher<Extra = unknown> {
|
|
9
|
+
set(view: DesiredView<Extra>): void;
|
|
10
|
+
remove(viewId: string): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createPlacementPublisher<Extra = unknown>(deps: PlacementPublisherDeps<Extra>): PlacementPublisher<Extra>;
|
|
14
|
+
//# sourceMappingURL=placement-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placement-publisher.d.ts","sourceRoot":"","sources":["../../src/client/placement-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAaxE,MAAM,WAAW,sBAAsB,CAAC,KAAK,GAAG,OAAO;IAMrD,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAA;IACnC,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;IAErD,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,MAAM,CAAA;IACzC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAED,MAAM,WAAW,kBAAkB,CAAC,KAAK,GAAG,OAAO;IAEjD,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAEnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,wBAAgB,wBAAwB,CAAC,KAAK,GAAG,OAAO,EACtD,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAClC,kBAAkB,CAAC,KAAK,CAAC,CAsD3B"}
|
package/dist/dock-react/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as closePanelForUser, c as extractPanel, d as setActive, m as splitPanel, p as setSizes, u as movePanel } from "../layout-ByOiOdnc.js";
|
|
2
2
|
import { Fragment, createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Group, Panel, Separator } from "react-resizable-panels";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|