Skip to content

Latest commit

 

History

History
212 lines (183 loc) · 12.9 KB

engineering-ui.md

File metadata and controls

212 lines (183 loc) · 12.9 KB

EngineeringUI

Status: current for the M6 foundation (theme, icons, navigation, workspace, EuiDialog, EuiNumberInput, EuiPropertyInspector, Storybook), the M7 drawing utilities and the M8 charts components (proof of concept, graphing §7); proposed for the rest (data grid, drawing components, further controls). Package rules for contributors are in packages/engineering-ui/AGENTS.md. Navigation: index · frontend · UI guidelines · ADR 0012.

EngineeringUI is a reusable Vue 3 component library for engineering desktop applications: GElectrical first, then GEstimator and future applications. It starts as a local npm workspace package inside this repository and is designed so it can move to its own repository without changing its public interface.

1. Boundaries

EngineeringUI may:

  • Render typed data received through props and emit typed events.
  • Own presentation state (focus, hover, open/closed, local drag preview).
  • Provide theme tokens, icons, layout, controls, dialogs, data grid, charts, drawing viewport utilities and generic composables.
  • Wrap third-party libraries (Quasar, Tabulator, ECharts) behind stable component APIs.

EngineeringUI must not:

  • Import anything from modern/, gelectrical/ or GEstimator.
  • Know backend method names, session IDs, revisions or project schemas.
  • Call Tauri APIs directly. Native capabilities are injected through interfaces (for example a ClipboardAdapter or FileDialogAdapter).
  • Hold global application state or singletons other than theme registration.
  • Perform engineering calculations or validation. A unit-aware input formats and parses display text; validation messages come from the host.

2. Package layout and exports

packages/engineering-ui/
├── package.json            # name "@kavilgroup/engineering-ui", licence MIT
├── src/
│   ├── theme/              # tokens.css, quasar-bridge.css, controls.css, useTheme()
│   ├── icons/              # EuiIcon + local SVG icon set (24-unit grid)
│   ├── controls/           # EuiNumberInput (units), EuiChoiceCards (picture cards), EuiDropdowns
│   ├── dialogs/            # EuiDialog, EuiSettingsLayout (page rail, search, changed filter)
│   ├── navigation/         # EuiHeaderBar, EuiApplicationMenu, EuiRibbon (commands, choice menus, status read-out panels with detail lines), EuiCommandPalette, EuiDocumentRail
│   ├── workspace/          # EuiWorkspace (panels/splitters), EuiStatusBar, EuiNotifications
│   ├── datagrid/           # EuiDataGrid (Tabulator adapter), cell navigation helpers
│   ├── inspectors/         # EuiPropertyInspector (schema-driven; image fields, defaults and reset), EuiResultList, EuiMessageList
│   ├── charts/             # EuiChart (ECharts adapter), EuiLogLogPlot, EuiCurveEditor, EuiSeriesChart
│   ├── drawing/            # viewport (zoom/pan), grid, snapping, selection, SVG symbol sprite
│   ├── composables/        # useShortcuts, useResizeObserver, useFocusTrap, useKeyboardList
│   └── index.ts            # root export: theme + icons + types only
├── .storybook/
├── stories/
├── tests/                  # Vitest component tests
├── README.md, AGENTS.md

Subpath exports keep heavy dependencies optional:

Import path Peer dependencies
@kavilgroup/engineering-ui vue
@kavilgroup/engineering-ui/theme, @kavilgroup/engineering-ui/icons, /composables vue
@kavilgroup/engineering-ui/navigation, /workspace vue (toolkit-independent since M6)
@kavilgroup/engineering-ui/controls, /dialogs, /inspectors vue, quasar
@kavilgroup/engineering-ui/datagrid vue, tabulator-tables
@kavilgroup/engineering-ui/charts vue, echarts (since M8; ECharts registered tree-shaken in charts/echarts.ts)
@kavilgroup/engineering-ui/drawing none (plain TypeScript utilities since M7; components will need vue)

