推进 INI 面板 shell handoff mount workflow helper
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
isSupportedIniPanelLaunchApiManifest,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
mountIniPanelShellSessionHandoff,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
} from "./ui-shell.js";
|
||||
|
||||
@@ -191,6 +192,12 @@
|
||||
renderShellSessionHandoffMountState: (renderState, options) => (
|
||||
renderIniPanelShellSessionHandoffMountState(renderState, options ?? { documentRef: document })
|
||||
),
|
||||
mountShellSessionHandoff: (options) => (
|
||||
mountIniPanelShellSessionHandoff(options ?? {
|
||||
renderState: shellViewModel.shellSessionHandoffPackageMountRenderState,
|
||||
documentRef: document,
|
||||
})
|
||||
),
|
||||
isSupportedShellSessionHandoffPackage: shellViewModel.isSupportedShellSessionHandoffPackage,
|
||||
getLauncherLinks: () => shellViewModel.launcherLinks,
|
||||
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
|
||||
|
||||
@@ -146,6 +146,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffMountDomContract",
|
||||
"getShellSessionHandoffMountDomReadiness",
|
||||
"renderShellSessionHandoffMountState",
|
||||
"mountShellSessionHandoff",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
@@ -1195,6 +1196,73 @@ export function renderIniPanelShellSessionHandoffMountState(
|
||||
};
|
||||
}
|
||||
|
||||
export function mountIniPanelShellSessionHandoff({
|
||||
renderState = createIniPanelShellSessionHandoffPackageMountRenderState(),
|
||||
rowDatasetPrefix = "handoffMount",
|
||||
contract = createIniPanelShellSessionHandoffMountDomContract({ rowDatasetPrefix }),
|
||||
documentRef = globalThis.document,
|
||||
mountNode = documentRef?.querySelector?.(contract.selectors.mount),
|
||||
statusNode = documentRef?.querySelector?.(contract.selectors.status),
|
||||
rowsNode = documentRef?.querySelector?.(contract.selectors.rows),
|
||||
} = {}) {
|
||||
const domReadiness = createIniPanelShellSessionHandoffMountDomReadiness({
|
||||
contract,
|
||||
documentRef,
|
||||
mountNode,
|
||||
statusNode,
|
||||
rowsNode,
|
||||
});
|
||||
if (!domReadiness.ready) {
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-workflow",
|
||||
workflowVersion: 1,
|
||||
phase: "blocked",
|
||||
ready: false,
|
||||
statusLine: `Blocked: ${domReadiness.missing.join(", ")}`,
|
||||
contract,
|
||||
domReadiness,
|
||||
renderState,
|
||||
renderResult: null,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const renderResult = renderIniPanelShellSessionHandoffMountState(renderState, {
|
||||
contract,
|
||||
documentRef,
|
||||
mountNode,
|
||||
statusNode,
|
||||
rowsNode,
|
||||
});
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-workflow",
|
||||
workflowVersion: 1,
|
||||
phase: renderState?.ready ? "ready" : "blocked",
|
||||
ready: renderState?.ready === true,
|
||||
statusLine: renderResult.statusLine,
|
||||
contract,
|
||||
domReadiness,
|
||||
renderState,
|
||||
renderResult,
|
||||
error: null,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-workflow",
|
||||
workflowVersion: 1,
|
||||
phase: "blocked",
|
||||
ready: false,
|
||||
statusLine: `Blocked: ${error?.message ?? "mount workflow error"}`,
|
||||
contract,
|
||||
domReadiness,
|
||||
renderState,
|
||||
renderResult: null,
|
||||
error: error?.message ?? String(error),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -1312,6 +1380,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffMountDomContract: createIniPanelShellSessionHandoffMountDomContract,
|
||||
createShellSessionHandoffMountDomReadiness: createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
renderShellSessionHandoffMountState: renderIniPanelShellSessionHandoffMountState,
|
||||
mountShellSessionHandoff: mountIniPanelShellSessionHandoff,
|
||||
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
|
||||
Reference in New Issue
Block a user