MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / renderWidgetScreen

Function renderWidgetScreen

scripts/hsr/widget-view.mjs:427–492  ·  view source on GitHub ↗
(state, handlers)

Source from the content-addressed store, hash-verified

425}
426
427export function renderWidgetScreen(state, handlers) {
428 const viewport = normalizeViewport(state.viewport);
429 const layoutMode = resolveWidgetDemoLayout(viewport);
430 const status = normalizeStatus(state.selfEditStatus);
431 const modal = normalizeModal(state.feedbackModal);
432 const feed = normalizeFeed(state.activityFeed);
433 const trapVersion =
434 typeof state.focusTrapVersion === "number" && Number.isFinite(state.focusTrapVersion)
435 ? Math.max(0, Math.floor(state.focusTrapVersion))
436 : 0;
437 const trapInitialFocus =
438 typeof state.focusTrapInitialFocus === "string" && state.focusTrapInitialFocus.length > 0
439 ? state.focusTrapInitialFocus
440 : CODE_EDITOR_ID;
441
442 const editorPanel = renderEditorPanel(state, handlers, layoutMode, viewport, status, feed);
443 const formPanel = renderFormPanel(state, handlers, layoutMode);
444 const counterPanel = renderCounterPanel(state, handlers);
445 const runbookPanel = renderRunbookPanel();
446 const body = renderBody(layoutMode, editorPanel, formPanel, counterPanel, runbookPanel);
447
448 const footer = ui.row({ gap: 1, wrap: true, items: "center" }, [
449 ui.text(`Viewport ${String(viewport.cols)}x${String(viewport.rows)} (${layoutMode})`, {
450 style: { fg: palette.muted },
451 }),
452 ui.kbd("Tab"),
453 ui.kbd("Shift+Tab"),
454 ui.kbd("Esc"),
455 ui.kbd("Enter"),
456 ui.kbd("F6"),
457 ui.kbd("q"),
458 ui.kbd("F10"),
459 ]);
460
461 const page = ui.page({
462 p: 1,
463 gap: 1,
464 header: renderHeader(state, layoutMode),
465 body,
466 footer,
467 });
468
469 const frame = ui.box(
470 {
471 border: "single",
472 p: 0,
473 width: "full",
474 height: "full",
475 style: { fg: palette.ink, bg: palette.frame },
476 },
477 [ui.box({ width: "full", height: "full", style: { fg: palette.ink, bg: palette.bg } }, [page])],
478 );
479
480 const trapped = ui.focusTrap(
481 {
482 id: `widget-hsr-focus-trap-${String(trapVersion)}`,
483 active: true,
484 initialFocus: trapInitialFocus,

Callers

nothing calls this directly

Calls 12

normalizeViewportFunction · 0.90
resolveWidgetDemoLayoutFunction · 0.90
normalizeStatusFunction · 0.85
normalizeModalFunction · 0.85
normalizeFeedFunction · 0.85
renderEditorPanelFunction · 0.85
renderFormPanelFunction · 0.85
renderCounterPanelFunction · 0.85
renderRunbookPanelFunction · 0.85
renderBodyFunction · 0.85
renderHeaderFunction · 0.85
renderFeedbackModalFunction · 0.85

Tested by

no test coverage detected