Skip to content

New UI Fixed Mode allowing positioning panel anywhere with any size to simulate one panel screen - #466

Merged
luc-github merged 20 commits into
3.1from
new-ui
Nov 17, 2026
Merged

luc-github merged 20 commits into
3.1from
new-ui

Conversation

@luc-github

Copy link
Copy Markdown
Owner

New CNC Change Tool Panel
Update CNC Probe Panel
Add Inch support in CNC UI
Add G5.X selection feature in CNC panel
Fix bug with https when not explicit port is provided
Add https /wss mock server for tests
Several small bug fixes
Massive refactoring to decrease core code and keep final footprint under 100KB

…rudersControl

- Add PanelShell component, migrate 17 panels
- Add JogSvg: generate jog rings/directions from reference path (Jog.js 85KB -> 28KB)
- Dedupe MixedExtrudersControl across Marlin/Marlin-embedded/Repetier via flavor prop
- New monochrome ESP3D logo with recropped viewBox
- Show "Hide panels borders" menu only in layout edit mode
- Remove dead .H-100 CSS, disable prod source maps
New change tool UI
…ator

- Toast: render non-string content as-is (T() returned "" for vnodes,
  regression vs 3.0)
- ToolChangeCNC: add missing fieldset legend (content overlapped the
  Active tool control due to -1rem compensation margin), send $G on
  panel mount to resolve active tool
- Input: apply width prop in default branch (was only honored for
  dropList); Tool number input now 4rem
- SpindleCNC: remove M6 button (now covered by Tool change panel)
- grblHAL simulator: push periodic status reports like real firmware,
  track G20/G21 modal units and $13 report-in-inches (echoed in $$ and
  position reports), handle $xx=yy settings writes, and implement
  manual tool change flow (T<n> M6 -> Tool state, 0xA3 ack, $TPW,
  0x81 cycle start, M61 Q<n>)
- dev server: start target auto report when provided
- ToolChangeCNC: full state machine (moving/user/probing/completing,
  60s timeouts), cancel recovery with $G re-read and conditional
  M61Q restore of the previous tool, $341 gating (mode 4 blocks start,
  modes 0/3 hide probe, modes 1/2 show guidance), Finish button,
  success/failed toasts; ack stays global (BackgroundContainer)
- ProbeCNC: lock probing during Tool state (firmware answers error 40)
- grblHAL simulator: $341 stored and reflected in $$, $TPW as
  Tool>Run>Tool then [PRB:]/ALARM:5, reset during motion raises ALARM,
  $X unlock
- Silence error toast when preferences.json is missing: forward the
  HTTP error code through the request queue wrappers (useHttpQueue)
  and filter on the code; missing file logs "not found, using
  defaults", only malformed content still warns
- docs: add tool-change-consensus.md (aligned with the pendant code)
Preferences refactoring (design: docs/refonte-preferences-design.md):
- New Helpers/settings module gathering settings data helpers:
  model.js (clone, reindexList, scanFlag/settingsStatus early-exit flag
  scans replacing JSON.stringify().includes() per keystroke),
  fonts.js (shared buildFontFaceCSS), panelsOrder.js (single
  syncPanelsOrder: orphan pruning + placeholder insertion + reindex),
  listKinds.js (static per-kind field metadata table: select options
  and depend blocks now defined once instead of inline in formatItem)
- useSettings / interface tab: deduplicated font CSS blocks, panels
  order reconciliation and extension-add logic now use the shared
  helpers (~250 lines removed)
- importHelper.formatItem rewritten on top of the listKinds table;
  dependency engine untouched (depend data moved verbatim)
- ItemsList: flag detection via scanFlag, VERBOSE_TYPE_KEYS derived
  from the shared table at module level, clone() for new items
- Settings headers: hide the section label when it duplicates the
  panel name (e.g. grblHAL "Tool change / Tool change")
Always use firmware WebSocketPort, add HTTPS dev mode, keep page path on routing