Peer dependencies are declared as optional where a subpath does not need them. A host that never imports charts never loads ECharts. The global stylesheet is @kavilgroup/engineering-ui/style.css; exports carry a source condition for development inside the workspace (ADR 0017).

3. Component API conventions

  • Props in, events out. v-model only for simple values.
  • Typed props with exported TypeScript interfaces (EuiFieldSchema, EuiCurveSeries, EuiRibbonGroup, ...).
  • No backend-specific naming: an inspector receives fields: EuiFieldSchema[] and values, emits change(code, rawText | value) and shows errors passed in.
  • Keyboard first: every interactive component supports keyboard operation and visible focus; documented in its story.
  • Styling through tokens (CSS custom properties). Components never hard-code colours or sizes; compact density is the default.
  • Each component is small and has separate template, script and style blocks.

4. Theme and tokens

  • theme/tokens.css defines semantic tokens: surfaces (frame, panel, field, workspace), text, borders, accent (warm amber, Open Planner Studio reference), selection, focus ring, semantic states (success, warning, danger, info), schematic colours (normal, inactive, selected, warning, grid, overlay), chart palette, spacing, radii, font families and sizes.
  • Light, dark and system themes switch by attribute on the root element (data-theme), mapped onto Quasar's Dark plugin and --q-* brand variables by theme/quasar-bridge.css.
  • theme/controls.css (current) holds the shared native control classes, adapted from GEstimator's shared style.css rules: eui-input (text fields, selects, list boxes and text areas, with --block and --mono variants, dashed read-only and aria-invalid states), eui-search (icon plus borderless input), eui-check (16 px checkbox or radio aligned with the first label line), eui-fieldset (--row, --plain), eui-section-title, eui-hint, eui-empty, eui-text-error, eui-text-warning, eui-kbd and eui-table (--plain, eui-numeric cells). They are opt-in classes, not element selectors, so a host page keeps its own defaults. Components and app views use them instead of local copies; the Theme/Controls story shows each in both themes.
  • Tooltips and value lists (current) follow GEstimator. EuiTooltips, mounted once, shows a themed panel (raised surface, border, shadow) for any element with data-tooltip, on hover after 300 ms and immediately on keyboard focus: the accessible name (or data-tooltip-heading) as heading, the help as detail, linked with aria-describedby. Components use data-tooltip, never title. EuiDropdowns, mounted once, replaces the platform popup of single-value select.eui-input controls with an anchored, field-width listbox (groups, disabled options, arrows, Home/End, type-to-select, Enter/Space, Escape without closing the dialog, Tab). The Quasar bridge gives QSelect/QMenu options the same states (hover or keyboard: soft amber with an amber outline; chosen value: amber text) and QTooltip the same surface. --eui-z-popup (6100) keeps lists above Quasar dialogs.
  • No icon font is loaded: bindQuasarIcons($q) (current, M9) installs an iconMapFn with SVG paths for the Material names Quasar components use internally (select arrow, tab arrows, clear buttons).
  • Interface and table fonts follow the platform default unless overridden by settings, as in GEstimator.

5. Candidate components from GEstimator

GEstimator (GPL-3.0-or-later, same copyright holder) is the main source. Its PrimeVue usage is light (25 files, mostly Dialog, plus Menu, Popover, AutoComplete, FocusTrap), so porting to Quasar is moderate. Most work is removing GEstimator-specific state and command names.

