From d3b099ea01843c7e4c9dbe62469533229b0df4bc Mon Sep 17 00:00:00 2001 From: Rohan Date: Tue, 17 Nov 2026 12:30:14 +0530 Subject: [PATCH 1/3] feat(workbench): add sectioned Explorer and activity rail --- README.md | 2 + docs/architecture/workbench-layout.md | 6 +- docs/design-system.md | 2 +- docs/verification.md | 6 + src/lib/ui/tools.css | 29 +++- src/lib/ui/workbench.css | 15 ++ src/lib/workbench/explorer/Explorer.tsx | 21 +-- .../workbench/explorer/ExplorerSection.tsx | 49 +++++++ src/lib/workbench/explorer/ModelTree.tsx | 15 +- src/lib/workbench/shell/ActivityRail.tsx | 29 ++++ src/lib/workbench/shell/WorkbenchPanels.tsx | 49 +++++-- tests/e2e/explorer-sections.spec.ts | 130 ++++++++++++++++++ tests/e2e/visual.spec.ts | 46 +++++++ .../explorer-model-dark-1440-visual-linux.png | Bin 0 -> 111693 bytes .../explorer-model-dark-390-visual-linux.png | Bin 0 -> 54943 bytes ...explorer-model-light-1440-visual-linux.png | Bin 0 -> 110800 bytes .../explorer-model-light-390-visual-linux.png | Bin 0 -> 54539 bytes ...plorer-sections-dark-1440-visual-linux.png | Bin 0 -> 96614 bytes ...xplorer-sections-dark-390-visual-linux.png | Bin 0 -> 62907 bytes ...lorer-sections-light-1440-visual-linux.png | Bin 0 -> 95529 bytes ...plorer-sections-light-390-visual-linux.png | Bin 0 -> 61720 bytes 21 files changed, 366 insertions(+), 33 deletions(-) create mode 100644 src/lib/workbench/explorer/ExplorerSection.tsx create mode 100644 src/lib/workbench/shell/ActivityRail.tsx create mode 100644 tests/e2e/explorer-sections.spec.ts create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-model-dark-1440-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-model-dark-390-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-model-light-1440-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-model-light-390-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-sections-dark-1440-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-sections-dark-390-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-sections-light-1440-visual-linux.png create mode 100644 tests/e2e/visual.spec.ts-snapshots/explorer-sections-light-390-visual-linux.png diff --git a/README.md b/README.md index ee20acf..f9e713a 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ OpenMBEE View Editor brings source editing, named model views and reviewed graph

Inspection rover: connected assemblies, declared component values and typed interfaces.