WebSocket:
- Always connect to the WebSocketPort reported by the firmware, whatever
  the page protocol (ws/wss) or port, instead of "page port + 1" when the
  URL has an explicit port. A reverse proxy must expose the WebSocket on
  that same port number.

Router:
- Change only the URL hash when redirecting to the default/active route
  (was window.location.href = "/#..."), so a WebUI served from another
  path (e.g. /www/index2.html) is not replaced by the root index.html.
- Reconnect button reloads the current page path instead of the site root.

Dev tools:
- New config/dev.js launcher for dev-* scripts, with optional "secure"
  argument: npm run dev-cnc-grblhal secure
  Starts Caddy (config/Caddyfile) as HTTPS front:
    https://localhost and :8443 -> webpack dev server (8088)
    https://localhost:8445      -> mock server (8080, packaged files)
    wss://localhost:8444        -> mock WebSocket (8089)
  Caddy is found in PATH, CADDY env var or the winget install folder.
- Mock targets report their real WebSocketPort (8089, or WS_PUBLIC_PORT).
- Mock server serves .br when the browser advertises br (HTTPS only),
  otherwise .gz, like the firmware.
The formatted form (value = array of { name, value, ... } sub-fields) is
now the only internal representation. Flat data (preferences.json files,
raw defaults) is expanded once at load/import, and flattened only at
export.

- formatItemsList detects already formatted items and keeps them as-is
  instead of flattening then re-expanding through formatItem: runtime
  flags (hasmodified, editionMode, newItem) now survive a re-format,
  and the "double-nesting / [object Object]" corruption class is
  structurally impossible
- normalizeListItem removed (no more flatten/expand shuttle)

Add offline round-trip test harness (npm run test):
- webpack-bundles only the preferences code paths (narrow stubs replace
  the Helpers/targets barrels) and runs under Node
- 21 checks: export -> import -> export stability in both flows (UI
  import into formatted settings, ESP load from a saved file), runtime
  flag preservation, per-kind export shapes (verbosefilters, panelsorder,
  extracontents metadata stripping), openonstart injection, newItem
  flags, macro type options with verbatim depend blocks
The per-entry generateValidation was copy-pasted in all 7 target
MachineSettings tabs with only the validity rule differing. Extract the
common shell into Helpers/settings/machineValidation.js:
machineSettingValidation(fieldData, rule, onStatus) keeps the exact
previous contract (Flag icon, hasmodified trimmed compare on text/number
entries, haserror, S42 message, optional save-status callback, pristine
cleanup), while each target now only passes its own rule:

- grblHAL: non-empty, $337 exception kept
- GRBL / SandTable: non-empty
- Marlin / Marlin-embedded: >= 3 chars starting with G/M/C/D
- Repetier: non-empty (all types)
- Smoothieware: override entries start with M/G, config entries no space

Batch save flows (progress modal, Smoothieware config/override tabs) and
the ESP400/$$ wire format are untouched. hasmodified compare is now
trimmed everywhere (was untrimmed in the GRBL family) and values go
through String() (avoids a potential crash on non-string values).

Flag icon import removed from the 7 files (only used by the old code).
Bundle size neutral (+/-100 bytes gz per target).
The two last eval() calls of the codebase lived in connectionDepend,
which builds comparison expressions from depend data as strings
(e.g. "'none'!=..." style) and eval's them at every dependency check.

New Helpers/connectionExpr.js parses the expression instead, with
identical semantics: quoted literal -> string comparison, bare literal
-> numeric comparison (both sides coerced), contains -> substring check.
Unknown expressions fail open (condition considered true), matching the
existing "missing connection setting => visible" behavior.

Offline test extended: the parser output is compared against the legacy
eval behavior on all 16 real expression patterns found in preferences
data (including the "10" > 2 numeric coercion trap), plus contains and
fail-open cases. 25/25 checks pass.

Benefit on footprint : A direct eval prevented webpack from concatenating the module and
Terser from mangling names across its whole scope chain.
…helper

