推进 INI 面板 shell handoff render-state
This commit is contained in:
@@ -132,6 +132,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffCompatibilityReport",
|
||||
"getShellSessionHandoffDisplayViewModel",
|
||||
"getShellSessionHandoffSnapshot",
|
||||
"getShellSessionHandoffRenderState",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
],
|
||||
@@ -553,6 +554,40 @@ export function createIniPanelShellSessionHandoffSnapshot({
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffRenderState(
|
||||
snapshot = createIniPanelShellSessionHandoffSnapshot(),
|
||||
) {
|
||||
const displayViewModel = snapshot?.displayViewModel && typeof snapshot.displayViewModel === "object"
|
||||
? snapshot.displayViewModel
|
||||
: createIniPanelShellSessionHandoffDisplayViewModel(snapshot?.compatibilityReport);
|
||||
const rows = Array.isArray(displayViewModel.rows)
|
||||
? displayViewModel.rows.map(({ id, label, value }) => ({
|
||||
id,
|
||||
label,
|
||||
value: value == null ? "" : String(value),
|
||||
}))
|
||||
: [];
|
||||
const ready = snapshot?.ready === true && displayViewModel.phase === "ready";
|
||||
const statusText = displayViewModel.statusText ?? (ready ? "Ready" : "Blocked");
|
||||
const detailText = displayViewModel.detailText ?? "No blocking reasons";
|
||||
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-render-state",
|
||||
renderStateVersion: 1,
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
title: displayViewModel.title ?? "Shell handoff compatibility",
|
||||
statusText,
|
||||
detailText,
|
||||
statusLine: `${statusText}: ${detailText}`,
|
||||
rows,
|
||||
dataset: {
|
||||
handoffPhase: ready ? "ready" : "blocked",
|
||||
handoffReady: ready ? "true" : "false",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -577,6 +612,9 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
compatibilityReport: shellSessionHandoffCompatibilityReport,
|
||||
displayViewModel: shellSessionHandoffDisplayViewModel,
|
||||
});
|
||||
const shellSessionHandoffRenderState = createIniPanelShellSessionHandoffRenderState(
|
||||
shellSessionHandoffSnapshot,
|
||||
);
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -593,6 +631,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffCompatibilityReport,
|
||||
shellSessionHandoffDisplayViewModel,
|
||||
shellSessionHandoffSnapshot,
|
||||
shellSessionHandoffRenderState,
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -604,6 +643,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffCompatibilityReport: createIniPanelShellSessionHandoffCompatibilityReport,
|
||||
createShellSessionHandoffDisplayViewModel: createIniPanelShellSessionHandoffDisplayViewModel,
|
||||
createShellSessionHandoffSnapshot: createIniPanelShellSessionHandoffSnapshot,
|
||||
createShellSessionHandoffRenderState: createIniPanelShellSessionHandoffRenderState,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
browserApiManifest: createControlPageBrowserApiManifest(),
|
||||
|
||||
Reference in New Issue
Block a user