+Explorer has independent Files, Views and Model sections. Fold a section to make room without losing its state; the Explorer activity button at the left edge toggles the sidebar. New view and model expand/collapse actions remain separate from section toggles. Diagram selection reveals the Model owner chain without moving keyboard focus away from the diagram. Section expansion lasts for the current session and is not saved in project files. + ## Features - **Edit highlighted SysML source.** CodeMirror provides line numbers, bracket matching/closing, indentation, find/replace and draft undo/redo. Apply or discard changes, undo/redo accepted source transactions, and keep the last valid model when a draft fails validation. diff --git a/docs/architecture/workbench-layout.md b/docs/architecture/workbench-layout.md index 8cb60cd..e887e5f 100644 --- a/docs/architecture/workbench-layout.md +++ b/docs/architecture/workbench-layout.md @@ -75,7 +75,9 @@ Apply and Download retain visible labels; frequent compact actions retain precis Navigation follows the [WAI-ARIA tree pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/): arrows move through visible rows and fold/unfold branches, Home/End reach the visible extremes, typed prefixes find visible names, and Enter/Space select the focused declaration. Focus and selection are separate. One treeitem participates in Tab order; shared focus styling distinguishes it from the inspected row. -Diagram selection opens the selected declaration's owner chain without taking focus from the diagram. A UI request counter handles a second selection of the same symbol after its branch has been folded. These are reveal requests, not semantic revisions or identity reconciliation. Selecting a tree row retains the existing Inspector behavior; source-range reveal still requires diagram correspondence. Expansion is not portable project data or automatic work recovery. +ExplorerSection owns independent session-only Files/Views/Model disclosure state. Section bodies stay mounted while hidden/inert, preserving tree expansion and focus state. New view and tree-wide actions are separate header targets. ActivityRail exposes only the implemented Explorer destination and delegates visibility to the existing panel controller; it owns no layout preferences. It replaces the adjacent collapsed Explorer rail, retaining the Inspector reopen control. Existing sidebar visibility preferences and `sysml-workbench-layout-v1` remain unchanged. + +Diagram selection opens the Model section and the selected declaration's owner chain without taking focus from the diagram. A UI request counter handles a second selection of the same symbol after its branch has been folded. These are reveal requests, not semantic revisions or identity reconciliation. Selecting a tree row retains the existing Inspector behavior; source-range reveal still requires diagram correspondence. Expansion is not portable project data or automatic work recovery. ## Entry and session lifetime @@ -83,4 +85,4 @@ The public landing lives at `/`; `/app` starts with a project launcher. Source/d ## Shell code ownership -`Workbench.tsx` retains the live session, project-opening validation, selection and reviewed-command orchestration. `ProjectHeader.tsx` and `SourceToolbar.tsx` render shell controls through explicit callbacks. `projectFiles.ts` owns local bundle construction, file reading and browser download preparation; workspace validation and saved-state tracking retain their existing contracts. Panel controls and preferences remain in `WorkbenchPanels.tsx` and `layout.ts`. Surface CSS is imported through `ui/theme.css`; see the [design-system ownership table](../design-system.md#ownership). +`Workbench.tsx` retains the live session, project-opening validation, selection and reviewed-command orchestration. `ProjectHeader.tsx`, `WorkspaceToolbar.tsx`, `SourcePaneHeader.tsx` and `ModelPaneHeader.tsx` render shell controls through explicit callbacks. `projectFiles.ts` owns local bundle construction, file reading and browser download preparation; workspace validation and saved-state tracking retain their existing contracts. Panel controls and preferences remain in `WorkbenchPanels.tsx` and `layout.ts`. Surface CSS is imported through `ui/theme.css`; see the [design-system ownership table](../design-system.md#ownership). diff --git a/docs/design-system.md b/docs/design-system.md index bbf1a3b..fd3c251 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -63,7 +63,7 @@ This is a working foundation, not a claim of complete keyboard/screen-reader cer Resizable, Tooltip and Popover are owned official registry primitives. `react-resizable-panels` 4.14.8 supplies resizing; the existing Radix package supplies popover/tooltip behavior. `ui/IconButton.tsx` composes the shared Button and Tooltip rather than introducing a second button style. Icons use Lucide and decorative SVGs remain hidden from accessibility names. Apply and Download keep visible labels. -The global arrangement bar selects Source only, Source + Model or Model only with CodeXml/Columns2/Layers icons, explicit tooltips and mutually exclusive pressed states. It is separate from Model representation. Pane-local Source controls use the existing buttons and tokens, keep Apply/Discard labeled, and wrap based on actual pane width. The active filename’s draft badge is per-file; the adjacent transaction status and Apply/Discard remain workspace-scoped. The Model header uses Network/Table2/Grid3X3 with visible representation labels and retains separate applied/draft/busy status. Diagram target and authoring controls occur once; data representations state project scope. Activity-rail and broader integration remain staged in the [product design](design/workbench-product-decisions.md). +The global arrangement bar selects Source only, Source + Model or Model only with CodeXml/Columns2/Layers icons, explicit tooltips and mutually exclusive pressed states. It is separate from Model representation. Pane-local Source controls use the existing buttons and tokens, keep Apply/Discard labeled, and wrap based on actual pane width. The active filename’s draft badge is per-file; the adjacent transaction status and Apply/Discard remain workspace-scoped. The Model header uses Network/Table2/Grid3X3 with visible representation labels and retains separate applied/draft/busy status. Diagram target and authoring controls occur once; data representations state project scope. The sparse 48 px activity rail contains only Explorer, with a persistent active border distinct from keyboard focus. Files/Views/Model use Folder/Network/ListTree identities and independent disclosure buttons. Header actions remain separate. Final responsive integration follows the [product design](design/workbench-product-decisions.md). Tool headers, dividers, collapse controls and preference handling live in the workbench, outside semantic workspace state. Focus transfer follows committed visibility, hidden tools are inert, and panel geometry is a browser preference. See [panel contracts](architecture/workbench-layout.md). diff --git a/docs/verification.md b/docs/verification.md index 600816a..90828a5 100644 --- a/docs/verification.md +++ b/docs/verification.md @@ -1,5 +1,11 @@ # Verification record +## Product design stage 3 — sectioned Explorer (#43) + +Recorded 2026-11-17 on `feature/product-design-explorer`, based on #42 commit `e4a4ad9`. ExplorerSection keeps Files/Views/Model mounted while independently hidden/inert. ModelTree retains its own expansion/roving-focus state and opens the section on diagram reveal requests. ActivityRail offers only Explorer and delegates to the existing panel controller. No semantic, engine, bundle, dependency or layout-storage schema changes. + +The new preservation regression failed against the old UI because no Workspace activities rail existed (`sandbox/product-design-explorer/red.log`). Both initial functional cases pass (`green-final.log`): exact draft/bundle/camera and tree expansion survive collapse/reopen, and diagram selection reveals the owner chain without taking focus. An initial typecheck caught an unused import and an over-broad ID edit; both were corrected before browser acceptance. Existing model-tree, panel and guide checks are recorded in `focused-*.log`. The initial phone inspection regression exposed an actual constraint deadlock: the new 48 px activity rail plus Inspector’s still-mounted 32 px reopen rail left insufficient width for expansion. A one-variable 32 px activity-rail control passed (`phone-width-probe.log`). The controller now commits the opening state to release the reopen rail before allocating panel width; focus transfer waits for that allocation. Both original phone scenarios pass at 48 px (`phone-open-fixed.log`). Existing preference keys and minimum sizes are unchanged. Post-fix panel confirmation passes the full resize/preservation case, keyboard size restoration/reset, Issues-on-failure, denied storage and corrupt narrow preferences (`panels-final.log`, `collapse-final.log`, `panel-remainder.log`); the interrupted aggregate log is retained and is not counted as a complete run. All three section/rail cases pass after the fix (`sections-confirmed.log`), including separate New view activation/cancellation and phone focus return. The first phone setup timed out in the legacy sidebar-based helper; establishing its fixture at desktop width before testing the narrow transition corrected that assumption (`sections-final.log` retains the failure). Four new visual scenarios pass (`visual-generated.log`); all eight expanded-section/model-tree captures at 1440/390 light/dark were inspected, with exact hashes in `inspected-visuals.json`. `npm run check` passes 179 unit tests, ten script tests, formatting, architecture and TypeScript (`check-final.log`). Broad normal visual comparisons remain deferred to the integrated #44 pass. Broad integrated baselines are refreshed with #44 so the navigation and responsive commits remain individually reviewable without two complete baseline refreshes. This is local evidence, not hosted approval or deployment. + ## Product design stage 2 — composed Model header (#42) Recorded 2026-11-16 on `feature/product-design-model-header`, based on #41’s merged develop commit `7a1661e`. ModelPaneHeader composes the existing representation state and one DiagramTargetControls set. The latter retains named-view/exploration handlers and focus refs; controls remain mounted but hidden/inert for data representations. Diagram keeps its existing key, mounted renderer, layout/selection/camera behavior, canvas controls and local arranging/failure reports. No engine, dependency, semantic workspace or saved-format changes. diff --git a/src/lib/ui/tools.css b/src/lib/ui/tools.css index 104d2e7..726074d 100644 --- a/src/lib/ui/tools.css +++ b/src/lib/ui/tools.css @@ -6,7 +6,7 @@ padding: 18px 10px; } .explorer section + section { - margin-top: 28px; + margin-top: 16px; } .explorer h2 { font-size: 11px; @@ -17,8 +17,31 @@ } .section-heading { display: flex; - align-items: baseline; + align-items: center; justify-content: space-between; + flex-wrap: wrap; + gap: 2px; +} +.explorer-section > .section-heading > h2 { + margin: 0; + min-width: 0; +} +.explorer-section > .section-heading > h2 > button { + font-size: 11px; + font-weight: 600; + gap: 5px; + white-space: nowrap; +} +.explorer-section > .section-heading > h2 > button > svg { + width: 14px; + height: 14px; + flex-shrink: 0; +} +.explorer-section .section-heading .expanded { + transform: rotate(90deg); +} +.explorer-section > [hidden] { + display: none; } .explorer button { display: flex; @@ -270,7 +293,7 @@ .model-tree-actions { display: flex; gap: 2px; - margin-bottom: 8px; + margin-left: auto; } .model-tree-actions button { width: 24px; diff --git a/src/lib/ui/workbench.css b/src/lib/ui/workbench.css index ddcbd3e..ea6d124 100644 --- a/src/lib/ui/workbench.css +++ b/src/lib/ui/workbench.css @@ -126,6 +126,21 @@ padding-top: 4px; background: var(--sysml-surface); } +.activity-rail { + display: flex; + flex: 0 0 48px; + width: 48px; + align-items: center; + flex-direction: column; + padding-top: 4px; + background: var(--sysml-surface); + border-right: 1px solid var(--sysml-border); +} +.activity-rail button[aria-pressed='true'] { + background: var(--sysml-active-bg); + color: var(--sysml-active-text); + border-left: 3px solid currentColor; +} @container (max-width: 410px) { .source-command-grid { display: flex; diff --git a/src/lib/workbench/explorer/Explorer.tsx b/src/lib/workbench/explorer/Explorer.tsx index 8df1333..250471a 100644 --- a/src/lib/workbench/explorer/Explorer.tsx +++ b/src/lib/workbench/explorer/Explorer.tsx @@ -1,5 +1,6 @@ import { Button } from '$lib/ui/primitives/button'; -import { Eye, FileCode2 } from 'lucide-react'; +import { Eye, FileCode2, Folder, Network, Plus } from 'lucide-react'; +import { ExplorerSection } from './ExplorerSection'; import { ModelTree } from './ModelTree'; import type { WorkspaceState } from '$lib/workspace/createWorkspace'; import type { ModelElement } from '$lib/workspace/project'; @@ -26,8 +27,7 @@ export function Explorer({ state.model?.elements.filter((item) => item.kind === 'viewUsage') ?? []; return (