Areas:
- Move the extensions postMessage bridge out of areas/index.js into
  src/areas/extensionBridge.js (createExtensionBridge): the message
  handler is now a table of handlers (response, cmd, query, upload,
  download, toast, modal, sound, translate, icon, extensionsData,
  capabilities, dispatch) with a shared proxyRequest helper.
  areas/index.js drops from ~830 to ~90 lines.
- Fix a typo (finitiator) in the upload error report and a latent
  ReferenceError on exportPreferences in the modal callback (now
  exportResult); remove debug console.logs from query.

Dashboard:
- Add applyPanelsOrder() to Helpers/settings/panelsOrder.js and use it
  for drag & drop reordering instead of rebuilding the list inline.

Tool Change:
- Give the Active tool control a minimum width so the value no longer
  touches the borders.

Dev tools:
- Fix HMR in secure mode: force the dev server client socket to
  wss://localhost:8443/ws, otherwise the browser mixes https page and
  plain port and loops on ERR_SSL_PROTOCOL_ERROR.
- Ignore test/out/ and drop the tracked roundtrip bundle.

Docs:
- WEBPACK_AND_SERVER.md: secure mode section (Caddy prerequisite, ports,
  WS_PUBLIC_PORT), what the mock can and cannot test, environment
  variables, and .br-over-HTTPS compressed file preference.
pages/dashboard/index.js drops from ~960 to ~370 lines; behavior is
unchanged and the bundle size is neutral (90.2 KB gz on grblHAL).

- shortcuts.js: keyboard shortcuts tracker, key handlers and the help
  modal.
- useCanvasMode.js: canvas / fullscreen state and effects, including
  why the Fullscreen API is not used for canvas mode.
- panelsInit.js: loading of the saved panels order and computation of
  the visible panels (with the "do not write back to uisettings" rule).
- extraPanels.js: extra content panels build with per-panel unique ids.
- DashboardMenu.js: the panels dropdown menu. Each visibility entry is
  now a real component (PanelVisibilityItem), which removes the
  useState/useEffect calls that lived inside the parent's .map() loop.
- usePanelDnD.js + DashboardPanel.js: drag & drop reordering and the
  panel wrapper with drag handle and drop indicator.
Files panel:
- Split components/Panels/Files.js (~960 -> ~590 lines) into
  filesTransfer.js (upload/download with progress modals), FileLine.js
  (file row with play/delete actions), fileDrop.js (drop zone handlers)
  and FilesFooter.js (occupation bar). Behavior unchanged, bundle size
  neutral.
- Fix a latent TypeError when a selected file was rejected by the
  Upload capability: toasts.add() -> toasts.addToast().
- Name the file in download error toasts: over HTTP/2 there is no
  status text, so a failure showed a bare "404" with no context.
- Remove a debug console.log and a dead useTargetContextFn import.

Test server (grblHAL mock):
- The mock advertised HostPath "/www" (like the real firmware) but
  ignored it: /files listed the Flash root and the default document was
  resolved there, so downloads to /www/... 404ed. Targets can now
  export webRoot (grblHAL: "/www"): the /files API (list, delete,
  createdir) resolves under Flash/<webRoot> and the default document
  falls back to Flash/<webRoot>/index.html, matching the firmware.
- Move the grblHAL fixtures (index.html.gz/.br, circle-Body.gcode)
  under server/CNC/grblHAL/Flash/www/ accordingly.

Docs:
- WEBPACK_AND_SERVER.md: document the mock webRoot behavior.
Canvas (fixed) mode:
- Panels are confined to the visible viewport: no overlap, no off-screen
  escape, container scroll only as a fallback
- Drop resolution: strict slot swap when dropped on another panel,
  otherwise shortest-axis nudge into free space
- Reset tiles the panels to fill the whole available area
- Blocking borders also apply to resize
- Close (X) buttons are shown in layout edition mode only
- Dashboard menu now lists only the closed panels (open ones are closed
  directly); the "Close all panels" entry is removed
