diff --git a/shared/messages.ts b/shared/messages.ts index 17ca9c7..0f3ea07 100644 --- a/shared/messages.ts +++ b/shared/messages.ts @@ -203,6 +203,9 @@ export interface UiTips { seen?: string[]; /** First-run guided tour completed/skipped/declined — suppresses the invite. */ tourDone?: boolean; + /** The gui build string the tour was answered at — a new deploy re-offers the + * invite (tourDone alone suppresses only within the same version). */ + tourVersion?: string; } /** Everything the webview persists. `saveUiState` params: `{ state: UiState }`. diff --git a/src/uiState.ts b/src/uiState.ts index 6179f37..fdfc0c8 100644 --- a/src/uiState.ts +++ b/src/uiState.ts @@ -60,6 +60,8 @@ export function sanitizeUiState(input: unknown): UiState | null { } // tourDone is only meaningful when true; absent/false both mean "not done". if ((tips as Record).tourDone === true) cleanTips.tourDone = true; + const tourVersion = (tips as Record).tourVersion; + if (typeof tourVersion === "string" && tourVersion.length > 0 && tourVersion.length <= 128) cleanTips.tourVersion = tourVersion; if (Object.keys(cleanTips).length) out.tips = cleanTips; } if (!out.theme && !out.layout && !out.options && !out.tips) return null; diff --git a/webview/components/appShell.ts b/webview/components/appShell.ts index 1284d50..8c506ec 100644 --- a/webview/components/appShell.ts +++ b/webview/components/appShell.ts @@ -773,7 +773,8 @@ export class AppShell { { icon: msym("open_in_new"), label: "Get the VS Code Extension…", fn: () => this.openExternalLink(LINKS.vscodeExt) }, { sep: true }, { icon: msym("info"), label: "About OM Core", fn: () => alertDialog("About OM Core", - `OM Core — multidimensional modeling engine for structured financial,\noperational, and analytical models.\n\nCopyright © 2026 Alexander Bikeyev.\nPublished by Cloudcell Limited.\n\nLicensed under the GNU Affero General Public License v3.0.\nCommercial licensing may be available separately.\n\nhttps://cloudcell.github.io/om-docs/\n\nVersion: gui ${guiVersionShort}`, logoPng) }, + `OM Core — multidimensional modeling engine\nfor structured financial, operational, and analytical models.\n\nCopyright © 2026 Alexander Bikeyev.\nPublished by Cloudcell Limited.\n\nLicensed under the GNU Affero General Public License v3.0.\nCommercial licensing may be available separately.\n\nVersion: gui ${guiVersionShort}`, logoPng, + { label: "cloudcell.github.io/om-docs", url: LINKS.docs, open: (u) => this.openExternalLink(u) }) }, ]; } @@ -784,10 +785,15 @@ export class AppShell { const ibtn = (name: MaterialIcon, fn: () => void, title: string) => el("button", { class: "tb-btn", title, "aria-label": title, onclick: fn, html: msym(name) }) as HTMLButtonElement; - tb.appendChild(ibtn("database", () => this.store.refreshModel().catch(() => {}), "Refresh model")); - tb.appendChild(ibtn("sync", () => this.store.recalc("all"), "Recalculate (Shift+F9)")); - tb.appendChild(ibtn("refresh", () => this.store.recalc("dirty"), "Recalculate View (F9)")); - tb.appendChild(el("span", { class: "tb-sep" })); + // Recalc cluster hidden for now — inactive in the current engine. Flip + // SHOW_RECALC to restore (handlers kept); same for the format cluster below. + const SHOW_RECALC = false; + if (SHOW_RECALC) { + tb.appendChild(ibtn("database", () => this.store.refreshModel().catch(() => {}), "Refresh model")); + tb.appendChild(ibtn("sync", () => this.store.recalc("all"), "Recalculate (Shift+F9)")); + tb.appendChild(ibtn("refresh", () => this.store.recalc("dirty"), "Recalculate View (F9)")); + tb.appendChild(el("span", { class: "tb-sep" })); + } const undoBtn = ibtn("undo", () => this.store.undo(), "Undo"); const redoBtn = ibtn("redo", () => this.store.redo(), "Redo"); tb.appendChild(undoBtn); @@ -797,7 +803,6 @@ export class AppShell { const pasteBtn = ibtn("content_paste", () => this.focusedGrid()?.pasteFromClipboard(), "Paste"); tb.appendChild(copyBtn); tb.appendChild(pasteBtn); - tb.appendChild(el("span", { class: "tb-sep" })); // Same enable rules as the Edit menu. const syncEnabled = () => { @@ -809,40 +814,45 @@ export class AppShell { syncEnabled(); this.store.subscribe(syncEnabled); - // Formatting is outside the MVP preview: controls stay visible but disabled (handlers kept for later). + // Formatting is outside the MVP preview: the cluster is hidden entirely for + // now (was disabled controls); flip SHOW_FORMAT to restore — handlers kept. + const SHOW_FORMAT = false; const off = (label: string) => ({ disabled: true, title: `${label} — ${NOT_IN_MVP_TITLE}` }); - // No text labels in the compact row ("Fill", "Font", "Format"): the title of each control names it. - - // Format buttons: one segmented block - const seg = el("div", { class: "tb-seg" }); - const boldBtn = el("button", { class: "tb-btn", ...off("Bold"), style: { fontWeight: "700" } }, ["B"]); - boldBtn.addEventListener("click", () => this.store.api.formatBold("selection", true).catch(() => {})); - seg.appendChild(boldBtn); - const italicBtn = el("button", { class: "tb-btn", ...off("Italic"), style: { fontStyle: "italic" } }, ["I"]); - italicBtn.addEventListener("click", () => this.store.api.formatItalic("selection", true).catch(() => {})); - seg.appendChild(italicBtn); - const underlineBtn = el("button", { class: "tb-btn", ...off("Underline"), style: { textDecoration: "underline" } }, ["U"]); - underlineBtn.addEventListener("click", () => this.store.api.formatUnderline("selection", true).catch(() => {})); - seg.appendChild(underlineBtn); - tb.appendChild(seg); - tb.appendChild(el("span", { class: "tb-sep" })); - - // Fill color - const fillInput = el("input", { class: "tb-color", type: "color", value: "#ffffff", ...off("Fill color") }) as HTMLInputElement; - fillInput.addEventListener("change", () => this.store.api.formatBgColor("selection", fillInput.value).catch(() => {})); - tb.appendChild(fillInput); - - // Font color - const fontInput = el("input", { class: "tb-color", type: "color", value: "#000000", ...off("Font color") }) as HTMLInputElement; - fontInput.addEventListener("change", () => this.store.api.formatColor("selection", fontInput.value).catch(() => {})); - tb.appendChild(fontInput); - tb.appendChild(el("span", { class: "tb-sep" })); - - // Number format - const fmt = el("select", { class: "tb-select", ...off("Number format") }) as HTMLSelectElement; - [["general", "General"], ["number", "Number"], ["currency", "Currency"], ["percent", "Percent"], ["scientific", "Scientific"]].forEach(([v, l]) => fmt.appendChild(el("option", { value: v }, [l]))); - fmt.addEventListener("change", () => this.store.api.formatNumberFormat("selection", fmt.value).catch(() => {})); - tb.appendChild(fmt); + if (SHOW_FORMAT) { + tb.appendChild(el("span", { class: "tb-sep" })); + // No text labels in the compact row ("Fill", "Font", "Format"): the title of each control names it. + + // Format buttons: one segmented block + const seg = el("div", { class: "tb-seg" }); + const boldBtn = el("button", { class: "tb-btn", ...off("Bold"), style: { fontWeight: "700" } }, ["B"]); + boldBtn.addEventListener("click", () => this.store.api.formatBold("selection", true).catch(() => {})); + seg.appendChild(boldBtn); + const italicBtn = el("button", { class: "tb-btn", ...off("Italic"), style: { fontStyle: "italic" } }, ["I"]); + italicBtn.addEventListener("click", () => this.store.api.formatItalic("selection", true).catch(() => {})); + seg.appendChild(italicBtn); + const underlineBtn = el("button", { class: "tb-btn", ...off("Underline"), style: { textDecoration: "underline" } }, ["U"]); + underlineBtn.addEventListener("click", () => this.store.api.formatUnderline("selection", true).catch(() => {})); + seg.appendChild(underlineBtn); + tb.appendChild(seg); + tb.appendChild(el("span", { class: "tb-sep" })); + + // Fill color + const fillInput = el("input", { class: "tb-color", type: "color", value: "#ffffff", ...off("Fill color") }) as HTMLInputElement; + fillInput.addEventListener("change", () => this.store.api.formatBgColor("selection", fillInput.value).catch(() => {})); + tb.appendChild(fillInput); + + // Font color + const fontInput = el("input", { class: "tb-color", type: "color", value: "#000000", ...off("Font color") }) as HTMLInputElement; + fontInput.addEventListener("change", () => this.store.api.formatColor("selection", fontInput.value).catch(() => {})); + tb.appendChild(fontInput); + tb.appendChild(el("span", { class: "tb-sep" })); + + // Number format + const fmt = el("select", { class: "tb-select", ...off("Number format") }) as HTMLSelectElement; + [["general", "General"], ["number", "Number"], ["currency", "Currency"], ["percent", "Percent"], ["scientific", "Scientific"]].forEach(([v, l]) => fmt.appendChild(el("option", { value: v }, [l]))); + fmt.addEventListener("change", () => this.store.api.formatNumberFormat("selection", fmt.value).catch(() => {})); + tb.appendChild(fmt); + } return tb; } diff --git a/webview/components/dialogs.ts b/webview/components/dialogs.ts index 4290025..0ec9c5e 100644 --- a/webview/components/dialogs.ts +++ b/webview/components/dialogs.ts @@ -168,7 +168,7 @@ export function choiceDialog(title: string, message: string, choices: DialogChoi } /** Show an alert dialog. Returns when dismissed. */ -export function alertDialog(title: string, message: string, image?: string): Promise { +export function alertDialog(title: string, message: string, image?: string, link?: { label: string; url: string; open: (url: string) => void }): Promise { return new Promise((resolve) => { const ov = ensureOverlay(); clear(ov); @@ -191,6 +191,12 @@ export function alertDialog(title: string, message: string, image?: string): Pro const msg = el("div", { style: { fontSize: "13px", color: "var(--dlg-text)", marginBottom: "16px", lineHeight: "1.4", whiteSpace: "pre-line", ...centered } }, [message]); dlg.appendChild(msg); + if (link) dlg.appendChild(el("a", { + href: link.url, target: "_blank", rel: "noopener noreferrer", + style: { display: "block", marginTop: "-8px", marginBottom: "16px", fontSize: "13px", color: "var(--accent)", textDecoration: "underline", ...centered }, + onclick: (e: Event) => { e.preventDefault(); link.open(link.url); }, + }, [link.label])); + const btnRow = el("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px" } }) as HTMLElement; const okBtn = el("button", { style: { padding: "6px 16px", border: "none", borderRadius: "6px", diff --git a/webview/components/multilevelGrid.ts b/webview/components/multilevelGrid.ts index d3b2094..f7189d8 100644 --- a/webview/components/multilevelGrid.ts +++ b/webview/components/multilevelGrid.ts @@ -241,7 +241,7 @@ export class MultilevelGrid { const grpActive = this.store.group(gid)?.activeTab; const tabbar = el("div", { class: "tabbar" }); for (const tab of grpTabs) { - const t = el("div", { class: "tab" + (tab.viewId === grpActive ? " active" : "") }, [ + const t = el("div", { class: "tab" + (tab.viewId === grpActive ? " active" : ""), ...(tab.viewId === grpActive ? { "data-tour": "view-tab" } : {}) }, [ document.createTextNode(tab.viewName), el("span", { class: "tab-close", title: "Close", onclick: (e: Event) => { e.stopPropagation(); this.closeTab(tab.viewId); } }, ["×"]), ]); diff --git a/webview/components/pivotBar.ts b/webview/components/pivotBar.ts index afbe059..9f8680b 100644 --- a/webview/components/pivotBar.ts +++ b/webview/components/pivotBar.ts @@ -117,7 +117,7 @@ export class PivotBar { const curName = items.find((it) => it.id === curId)?.name || (items[0]?.name || "\u2014"); const label = el("span", {}, [`${name}: ${curName}`]); const arrow = el("span", { class: "chip-arrow" }); - const chip = el("div", { class: cls, draggable: "true", title: `Drag to move; click to pick ${name} item`, "data-tour": dimId === "@" ? "at-dim" : null }, + const chip = el("div", { class: cls, draggable: "true", title: `Drag to move; click to pick ${name} item`, "data-tour": dimId === "@" ? "at-dim" : "chip" }, [grip, label, seqMark, arrow].filter(Boolean) as HTMLElement[]); chip.addEventListener("click", (e) => { e.stopPropagation(); this.showPageDropdown(chip, dimId, items); }); this.setupChipDrag(chip, dimId, zone); @@ -125,7 +125,7 @@ export class PivotBar { } // AxisChip / HeaderChip: grip + name - const chip = el("div", { class: cls, draggable: "true", title: `Drag to move ${name}`, "data-tour": dimId === "@" ? "at-dim" : null }, + const chip = el("div", { class: cls, draggable: "true", title: `Drag to move ${name}`, "data-tour": dimId === "@" ? "at-dim" : "chip" }, [grip, el("span", {}, [name]), seqMark].filter(Boolean) as HTMLElement[]); this.setupChipDrag(chip, dimId, zone); return chip; diff --git a/webview/tips.ts b/webview/tips.ts index 329b323..8503632 100644 --- a/webview/tips.ts +++ b/webview/tips.ts @@ -77,7 +77,7 @@ export function suppressedForOnboarding(store: Store): boolean { /** Nested read-modify-write of `UiState.tips` — `updateUiState` shallow-merges * top-level keys only, so the `seen` writer (tips) and the `tourDone` writer * (tour) must go through one merge helper or they wipe each other. */ -export function updateTipsState(store: Store, patch: { seen?: string[]; tourDone?: boolean }): void { +export function updateTipsState(store: Store, patch: { seen?: string[]; tourDone?: boolean; tourVersion?: string }): void { const cur = store.api.loadUiState()?.tips ?? {}; store.api.updateUiState({ tips: { ...cur, ...patch } }); } @@ -112,7 +112,7 @@ export class TipManager { /** Reset = fresh onboarding: clears seen tips AND the tour-done flag, so the * invite re-fires next run ("show me everything again" semantics). */ - reset() { this.queue.clearSeen(); updateTipsState(this.store, { seen: [], tourDone: false }); } + reset() { this.queue.clearSeen(); updateTipsState(this.store, { seen: [], tourDone: false, tourVersion: undefined }); } /** Drops the visible tip and the queue without marking seen — used when the * tour starts so no two floating elements collide (T5). */ diff --git a/webview/tour.ts b/webview/tour.ts index cbef808..6a631a7 100644 --- a/webview/tour.ts +++ b/webview/tour.ts @@ -7,6 +7,7 @@ * clamp), unit-testable in plain Node like TipQueue. */ import type { Store } from "./state"; +import { guiVersion } from "./version"; import { LINKS } from "../shared/messages"; import { el } from "./dom"; import { materialIconSvg } from "./menuIcons"; @@ -48,9 +49,9 @@ export const TOUR_STEPS: readonly TourStep[] = [ text: "A cube stores the data — cells addressed by items of its dimensions — and the rules that compute them." }, { id: "browser-views", anchor: "views", fallbackAnchor: "view-area", place: "right", fallbackPlace: "inside", title: "Views", text: "A view is a live window into a cube — opening one adds a tab to the workspace." }, - { id: "views", anchor: "view-area", place: "inside", title: "View tabs", + { id: "views", anchor: "view-tab", fallbackAnchor: "view-area", place: "bottom", fallbackPlace: "inside", title: "View tabs", text: "Each tab is a live view into the model — drag a tab to split." }, - { id: "chips", anchor: "pivot", fallbackAnchor: "view-area", place: "bottom", fallbackPlace: "inside", title: "Dimension chips", + { id: "chips", anchor: "chip", fallbackAnchor: "pivot", place: "bottom", fallbackPlace: "bottom", title: "Dimension chips", text: "Drag chips between Page, Rows and Columns to rearrange a view; Page chips filter the slice." }, { id: "at-dim", anchor: "at-dim", fallbackAnchor: "view-area", place: "bottom", fallbackPlace: "inside", title: "The @ dimension", text: "Every cube's channel axis — 'value' holds the data; the other items carry formatting (fill, fonts, number formats)." }, @@ -186,13 +187,21 @@ export class TourManager { this.render(); } + /** tourDone suppresses the invite only within the version it was answered + * at — every deploy bumps the gui build string, so a new version re-offers + * the tour even after complete/skip/"don't ask again". */ + private tourAnswered(): boolean { + const t = this.store.api.loadUiState()?.tips; + return !!(t?.tourDone && t.tourVersion === guiVersion); + } + /** Completion and skip both persist tourDone — a skipped tour is a declined * tour; replay stays one menu click away, so there is no resume state. */ private finish() { this.stepIndex = -1; window.removeEventListener("resize", this.onResize); this.teardownDom(); - updateTipsState(this.store, { tourDone: true }); + updateTipsState(this.store, { tourDone: true, tourVersion: guiVersion }); } private next() { @@ -338,7 +347,7 @@ export class TourManager { * fact). Re-shown each run until Take the tour / Don't ask again. */ maybeInvite() { if (this.inviteEl || this.active()) return; - if (this.store.api.loadUiState()?.tips?.tourDone) return; + if (this.tourAnswered()) return; if (this.store.state.options.showTips === false) return; if (suppressedForOnboarding(this.store)) { this.pollInvite(); return; } @@ -349,8 +358,8 @@ export class TourManager { ["Take the tour"]), el("button", { class: "om-tip-btn", onClick: () => this.hideInvite() }, ["Later"]), - el("button", { class: "om-tip-btn", title: "Don't ask again (Help → Take the Tour… still works)", - onClick: () => { updateTipsState(this.store, { tourDone: true }); this.hideInvite(); } }, + el("button", { class: "om-tip-btn", title: "Don't ask again for this version (Help → Take the Tour… still works)", + onClick: () => { updateTipsState(this.store, { tourDone: true, tourVersion: guiVersion }); this.hideInvite(); } }, ["Don't ask again"]), ]); document.body.appendChild(this.inviteEl); @@ -363,7 +372,7 @@ export class TourManager { let tries = 0; this.invitePoll = window.setInterval(() => { if (++tries > 120 || this.inviteEl || this.active() - || this.store.api.loadUiState()?.tips?.tourDone + || this.tourAnswered() || this.store.state.options.showTips === false) { window.clearInterval(this.invitePoll); this.invitePoll = 0;