@forgeax/view 0.4.1 → 0.4.2
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 +21 -7
- package/dist/build-revision.json +1 -1
- package/dist/modules/backend.mjs +11 -11
- package/dist/modules/browser.mjs +16 -16
- package/dist/modules/chunks/{App-E3M52XTQ.mjs → App-4XQ5SNNT.mjs} +2 -2
- package/dist/modules/chunks/{chunk-3GIGTM7E.mjs → chunk-27XASYEH.mjs} +2 -2
- package/dist/modules/chunks/{chunk-UAGQZPAB.mjs → chunk-2Z5KEV6L.mjs} +2 -2
- package/dist/modules/chunks/{chunk-4NGODRIE.mjs → chunk-46UEGAXY.mjs} +4 -4
- package/dist/modules/chunks/{chunk-UZHTLAIZ.mjs → chunk-47RJSHLM.mjs} +2 -2
- package/dist/modules/chunks/{chunk-L5EV6NEE.mjs → chunk-4JGCYD3Q.mjs} +3 -3
- package/dist/modules/chunks/{chunk-ACOMGSSB.mjs → chunk-5PHAXNFO.mjs} +2 -2
- package/dist/modules/chunks/{chunk-45ZU2HHR.mjs → chunk-B6QUJ33G.mjs} +27 -23
- package/dist/modules/chunks/chunk-B6QUJ33G.mjs.map +7 -0
- package/dist/modules/chunks/{chunk-FKLYSAVN.mjs → chunk-CXOD7FW6.mjs} +7 -4
- package/dist/modules/chunks/chunk-CXOD7FW6.mjs.map +7 -0
- package/dist/modules/chunks/{chunk-CRNEX7YH.mjs → chunk-D25SR5FS.mjs} +2 -2
- package/dist/modules/chunks/{chunk-PG4AJFDC.mjs → chunk-DJZGRO7W.mjs} +12 -12
- package/dist/modules/chunks/{chunk-MHE5EBU4.mjs → chunk-E3PJGTLI.mjs} +22 -14
- package/dist/modules/chunks/chunk-E3PJGTLI.mjs.map +7 -0
- package/dist/modules/chunks/{chunk-3Q26HNFS.mjs → chunk-FICPCJKR.mjs} +2 -2
- package/dist/modules/chunks/{chunk-CWNB67UF.mjs → chunk-FMCHH5R4.mjs} +2 -2
- package/dist/modules/chunks/{chunk-TTFLJHQZ.mjs → chunk-H4UIESCF.mjs} +6 -6
- package/dist/modules/chunks/{chunk-TTFLJHQZ.mjs.map → chunk-H4UIESCF.mjs.map} +1 -1
- package/dist/modules/chunks/{chunk-MO5LILCP.mjs → chunk-HWZCLROY.mjs} +6 -2
- package/dist/modules/chunks/chunk-HWZCLROY.mjs.map +7 -0
- package/dist/modules/chunks/{chunk-2VJPRNYB.mjs → chunk-IZAHIOFU.mjs} +4 -4
- package/dist/modules/chunks/{chunk-BGK4ZEQ5.mjs → chunk-KX2WU5Z6.mjs} +2 -2
- package/dist/modules/chunks/{chunk-TBZZ37VI.mjs → chunk-KYTG2MKV.mjs} +3 -3
- package/dist/modules/chunks/{chunk-M5X56JWH.mjs → chunk-PW5CE2Y6.mjs} +3 -3
- package/dist/modules/chunks/{chunk-OHVTNEQ2.mjs → chunk-PZIAKZJC.mjs} +2 -2
- package/dist/modules/chunks/{chunk-WHVPE2P6.mjs → chunk-Q2ZYLFJM.mjs} +4 -4
- package/dist/modules/chunks/{chunk-WHVPE2P6.mjs.map → chunk-Q2ZYLFJM.mjs.map} +1 -1
- package/dist/modules/chunks/{chunk-JZ3V27HQ.mjs → chunk-U64FRQKP.mjs} +3 -3
- package/dist/modules/chunks/{chunk-W46L4HSP.mjs → chunk-U6UMATPV.mjs} +3 -3
- package/dist/modules/chunks/{chunk-7ICJKZYO.mjs → chunk-VKNIYV2W.mjs} +26 -21
- package/dist/modules/chunks/chunk-VKNIYV2W.mjs.map +7 -0
- package/dist/modules/chunks/{chunk-7R6CGQDU.mjs → chunk-VW2ZF3P4.mjs} +4 -4
- package/dist/modules/chunks/{chunk-AIIYGGGC.mjs → chunk-X4NNZ5X6.mjs} +2 -2
- package/dist/modules/chunks/{chunk-BCTPTLA6.mjs → chunk-XEE3E42Q.mjs} +3 -3
- package/dist/modules/chunks/{chunk-CDO6LELS.mjs → chunk-Y2IAXE2C.mjs} +3 -3
- package/dist/modules/chunks/{chunk-6WCG6WPC.mjs → chunk-YNHEYXDG.mjs} +3 -3
- package/dist/modules/chunks/{chunk-7MJUWNVI.mjs → chunk-ZGOGO7SS.mjs} +1 -1
- package/dist/modules/chunks/{chunk-VXSD4FK5.mjs → chunk-ZHO2G4JR.mjs} +3 -3
- package/dist/modules/embedded.mjs +100 -21
- package/dist/modules/embedded.mjs.map +3 -3
- package/dist/modules/frontend-root.mjs +15 -15
- package/dist/modules/index.mjs +21 -21
- package/dist/modules/plugin.mjs +11 -11
- package/dist/modules/plugins/asset/frontend.mjs +4 -4
- package/dist/modules/plugins/asset/identity.mjs +3 -3
- package/dist/modules/plugins/asset/ui.mjs +2 -2
- package/dist/modules/plugins/content-browser/ui.mjs +2 -2
- package/dist/modules/plugins/inspector/ui.mjs +2 -2
- package/dist/modules/plugins/material/frontend.mjs +4 -4
- package/dist/modules/plugins/material/identity.mjs +3 -3
- package/dist/modules/plugins/material/ui.mjs +5 -5
- package/dist/modules/plugins/mesh/frontend.mjs +4 -4
- package/dist/modules/plugins/mesh/identity.mjs +3 -3
- package/dist/modules/plugins/mesh/ui.mjs +5 -5
- package/dist/modules/plugins/plugins/ui/panel.mjs +2 -2
- package/dist/modules/plugins/plugins/ui.mjs +3 -3
- package/dist/modules/plugins/scene-tree/ui.mjs +2 -2
- package/dist/modules/plugins/texture/frontend.mjs +4 -4
- package/dist/modules/plugins/texture/identity.mjs +3 -3
- package/dist/modules/plugins/texture/ui.mjs +5 -5
- package/dist/modules/plugins/viewport/frontend.mjs +1 -1
- package/dist/modules/product.mjs +11 -11
- package/dist/modules/shell/frontend.mjs +1 -1
- package/dist/modules/viewer/catalog/backend.mjs +10 -10
- package/dist/modules/viewer/catalog/frontend.mjs +14 -14
- package/dist/modules/viewer/catalog/shared.mjs +7 -7
- package/dist/modules/viewer/catalog.mjs +17 -17
- package/dist/modules/viewer-host/frontend.mjs +16 -16
- package/dist/modules/viewer.mjs +17 -17
- package/dist/modules/workspace/backend.mjs +2 -2
- package/dist/modules/workspace/broker.mjs +1 -1
- package/dist/modules/workspace/preview-surface.mjs +1 -1
- package/dist/modules/workspace/resource-page.mjs +2 -2
- package/dist/viewer/assets/{embedded-DWrXFZbD.js → embedded-Ch4NawY-.js} +2 -2
- package/dist/viewer/assets/{embedded-DWrXFZbD.js.map → embedded-Ch4NawY-.js.map} +1 -1
- package/dist/viewer/assets/main-DUQJ1NlR.js +22 -0
- package/dist/viewer/assets/main-DUQJ1NlR.js.map +1 -0
- package/dist/viewer/assets/{panels-lazy-CUTQACqc.js → panels-lazy-DbOAvYN1.js} +3 -3
- package/dist/viewer/assets/{panels-lazy-CUTQACqc.js.map → panels-lazy-DbOAvYN1.js.map} +1 -1
- package/dist/viewer/assets/panels-ui-DICIsCag.js +12 -0
- package/dist/viewer/assets/panels-ui-DICIsCag.js.map +1 -0
- package/dist/viewer/assets/style-gOtSMZif.css +2 -0
- package/dist/viewer/index.html +4 -4
- package/dist/viewer/panels.js +1 -1
- package/package.json +3 -4
- package/scripts/browser-proof-workload.mjs +0 -1
- package/scripts/verify-runtime-content-engine.mjs +12 -6
- package/dist/modules/chunks/chunk-45ZU2HHR.mjs.map +0 -7
- package/dist/modules/chunks/chunk-7ICJKZYO.mjs.map +0 -7
- package/dist/modules/chunks/chunk-FKLYSAVN.mjs.map +0 -7
- package/dist/modules/chunks/chunk-MHE5EBU4.mjs.map +0 -7
- package/dist/modules/chunks/chunk-MO5LILCP.mjs.map +0 -7
- package/dist/viewer/assets/main-D0JG9szD.js +0 -22
- package/dist/viewer/assets/main-D0JG9szD.js.map +0 -1
- package/dist/viewer/assets/panels-ui-Kvu5G7za.js +0 -12
- package/dist/viewer/assets/panels-ui-Kvu5G7za.js.map +0 -1
- package/dist/viewer/assets/style-BM0losky.css +0 -2
- package/scripts/verify-game3d-workspace.mjs +0 -318
- /package/dist/modules/chunks/{App-E3M52XTQ.mjs.map → App-4XQ5SNNT.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-3GIGTM7E.mjs.map → chunk-27XASYEH.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-UAGQZPAB.mjs.map → chunk-2Z5KEV6L.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-4NGODRIE.mjs.map → chunk-46UEGAXY.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-UZHTLAIZ.mjs.map → chunk-47RJSHLM.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-L5EV6NEE.mjs.map → chunk-4JGCYD3Q.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-ACOMGSSB.mjs.map → chunk-5PHAXNFO.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-CRNEX7YH.mjs.map → chunk-D25SR5FS.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-PG4AJFDC.mjs.map → chunk-DJZGRO7W.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-3Q26HNFS.mjs.map → chunk-FICPCJKR.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-CWNB67UF.mjs.map → chunk-FMCHH5R4.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-2VJPRNYB.mjs.map → chunk-IZAHIOFU.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-BGK4ZEQ5.mjs.map → chunk-KX2WU5Z6.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-TBZZ37VI.mjs.map → chunk-KYTG2MKV.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-M5X56JWH.mjs.map → chunk-PW5CE2Y6.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-OHVTNEQ2.mjs.map → chunk-PZIAKZJC.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-JZ3V27HQ.mjs.map → chunk-U64FRQKP.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-W46L4HSP.mjs.map → chunk-U6UMATPV.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-7R6CGQDU.mjs.map → chunk-VW2ZF3P4.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-AIIYGGGC.mjs.map → chunk-X4NNZ5X6.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-BCTPTLA6.mjs.map → chunk-XEE3E42Q.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-CDO6LELS.mjs.map → chunk-Y2IAXE2C.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-6WCG6WPC.mjs.map → chunk-YNHEYXDG.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-7MJUWNVI.mjs.map → chunk-ZGOGO7SS.mjs.map} +0 -0
- /package/dist/modules/chunks/{chunk-VXSD4FK5.mjs.map → chunk-ZHO2G4JR.mjs.map} +0 -0
package/dist/viewer/index.html
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>ForgeaX View</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/main-
|
|
7
|
+
<script type="module" crossorigin src="/assets/main-DUQJ1NlR.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-S-ySWqyJ.js">
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/panels-lazy-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/panels-ui-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/style-
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/panels-lazy-DbOAvYN1.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/panels-ui-DICIsCag.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/style-gOtSMZif.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/dist/viewer/panels.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./assets/rolldown-runtime-S-ySWqyJ.js";import{a as t,c as n,d as r,f as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./assets/panels-ui-
|
|
1
|
+
import{n as e}from"./assets/rolldown-runtime-S-ySWqyJ.js";import{a as t,c as n,d as r,f as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./assets/panels-ui-DICIsCag.js";var h=e({mountAssetPropertiesPanel:()=>t,mountContentBrowserPanel:()=>s,mountInspectorPanel:()=>u,mountMaterialPanel:()=>m,mountMaterialPreviewPanel:()=>r,mountMaterialPropertiesPanel:()=>i,mountMeshPreviewPanel:()=>n,mountMeshPropertiesPanel:()=>o,mountPluginsPanel:()=>a,mountProfilerPanel:()=>p,mountRhiDebugPanel:()=>c,mountSceneTreePanel:()=>d,mountTexturePreviewPanel:()=>l,mountTexturePropertiesPanel:()=>f});export{t as mountAssetPropertiesPanel,s as mountContentBrowserPanel,u as mountInspectorPanel,m as mountMaterialPanel,r as mountMaterialPreviewPanel,i as mountMaterialPropertiesPanel,n as mountMeshPreviewPanel,o as mountMeshPropertiesPanel,a as mountPluginsPanel,p as mountProfilerPanel,c as mountRhiDebugPanel,d as mountSceneTreePanel,l as mountTexturePreviewPanel,f as mountTexturePropertiesPanel,h as t};
|
|
2
2
|
//# sourceMappingURL=panels.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgeax/view",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An optional display host for ForgeaX CLI runs",
|
|
6
6
|
"files": [
|
|
@@ -12,15 +12,14 @@
|
|
|
12
12
|
"scripts/browser-proof-workload.mjs",
|
|
13
13
|
"scripts/runtime-content-import.mjs",
|
|
14
14
|
"scripts/verify-runtime-content-engine.mjs",
|
|
15
|
-
"scripts/preview-rhi-evidence.mjs"
|
|
16
|
-
"scripts/verify-game3d-workspace.mjs"
|
|
15
|
+
"scripts/preview-rhi-evidence.mjs"
|
|
17
16
|
],
|
|
18
17
|
"publishConfig": {
|
|
19
18
|
"access": "public",
|
|
20
19
|
"registry": "https://registry.npmjs.org/"
|
|
21
20
|
},
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@forgeax/engine": "0.4.
|
|
22
|
+
"@forgeax/engine": "0.4.2",
|
|
24
23
|
"dockview": "^6.6.1",
|
|
25
24
|
"lucide-react": "^0.460.0",
|
|
26
25
|
"playwright": "1.63.0",
|
|
@@ -5,6 +5,5 @@ export function browserProofWorkload(lightweight = process.env.FORGEAX_BROWSER_C
|
|
|
5
5
|
gameViewport: lightweight ? { width: 1000, height: 700 } : { width: 1440, height: 900 },
|
|
6
6
|
sceneFrames: lightweight ? 60 : 300,
|
|
7
7
|
resourceCycles: lightweight ? 2 : 6,
|
|
8
|
-
shadowMapSize: lightweight ? 256 : 2048,
|
|
9
8
|
};
|
|
10
9
|
}
|
|
@@ -200,12 +200,15 @@ try {
|
|
|
200
200
|
await page.waitForURL(url => url.searchParams.has('forgeaxWorkspaceTarget'), { timeout: 90000 });
|
|
201
201
|
await page.waitForFunction(() => !!globalThis.__forgeaxViewReady?.mounted, undefined, { timeout: 90000 });
|
|
202
202
|
const contentBrowser = page.getByTestId('panel-content-browser');
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
await
|
|
206
|
-
.
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
const revealContentBrowser = async () => {
|
|
204
|
+
await contentBrowser.waitFor({ state: 'attached' });
|
|
205
|
+
if (!(await contentBrowser.isVisible())) {
|
|
206
|
+
await page.locator('.fx-view-workspace-row.is-active .dv-groupview-edge .dv-tab')
|
|
207
|
+
.filter({ hasText: /^Content Browser$/ }).click();
|
|
208
|
+
}
|
|
209
|
+
await contentBrowser.waitFor({ state: 'visible' });
|
|
210
|
+
};
|
|
211
|
+
await revealContentBrowser();
|
|
209
212
|
let state = await client.getState();
|
|
210
213
|
const readyDeadline = Date.now() + 90000;
|
|
211
214
|
while (!state.projectTarget?.worldId || state.projectTarget.worldId.startsWith('pending:')) {
|
|
@@ -385,6 +388,7 @@ try {
|
|
|
385
388
|
assert.ok(Math.abs(capture.pixels.aspect - 1.5) < 0.05);
|
|
386
389
|
await page.screenshot({ path: join(evidence, 'direct-original-ui.png') });
|
|
387
390
|
await sceneTab.click();
|
|
391
|
+
await revealContentBrowser();
|
|
388
392
|
const downloadPromise = page.waitForEvent('download');
|
|
389
393
|
await panel.getByRole('button', { name: 'Save content', exact: true }).click();
|
|
390
394
|
await (await downloadPromise).saveAs(join(evidence, 'saved-content.json'));
|
|
@@ -502,6 +506,7 @@ try {
|
|
|
502
506
|
|
|
503
507
|
phase = 'parameters';
|
|
504
508
|
await sceneTab.click();
|
|
509
|
+
await revealContentBrowser();
|
|
505
510
|
await panel.getByLabel('width', { exact: true }).fill('4');
|
|
506
511
|
await panel.getByRole('button', { name: 'Generate', exact: true }).click();
|
|
507
512
|
await page.waitForFunction(previous => {
|
|
@@ -535,6 +540,7 @@ try {
|
|
|
535
540
|
|
|
536
541
|
phase = 'persist';
|
|
537
542
|
await sceneTab.click();
|
|
543
|
+
await revealContentBrowser();
|
|
538
544
|
const downloadPromise = page.waitForEvent('download');
|
|
539
545
|
await panel.getByRole('button', { name: 'Save content', exact: true }).click();
|
|
540
546
|
const download = await downloadPromise;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/view-workspace-core/src/preview-surface.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EngineWorkspaceTarget } from '@forgeax/engine/app';\nimport type { WorkspaceTarget } from './contract.ts';\nimport type { ViewWorkspaceClient } from './client.ts';\nimport type { ViewPresentation, PreviewOwner } from './engine-presentation.ts';\nexport type PreviewSurfaceResult = { ok: true; dispose?: () => void | Promise<void> } | { ok: false; error: { code: string; expected: string; hint: string } };\nexport type PreviewSurfaceOptions = { presentation?: ViewPresentation; target?: WorkspaceTarget; container?: HTMLElement | null; canvas?: unknown; owner?: PreviewOwner; editorTargetId?: string; api?: Pick<ViewWorkspaceClient, 'resizePreview'> };\n\nimport { keepSurfaceInContainer, placeSurface, watchUntilReady } from './adopt-surface.ts';\nimport { logResourceOpen } from './resource-open.ts';\nimport { attachPreviewRenderResizeSync } from './render-resize-sync.ts';\n\nconst OWNER_PLACEMENT = 'owner';\nconst containerOwners = new WeakMap<HTMLElement, PreviewOwner>();\n\nfunction previewSurfaceError(code: string, expected: string, hint: string): Extract<PreviewSurfaceResult, { ok: false }> {\n return Object.freeze({\n ok: false,\n error: Object.freeze({ code, expected, hint }),\n });\n}\n\nfunction placementOf(presentation: ViewPresentation | undefined) {\n return presentation?.surfacePlacement === OWNER_PLACEMENT ? OWNER_PLACEMENT : 'shell';\n}\n\nfunction isCanvasNode(node: unknown): node is HTMLCanvasElement {\n return node != null && typeof node === 'object' && 'tagName' in node && typeof node.tagName === 'string' && node.tagName.toLowerCase() === 'canvas';\n}\n\nfunction isPanelContainer(node: unknown): node is HTMLElement {\n if (!node || typeof node !== 'object' || isCanvasNode(node)) return false;\n return ('replaceChildren' in node && typeof node.replaceChildren === 'function') || ('append' in node && typeof node.append === 'function');\n}\n\nfunction surfaceCanvas(surface: HTMLElement) {\n if (isCanvasNode(surface)) return surface;\n return typeof surface?.querySelector === 'function' ? surface.querySelector('canvas') : null;\n}\n\nfunction isEditorOwnerSurface(surface: HTMLElement, container: HTMLElement, { target, editorTargetId }: Pick<PreviewSurfaceOptions, 'target' | 'editorTargetId'> = {}) {\n if (surface?.id === 'app-shell' || surface?.id === 'app') return true;\n if (\n editorTargetId != null &&\n target?.targetId != null &&\n String(editorTargetId) === String(target.targetId)\n ) {\n return true;\n }\n const marker = surface?.dataset?.forgeaxViewSurface;\n if (marker === 'engine-canvas' || marker === 'engine-target') return true;\n if (typeof surface?.closest !== 'function') return false;\n const viewport = surface.closest('[data-forgeax-view-mount-host=\"viewport\"]');\n if (!viewport) return false;\n if (container === viewport || container?.contains?.(viewport)) return false;\n return true;\n}\n\nfunction adoptSurface(container: HTMLElement, surface: HTMLElement) {\n placeSurface(container, surface, { replace: true });\n}\n\nfunction fillPresentationSurface(surface: HTMLElement | null) {\n if (!surface?.style) return;\n Object.assign(surface.style, {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n transform: 'none',\n position: 'relative',\n overflow: 'hidden',\n flex: '1 1 auto',\n minWidth: '0',\n minHeight: '0',\n display: 'block',\n });\n}\n\n/**\n * Stamp a panel/page owner onto presentation. Asset pages only host the\n * Engine type-preview surface; they do not create a canvas.\n */\nexport function dedicatedPreviewPresentation(presentation: ViewPresentation | undefined, owner: PreviewOwner): ViewPresentation | undefined {\n if (!presentation || typeof presentation !== 'object') return undefined;\n return {\n get surfacePlacement() {\n return presentation.surfacePlacement;\n },\n get owner() {\n return owner ?? presentation.owner;\n },\n createSurface(input) {\n return presentation.createSurface?.(input);\n },\n attach(input) {\n return presentation.attach?.({ ...input, owner });\n },\n detach(input) {\n return presentation.detach?.(input);\n },\n };\n}\n\n/**\n * Place an Engine type-preview surface into the container owned by one asset\n * panel. The panel never creates a canvas; Engine `createSurface` returns the\n * live surface. Editor owner canvases are refused.\n *\n * @param {{\n * presentation?: object,\n * target?: { targetId?: string | number },\n * container?: HTMLElement,\n * owner?: { panelId?: string, pageType?: string },\n * editorTargetId?: string | number,\n * api?: { resizePreview?: (input: object) => Promise<unknown> },\n * }} [options]\n * @returns {{ ok: true, dispose?: () => unknown } | { ok: false, error: { code: string, expected: string, hint: string } }}\n */\nexport function bindWorkspacePreviewSurface({\n presentation,\n target,\n container,\n canvas,\n owner,\n editorTargetId,\n api,\n}: PreviewSurfaceOptions = {}): PreviewSurfaceResult {\n if (canvas !== undefined || isCanvasNode(container)) {\n throw new TypeError('bindWorkspacePreviewSurface requires a panel-owned container, not a canvas');\n }\n if (!isPanelContainer(container)) {\n throw new TypeError('bindWorkspacePreviewSurface requires a panel-owned container');\n }\n if (!target || (typeof target.targetId !== 'string' && typeof target.targetId !== 'number')) {\n return previewSurfaceError(\n 'view-preview-target-unavailable',\n 'an Engine preview target identity',\n 'Open the asset through Engine asset.open before attaching a preview surface.',\n );\n }\n if (placementOf(presentation) === OWNER_PLACEMENT) {\n return previewSurfaceError(\n 'view-preview-surface-unavailable',\n 'a shell-placed Engine preview surface dedicated to this panel',\n 'The Engine owner surface stays on the Editor viewport; asset preview cannot relocate that iframe.',\n );\n }\n if (!presentation || typeof presentation.createSurface !== 'function') {\n return previewSurfaceError(\n 'view-preview-surface-unavailable',\n 'an Engine presentation that can create a type-preview surface',\n 'The asset tab hosts a DOM container; Engine createSurface places the live canvas into it.',\n );\n }\n const surfaceOwner = owner ?? presentation.owner;\n if (!surfaceOwner?.panelId || !surfaceOwner?.pageType) {\n return previewSurfaceError(\n 'view-preview-owner-unavailable',\n 'a stable asset preview panel owner',\n 'Bind the preview through its PageType panel contribution.',\n );\n }\n const claimedBy = containerOwners.get(container);\n if (claimedBy !== undefined && claimedBy !== surfaceOwner) {\n return previewSurfaceError(\n 'view-preview-canvas-owned',\n 'a container used by exactly one asset preview panel',\n 'Create a new container for this asset preview panel.',\n );\n }\n\n const missingSurface = () => previewSurfaceError(\n 'view-preview-surface-unavailable',\n 'an Engine type-preview surface for this target',\n 'Engine must expose a type-preview surface via createSurface; the tab does not create a canvas.',\n );\n const refuseEditor = () => previewSurfaceError(\n 'view-preview-surface-unavailable',\n 'a shell-placed Engine preview surface dedicated to this panel',\n 'The Engine owner surface stays on the Editor viewport; asset preview cannot relocate that iframe.',\n );\n\n const resolveSurface = () => {\n const surface = presentation.createSurface!({\n target: target as EngineWorkspaceTarget,\n document: container.ownerDocument,\n });\n return surface && typeof surface === 'object' && 'tagName' in surface && typeof surface.tagName === 'string' ? surface as HTMLElement : null;\n };\n\n const installSurface = (surface: HTMLElement): Extract<PreviewSurfaceResult, { ok: true }> => {\n containerOwners.set(container, surfaceOwner);\n container.dataset.forgeaxPreviewPanel = surfaceOwner.panelId;\n container.dataset.forgeaxPreviewPage = surfaceOwner.pageType;\n container.dataset.forgeaxAssetPreview = String(target.targetId);\n adoptSurface(container, surface);\n fillPresentationSurface(surface);\n const canvasNode = surfaceCanvas(surface);\n fillPresentationSurface(canvasNode);\n const resizeTarget = Number.isSafeInteger(target.generation)\n ? { targetId: String(target.targetId), generation: target.generation }\n : null;\n const detachResize = resizeTarget && api\n ? attachPreviewRenderResizeSync({ api, surface: container, target: resizeTarget })\n : () => {};\n if (canvasNode?.dataset) {\n canvasNode.dataset.forgeaxAssetPreview = String(target.targetId);\n canvasNode.dataset.forgeaxPreviewPanel = surfaceOwner.panelId;\n canvasNode.dataset.forgeaxPreviewPage = surfaceOwner.pageType;\n }\n logResourceOpen('preview-surface-hosted', {\n pageType: surfaceOwner.pageType,\n panelId: surfaceOwner.panelId,\n targetId: String(target.targetId),\n surfaceTag: surface.tagName ?? null,\n });\n const attachment = typeof presentation.attach === 'function'\n ? Promise.resolve(presentation.attach({ target: target as EngineWorkspaceTarget, element: surface, owner: surfaceOwner }))\n : Promise.resolve();\n const stopKeep = keepSurfaceInContainer({\n document: container.ownerDocument,\n getContainer: () => container,\n getSurface: () => surface,\n replace: true,\n });\n return {\n ok: true,\n dispose: async () => {\n stopKeep();\n detachResize();\n // React may bind this same Engine surface again before detach resolves.\n // Release this placement synchronously so old cleanup cannot remove it.\n if (surface.parentNode === container) {\n if (typeof container.removeChild === 'function') container.removeChild(surface);\n else container.replaceChildren?.();\n }\n if (containerOwners.get(container) === surfaceOwner) containerOwners.delete(container);\n delete container.dataset.forgeaxPreviewPanel;\n delete container.dataset.forgeaxPreviewPage;\n delete container.dataset.forgeaxAssetPreview;\n const detach = await attachment;\n await detach?.();\n },\n };\n };\n\n const first = resolveSurface();\n if (first) {\n if (isEditorOwnerSurface(first, container, { target, editorTargetId })) return refuseEditor();\n return installSurface(first);\n }\n\n const document = container.ownerDocument;\n const win = document?.defaultView ?? globalThis;\n const Observer = document?.defaultView?.MutationObserver ?? globalThis.MutationObserver;\n const canWatch = typeof Observer === 'function' || typeof win.requestAnimationFrame === 'function';\n if (!canWatch) return missingSurface();\n\n let hosted: Extract<PreviewSurfaceResult, { ok: true }> | undefined;\n const stopWatch = watchUntilReady({\n document,\n probe: () => {\n if (hosted) return true;\n const surface = resolveSurface();\n if (!surface || isEditorOwnerSurface(surface, container, { target, editorTargetId })) return false;\n hosted = installSurface(surface);\n return true;\n },\n });\n return {\n ok: true,\n dispose: async () => {\n stopWatch();\n await hosted?.dispose?.();\n },\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAWA,IAAM,kBAAkB;AACxB,IAAM,kBAAkB,oBAAI,QAAmC;AAE/D,SAAS,oBAAoB,MAAc,UAAkB,MAA4D;AACvH,SAAO,OAAO,OAAO;AAAA,IACnB,IAAI;AAAA,IACJ,OAAO,OAAO,OAAO,EAAE,MAAM,UAAU,KAAK,CAAC;AAAA,EAC/C,CAAC;AACH;AAEA,SAAS,YAAY,cAA4C;AAC/D,SAAO,cAAc,qBAAqB,kBAAkB,kBAAkB;AAChF;AAEA,SAAS,aAAa,MAA0C;AAC9D,SAAO,QAAQ,QAAQ,OAAO,SAAS,YAAY,aAAa,QAAQ,OAAO,KAAK,YAAY,YAAY,KAAK,QAAQ,YAAY,MAAM;AAC7I;AAEA,SAAS,iBAAiB,MAAoC;AAC5D,MAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,aAAa,IAAI,EAAG,QAAO;AACpE,SAAQ,qBAAqB,QAAQ,OAAO,KAAK,oBAAoB,cAAgB,YAAY,QAAQ,OAAO,KAAK,WAAW;AAClI;AAEA,SAAS,cAAc,SAAsB;AAC3C,MAAI,aAAa,OAAO,EAAG,QAAO;AAClC,SAAO,OAAO,SAAS,kBAAkB,aAAa,QAAQ,cAAc,QAAQ,IAAI;AAC1F;AAEA,SAAS,qBAAqB,SAAsB,WAAwB,EAAE,QAAQ,eAAe,IAA8D,CAAC,GAAG;AACrK,MAAI,SAAS,OAAO,eAAe,SAAS,OAAO,MAAO,QA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