- Settings / Informations / About links are added to the panels menu
  (the header is unreachable when the canvas covers the viewport)
- Fullscreen button: apply the page background to #app while browser
  fullscreen is active, instead of the default black backdrop
- New "canvassnap" preference (1-50 px, default 10) under a new
  "Fixed canvas mode" settings group; grid-only prefs moved to a
  "Responsive grid mode" group

Grid (responsive) mode:
- Drag & drop is rebuilt on the same pointer-based engine as the canvas:
  live swap with the panel under the pointer, red dashed outline,
  no more HTML5 drag events, anchor icon or blue insertion bar
- Panel order persistence is debounced (300 ms)

Reset layout:
- Also restores the startup visibility (onstart panels), discarding the
  device-local overrides - previously a reset with every panel closed
  had no visible effect

Cleanup:
- Remove usePanelDnD.js (replaced by usePanelsOrder.js)
- Remove unused S117 and S274 translation keys (en/fr)
Canvas (fixed) mode:
- Panels are confined to the visible viewport: no overlap, no off-screen
  escape, container scroll only as a fallback
- Drop resolution: strict slot swap when dropped on another panel,
  otherwise shortest-axis nudge into free space
- Reset tiles the panels to fill the whole available area
- Blocking borders also apply to resize
- Close (X) buttons are shown in layout edition mode only
- Dashboard menu now lists only the closed panels (open ones are closed
  directly); the "Close all panels" entry is removed
- The header is unreachable when the canvas covers the viewport, so the
  panels menu now carries the main pages: Settings deep-links to each
  tab (Features / Interface / Machine, same icons and visibility rules
  as the settings TabBar), plus Informations and About
- Fullscreen button: apply the page background to #app while browser
  fullscreen is active, instead of the default black backdrop
- New "canvassnap" preference (1-50 px, default 10) under a new
  "Fixed canvas mode" settings group; grid-only prefs moved to a
  "Responsive grid mode" group

Grid (responsive) mode:
- Drag & drop is rebuilt on the same pointer-based engine as the canvas:
  live swap with the panel under the pointer, red dashed outline,
  no more HTML5 drag events, anchor icon or blue insertion bar
- Panel order persistence is debounced (300 ms)

Reset layout:
- Also restores the startup visibility (onstart panels), discarding the
  device-local overrides - previously a reset with every panel closed
  had no visible effect

Pack scanners (themes / languages / extensions):
- Fix listing on targets with a HostPath subdir (grblHAL /www): the
  /files API is rooted at the host path, so list paths must be relative
  to the web root - the scanners wrongly prefixed them with
  HostUploadPath, producing /www/www/... and empty lists. sdfiles keeps
  absolute paths. Was broken for every pack kind, themes included.
  (real-hardware convention still to be confirmed by terjeio)

Themes:
- New themes_samples/theme-reference: complete annotated template with
  every themeable selector and the factory defaults
- New examples: theme-ocean (simple palette swap, legacy CSS) and
  theme-neon.json (advanced bundle: web font, glow effects, custom logo)
- docs/themes.md: reference theme section, themable Spectre modules,
  canvas/borderless/close-button specifics

