Help panel, Units settings, file format = IFCX, hlookup/take fixes, code folding#2
Merged
Conversation
Reflects the rename + the substantial feature set added in this branch: real CalcPAD compatibility (including the 2259-Intertek regression sample), parametric SVG macros, @img(*.svg) inlining, live IFCX/STEP generation, the IFC viewer panel, Tauri desktop shell, and the load- case tabs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The File-menu Open item used to do nothing (recents list with no loader wired up). Now it shows a prominent Browse… card on top that opens the OS file picker, with the recent-files list below — clicking a recent loads it via Tauri readTextFile. - App.tsx: handleBrowse + handleOpenRecent wired to documentStore + useRecentFiles, passed through to Backstage as onBrowse / onOpenFile - Backstage.tsx: OpenPanel renders a Browse… card; props extended with onBrowse; click outside closes - Backstage.css: .bs-browse-card styled in --theme-accent-soft with hover/active states - CalcTab.tsx: ribbon "Openen" → "Browse…", same handler now adds to recents via useRecentFiles - i18n: openPanel.browse / browseDesc / title / clearAll / etc keys in nl + en; ribbon.calc.browse in nl + en Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…directives, imageUrls - hlookup / hlookup_ge / hlookup_le / vlookup rewritten as a single unit-aware 2D lookup helper. Honours the lookupCol / returnCol args CalcPAD passes, extracts numeric value from mathjs Units, and falls back to flat-vector lookup when the matrix is 1D. Fixes 5.2.1 Wind 1 NaN cascade — the 2259-Intertek wind reference pressure now solves. - `take(idx, scalar)` returns the scalar instead of NaN, so chains like `take(1; hlookup_ge(M; h; 1; 1))` work when hlookup_ge returns a cell. - Trig wrappers (sin/cos/tan + a/.../) honour a global angle mode set via the new `setAngleMode(mode)` export — Settings → Eenheden picks rad / deg / gra and the change applies instantly. - `#val` and `#noc` registered as no-op directives (display hints that don't affect math), so they don't surface in the rendered output. - Parser: new `ParseOptions.imageUrls` map rewrites `<img src="...">` basenames to Vite-bundled asset URLs (Picture0.png et al.). - Renderer: `renderVarDisplay` now splits result via `splitResult` so `l = 12.34m` no longer renders the unit twice as `12.34m m`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…pable) The on-disk format is now a JSON-LD IFCX document with the CalcPAD source embedded under `source.content`. An IFC viewer can read it as a normal IFCX file; this app reads it back as the calc source. - wrapAsIfcCalculation / unwrapFromIfcCalculation helpers in fileOps - saveCalculationFile takes (source, ifcx, defaultName) and writes the wrapped JSON; default extension is .ifc-calculation - openCalculationFile + handleOpenRecent unwrap on load (also accepts legacy raw .cpd / .ifc-calculation text) - IfcViewerPanel's IFCX viewer shows the *exact* JSON that Save would write (calls wrapAsIfcCalculation under the hood) - IFC ribbon tab cleared — file ops live in the Calc tab now - handleNew in CalcTab loads an empty document so the HelpPanel shows Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- HelpPanel.tsx + .css — CalcPAD-style language reference shown in the preview pane when the editor is empty. Click sections to expand, click snippets to insert into the editor. Mirrors the CalcPAD "How it works" card. - useZoom hook: Ctrl+wheel zoom for both panes. Editor sets the CSS var --cm-font-size on its wrapper (CodeMirror picks it up via Editor.css); Preview adjusts root font-size %. - ifcCalcLanguage.ts adds a foldService — `@svg`, `@select`, `#if`, `#repeat`, `#for`, `#def name(...)`, and `#hide` ranges all collapse via the gutter minus button. Nested blocks of the same kind nest correctly. - Preview switches to HelpPanel when source.trim() is empty. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New Settings tab with the four knobs CalcPAD users expect: • Hoek-eenheid (deg / rad / gra) — live, applied to sin/cos/tan • Return-angle-with-unit toggle • Default display units: lengte, kracht, spanning The angle-mode choice routes through setAngleMode() on save and on app boot (App.tsx subscribes to `units-changed` events + restores from the Tauri store on mount). Defaults match CalcPAD: rad, mm, kN, MPa. i18n keys in nl + en. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…g scripts - Backstage: removed File → Import entry and ImportPanel (nothing to import; opening files happens via File → Open / Browse) - calcpad-includes: register Picture0–5.png as Vite ?url assets so the parser's imageUrls rewrite resolves `<img src="./Images/Picture0.png">` in 2259-Intertek-units to the bundled asset - .gitignore: scripts/debug-*.mjs + last-render.html (scratch artefacts) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Grote batch UX + correctness work. Alles loopt live via Vite HMR.
Bestandsformaat (round-trippable)
.ifc-calculationis nu een IFCX JSON-LD document met de CalcPAD-bron embedded ondersource.content. Een IFC-viewer leest het als een geldige IFCX-file; deze app leest dezelfde file terug als calc-bron.IfcViewerPaneltoont 1:1 wat Save naar schijf schrijft. Backward-compat: legacy raw.cpdfiles worden nog steeds geaccepteerd.HelpPanel (taal-referentie)
Lege editor → Preview wordt vervangen door
HelpPanel.tsxmet CalcPAD-stijl referentie:+collapsibleSettings → Eenheden
Nieuwe tab met CalcPAD-knoppen:
setAngleModezodatsin(45)werkelijk afhankelijk is van de modeEditor verbeteringen
@svg,@select,#if,#repeat,#for,#def name(...),#hide(gutter minus-knop)\"…\"strings krijgen string-token in syntax highlightMath correctness — 2259-Intertek
hlookup/hlookup_ge/hlookup_le/vlookupherschreven als unit-aware 2D lookup met expliciete lookupCol/returnCol.take(1; scalar)returnt de scalar i.p.v. NaN. q_p resolved → 0,751 kN/m², alle P_rep + F_Wind nu numeriek.#valen#nocals no-op directives (display-hints, niet zichtbaar in output)renderVarDisplayfix:l = 12.34m m→l = 12.34 mImages
Picture0–5.pngvan het Intertek-rapport intemplates/calcpad-samples/Images/gebundeldParseOptions.imageUrlsmap rewrites<img src=\"./Images/X.png\">basenames naar Vite-bundled URLscalcpadImageUrlsregistreert deze map; doorgegeven aan parse() in Preview, IfcViewerPanel, CalcTabFile Open (Office-style)
Cleanup
Test plan
@svg-block met − in de gutter, expand met +cpd-2259-intertek: Picture0 rendert in hoofdstuk 2, Wind 1 toont geldige waarden, 5.1 toontl = 12.34 mzonder dubbelmsin(90)in editor geeft 1🤖 Generated with Claude Code