GEstimator source EngineeringUI target Assessment
RibbonToolbar.vue navigation/EuiRibbon Reuse structure (groups, measured overflow, tooltips); remove app commands; port to Quasar buttons
DocumentRail.vue navigation/EuiDocumentRail Reuse; tiles, dirty dot, flyout; generic tab model
ApplicationMenu.vue, KeyboardShortcutsDialog.vue navigation/EuiAppMenu, dialogs/EuiShortcutsDialog Reuse layout; data-driven entries
AppIcon.vue + local SVG paths icons/EuiIcon Reuse mechanism and drawing grammar; add electrical glyphs
theme.css, style.css, appearance.ts theme/ Reuse token naming and themes; split app-specific rules out
statusNotice.ts workspace/EuiNotifications + composable Reuse; bridge to Quasar Notify or keep custom
PersistentDialog.vue dialogs/EuiDialog Adapt to QDialog
ButtonTooltips.vue workspace/EuiTooltips Done (current): any data-tooltip element; data-tooltip-heading for field wrappers
ThemedDropdowns.vue controls/EuiDropdowns Done (current): enhances select.eui-input; QSelect menus share its option states through the Quasar bridge
ThemedAutocomplete.vue controls/EuiAutocomplete Evaluate against QSelect; keep GEstimator keyboard behaviour
DataTable.vue, cellNavigation.ts, tableSelection.ts, tableTextEditor.ts, virtualRows.ts datagrid/ Reuse Tabulator integration and navigation helpers; remove schedule-specific logic
WorkbookSheetGrid.vue datagrid/EuiSheetPreview Reuse for spreadsheet import preview
ProgramSettings.vue, MCPSettings.vue, MCPRibbon.vue, mcp.ts dialogs/EuiSettingsPage, workspace/EuiServiceStatus Reuse generic layout and status display; MCP specifics stay in the app
numberFormatting.ts, middleEllipsis.ts, typeAhead.ts, liveSearch.ts composables/ Reuse generic helpers
backend.ts, useWorkspace*.ts, ProjectViews.vue not in EngineeringUI Application-specific; inform modern/src/services only

Open Planner Studio (LGPL-3.0-or-later, React) is a visual reference only. Its tokens and two-tone icon grammar inform the theme; no code or B2 artwork (LGPL-3.0-only) is copied.

6. Provenance

  • EngineeringUI is MIT licensed. GEstimator code is relicensed to MIT by its copyright holder when adapted: adapted files use the MIT header and add Adapted from GEstimator <path> at <commit>.
  • Only code whose copyright holder agrees to MIT may enter the package; no GPL/LGPL code from other projects.
  • packages/engineering-ui/README.md keeps a provenance table.
  • Third-party code is used only through package dependencies with recorded licences; no vendored copies without an ADR.

7. Storybook

  • @storybook/vue3-vite, with @storybook/addon-a11y and the Vitest addon for running stories as browser tests (Playwright provider). All local; no Chromatic or hosted service.
  • Each component has stories for: default use, light and dark theme, disabled and read-only, validation errors, narrow and wide containers, large datasets (grids, charts), keyboard interaction (play functions) and engineering units where relevant.
  • Storybook MCP integration for AI-assisted component discovery is evaluated as an optional development aid only (milestone M6); it must not become a build or runtime dependency.
  • M6 outcome (current): @storybook/addon-mcp 10.6.9 (MIT) lists vue3 as a supported framework and needs @storybook/addon-vitest, which is installed. Its story-writing, preview and test tools work with any framework; its component-documentation tools need a components manifest, which @storybook/vue3-vite produces only with the experimental experimentalDocgenServer feature (default from Storybook 11). Not adopted: it would add an HTTP endpoint to the Storybook dev server for a benefit that the stories and type declarations already give. Revisit after Storybook 11. The evaluation read the package metadata and code; the addon was not run.

8. Extraction strategy

The package is extractable when:

  1. It builds, tests and runs Storybook from its own directory with only its declared dependencies (npm run build -w @kavilgroup/engineering-ui).
  2. A dependency check confirms no imports from outside packages/engineering-ui/.
  3. Public API is limited to the documented subpath exports, with types emitted (vite build library mode + vue-tsc --declaration).
  4. Licence and provenance records are complete.

Extraction steps: move the folder with history (git filter-repo), publish as @kavilgroup/engineering-ui, replace the workspace dependency with a versioned dependency, and keep a changelog with semantic versioning. Until then, it is versioned with GElectrical and marked private: true.

The package name is @kavilgroup/engineering-ui from the start, so extraction needs no import renames. The licence is MIT (decided 2026-11-26) to encourage reuse; GElectrical and GEstimator remain GPL-3.0-or-later.