Cleanup:
- Remove usePanelDnD.js (replaced by usePanelsOrder.js)
- Remove unused S117 and S274 translation keys (en/fr)
Page fixes (same class of issue as the webui fix in d96b431/451e8fa):
- synchronous mode now uses wss:// when the page is served over https
  (ws:// is blocked as mixed content)
- the limited-environment message only appends an explicit port, whatever
  the scheme (window.location.port is empty for default ports)

Secure dev mode, aligned on the webui flow (Caddy, no native TLS - a wss
handshake has no browser error UI for self-signed certificates):
- config/Caddyfile: 8443 -> front 8088, 443 -> front, 8444 -> mock ws 81,
  8445 -> mock 8080 (packaged page)
- config/dev.js launcher: npm run dev secure checks Caddy, seeds
  server/public with dist/index.html.gz, sets SECURE + WS_PUBLIC_PORT=8444
- webpack dev server opens https://localhost:8443 and routes its HMR
  socket through Caddy in secure mode
- mock serves the packaged page (gzip) and the /ws upgrade on the page
  port like the firmware; [ESP800] reports WS_PUBLIC_PORT, WEBCOMM env
  switches WebCommunication
- smoke test: node test/mock-smoke.js
… fixes

Note: the embedded/ directory (embedded page + its own test server) is
hosted in this repo temporarily; it will be extracted into its own
project (shared test-server submodule, see docs/test_server_extraction_plan.md)
before the PR towards the 3.0 branch.

Docs:
- New docs/hostpath_files_api.md: path-convention memo validated with
  grblHAL (TerjeIo). User root is the HostPath content and is never
  displayed; /files?path= is relative to HostPath; upload, download and
  static GETs use absolute FS paths; /files and /sdfiles are historical
  web handlers, not paths; 400 when no flash FS.
- New docs/test_server_extraction_plan.md: plan to extract the test
  server into a shared repo (submodule of WebUI and embedded), covering
  ESP3D 3.X, ESP3DLib 3.X, ESP3D-X and grblHAL (ESP3D-TFT excluded),
  cross-platform by principle, CLI-driven options, and future
  FlashFileSystem=none / SD-hosting test support.
- docs/WEBPACK_AND_SERVER.md: document the dev launcher flags
  (secure / auth / root=) and the AUTH / WEBROOT / PORT env vars.

Mock server (config/server.js + targets):
- Fix latent authentication bugs: loginURI was never imported; 14 auth
  guards set res.status(401) without sending a response; the WebSocket
  PING handler referenced a misspelled flag and an undefined variable and
  crashed - PING now replies with the full PING:60000:60000 keep-alive
  window.
- "unknown command" fallback no longer masks a non-200 status code.
- WEBROOT env var overrides the target web root (normalized before
  targets load); PORT env var override; AUTH=1 enables authentication in
  all targets; login/logout now guard /files, /sdfiles and /updatefw;
  ESP800 reports HostPath from the environment.
- Startup log summarizes the active options.

Dev launcher (config/dev.js):
- node config/dev.js <Target> <Subtarget> [secure] [auth] [root=<dir>]
  Flags accepted in any order; root= is normalized and AUTH/WEBROOT are
  propagated to the mock.

Embedded page (3.0.0 - first non-alpha release, adds HTTPS support for
grblHAL / ESP3D-X):
- Fix download 404 when HostPath is /www: static GETs are now prefixed
  with the host path (new toFSPath helper).
- Uploads send absolute FS paths, per firmware convention.
- Fix ESP3D files-button root detection with HostPath=/www.
- Update menu links for grblHAL / ESP3D-X (docs now on esp3d.io).
- Test server: HOSTPATH from env or CLI arg with MSYS mangling guard,
  full authentication support (AUTH=1, admin/admin, 401 on protected
  endpoints, dynamic ESP800 Authentication field), .br serving when the
  browser advertises br (HTTPS only, like the firmware), PORT override.
- Dev launcher accepts secure / auth / root=www in any order; the
  packaged page is copied only when missing, with a staleness warning.
- Regenerate .br fixtures as real Brotli (they were renamed gzip files).
- Version bumped to 3.0.0 (page and package.json).

WebUI version bumped to 3.2.0.

Dist:
- Rebuild all packages

Relicense sources to GPL-3.0-or-later

- Replace the LGPL-2.1+ license paragraph in all 289 source headers
  with the GPL-3.0+ wording; copyright holders, years and file
  descriptions are unchanged. The conversion is permitted by LGPL-2.1
  section 3 (one-way LGPL -> GPL option) together with the headers'
  "or any later version" clause.
- Fix the "license" field in package.json and embedded/package.json:
  ISC (placeholder) -> GPL-3.0-or-later, matching the LICENSE file
  (GPL v3) and the license GitHub displays for this repository.
@luc-github
luc-github merged commit d6b0a5e into 3.1 Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant