feat: éditeur tableur — grille A → Z par blocs, barre de menus Sheets, panneau de couleurs, création .xlsx (#180 → #186)
CI / lint (push) Successful in 2m43s
CI / security (push) Successful in 1m33s
CI / test (push) Canceled after 0s
CI / build (push) Canceled after 0s
CI / e2e (push) Canceled after 0s

Restaure et termine le lot tableur resté non committé. Il n'existait que dans un
`git stash` (24 fichiers suivis) et en fichiers non suivis (menus.js, formula.js,
color-picker.js, tests, fiches) : la 2.53.3 livrée ne le contenait donc pas. Le
stash, créé avant le commit BUG-108, n'a jamais été restauré.

#180 Redimensionnement au curseur (en-tête de bord miroité + classe de repaint),
grille thémée sur les 15 thèmes et les modes contraste élevé / sépia, menu
Fichier au niveau des onglets, barre épinglée pleine largeur.

#181 Modèle de saisie Google Sheets : sélection ≠ édition (caret masqué sans
quitter contenteditable, double-clic / F2 / première frappe qui remplace,
Entrée contextuelle, Échap qui restaure) + inventaire priorisé des écarts.

#182 Désélection fiable (clic simple sans dépendre du focus), contours de plage
non empilés (sélecteur de classes sans point), couleurs texte/fond sur une
plage, clic droit qui préserve la sélection multiple.

#183 Panneau de couleurs façon Google Sheets : palette 8 × 10, STANDARD,
PERSONNALISÉ, coche selon la luminance, sortie `#rrggbb` (une valeur HSL était
rejetée par normHex).

#184 Peinture de format complète (toutes propriétés, source sans format =
réinitialisation), sélection multi-lignes/colonnes depuis les marges, grille
étendue : colonnes A → Z d'emblée, lignes ajoutées PAR BLOCS DE 100 au
défilement jusqu'à 1000 — matérialiser 1000 lignes d'un coup = ~26 000 cellules
câblées par feuille, ce qui épuisait le tas de la suite JSDOM ; index de
cellules `ref → td`, court-circuits formule/styles, marqueur data-wired.

#185 Barre de menus : les 10 menus Google Sheets (161 entrées, 125 câblées, 36
annoncées indisponibles), ruban façon Sheets, grille unie 1 px dérivée du thème.

#186 « Créer un fichier » propose .xlsx et construit un vrai classeur OPC
(openpyxl) au lieu d'une charge utile texte illisible.

Corrections trouvées en restaurant et en exerçant le lot :
- fuite mémoire : écouteur `click` anonyme posé sur #content-area à chaque
  rendu, jamais retiré — sa fermeture retenait la grille précédente en entier ;
- sorties Markdown / HTML / Imprimer de la barre de menus inertes
  (`data-xlsx-export` jamais réparti, seul `data-xlsx-action` l'était) ;
- collision de classe `.xlsx-structure-menu` entre la barre de menus et le menu
  Structure de la barre d'outils (toute requête tombait sur un nœud masqué) ;
- curseur col/row-resize absent quand le pointeur est sur la table elle-même ;
- l'export emportait les lignes et colonnes vides du quadrillage (CSV, Markdown,
  HTML, impression) ;
- clic extérieur avalé par la grâce de 250 ms du menu contextuel (destinée au
  seul appui long tactile) ;
- une entrée indisponible laissait la barre de menus ouverte.

Tests : pytest 1595 passés / 2 ignorés ; ruff et mypy 0 erreur ; bandit 0 ;
33 suites frontend vertes (xlsx-viewer 163/163, xlsx-menus 19/19,
xlsx-formula 14/14) ; E2E complet 132 passés / 12 ignorés ; E2E xlsx-viewer
19/19.
This commit is contained in:
2026-10-08 12:00:15 -04:00
parent ce1944d437
commit 634ba8a272
39 changed files with 9996 additions and 491 deletions
+20
View File
@@ -587,6 +587,26 @@ function applyTheme(themeKey, mode) {
Object.keys(vars).forEach(function(key) {
root.style.setProperty(key, vars[key]);
});
// #180 — the spreadsheet grid follows the active theme: derive its tokens
// from the generic surfaces so every theme (15 built-in × 4 modes, custom
// imports) gets a matching grid instead of the hardcoded dark/light pair.
// color-mix keeps the zebra stripe subtle on both dark and light grounds.
// #185 — `--grid-border` no longer reuses `--border` (which sits 1-2% off the
// cell background on most themes, so the grid was invisible). The line is now
// a blend of the text colour into the sheet surface: the SAME single value
// for every line, and legible on both dark and light grounds.
var _gridSurface = vars['--surface'] || vars['--bg-secondary'] || '#000000';
var _gridInk = vars['--text-primary'] || vars['--text'] || '#888888';
var _grid = {
'--grid-bg': _gridSurface,
'--grid-header-bg': vars['--bg-hover'] || _gridSurface,
'--grid-header-text': _gridInk,
'--grid-border': 'color-mix(in srgb, ' + _gridInk + ' 22%, ' + _gridSurface + ')',
'--grid-zebra': 'color-mix(in srgb, ' + _gridInk + ' 4%, transparent)'
};
Object.keys(_grid).forEach(function(key) {
if (_grid[key]) root.style.setProperty(key, _grid[key]);
});
// Store resolved vars on the theme for export/preview
if (!theme.modes[mode]) theme.modes[mode] = vars;
+10 -9
View File
@@ -795,15 +795,16 @@ const FileOperations = {
<div class="modal-form-group">
<label class="modal-label">${t('modal.file_type')}</label>
<select class="modal-select" id="file-ext-select">
<option value=".md">Markdown (.md)</option>
<option value=".txt">Texte (.txt)</option>
<option value=".py">Python (.py)</option>
<option value=".js">JavaScript (.js)</option>
<option value=".json">JSON (.json)</option>
<option value=".excalidraw">Excalidraw (.excalidraw)</option>
<option value=".yaml">YAML (.yaml)</option>
<option value=".sh">Shell (.sh)</option>
<option value=".ps1">PowerShell (.ps1)</option>
<option value=".md">${t('modal.ext_md')}</option>
<option value=".txt">${t('modal.ext_txt')}</option>
<option value=".py">${t('modal.ext_py')}</option>
<option value=".js">${t('modal.ext_js')}</option>
<option value=".json">${t('modal.ext_json')}</option>
<option value=".xlsx">${t('modal.ext_xlsx')}</option>
<option value=".excalidraw">${t('modal.ext_excalidraw')}</option>
<option value=".yaml">${t('modal.ext_yaml')}</option>
<option value=".sh">${t('modal.ext_sh')}</option>
<option value=".ps1">${t('modal.ext_ps1')}</option>
</select>
</div>
</div>
+15
View File
@@ -695,6 +695,21 @@ async function reloadExternalWrite(vault, path, force = false) {
}
// Not editing: refresh the read view when it shows the written document.
if (state.currentVault === vault && state.currentPath === path) {
// The spreadsheet viewer applies its own writes dynamically (values,
// styles and structure stay in the DOM): reloading it here would wipe the
// grid behind a loading spinner on every save. Skip the reload when the
// event is the watcher echo of our own write (recent stamp) or when
// unsaved edits are still on screen (they would be clobbered). Forced
// reloads (assistant writes) still go through.
const xlsxOpen = !force
&& document.querySelector("#content-area .xlsx-viewer");
if (xlsxOpen) {
const own = window.__xlsxLastOwnWrite;
const recentOwn = own && own.vault === vault && own.path === path
&& (Date.now() - (own.at || 0)) < 15000;
const hasDirty = Boolean(document.querySelector("#content-area td.xlsx-dirty"));
if (recentOwn || hasDirty) return;
}
// Excalidraw owns its iframe: re-rendering would recreate it (visible page
// refresh) and discard the in-editor scene. Its own save already persisted
// the file, so there is nothing to reload here.
+3629 -185
View File
File diff suppressed because it is too large Load Diff
+311
View File
@@ -0,0 +1,311 @@
/* ObsiGate — XLSX colour picker panel (#183).
*
* Replaces the native `<input type="color">` of the spreadsheet ribbon and of
* the Mise en forme menu with a Google-Sheets-like panel:
*
* ┌ header ─ « Réinitialiser » ───────────────────┐
* │ palette 8 x 10 : ligne 1 = échelles de gris, │
* │ lignes 2-10 = 8 teintes x 9 │
* │ nuances (clair -> foncé) │
* │ STANDARD 8 pastilles prédéfinies │
* │ PERSONNALISÉ pastille + bouton « + » + crayon │
* │ pied Mise en forme conditionnelle, │
* │ Couleurs en alternance │
* └────────────────────────────────────────────────┘
*
* Picking a colour closes the panel and applies it (the caller owns the
* write). The panel markup is built here, positioning and dismissal are the
* viewer's (it already owns `anchorUnder` + `trackDismissable` for the other
* spreadsheet menus), so this module stays a pure builder.
*/
import { t } from '../i18n.js';
// 8 columns = 8 hues, in the Google Sheets order: red, orange, yellow, light
// green, cyan, blue, violet, magenta.
const HUES = [0, 30, 55, 100, 180, 215, 270, 320];
// 9 value rows, light (top) -> dark (bottom).
const ROWS = 9;
const GREYS = 8;
/**
* HSL → `#rrggbb`.
*
* The palette is generated in HSL for readability, but it MUST leave this
* module as hex: the write path (`normHex` in viewer.js) and the backend only
* accept `#rrggbb`, so an `hsl(...)` swatch would be silently dropped on save.
*/
export function hslToHex(h, s, l) {
const hue = ((h % 360) + 360) % 360;
const sat = Math.min(1, Math.max(0, s));
const lig = Math.min(1, Math.max(0, l));
const c = (1 - Math.abs(2 * lig - 1)) * sat;
const x = c * (1 - Math.abs(((hue / 60) % 2) - 1));
const m = lig - c / 2;
const seg = Math.floor(hue / 60) % 6;
const rgb = [
[c, x, 0], [x, c, 0], [0, c, x],
[0, x, c], [x, 0, c], [c, 0, x],
][seg] || [0, 0, 0];
return `#${rgb.map((v) => Math.round((v + m) * 255).toString(16).padStart(2, "0")).join("")}`;
}
/** Relative luminance (WCAG-ish) of a `#rrggbb` string, 0 (black) → 1 (white). */
export function luminanceOf(hex) {
const m = /^#?([0-9a-f]{6})$/i.exec(String(hex || "").trim());
if (!m) return 0;
const n = parseInt(m[1], 16);
const r = ((n >> 16) & 255) / 255;
const g = ((n >> 8) & 255) / 255;
const b = (n & 255) / 255;
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}
/**
* The 80 swatches: a first row of greys then 9 x 8 hues.
* @returns {Array<Array<string>>} 10 rows of 8 CSS colours
*/
export function buildPalette() {
const rows = [];
const greys = [];
for (let i = 0; i < GREYS; i++) {
// black -> white in 8 steps (l stays a 0..1 ratio, converted by hslToHex)
greys.push(hslToHex(0, 0, i / (GREYS - 1)));
}
rows.push(greys);
for (let r = 0; r < ROWS; r++) {
const l = 0.90 - r * (0.60 / (ROWS - 1)); // 0.90 -> 0.30
const s = 0.60 + r * (0.25 / (ROWS - 1)); // 0.60 -> 0.85
rows.push(HUES.map((h) => hslToHex(h, s, l)));
}
return rows;
}
/** The 8 predefined colours of the STANDARD row. */
export const STANDARD_COLOURS = [
{ key: "black", hex: "#000000" },
{ key: "white", hex: "#ffffff" },
{ key: "blue", hex: "#1a73e8" },
{ key: "red", hex: "#d93025" },
{ key: "yellow", hex: "#f4b400" },
{ key: "green", hex: "#188038" },
{ key: "orange", hex: "#e8710a" },
{ key: "cyan", hex: "#00bcd4" },
];
const CHECK_SVG =
'<svg class="xlsx-colour-check" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true" focusable="false">'
+ '<path fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" d="M20 6 9 17l-5-5"/></svg>';
const icon = (name) =>
`<i data-lucide="${name}" class="xlsx-colour-icon" aria-hidden="true"></i>`;
const button = (cls, label, ariaLabel) => {
const b = document.createElement("button");
b.type = "button";
b.className = `btn-action ${cls}`;
b.title = label;
b.setAttribute("aria-label", ariaLabel || label);
return b;
};
/**
* A single round swatch.
* @param {string} colour - CSS colour
* @param {string} label - tooltip / aria-label
* @param {boolean} selected - draw the check mark
*/
const swatchButton = (colour, label, selected) => {
const b = document.createElement("button");
b.type = "button";
b.className = "xlsx-colour-swatch-btn";
b.title = label;
b.setAttribute("aria-label", label);
b.style.background = colour;
b.dataset.colour = colour;
if (selected) {
b.classList.add("selected");
b.setAttribute("aria-pressed", "true");
// White check on dark grounds, black on light ones — otherwise the mark
// disappears (the same contrast rule as the design).
b.style.color = luminanceOf(colour) > 0.55 ? "#000000" : "#ffffff";
b.innerHTML = CHECK_SVG;
}
return b;
};
/**
* Build the panel.
*
* @param {object} opts
* @param {"font"|"fill"} opts.kind - drives the panel label and the footer
* @param {string} [opts.value] - current colour (`""` = none)
* @param {string} [opts.custom] - colour shown in the PERSONNALISÉ slot
* @param {Function} opts.onPick - (cssColour) => void; the panel is closed by
* the caller right after
* @param {Function} [opts.onReset] - clear the colour entirely
* @param {Function} [opts.onCustom] - open the native picker for a custom
* colour, called with no argument
* @param {Function} [opts.onUnavailable] - (i18nLabel) => void for the footer
* entries that ObsiGate does not implement yet
* @returns {{ el: HTMLElement, sync: Function }}
*/
export function createColourPicker({
kind = "font",
value = "",
custom = "",
onPick,
onReset,
onCustom,
onUnavailable,
} = {}) {
const panel = document.createElement("div");
panel.className = "xlsx-colour-panel";
panel.setAttribute("role", "dialog");
panel.setAttribute(
"aria-label",
kind === "fill" ? t("xlsx.colour_panel_fill") : t("xlsx.colour_panel_font")
);
const isFill = kind === "fill";
const norm = (c) => String(c || "").trim().toLowerCase();
// ── Header : Réinitialiser ────────────────────────────────────────────────
const head = document.createElement("div");
head.className = "xlsx-colour-head";
const reset = button(
"xlsx-colour-reset",
t("xlsx.colour_reset"),
isFill ? t("xlsx.colour_reset_fill") : t("xlsx.colour_reset_font")
);
reset.innerHTML = `${icon(isFill ? "eraser" : "paintbrush")}<span>${t("xlsx.colour_reset")}</span>`;
reset.addEventListener("click", () => {
if (onReset) onReset();
});
head.appendChild(reset);
panel.appendChild(head);
// ── Palette 8 x 10 ───────────────────────────────────────────────────────
const grid = document.createElement("div");
grid.className = "xlsx-colour-grid";
grid.setAttribute("role", "group");
grid.setAttribute("aria-label", t("xlsx.colour_palette"));
const current = norm(value);
buildPalette().forEach((row) => {
row.forEach((colour) => {
const b = swatchButton(colour, colour, norm(colour) === current);
b.addEventListener("click", () => {
if (onPick) onPick(colour);
});
grid.appendChild(b);
});
});
panel.appendChild(grid);
// ── STANDARD ─────────────────────────────────────────────────────────────
const standard = document.createElement("div");
standard.className = "xlsx-colour-section";
const stdHead = document.createElement("div");
stdHead.className = "xlsx-colour-title";
stdHead.appendChild(document.createTextNode(t("xlsx.colour_standard")));
const stdEdit = button(
"xlsx-colour-edit",
t("xlsx.colour_edit_standard"),
t("xlsx.colour_edit_standard")
);
stdEdit.innerHTML = icon("pencil");
stdEdit.addEventListener("click", () => {
if (onCustom) onCustom();
});
stdHead.appendChild(stdEdit);
standard.appendChild(stdHead);
const stdRow = document.createElement("div");
stdRow.className = "xlsx-colour-row";
STANDARD_COLOURS.forEach(({ key, hex }) => {
const label = t(`xlsx.colour_${key}`);
const b = swatchButton(hex, label, norm(hex) === current);
b.addEventListener("click", () => {
if (onPick) onPick(hex);
});
stdRow.appendChild(b);
});
standard.appendChild(stdRow);
panel.appendChild(standard);
// ── PERSONNALISÉ ─────────────────────────────────────────────────────────
const customSection = document.createElement("div");
customSection.className = "xlsx-colour-section";
const cusHead = document.createElement("div");
cusHead.className = "xlsx-colour-title";
cusHead.appendChild(document.createTextNode(t("xlsx.colour_custom")));
customSection.appendChild(cusHead);
const cusRow = document.createElement("div");
cusRow.className = "xlsx-colour-row";
const customColour = custom || value;
const cusSwatch = swatchButton(
customColour || "transparent",
t("xlsx.colour_custom"),
Boolean(customColour) && norm(customColour) === current
);
cusSwatch.addEventListener("click", () => {
if (customColour && onPick) onPick(customColour);
});
cusRow.appendChild(cusSwatch);
const add = button("xlsx-colour-add", t("xlsx.colour_custom_pick"), t("xlsx.colour_custom_pick"));
add.innerHTML = icon("plus");
add.addEventListener("click", () => {
if (onCustom) onCustom();
});
cusRow.appendChild(add);
const cusEdit = button("xlsx-colour-edit", t("xlsx.colour_custom_pick"), t("xlsx.colour_custom_pick"));
cusEdit.innerHTML = icon("pencil");
cusEdit.addEventListener("click", () => {
if (onCustom) onCustom();
});
cusRow.appendChild(cusEdit);
customSection.appendChild(cusRow);
panel.appendChild(customSection);
// ── Footer ───────────────────────────────────────────────────────────────
// Both entries are announced by ObsiGate but not implemented yet: they call
// back with their label so the caller can tell the user instead of leaving a
// dead button. « Couleurs en alternance » only shows once a colour is set,
// exactly like the reference screenshots.
const foot = document.createElement("div");
foot.className = "xlsx-colour-foot";
const footEntry = (label, key) => {
const b = document.createElement("button");
b.type = "button";
b.className = "xlsx-colour-foot-item";
b.textContent = label;
b.dataset.colourAction = key;
b.addEventListener("click", () => {
if (onUnavailable) onUnavailable(label);
});
return b;
};
foot.appendChild(footEntry(t("xlsx.colour_conditional"), "conditional"));
if (value) foot.appendChild(footEntry(t("xlsx.colour_banded"), "banded"));
panel.appendChild(foot);
/** Repaint the check mark after the value changed (custom colour applied). */
const sync = (next, nextCustom) => {
const want = norm(next);
panel.querySelectorAll(".xlsx-colour-swatch-btn").forEach((b) => {
const on = norm(b.dataset.colour) === want;
b.classList.toggle("selected", on);
b.setAttribute("aria-pressed", String(on));
b.innerHTML = on
? (b.style.color = luminanceOf(b.dataset.colour) > 0.55 ? "#000000" : "#ffffff", CHECK_SVG)
: "";
});
if (nextCustom) {
const slot = panel.querySelector(".xlsx-colour-section:nth-of-type(3) .xlsx-colour-row .xlsx-colour-swatch-btn");
if (slot) slot.style.background = nextCustom;
}
};
return { el: panel, sync };
}
+128 -25
View File
@@ -1,19 +1,29 @@
/* ObsiGate — XLSX command bar builder (#154-A5).
/* ObsiGate — XLSX command bar builder (Sheets-like ribbon).
*
* Pure string builder for the spreadsheet shell (sheet tabs + grouped action
* buttons + status pills). Extracted from frontend/js/viewer.js so the markup
* is testable and the viewer only wires behaviour.
*
* Order follows Google Sheets: search, undo/redo, print, paint, zoom, number
* formats, font size, B/I/S/U, colours, borders, merge, alignments, wrap,
* rotation, overflow menu — then the ObsiGate-specific groups (structure,
* format, view, gridlines) kept with their stable ids. File outputs
* (Download / CSV / Markdown / HTML / Print) moved to the **Fichier** menu of
* the menu bar (#185, frontend/js/xlsx/menus.js); only Save stays on the
* sheet-tab strip, pinned at its right end.
*/
import { t } from '../i18n.js';
import { escapeHtml } from '../utils.js';
const IC = (name) => `<i data-lucide="${name}" style="width:14px;height:14px" aria-hidden="true"></i>`;
/**
* @param {object} ctx
* @param {Array<{name: string}>} ctx.sheets
* @param {boolean} ctx.isCsv
* @param {boolean} ctx.readOnly
* @param {boolean} ctx.editable - not a CSV and not read-only
* @returns {{ tabs: string, actionsHtml: string, statusBar: string }}
* @returns {{ tabs: string, actionsHtml: string, statusBar: string, fileHtml: string }}
*/
export function buildCommandBar({ sheets, isCsv, readOnly, editable }) {
// Sheet tabs are always rendered (even for a single sheet) so the strip reads
@@ -26,19 +36,23 @@ export function buildCommandBar({ sheets, isCsv, readOnly, editable }) {
? `<button class="xlsx-tab-add" id="xlsx-tab-add" type="button" title="${escapeHtml(t("xlsx.tabs_add_sheet"))}" aria-label="${escapeHtml(t("xlsx.tabs_add_sheet"))}"><i data-lucide="plus" style="width:14px;height:14px" aria-hidden="true"></i></button>`
: ""}</div>`;
// Status pills make the viewer's limits visible up front.
// Status pills make the viewer's limits visible up front (#180: the
// "formulas computed locally" pill is gone — local computation is the
// normal behaviour, not a limit worth a badge).
const statusPills = [
readOnly
? `<span class="xlsx-status-pill xlsx-status-readonly" title="${escapeHtml(t("xlsx.readonly_hint"))}"><i data-lucide="lock" class="xlsx-status-icon"></i>${escapeHtml(t("xlsx.readonly_badge"))}</span>`
: "",
!isCsv
? `<span class="xlsx-status-pill xlsx-status-formula" title="${escapeHtml(t("xlsx.formulas_note_title"))}"><i data-lucide="sigma" class="xlsx-status-icon"></i>${escapeHtml(t("xlsx.formulas_note"))}</span>`
: "",
].filter(Boolean).join("");
const statusBar = statusPills ? `<div class="xlsx-status-bar">${statusPills}</div>` : "";
// Command groups, separated by thin rules.
// Command groups, separated by thin rules (Sheets order).
const actionGroups = [];
actionGroups.push(`<span class="xlsx-cmd-group" data-group="search">
<button class="btn-action" id="xs-search" type="button" title="${escapeHtml(t("xlsx.tb_search"))}" aria-label="${escapeHtml(t("xlsx.tb_search"))}">
${IC("search")}
</button>
</span>`);
if (!readOnly) {
actionGroups.push(`<span class="xlsx-cmd-group" data-group="history">
<button class="btn-action" id="xlsx-undo-btn" type="button" title="${escapeHtml(t("xlsx.undo"))}" disabled>
@@ -48,6 +62,97 @@ export function buildCommandBar({ sheets, isCsv, readOnly, editable }) {
<i data-lucide="redo-2" style="width:14px;height:14px"></i>
</button>
</span>`);
}
actionGroups.push(`<span class="xlsx-cmd-group" data-group="print">
<button class="btn-action" id="xs-print" type="button" title="${escapeHtml(t("xlsx.print"))}" aria-label="${escapeHtml(t("xlsx.print"))}">
${IC("printer")}
</button>
</span>`);
if (editable) {
actionGroups.push(`<span class="xlsx-cmd-group" data-group="paint">
<button class="btn-action" id="xs-paint" type="button" title="${escapeHtml(t("xlsx.tb_paint"))}" aria-label="${escapeHtml(t("xlsx.tb_paint"))}" aria-pressed="false">
${IC("paint-roller")}
</button>
</span>`);
actionGroups.push(`<span class="xlsx-cmd-group" data-group="zoom">
<select class="xlsx-select" id="xs-zoom" title="${escapeHtml(t("xlsx.tb_zoom"))}" aria-label="${escapeHtml(t("xlsx.tb_zoom"))}">
${[50, 75, 90, 100, 125, 150, 200].map((z) =>
`<option value="${z}"${z === 100 ? " selected" : ""}>${z} %</option>`).join("")}
</select>
</span>`);
actionGroups.push(`<span class="xlsx-cmd-group" data-group="number">
<button class="btn-action" id="xs-cur" type="button" title="${escapeHtml(t("xlsx.tb_currency"))}" aria-label="${escapeHtml(t("xlsx.tb_currency"))}">
${IC("dollar-sign")}
</button>
<button class="btn-action" id="xs-pct" type="button" title="${escapeHtml(t("xlsx.tb_percent"))}" aria-label="${escapeHtml(t("xlsx.tb_percent"))}">
${IC("percent")}
</button>
<button class="btn-action xlsx-dec" id="xs-decminus" type="button" title="${escapeHtml(t("xlsx.tb_dec_minus"))}" aria-label="${escapeHtml(t("xlsx.tb_dec_minus"))}">.0&larr;</button>
<button class="btn-action xlsx-dec" id="xs-decplus" type="button" title="${escapeHtml(t("xlsx.tb_dec_plus"))}" aria-label="${escapeHtml(t("xlsx.tb_dec_plus"))}">.00&rarr;</button>
<button class="btn-action" id="xs-num123" type="button" title="${escapeHtml(t("xlsx.tb_number"))}" aria-label="${escapeHtml(t("xlsx.tb_number"))}">123</button>
<select class="xlsx-select" id="xs-numfmt" title="${escapeHtml(t("xlsx.tb_numfmt"))}" aria-label="${escapeHtml(t("xlsx.tb_numfmt"))}">
<option value="" selected>${escapeHtml(t("xlsx.tb_numfmt"))}</option>
<option value="General">${escapeHtml(t("xlsx.format_num_general"))}</option>
<option value="0.00">${escapeHtml(t("xlsx.format_num_number"))}</option>
<option value="0.0%">${escapeHtml(t("xlsx.format_num_percent"))}</option>
<option value="#,##0.00 &quot;€&quot;">${escapeHtml(t("xlsx.format_num_currency"))}</option>
<option value="DD/MM/YYYY">${escapeHtml(t("xlsx.format_num_date"))}</option>
<option value="@">${escapeHtml(t("xlsx.format_num_text"))}</option>
</select>
</span>`);
// #183 — colour commands open the Sheets-like panel built by
// xlsx/color-picker.js (the native <input type="color"> is kept hidden and
// only driven by the panel's « + » / crayon buttons).
const colourPick = (id, label, iconName, swatchId) =>
`<span class="xlsx-colorpick-wrap">`
+ `<button class="btn-action xlsx-colorpick" id="${id}" type="button"`
+ ` data-xlsx-colour="${swatchId === "xs-fgcolor" ? "font" : "fill"}"`
+ ` title="${escapeHtml(label)}" aria-label="${escapeHtml(label)}"`
+ ` aria-haspopup="dialog" aria-expanded="false">`
+ (iconName === "fill" ? IC("paint-bucket") : '<span class="xlsx-colorletter" aria-hidden="true">A</span>')
+ `<span class="xlsx-color-swatch" data-swatch-for="${swatchId}" aria-hidden="true"></span>`
+ `</button>`
+ `<input type="color" class="xlsx-color-native" data-xlsx-native-for="${swatchId}" tabindex="-1" aria-hidden="true">`
+ `</span>`;
actionGroups.push(`<span class="xlsx-cmd-group" data-group="font">
<button class="btn-action" id="xs-fsminus" type="button" title="${escapeHtml(t("xlsx.tb_font_minus"))}" aria-label="${escapeHtml(t("xlsx.tb_font_minus"))}">&minus;</button>
<select class="xlsx-select xlsx-fontsize" id="xs-fssize" title="${escapeHtml(t("xlsx.tb_font_size"))}" aria-label="${escapeHtml(t("xlsx.tb_font_size"))}">
${[6, 7, 8, 9, 10, 11, 12, 14, 18, 24, 36, 40].map((s) =>
`<option value="${s}"${s === 11 ? " selected" : ""}>${s}</option>`).join("")}
</select>
<button class="btn-action" id="xs-fsplus" type="button" title="${escapeHtml(t("xlsx.tb_font_plus"))}" aria-label="${escapeHtml(t("xlsx.tb_font_plus"))}">+</button>
<button class="btn-action xlsx-fontstyle" id="xs-b" type="button" title="${escapeHtml(t("xlsx.format_bold"))}" aria-label="${escapeHtml(t("xlsx.format_bold"))}" aria-pressed="false"><b>B</b></button>
<button class="btn-action xlsx-fontstyle" id="xs-i" type="button" title="${escapeHtml(t("xlsx.format_italic"))}" aria-label="${escapeHtml(t("xlsx.format_italic"))}" aria-pressed="false"><i>I</i></button>
<button class="btn-action xlsx-fontstyle" id="xs-s" type="button" title="${escapeHtml(t("xlsx.format_strike"))}" aria-label="${escapeHtml(t("xlsx.format_strike"))}" aria-pressed="false"><s>S</s></button>
<button class="btn-action xlsx-fontstyle" id="xs-u" type="button" title="${escapeHtml(t("xlsx.format_underline"))}" aria-label="${escapeHtml(t("xlsx.format_underline"))}" aria-pressed="false"><u>U</u></button>
${colourPick("xs-fgcolor", t("xlsx.format_font_color"), "font", "xs-fgcolor")}
${colourPick("xs-bgcolor", t("xlsx.format_fill_color"), "fill", "xs-bgcolor")}
</span>`);
actionGroups.push(`<span class="xlsx-cmd-group" data-group="arrange">
<button class="btn-action" id="xs-borders" type="button" title="${escapeHtml(t("xlsx.tb_borders"))}" aria-label="${escapeHtml(t("xlsx.tb_borders"))}" aria-haspopup="menu" aria-expanded="false">
${IC("grid-2x2")}
</button>
<button class="btn-action" id="xs-merge" type="button" title="${escapeHtml(t("xlsx.tb_merge"))}" aria-label="${escapeHtml(t("xlsx.tb_merge"))}">
${IC("combine")}
</button>
<button class="btn-action" id="xs-alignh" type="button" title="${escapeHtml(t("xlsx.tb_alignh"))}" aria-label="${escapeHtml(t("xlsx.tb_alignh"))}" aria-haspopup="menu" aria-expanded="false">
${IC("align-left")}
</button>
<button class="btn-action" id="xs-alignv" type="button" title="${escapeHtml(t("xlsx.tb_alignv"))}" aria-label="${escapeHtml(t("xlsx.tb_alignv"))}" aria-haspopup="menu" aria-expanded="false">
${IC("align-center-vertical")}
</button>
<button class="btn-action" id="xs-wrap" type="button" title="${escapeHtml(t("xlsx.tb_wrap"))}" aria-label="${escapeHtml(t("xlsx.tb_wrap"))}" aria-pressed="false">
${IC("wrap-text")}
</button>
<button class="btn-action" id="xs-rot" type="button" title="${escapeHtml(t("xlsx.tb_rotation"))}" aria-label="${escapeHtml(t("xlsx.tb_rotation"))}" aria-haspopup="menu" aria-expanded="false">
${IC("rotate-cw")}
</button>
<button class="btn-action" id="xs-more" type="button" title="${escapeHtml(t("xlsx.tb_more"))}" aria-label="${escapeHtml(t("xlsx.tb_more"))}" aria-haspopup="menu" aria-expanded="false">
${IC("more-vertical")}
</button>
</span>`);
}
if (!readOnly) {
actionGroups.push(`<span class="xlsx-cmd-group" data-group="formulas">
<button class="btn-action xlsx-formula-toggle" id="xlsx-formula-btn" type="button"
aria-pressed="false" title="${escapeHtml(t("xlsx.formula_toggle_title"))}">f(x)</button>
@@ -64,26 +169,24 @@ export function buildCommandBar({ sheets, isCsv, readOnly, editable }) {
</span>`);
actionGroups.push(`<span class="xlsx-cmd-group" id="xlsx-view-group" data-group="view"></span>`);
}
actionGroups.push(`<span class="xlsx-cmd-group" data-group="file">
<button class="btn-action" id="xlsx-download-btn">
<i data-lucide="download" style="width:14px;height:14px"></i> ${t("viewer.download")}
// #185 — the ribbon now reads like Google Sheets': flat icon buttons, no
// chrome, grouped by thin vertical rules. The gridline switch belongs to it
// (the View ▸ Show menu toggles the very same state).
actionGroups.push(`<span class="xlsx-cmd-group" data-group="grid">
<button class="btn-action active" id="xs-grid" type="button" aria-pressed="true"
title="${escapeHtml(t("xlsx.mi_show_grid"))}" aria-label="${escapeHtml(t("xlsx.mi_show_grid"))}">
${IC("grid-3x3")}
</button>
<button class="btn-action" id="xlsx-csv-btn" title="${escapeHtml(t("xlsx.csv_export"))}">
<i data-lucide="file-spreadsheet" style="width:14px;height:14px"></i> CSV
</button>
<span class="export-dropdown xlsx-export-dropdown">
<button class="btn-action" id="xlsx-export-btn" type="button" title="${escapeHtml(t("xlsx.export_title"))}" aria-haspopup="menu" aria-expanded="false">
<i data-lucide="file-down" style="width:14px;height:14px"></i> ${escapeHtml(t("xlsx.export_btn"))}
</button>
<div class="export-menu xlsx-export-menu" id="xlsx-export-menu" style="display:none" role="menu">
<button class="export-menu-item" type="button" role="menuitem" data-xlsx-export="md"><i data-lucide="file-text" class="xlsx-menu-icon" aria-hidden="true"></i><span class="xlsx-menu-label">${escapeHtml(t("xlsx.export_md"))}</span></button>
<button class="export-menu-item" type="button" role="menuitem" data-xlsx-export="html"><i data-lucide="code" class="xlsx-menu-icon" aria-hidden="true"></i><span class="xlsx-menu-label">${escapeHtml(t("xlsx.export_html"))}</span></button>
<button class="export-menu-item" type="button" role="menuitem" data-xlsx-export="print"><i data-lucide="printer" class="xlsx-menu-icon" aria-hidden="true"></i><span class="xlsx-menu-label">${escapeHtml(t("xlsx.print"))}</span></button>
</div>
</span>
<button class="btn-action xlsx-save-primary" id="xlsx-save-btn" disabled><i data-lucide="save" style="width:14px;height:14px" aria-hidden="true"></i> ${t("common.save")}</button>
</span>`);
const actionsHtml = actionGroups.join('<span class="xlsx-cmd-sep" aria-hidden="true"></span>');
return { tabs, actionsHtml, statusBar };
// #185 — file outputs moved to the **Fichier** menu of the menu bar
// (frontend/js/xlsx/menus.js), which keeps the `#xlsx-download-btn` /
// `#xlsx-csv-btn` ids and the `[data-xlsx-export]` markers. Only **Save**
// stays on the sheet-tab strip, pinned at its right end.
const fileHtml =
`<button class="btn-action xlsx-save-primary" id="xlsx-save-btn" disabled>`
+ `<i data-lucide="save" style="width:14px;height:14px" aria-hidden="true"></i> ${t("common.save")}</button>`;
return { tabs, actionsHtml, statusBar, fileHtml };
}
+50 -17
View File
@@ -14,14 +14,15 @@ import { safeCreateIcons } from '../utils.js';
let _menu = null;
let _openedAt = 0;
// Only a touch long-press can emit a click right after the menu opened.
let _openedByTouch = false;
let _dismissBound = false;
export function closeContextMenu() {
// BUG-108: drop the reference BEFORE touching the DOM — removing a menu
// that holds the focus fires blur/focusout synchronously, which re-enters
// this very function; the second remove() on the mid-flight node throws
// NotFoundError and aborts the caller's click handler before its action
// runs (contextual « Coller » silently dead, e2e xlsx-viewer A5).
// Drop the reference BEFORE touching the DOM: removing a menu that holds
// the focus fires blur/focusout synchronously, which re-enters this very
// function — a second remove() on the mid-flight node throws NotFoundError
// and aborts the caller's click handler before its action runs.
const menu = _menu;
_menu = null;
if (menu) menu.remove();
@@ -36,9 +37,11 @@ function bindDismiss() {
_dismissBound = true;
document.addEventListener("click", (e) => {
if (!_menu) return;
// Ignore the very gesture that opened the menu (touch long-press can emit
// a click right after).
if (Date.now() - _openedAt < 250) return;
// Ignore the very gesture that opened the menu — but only for a touch
// long-press, which is the one that emits a trailing click. A mouse
// right-click does not, so a deliberate outside click made right after
// must close the menu instead of being swallowed.
if (_openedByTouch && Date.now() - _openedAt < 250) return;
if (e.target && e.target.closest && e.target.closest(".xlsx-context-menu")) return;
closeContextMenu();
});
@@ -56,8 +59,12 @@ function bindDismiss() {
});
if (typeof window !== "undefined") {
window.addEventListener("blur", closeContextMenu);
// A scroll or resize detaches the viewport-anchored menu from its cell.
window.addEventListener("scroll", closeContextMenu, true);
// A scroll detaches the viewport-anchored menu from its cell — except the
// tail of the smooth scroll that revealed the right-clicked cell (global
// `scroll-behavior: smooth` keeps firing after the menu opened).
window.addEventListener("scroll", () => {
if (Date.now() - _openedAt > 400) closeContextMenu();
}, true);
window.addEventListener("resize", closeContextMenu);
}
}
@@ -111,25 +118,50 @@ export function trackDismissable(menuEl, { toggle = null, onClose = null } = {})
if (onClose) onClose();
else menuEl.remove();
};
// A re-render can detach the menu without dismissing it: unbind silently
// instead of leaking listeners on a dead node.
const dropIfDetached = () => {
if (!menuEl.isConnected) {
if (!done) { done = true; unbind(); }
return true;
}
return false;
};
const onDocClick = (e) => {
if (done) return;
if (!menuEl.isConnected) { done = true; unbind(); return; }
if (done || dropIfDetached()) return;
const t = e.target;
if (menuEl.contains(t)) return;
if (toggle && (toggle === t || toggle.contains(t))) return;
dismiss();
};
const onKey = (e) => {
if (e.key === "Escape" && menuEl.isConnected) dismiss();
if (dropIfDetached()) return;
if (e.key === "Escape") dismiss();
};
const onFocusOut = (e) => {
if (done || !menuEl.isConnected) return;
if (done || dropIfDetached()) return;
const next = e.relatedTarget;
if (next && (menuEl.contains(next) || (toggle && toggle.contains(next)))) return;
dismiss();
};
const onScroll = () => {
if (menuEl.isConnected) dismiss();
// Toolbar-anchored menus travel WITH their button: a scroll inside the
// hosting toolbar (focus scroll-into-view, horizontal scroll, the menu's
// own overflow) must not dismiss them — only an outside scroll detaches.
// Same grace as the grid menu for the smooth-scroll tail of the opening.
// A body-level menu has no travelling anchor: every scroll detaches it.
const rawAnchor = (toggle && toggle.closest && toggle.closest(".xlsx-toolbar"))
|| menuEl.parentElement
|| null;
const anchor = rawAnchor && rawAnchor !== document && rawAnchor !== document.body
? rawAnchor
: null;
const openedAt = Date.now();
const onScroll = (e) => {
if (dropIfDetached()) return;
if (Date.now() - openedAt < 400) return;
const t = e && e.target;
if (t && anchor && (t === anchor || (anchor.contains && anchor.contains(t)))) return;
dismiss();
};
document.addEventListener("click", onDocClick);
document.addEventListener("keydown", onKey);
@@ -147,7 +179,7 @@ export function trackDismissable(menuEl, { toggle = null, onClose = null } = {})
* @param {Array<{label?: string, icon?: string, separator?: boolean, danger?: boolean, disabled?: boolean, onClick?: Function}>} items
* @returns {HTMLElement} the menu element
*/
export function openContextMenu(x, y, items) {
export function openContextMenu(x, y, items, { byTouch = false } = {}) {
bindDismiss();
closeContextMenu();
const menu = document.createElement("div");
@@ -198,6 +230,7 @@ export function openContextMenu(x, y, items) {
_menu = menu;
_openedAt = Date.now();
_openedByTouch = byTouch;
// Keyboard users land on the first entry right away; mouse users are
// unaffected (hover/click still work). preventScroll avoids yanking the grid.
const first = menu.querySelector(".xlsx-context-item:not(:disabled)");
+755
View File
@@ -0,0 +1,755 @@
/* ObsiGate — minimal client-side spreadsheet formula engine.
*
* Evaluates `=…` / `@…` cell content locally (same sheet, plus loaded
* cross-sheet panels) so functions work without a round-trip: arithmetic,
* comparisons, %, cell/range references and ~30 FR/EN functions.
*
* Safe by construction: own tokenizer + recursive-descent parser, no eval().
* Anything the parser rejects keeps its original rendering (Excel stays the
* source of truth on save); evaluation failures surface as Excel-style error
* codes instead.
*
* Limits (documented): same-workbook only, no whole-column (A:A) references,
* TODAY()/NOW() refresh on edit/render (no timer), array results show their
* top-left value.
*/
const MAX_COL = 18278; // XFD
const MAX_ROW = 1048576;
/** FR aliases accepted next to the EN canonical names. */
const ALIASES = {
SOMME: "SUM", MOYENNE: "AVERAGE", NB: "COUNT", NBVAL: "COUNTA",
PRODUIT: "PRODUCT", MEDIANE: "MEDIAN", ARRONDI: "ROUND", ENT: "INT",
RACINE: "SQRT", PUISSANCE: "POWER", SI: "IF", ET: "AND", OU: "OR",
NON: "NOT", SIERREUR: "IFERROR", CONCATENER: "CONCAT",
MAJUSCULES: "UPPER", MINUSCULES: "LOWER", NBCAR: "LEN",
SUPPRESPACE: "TRIM", GAUCHE: "LEFT", DROITE: "RIGHT", STXT: "MID",
AUJOURDHUI: "TODAY", MAINTENANT: "NOW", JOUR: "DAY", MOIS: "MONTH",
ANNEE: "YEAR", LIEN: "HYPERLINK",
};
const ERRORS = {
fr: { DIV: "#DIV/0!", VALUE: "#VALEUR!", NAME: "#NOM?", REF: "#REF!", CYCLE: "#CYCLE!" },
en: { DIV: "#DIV/0!", VALUE: "#VALUE!", NAME: "#NAME?", REF: "#REF!", CIRC: "#CIRC!" },
};
export function errorCodes(locale) {
return ERRORS[locale === "fr" ? "fr" : "en"];
}
export function isFormulaText(s) {
if (typeof s !== "string") return false;
const t = s.trim();
return t.length > 1 && (t[0] === "=" || t[0] === "@");
}
/** Column letters (no $) → 1-based index, or 0 when invalid. */
export function colToIndex(letters) {
let n = 0;
const up = String(letters || "").toUpperCase();
if (!/^[A-Z]{1,3}$/.test(up)) return 0;
for (const ch of up) n = n * 26 + (ch.charCodeAt(0) - 64);
return n > MAX_COL ? 0 : n;
}
export function indexToCol(n) {
let s = "";
while (n > 0) {
const m = (n - 1) % 26;
s = String.fromCharCode(65 + m) + s;
n = Math.floor((n - 1) / 26);
}
return s;
}
/** Parse "[$]A[$]1" (already stripped of any sheet prefix) → {col,row} | null. */
export function parseA1(ref) {
const m = /^\$?([A-Za-z]{1,3})\$?([0-9]+)$/.exec(String(ref || "").trim());
if (!m) return null;
const col = colToIndex(m[1]);
const row = Number(m[2]);
if (!col || !(row >= 1 && row <= MAX_ROW)) return null;
return { col, row };
}
// ── Tokenizer ─────────────────────────────────────────────────────────────
function tokenize(src, sep) {
const tokens = [];
let i = 0;
const n = src.length;
const isSpace = (c) => c === " " || c === "\t" || c === "\n" || c === "\r";
while (i < n) {
const c = src[i];
if (isSpace(c)) { i++; continue; }
if (c === '"') {
let j = i + 1;
let out = "";
while (j < n) {
if (src[j] === '"') {
if (src[j + 1] === '"') { out += '"'; j += 2; }
else break;
} else { out += src[j]; j++; }
}
if (j >= n) throw new Error("string");
tokens.push({ t: "str", v: out });
i = j + 1;
continue;
}
if (c === "'") {
// Quoted sheet name: 'Mon Sheet'!A1
let j = i + 1;
let out = "";
while (j < n && src[j] !== "'") { out += src[j]; j++; }
if (j >= n) throw new Error("sheet");
tokens.push({ t: "sheet", v: out });
i = j + 1;
continue;
}
const numMatch = /^[0-9]+(?:[.,][0-9]+)?/.exec(src.slice(i));
if (numMatch && (sep === ";" || !numMatch[0].includes(","))) {
tokens.push({ t: "num", v: numMatch[0].replace(",", ".") });
i += numMatch[0].length;
continue;
}
const absRef = /^\$?[A-Za-z]{1,3}\$?[0-9]+/.exec(src.slice(i));
if (absRef) {
tokens.push({ t: "ref", v: absRef[0] });
i += absRef[0].length;
continue;
}
const two = src.slice(i, i + 2);
if (["<=", ">=", "<>"].includes(two)) {
tokens.push({ t: "op", v: two === "<>" ? "!=" : two });
i += 2;
continue;
}
if ("+-*/^%=()<>,;:&!".includes(c)) {
tokens.push({ t: c === "," || c === ";" ? "sep" : "op", v: c });
i++;
continue;
}
const word = /^[A-Za-zÀ-ÿ_][A-Za-zÀ-ÿ0-9_.]*/.exec(src.slice(i));
if (word) {
const w = word[0];
// A bare cell reference (A1, $B$12) — but not TRUE/FALSE yet (bools).
if (/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(w)) {
tokens.push({ t: "ref", v: w });
} else {
const up = w.toUpperCase();
if (up === "TRUE" || up === "VRAI") tokens.push({ t: "bool", v: true });
else if (up === "FALSE" || up === "FAUX") tokens.push({ t: "bool", v: false });
else tokens.push({ t: "word", v: w });
}
i += w.length;
continue;
}
throw new Error("char:" + c);
}
return tokens;
}
// ── Parser (recursive descent, builds a small AST) ─────────────────────────
function makeParser(tokens, sep) {
let pos = 0;
const peek = () => tokens[pos] || null;
const next = () => tokens[pos++] || null;
const expectOp = (v) => {
const t = next();
if (!t || t.t !== "op" || t.v !== v) throw new Error("expected " + v);
};
const expectSep = () => {
const t = next();
if (!t || t.t !== "sep") throw new Error("expected separator");
};
function parseExpr() { return parseComparison(); }
function parseComparison() {
let left = parseConcat();
for (;;) {
const t = peek();
if (!t || t.t !== "op" || !["=", "!=", "<", "<=", ">", ">="].includes(t.v)) return left;
next();
left = [t.v, left, parseConcat()];
}
}
function parseConcat() {
let left = parseAdd();
for (;;) {
const t = peek();
if (!t || t.t !== "op" || t.v !== "&") return left;
next();
left = ["&", left, parseAdd()];
}
}
function parseAdd() {
let left = parseMul();
for (;;) {
const t = peek();
if (!t || t.t !== "op" || (t.v !== "+" && t.v !== "-")) return left;
next();
left = [t.v, left, parseMul()];
}
}
function parseMul() {
let left = parsePower();
for (;;) {
const t = peek();
if (!t || t.t !== "op" || (t.v !== "*" && t.v !== "/")) return left;
next();
left = [t.v, left, parsePower()];
}
}
// Excel-compatible: a leading sign binds to the base (-2^2 = (-2)^2 = 4),
// and to the exponent on the right (2^-2).
function parseSigned() {
let neg = false;
for (;;) {
const t = peek();
if (t && t.t === "op" && (t.v === "+" || t.v === "-")) {
if (t.v === "-") neg = !neg;
next();
} else break;
}
const node = parsePostfix();
return neg ? ["neg", node] : node;
}
function parsePower() {
const base = parseSigned();
const t = peek();
if (t && t.t === "op" && t.v === "^") {
next();
return ["^", base, parseSigned()];
}
return base;
}
function parsePostfix() {
let node = parsePrimary();
for (;;) {
const t = peek();
if (t && t.t === "op" && t.v === "%") { next(); node = ["%", node]; }
else return node;
}
}
function parsePrimary() {
const t = next();
if (!t) throw new Error("empty");
if (t.t === "num") return ["n", Number(t.v)];
if (t.t === "str") return ["s", t.v];
if (t.t === "bool") return ["b", t.v];
if (t.t === "ref") {
const after = peek();
if (after && after.t === "op" && after.v === ":") {
next();
const t2 = next();
if (!t2 || t2.t !== "ref") throw new Error("range");
return ["range", normRef(t.v), normRef(t2.v)];
}
return ["ref", normRef(t.v)];
}
if (t.t === "word" || t.t === "sheet") {
const isSheet = t.t === "sheet";
let name = t.v;
if (!isSheet) {
// Unquoted sheet name: Name!A1
const bang = peek();
if (bang && bang.t === "op" && bang.v === "!") {
next();
} else {
// Function call?
const paren = peek();
if (paren && paren.t === "op" && paren.v === "(") {
next();
const args = [];
const closing = peek();
if (!(closing && closing.t === "op" && closing.v === ")")) {
for (;;) {
args.push(parseExpr());
const s = peek();
if (s && s.t === "sep") { next(); continue; }
break;
}
}
expectOp(")");
return ["call", canonName(name), args];
}
throw new Error("name:" + name);
}
} else {
const bang = peek();
if (!bang || bang.t !== "op" || bang.v !== "!") throw new Error("sheetref");
next();
}
const r1 = next();
if (!r1 || r1.t !== "ref") throw new Error("sheetref");
const colon = peek();
if (colon && colon.t === "op" && colon.v === ":") {
next();
const r2 = next();
if (!r2 || r2.t !== "ref") throw new Error("sheetrange");
return ["sheetrange", name, normRef(r1.v), normRef(r2.v)];
}
return ["sheetref", name, normRef(r1.v)];
}
if (t.t === "op" && t.v === "(") {
const e = parseExpr();
expectOp(")");
return e;
}
throw new Error("primary");
}
function normRef(r) {
return r.replace(/\$/g, "").toUpperCase();
}
function canonName(name) {
const up = String(name).toUpperCase();
return ALIASES[up] || up;
}
return { parseExpr, atEnd: () => pos >= tokens.length };
}
export function parseFormula(text) {
const body = String(text || "").trim().replace(/^[=@]/, "");
const sep = body.includes(";") ? ";" : ",";
// A comma is a decimal mark (FR style) when ';' is the separator, or when
// the expression holds no letters at all ("=1,5+1" can only mean 1.5 + 1).
const commaDecimal = sep === ";" || !/[A-Za-zÀ-ÿ]/.test(body);
const { parseExpr, atEnd } = makeParser(tokenize(body, commaDecimal ? ";" : sep), sep);
const ast = parseExpr();
if (!atEnd()) throw new Error("trailing");
return ast;
}
// ── Evaluator ───────────────────────────────────────────────────────────────
/** Engine scope: resolve raw cell values + locale + cycle guard. */
export function createScope({ readRaw, sheet, locale = "en", seen = null } = {}) {
const scope = {
sheet: sheet || "",
locale: locale === "fr" ? "fr" : "en",
seen: seen || new Set(),
memo: new Map(),
/** Engine value of `sheet!ref` (formulas recurse, cycles guarded). */
getCell(targetSheet, ref) {
const key = `${targetSheet || scope.sheet}!${String(ref).toUpperCase()}`;
const raw = readRaw ? readRaw(targetSheet || scope.sheet, ref) : null;
return evalRefValue(raw, scope, key);
},
};
return scope;
}
const err = (code) => ({ t: "e", code });
const isErr = (v) => v && v.t === "e";
const isBlank = (v) => !v || v.t === "blank";
function toNumber(v) {
if (!v || v.t === "blank") return 0;
if (v.t === "n") return v.v;
if (v.t === "b") return v.v ? 1 : 0;
if (v.t === "s") {
const s = v.v.trim().replace(",", ".");
if (s === "") return 0;
const n = Number(s);
return Number.isFinite(n) ? n : null;
}
return null;
}
function toText(v, locale) {
if (!v || v.t === "blank") return "";
if (v.t === "s") return v.v;
if (v.t === "n") return numText(v.v);
if (v.t === "b") return locale === "fr" ? (v.v ? "VRAI" : "FAUX") : v.v ? "TRUE" : "FALSE";
if (v.t === "link") return v.label;
return "";
}
export function numText(n) {
if (!Number.isFinite(n)) return String(n);
if (Number.isInteger(n) && Math.abs(n) < 1e15) return String(n);
return String(parseFloat(n.toPrecision(10)));
}
function flattenArgs(vals) {
const out = [];
const walk = (v) => {
if (v && v.t === "a") v.rows.forEach((r) => r.forEach(walk));
else out.push(v);
};
vals.forEach(walk);
return out;
}
function evalRefValue(raw, scope, key) {
// Raw storage text → engine value (formulas recurse, cycles guarded).
if (raw === null || raw === undefined) return { t: "blank" };
if (typeof raw === "number") return { t: "n", v: raw };
if (typeof raw === "boolean") return { t: "b", v: raw };
const s = String(raw);
if (scope.memo.has(key)) return scope.memo.get(key);
let out;
if (isFormulaText(s)) {
if (scope.seen.has(key)) {
out = err("CYCLE");
} else {
scope.seen.add(key);
try {
out = evaluate(parseFormula(s), scope);
} catch (_) {
out = err("NAME");
}
scope.seen.delete(key);
}
} else if (s.trim() === "") {
out = { t: "blank" };
} else {
const n = Number(s.trim().replace(",", "."));
out = s.trim() !== "" && Number.isFinite(n) && /^[-+0-9.,\s]+$/.test(s.trim())
? { t: "n", v: n }
: { t: "s", v: s };
}
scope.memo.set(key, out);
return out;
}
function rangeValues(r1, r2, scope) {
const a = parseA1(r1);
const b = parseA1(r2);
if (!a || !b) return err("REF");
const rStart = Math.min(a.row, b.row);
const rEnd = Math.max(a.row, b.row);
const cStart = Math.min(a.col, b.col);
const cEnd = Math.max(a.col, b.col);
if ((rEnd - rStart + 1) * (cEnd - cStart + 1) > 100000) return err("VALUE");
const rows = [];
for (let r = rStart; r <= rEnd; r++) {
const line = [];
for (let c = cStart; c <= cEnd; c++) {
const ref = indexToCol(c) + r;
line.push(scope.getCell(scope.sheet, ref));
}
rows.push(line);
}
return { t: "a", rows };
}
function firstOf(v) {
if (v && v.t === "a") {
for (const row of v.rows) for (const cell of row) {
if (cell && cell.t !== "blank") return cell;
}
return { t: "blank" };
}
return v;
}
function cmpValues(a, b) {
// Excel-ish: numbers < text; blank sorts with text "".
const rank = (v) => (!v || v.t === "blank" ? 0 : v.t === "n" ? 1 : v.t === "b" ? 2 : 3);
const ra = rank(a);
const rb = rank(b);
if (ra !== rb) return ra - rb;
if (ra === 1) return a.v - b.v;
if (ra === 2) return (a.v ? 1 : 0) - (b.v ? 1 : 0);
const sa = toText(a);
const sb = toText(b);
return sa < sb ? -1 : sa > sb ? 1 : 0;
}
const FUNCTIONS = {
SUM: (vals) => num(flattenArgs(vals).reduce((acc, v) => {
if (isBlank(v)) return acc;
const n = toNumber(v);
return n === null ? acc : acc + n;
}, 0)),
AVERAGE: (vals, scope) => {
const nums = flattenArgs(vals).map(toNumber).filter((n) => n !== null);
if (!nums.length) return err("DIV");
return num(nums.reduce((a, b) => a + b, 0) / nums.length);
},
MIN: (vals) => {
const nums = flattenArgs(vals).map(toNumber).filter((n) => n !== null);
return nums.length ? num(Math.min(...nums)) : num(0);
},
MAX: (vals) => {
const nums = flattenArgs(vals).map(toNumber).filter((n) => n !== null);
return nums.length ? num(Math.max(...nums)) : num(0);
},
COUNT: (vals) => num(flattenArgs(vals).filter((v) => v && v.t === "n").length),
COUNTA: (vals) => num(flattenArgs(vals).filter((v) => !isBlank(v)).length),
PRODUCT: (vals) => num(flattenArgs(vals).reduce((acc, v) => {
if (isBlank(v)) return acc;
const n = toNumber(v);
return n === null ? acc : acc * n;
}, 1)),
MEDIAN: (vals) => {
const nums = flattenArgs(vals).map(toNumber).filter((n) => n !== null).sort((a, b) => a - b);
if (!nums.length) return err("DIV");
const m = Math.floor(nums.length / 2);
return num(nums.length % 2 ? nums[m] : (nums[m - 1] + nums[m]) / 2);
},
ABS: ([v]) => {
const n = toNumber(firstOf(v));
return n === null ? err("VALUE") : num(Math.abs(n));
},
ROUND: ([v, d]) => {
const n = toNumber(firstOf(v));
const digits = d === undefined ? 0 : toNumber(firstOf(d));
if (n === null || digits === null) return err("VALUE");
const f = 10 ** Math.trunc(digits);
return num(Math.round(n * f) / f);
},
INT: ([v]) => {
const n = toNumber(firstOf(v));
return n === null ? err("VALUE") : num(Math.floor(n));
},
SQRT: ([v]) => {
const n = toNumber(firstOf(v));
if (n === null) return err("VALUE");
if (n < 0) return err("VALUE");
return num(Math.sqrt(n));
},
POWER: ([a, b]) => {
const x = toNumber(firstOf(a));
const y = toNumber(firstOf(b));
if (x === null || y === null) return err("VALUE");
const r = x ** y;
return Number.isFinite(r) ? num(r) : err("VALUE");
},
MOD: ([a, b]) => {
const x = toNumber(firstOf(a));
const y = toNumber(firstOf(b));
if (x === null || y === null || y === 0) return y === 0 ? err("DIV") : err("VALUE");
return num(((x % y) + y) % y);
},
CONCAT: (vals, scope) => ({ t: "s", v: flattenArgs(vals).map((v) => toText(v, scope.locale)).join("") }),
UPPER: ([v], scope) => ({ t: "s", v: toText(firstOf(v), scope.locale).toUpperCase() }),
LOWER: ([v], scope) => ({ t: "s", v: toText(firstOf(v), scope.locale).toLowerCase() }),
LEN: ([v], scope) => num([...toText(firstOf(v), scope.locale)].length),
TRIM: ([v], scope) => ({ t: "s", v: toText(firstOf(v), scope.locale).trim().replace(/\s+/g, " ") }),
LEFT: ([v, n]) => {
const s = toText(firstOf(v), "en");
const k = n === undefined ? 1 : toNumber(firstOf(n));
if (k === null) return err("VALUE");
return { t: "s", v: s.slice(0, Math.max(0, Math.trunc(k))) };
},
RIGHT: ([v, n]) => {
const s = toText(firstOf(v), "en");
const k = n === undefined ? 1 : toNumber(firstOf(n));
if (k === null) return err("VALUE");
return { t: "s", v: k <= 0 ? "" : s.slice(-Math.trunc(k)) };
},
MID: ([v, start, len]) => {
const s = toText(firstOf(v), "en");
const a = toNumber(firstOf(start));
const k = len === undefined ? s.length : toNumber(firstOf(len));
if (a === null || k === null || a < 1) return err("VALUE");
return { t: "s", v: s.slice(Math.trunc(a) - 1, Math.trunc(a) - 1 + Math.max(0, Math.trunc(k))) };
},
TODAY: () => ({ t: "s", v: new Date().toLocaleDateString() }),
NOW: () => ({ t: "s", v: new Date().toLocaleString() }),
DAY: ([v]) => datePart(v, "day"),
MONTH: ([v]) => datePart(v, "month"),
YEAR: ([v]) => datePart(v, "year"),
NOT: ([v]) => ({ t: "b", v: !toBool(firstOf(v)) }),
HYPERLINK: ([url, label], scope) => {
const u = toText(firstOf(url), scope.locale).trim();
if (!/^https?:\/\//i.test(u)) return err("VALUE");
const text = label === undefined ? u : toText(firstOf(label), scope.locale);
return { t: "link", url: u, label: text };
},
};
function num(n) {
return { t: "n", v: n };
}
function toBool(v) {
if (!v || v.t === "blank") return false;
if (v.t === "b") return v.v;
if (v.t === "n") return v.v !== 0;
const s = v.t === "s" ? v.v.trim().toUpperCase() : "";
if (["TRUE", "VRAI", "1", "YES", "OUI"].includes(s)) return true;
if (["FALSE", "FAUX", "0", "", "NO", "NON"].includes(s)) return false;
return s !== "";
}
function datePart(v, part) {
const first = firstOf(v);
let d = null;
if (first && first.t === "s") {
const parsed = new Date(first.v);
if (!Number.isNaN(parsed.getTime())) d = parsed;
} else if (first && first.t === "n") {
// Excel serial date (1900 system).
const base = Date.UTC(1899, 11, 30);
d = new Date(base + Math.trunc(first.v) * 86400000);
}
if (!d) return err("VALUE");
if (part === "day") return num(d.getDate());
if (part === "month") return num(d.getMonth() + 1);
return num(d.getFullYear());
}
function callFunction(name, argNodes, scope) {
if (name === "IF") {
if (argNodes.length < 2 || argNodes.length > 3) return err("NAME");
const cond = evaluate(argNodes[0], scope);
if (isErr(cond)) return cond;
const branch = toBool(cond) ? argNodes[1] : argNodes[2];
if (!branch) return { t: "b", v: false };
return evaluate(branch, scope);
}
if (name === "AND" || name === "OR") {
let out = name === "AND";
for (const node of argNodes) {
const v = evaluate(node, scope);
if (isErr(v)) return v;
const b = toBool(v);
if (name === "AND" && !b) return { t: "b", v: false };
if (name === "OR" && b) return { t: "b", v: true };
out = b;
}
return { t: "b", v: out };
}
if (name === "IFERROR") {
if (!argNodes.length || argNodes.length > 2) return err("NAME");
const v = evaluate(argNodes[0], scope);
if (!isErr(v)) return v;
if (v.code === "CYCLE" || v.code === "CIRC") return v;
return argNodes[1] ? evaluate(argNodes[1], scope) : { t: "blank" };
}
const fn = FUNCTIONS[name];
if (!fn) return err("NAME");
const vals = argNodes.map((node) => evaluate(node, scope));
for (const v of vals) {
if (isErr(v)) {
// Errors propagate, except through aggregations over ranges.
if (["SUM", "AVERAGE", "MIN", "MAX", "COUNT", "COUNTA", "PRODUCT", "MEDIAN", "CONCAT"].includes(name)) {
continue;
}
return v;
}
}
return fn(vals, scope);
}
export function evaluate(node, scope) {
if (Array.isArray(node)) {
const [kind, ...rest] = node;
switch (kind) {
case "n": return { t: "n", v: rest[0] };
case "s": return { t: "s", v: rest[0] };
case "b": return { t: "b", v: rest[0] };
case "neg": {
const v = firstOf(evaluate(rest[0], scope));
if (isErr(v)) return v;
const n = toNumber(v);
return n === null ? err("VALUE") : num(-n);
}
case "%": {
const v = firstOf(evaluate(rest[0], scope));
if (isErr(v)) return v;
const n = toNumber(v);
return n === null ? err("VALUE") : num(n / 100);
}
case "ref": {
const p = parseA1(rest[0]);
if (!p) return err("REF");
return scope.getCell(scope.sheet, indexToCol(p.col) + p.row);
}
case "range": return rangeValues(rest[0], rest[1], scope);
case "sheetref": {
const [, sheet, ref] = node;
const p = parseA1(ref);
if (!p) return err("REF");
return scope.getCell(sheet, indexToCol(p.col) + p.row);
}
case "sheetrange": {
const [, sheet, r1, r2] = node;
const a = parseA1(r1);
const b = parseA1(r2);
if (!a || !b) return err("REF");
const rows = [];
for (let r = Math.min(a.row, b.row); r <= Math.max(a.row, b.row); r++) {
const line = [];
for (let c = Math.min(a.col, b.col); c <= Math.max(a.col, b.col); c++) {
line.push(scope.getCell(sheet, indexToCol(c) + r));
}
rows.push(line);
}
return { t: "a", rows };
}
case "call": return callFunction(rest[0], rest[1], scope);
case "+":
case "-":
case "*":
case "/":
case "^":
case "&": {
const l = firstOf(evaluate(rest[0], scope));
const r = firstOf(evaluate(rest[1], scope));
if (isErr(l)) return l;
if (isErr(r)) return r;
if (kind === "&") return { t: "s", v: toText(l, scope.locale) + toText(r, scope.locale) };
const a = toNumber(l);
const b = toNumber(r);
if (a === null || b === null) return err("VALUE");
if (kind === "+") return num(a + b);
if (kind === "-") return num(a - b);
if (kind === "*") return num(a * b);
if (kind === "/") return b === 0 ? err("DIV") : num(a / b);
if (kind === "^") {
const v = a ** b;
return Number.isFinite(v) ? num(v) : err("VALUE");
}
return err("VALUE");
}
case "=":
case "!=":
case "<":
case "<=":
case ">":
case ">=": {
const l = firstOf(evaluate(rest[0], scope));
const r = firstOf(evaluate(rest[1], scope));
if (isErr(l)) return l;
if (isErr(r)) return r;
const c = cmpValues(l, r);
const out = kind === "=" ? c === 0 : kind === "!=" ? c !== 0
: kind === "<" ? c < 0 : kind === "<=" ? c <= 0
: kind === ">" ? c > 0 : c >= 0;
return { t: "b", v: out };
}
default:
return err("NAME");
}
}
return err("NAME");
}
/** Render an evaluated value for display (localized booleans/errors). */
export function displayValue(v, locale = "en") {
const codes = errorCodes(locale);
if (!v || v.t === "blank") return "";
if (v.t === "n") return numText(v.v);
if (v.t === "s") return v.v;
if (v.t === "b") return locale === "fr" ? (v.v ? "VRAI" : "FAUX") : v.v ? "TRUE" : "FALSE";
if (v.t === "link") return v.label;
if (v.t === "e") {
if (v.code === "CYCLE" || v.code === "CIRC") {
return locale === "fr" ? codes.CYCLE : codes.CIRC;
}
return codes[v.code] || codes.VALUE;
}
if (v.t === "a") {
for (const row of v.rows) for (const cell of row) {
if (cell && cell.t !== "blank") return displayValue(cell, locale);
}
return "";
}
return "";
}
+513
View File
@@ -0,0 +1,513 @@
/* ObsiGate — XLSX menu bar (the ten Google Sheets menus).
*
* Pure declarative data + a string builder, in the same spirit as
* `command-bar.js`: the menu tree lives here and stays testable on its own,
* while `viewer.js` only resolves each entry's symbolic `action` against its
* own flows. No DOM here beyond `innerHTML` of the shell.
*
* Entry shape
* -----------
* { labelKey, icon, action, children, unavailable, danger, needs, sep }
* - `labelKey` i18n key of the visible label (never raw text).
* - `icon` Lucide icon name, hydrated later by `safeCreateIcons()`.
* - `action` symbolic name resolved by the viewer. An entry with no
* action — or flagged `unavailable` — is rendered honestly and
* reports that ObsiGate does not implement it: a documented
* dead end, never a silent no-op.
* - `children` a Sheets-style accordion section (Nombre, Thème, Zoom, …):
* collapsed, expanded by a click on its parent row.
* - `needs` `"editable"` (hide unless the workbook can be written) or
* `"notReadOnly"` (hide only for .xls/.ods).
* - `sep` a thin rule instead of an entry.
*
* The Fichier menu keeps the historical `#xlsx-file-btn` / `#xlsx-file-menu` /
* `#xlsx-download-btn` / `#xlsx-csv-btn` ids and the `[data-xlsx-export]`
* markers: the File menu moved from the sheet strip to the menu bar, but every
* consumer (viewer wiring, tests, E2E) keeps working untouched.
*/
import { t } from '../i18n.js';
import { escapeHtml } from '../utils.js';
const IC = (name) => `<i data-lucide="${name}" class="xlsx-menu-icon" aria-hidden="true"></i>`;
/** Google Sheets' menu bar: same order, same entries, same French labels. */
export const SHEETS_MENUS = [
{
id: "file",
labelKey: "xlsx.mbar_file",
btnId: "xlsx-file-btn",
dropId: "xlsx-file-menu",
items: [
{ labelKey: "xlsx.mi_new", icon: "file-plus", unavailable: true },
{ labelKey: "xlsx.mi_open", icon: "folder-open", unavailable: true },
{ labelKey: "xlsx.mi_import", icon: "file-input", unavailable: true },
{ labelKey: "xlsx.mi_make_copy", icon: "copy", unavailable: true },
{ labelKey: "xlsx.mi_share", icon: "share-2", action: "share" },
{ labelKey: "xlsx.mi_email", icon: "mail", unavailable: true },
{ sep: true },
{
labelKey: "xlsx.mi_download",
icon: "download",
children: [
{ labelKey: "viewer.download", icon: "download", id: "xlsx-download-btn", action: "download" },
{ labelKey: "xlsx.export_csv", icon: "file-spreadsheet", id: "xlsx-csv-btn", action: "export-csv", titleKey: "xlsx.csv_export" },
{ sep: true },
{ labelKey: "xlsx.export_md", icon: "file-text", export: "md", action: "export-md" },
{ labelKey: "xlsx.export_html", icon: "code", export: "html", action: "export-html" },
{ labelKey: "xlsx.print", icon: "printer", export: "print", action: "print" },
],
},
{ labelKey: "xlsx.mi_rename", icon: "pencil", action: "rename" },
{ labelKey: "xlsx.mi_trash", icon: "trash-2", action: "trash", danger: true },
{ labelKey: "xlsx.mi_history", icon: "history", action: "history" },
{ labelKey: "xlsx.mi_offline", icon: "cloud-off", unavailable: true },
{ sep: true },
{ labelKey: "xlsx.mi_details", icon: "info", action: "details" },
{ labelKey: "xlsx.mi_settings", icon: "settings", action: "settings" },
{ labelKey: "xlsx.print", icon: "printer", action: "print" },
],
},
{
id: "edit",
labelKey: "xlsx.mbar_edit",
items: [
{ labelKey: "xlsx.undo", icon: "undo-2", action: "undo", needs: "notReadOnly" },
{ labelKey: "xlsx.redo", icon: "redo-2", action: "redo", needs: "notReadOnly" },
{ sep: true },
{ labelKey: "xlsx.cut", icon: "scissors", action: "cut", needs: "editable" },
{ labelKey: "xlsx.copy", icon: "copy", action: "copy" },
{ labelKey: "xlsx.paste", icon: "clipboard-paste", action: "paste", needs: "editable" },
{
labelKey: "xlsx.mi_paste_special",
icon: "clipboard-paste",
needs: "editable",
children: [
{ labelKey: "xlsx.mi_paste_all", icon: "clipboard-paste", action: "paste" },
{ labelKey: "xlsx.mi_paste_values", icon: "pilcrow", action: "paste-values" },
],
},
{ sep: true },
{
labelKey: "xlsx.mi_move",
icon: "move",
needs: "editable",
children: [
{ labelKey: "xlsx.mi_move_rows", icon: "rows", unavailable: true },
{ labelKey: "xlsx.mi_move_cols", icon: "columns", unavailable: true },
],
},
{
labelKey: "xlsx.mi_delete",
icon: "trash-2",
needs: "editable",
children: [
{ labelKey: "xlsx.mi_delete_rows", icon: "rows", action: "delete-rows", danger: true },
{ labelKey: "xlsx.mi_delete_cols", icon: "columns", action: "delete-cols", danger: true },
{ sep: true },
{ labelKey: "xlsx.clear_contents", icon: "eraser", action: "clear-contents" },
],
},
{ sep: true },
{ labelKey: "xlsx.mi_select_all", icon: "check-check", action: "select-all" },
{ labelKey: "xlsx.mi_replace", icon: "replace", action: "find-replace", needs: "editable" },
],
},
{
id: "view",
labelKey: "xlsx.mbar_view",
items: [
{
labelKey: "xlsx.mi_freeze",
icon: "snowflake",
children: [
{ labelKey: "xlsx.mi_freeze_here", icon: "snowflake", action: "freeze" },
{ labelKey: "xlsx.mi_freeze_row", icon: "rows", action: "freeze-row" },
{ labelKey: "xlsx.mi_freeze_col", icon: "columns", action: "freeze-col" },
{ sep: true },
{ labelKey: "xlsx.format_unfreeze", icon: "sun", action: "unfreeze" },
],
},
{
labelKey: "xlsx.mi_show",
icon: "eye",
children: [
{ labelKey: "xlsx.mi_show_formula", icon: "chevrons-right", action: "toggle-formula-bar" },
{ labelKey: "xlsx.mi_show_grid", icon: "grid-3x3", action: "toggle-grid" },
{ labelKey: "xlsx.mi_show_headers", icon: "rows-3", action: "toggle-headers" },
{ sep: true },
{ labelKey: "xlsx.mi_show_dashboard", icon: "layout-dashboard", action: "dashboard" },
],
},
{
labelKey: "xlsx.mi_group",
icon: "group",
children: [
{ labelKey: "xlsx.mi_group_rows", icon: "rows", unavailable: true },
{ labelKey: "xlsx.mi_group_cols", icon: "columns", unavailable: true },
{ sep: true },
{ labelKey: "xlsx.mi_ungroup_rows", icon: "ungroup", unavailable: true },
{ labelKey: "xlsx.mi_ungroup_cols", icon: "ungroup", unavailable: true },
],
},
{
labelKey: "xlsx.mi_hidden_sheets",
icon: "eye-off",
children: [
{ labelKey: "xlsx.mi_hide_sheet", icon: "eye-off", unavailable: true },
{ labelKey: "xlsx.mi_unhide_sheets", icon: "eye", unavailable: true },
],
},
{
labelKey: "xlsx.mi_zoom",
icon: "zoom-in",
children: [50, 75, 90, 100, 125, 150, 200].map((z) => ({
labelKey: null,
label: `${z} %`,
icon: z === 100 ? "crosshair" : null,
action: "zoom",
arg: z,
})),
},
{ labelKey: "xlsx.mi_fullscreen", icon: "fullscreen", action: "fullscreen" },
],
},
{
id: "insert",
labelKey: "xlsx.mbar_insert",
items: [
{
labelKey: "xlsx.mi_insert_rows",
icon: "rows",
needs: "editable",
children: [
{ labelKey: "xlsx.insert_row_above", icon: "arrow-up", action: "insert-rows-above" },
{ labelKey: "xlsx.insert_row_below", icon: "arrow-down", action: "insert-rows-below" },
],
},
{
labelKey: "xlsx.mi_insert_cols",
icon: "columns",
needs: "editable",
children: [
{ labelKey: "xlsx.insert_col_left", icon: "arrow-left", action: "insert-cols-left" },
{ labelKey: "xlsx.insert_col_right", icon: "arrow-right", action: "insert-cols-right" },
],
},
{ labelKey: "xlsx.mi_insert_cells", icon: "grid-2x2-plus", action: "insert-cells", needs: "editable" },
{ sep: true },
{ labelKey: "xlsx.mi_image", icon: "image", unavailable: true },
{ labelKey: "xlsx.mi_chart", icon: "bar-chart-3", unavailable: true },
{ labelKey: "xlsx.mi_drawing", icon: "pen-tool", unavailable: true },
{ labelKey: "xlsx.link_add", icon: "link", action: "link", needs: "editable" },
{ labelKey: "xlsx.comment_add", icon: "message-square", action: "comment", needs: "editable" },
{
labelKey: "xlsx.mi_function",
icon: "function-square",
needs: "editable",
titleKey: "xlsx.mi_function_hint",
action: "function",
},
{ sep: true },
{ labelKey: "xlsx.mi_pivot", icon: "table-2", unavailable: true },
{ labelKey: "xlsx.mi_smart_chips", icon: "tags", unavailable: true },
{ labelKey: "xlsx.mi_form", icon: "clipboard-list", unavailable: true },
],
},
{
id: "format",
labelKey: "xlsx.mbar_format",
items: [
{
labelKey: "xlsx.mi_number",
icon: "hash",
needs: "editable",
children: [
{ labelKey: "xlsx.format_num_general", icon: "type", action: "numfmt", arg: "General" },
{ labelKey: "xlsx.format_num_number", icon: "hash", action: "numfmt", arg: "0.00" },
{ labelKey: "xlsx.format_num_percent", icon: "percent", action: "numfmt", arg: "0.0%" },
{ labelKey: "xlsx.format_num_currency", icon: "euro", action: "numfmt", arg: '#,##0.00 "€"' },
{ labelKey: "xlsx.format_num_date", icon: "calendar", action: "numfmt", arg: "DD/MM/YYYY" },
{ labelKey: "xlsx.format_num_text", icon: "pilcrow", action: "numfmt", arg: "@" },
],
},
{
labelKey: "xlsx.mi_theme",
icon: "swatch-book",
// Filled on demand by the viewer (the theme list is built from
// themes.js, so it must not be hard-coded here).
children: [],
action: "theme-menu",
},
{ sep: true },
{ labelKey: "xlsx.format_bold", icon: "bold", action: "bold", needs: "editable" },
{ labelKey: "xlsx.format_italic", icon: "italic", action: "italic", needs: "editable" },
{ labelKey: "xlsx.format_underline", icon: "underline", action: "underline", needs: "editable" },
{ labelKey: "xlsx.format_strike", icon: "strikethrough", action: "strike", needs: "editable" },
{
labelKey: "xlsx.mi_font_size",
icon: "type",
needs: "editable",
children: [9, 10, 11, 12, 14, 18, 24, 36, 40].map((s) => ({
labelKey: null,
label: String(s),
icon: null,
action: "fontsize",
arg: s,
})),
},
{
labelKey: "xlsx.mi_align",
icon: "align-justify",
needs: "editable",
children: [
{
labelKey: "xlsx.mi_align_h",
icon: "align-left",
children: [
{ labelKey: "xlsx.format_align_left", icon: "align-left", action: "align", arg: "left" },
{ labelKey: "xlsx.format_align_center", icon: "align-center", action: "align", arg: "center" },
{ labelKey: "xlsx.format_align_right", icon: "align-right", action: "align", arg: "right" },
{ labelKey: "xlsx.format_align_justify", icon: "align-justify", action: "align", arg: "justify" },
],
},
{
labelKey: "xlsx.mi_align_v",
icon: "align-center-vertical",
children: [
{ labelKey: "xlsx.valign_top", icon: "align-start-vertical", action: "valign", arg: "top" },
{ labelKey: "xlsx.valign_middle", icon: "align-center-vertical", action: "valign", arg: "middle" },
{ labelKey: "xlsx.valign_bottom", icon: "align-end-vertical", action: "valign", arg: "bottom" },
],
},
],
},
{
labelKey: "xlsx.mi_wrap",
icon: "wrap-text",
needs: "editable",
children: [
{ labelKey: "xlsx.mi_wrap_on", icon: "wrap-text", action: "wrap-on" },
{ labelKey: "xlsx.mi_wrap_off", icon: "remove-formatting", action: "wrap-off" },
],
},
{
labelKey: "xlsx.mi_rotation",
icon: "rotate-cw",
needs: "editable",
children: [
{ labelKey: "xlsx.rotation_0", icon: "minus", action: "rotate", arg: 0 },
{ labelKey: "xlsx.rotation_45", icon: "trending-up", action: "rotate", arg: 45 },
{ labelKey: "xlsx.rotation_315", icon: "trending-down", action: "rotate", arg: -45 },
{ labelKey: "xlsx.rotation_90", icon: "arrow-up", action: "rotate", arg: 90 },
],
},
{ sep: true },
// Tailles de colonnes / de lignes — même emplacement que Google Sheets
// (Format ▸ Redimensionner) et Excel (Format ▸ Colonne / Ligne) :
// saisie manuelle (unités Excel : caractères / points) + ajustement
// automatique au contenu (AutoFit / « Fit to data »).
{
labelKey: "xlsx.mi_resize",
icon: "move-horizontal",
needs: "editable",
children: [
{ labelKey: "xlsx.format_col_width", icon: "move-horizontal", action: "col-width" },
{ labelKey: "xlsx.format_col_fit", icon: "maximize-2", action: "col-fit" },
{ labelKey: "xlsx.format_row_height", icon: "move-vertical", action: "row-height" },
{ labelKey: "xlsx.format_row_fit", icon: "maximize-2", action: "row-fit" },
],
},
{ sep: true },
{ labelKey: "xlsx.mi_conditional", icon: "git-compare", unavailable: true },
{
labelKey: "xlsx.mi_banded",
icon: "rows-3",
needs: "editable",
titleKey: "xlsx.mi_banded_hint",
action: "banded",
},
{ labelKey: "xlsx.format_clear", icon: "remove-formatting", action: "clear-format", needs: "editable" },
],
},
{
id: "data",
labelKey: "xlsx.mbar_data",
items: [
{
labelKey: "xlsx.mi_sort",
icon: "arrow-up-down",
children: [
{ labelKey: "xlsx.sort_asc", icon: "arrow-up", action: "sort-asc" },
{ labelKey: "xlsx.sort_desc", icon: "arrow-down", action: "sort-desc" },
{ sep: true },
{ labelKey: "xlsx.sort_reset", icon: "rotate-ccw", action: "sort-reset" },
],
},
{ labelKey: "xlsx.mi_filter", icon: "filter", titleKey: "xlsx.mi_filter_hint", action: "filter-column" },
{ sep: true },
{ labelKey: "xlsx.mi_validation", icon: "list-checks", unavailable: true },
{ labelKey: "xlsx.mi_named", icon: "bookmark", action: "named-ranges" },
{ labelKey: "xlsx.mi_protect", icon: "lock", unavailable: true },
{ sep: true },
{
labelKey: "xlsx.mi_cleanup",
icon: "wand-2",
needs: "editable",
children: [
{ labelKey: "xlsx.mi_cleanup_dupes", icon: "copy-x", action: "cleanup-dupes" },
{ labelKey: "xlsx.mi_cleanup_trim", icon: "scissors", action: "cleanup-trim" },
],
},
{
labelKey: "xlsx.mi_split",
icon: "columns-2",
needs: "editable",
titleKey: "xlsx.mi_split_hint",
action: "split-text",
},
],
},
{
id: "tools",
labelKey: "xlsx.mbar_tools",
items: [
{ labelKey: "xlsx.mi_form_create", icon: "clipboard-list", unavailable: true },
{ labelKey: "xlsx.mi_spellcheck", icon: "spell-check", unavailable: true },
{
labelKey: "xlsx.mi_autocomplete",
icon: "text-cursor-input",
children: [
{ labelKey: "xlsx.mi_autocomplete_on", icon: "check", action: "autocomplete", arg: true },
{ labelKey: "xlsx.mi_autocomplete_off", icon: "x", action: "autocomplete", arg: false },
],
},
{ sep: true },
{ labelKey: "xlsx.mi_notifications", icon: "bell", unavailable: true },
{ labelKey: "xlsx.mi_macros", icon: "workflow", unavailable: true },
{ labelKey: "xlsx.mi_script_editor", icon: "code", unavailable: true },
{ sep: true },
{ labelKey: "xlsx.mi_a11y", icon: "accessibility", action: "a11y" },
],
},
{
id: "gemini",
labelKey: "xlsx.mbar_gemini",
items: [
{ labelKey: "xlsx.mi_ask_gemini", icon: "sparkles", action: "gemini" },
{ sep: true },
{ labelKey: "xlsx.mi_gem_table", icon: "table-2", action: "gemini" },
{ labelKey: "xlsx.mi_gem_formula", icon: "function-square", action: "gemini" },
{ labelKey: "xlsx.mi_gem_insights", icon: "lightbulb", action: "gemini" },
{ labelKey: "xlsx.mi_gem_chart", icon: "bar-chart-3", unavailable: true },
{ labelKey: "xlsx.mi_gem_summarize", icon: "file-text", unavailable: true },
{ sep: true },
{ labelKey: "xlsx.mi_gem_actions", icon: "wand-sparkles", action: "gemini" },
{ labelKey: "xlsx.mi_gem_more", icon: "ellipsis", action: "gemini" },
],
},
{
id: "extensions",
labelKey: "xlsx.mbar_extensions",
items: [
{ labelKey: "xlsx.mi_addons", icon: "blocks", unavailable: true },
{ labelKey: "xlsx.mi_apps_script", icon: "code", unavailable: true },
{ labelKey: "xlsx.mi_appsheet", icon: "app-window", unavailable: true },
{ labelKey: "xlsx.mi_looker", icon: "bar-chart", unavailable: true },
],
},
{
id: "help",
labelKey: "xlsx.mbar_help",
items: [
{ labelKey: "xlsx.mi_help_sheets", icon: "life-buoy", action: "help" },
{ labelKey: "xlsx.mi_training", icon: "graduation-cap", unavailable: true },
{ labelKey: "xlsx.mi_whatsnew", icon: "sparkles", action: "whatsnew" },
{ sep: true },
{ labelKey: "xlsx.mi_shortcuts", icon: "keyboard", action: "shortcuts" },
{ labelKey: "xlsx.mi_report", icon: "bug", action: "report" },
{ labelKey: "xlsx.mi_abuse", icon: "flag", unavailable: true },
],
},
];
/** Drop an entry when the workbook cannot honour it. */
const allowed = (entry, { editable, readOnly }) => {
if (entry.needs === "editable") return editable;
if (entry.needs === "notReadOnly") return !readOnly;
return true;
};
/** Label of one entry: an explicit label, else the i18n key, else nothing. */
const labelOf = (entry) => (entry.label !== undefined
? entry.label
: (entry.labelKey ? t(entry.labelKey) : ""));
/** One clickable row. `depth` > 0 = nested inside an accordion section. */
const rowHtml = (entry, depth, ctx) => {
if (entry.sep) return `<div class="xlsx-structure-sep" role="separator"></div>`;
const unavailable = entry.unavailable || (!entry.children && !entry.action && !entry.export);
const id = entry.id ? ` id="${entry.id}"` : "";
const exportAttr = entry.export ? ` data-xlsx-export="${entry.export}"` : "";
const argAttr = entry.arg !== undefined ? ` data-xlsx-arg="${escapeHtml(String(entry.arg))}"` : "";
const title = entry.titleKey ? ` title="${escapeHtml(t(entry.titleKey))}"` : "";
const cls = [
"btn-action",
"xlsx-structure-item",
"xlsx-menu-item",
unavailable ? "xlsx-menu-item-na" : "",
entry.danger ? "xlsx-context-danger" : "",
depth ? `xlsx-menu-item-d${depth}` : "",
].filter(Boolean).join(" ");
const caret = entry.children
? `<i data-lucide="chevron-right" class="xlsx-menu-caret" aria-hidden="true"></i>`
: "";
const body = entry.children
// A section may ALSO declare an action: the viewer runs it instead of
// toggling, which is how the empty « Thème » section gets filled.
? `<button type="button" class="${cls}" role="menuitem" aria-haspopup="menu" aria-expanded="false"`
+ `${entry.action ? ` data-xlsx-action="${entry.action}"` : ""}${title}${id}>`
+ `${entry.icon ? IC(entry.icon) : ""}<span class="xlsx-menu-label">${escapeHtml(labelOf(entry))}</span>${caret}</button>`
+ `<div class="xlsx-menu-sub" hidden>${entry.children
.filter((c) => allowed(c, ctx))
.map((c) => rowHtml(c, depth + 1, ctx))
.join("")}</div>`
: `<button type="button" class="${cls}" role="menuitem"`
+ `${unavailable ? ' data-xlsx-unavailable="1"' : ""}`
+ `${entry.action ? ` data-xlsx-action="${entry.action}"` : ""}`
+ `${argAttr}${exportAttr}${title}${id}>`
+ `${entry.icon ? IC(entry.icon) : ""}<span class="xlsx-menu-label">${escapeHtml(labelOf(entry))}</span></button>`;
return body;
};
/** One dropdown: the filtered rows of a menu. */
const menuItemsHtml = (menu, ctx) => menu.items
.filter((entry) => allowed(entry, ctx))
.map((entry) => rowHtml(entry, 0, ctx))
.join("");
/**
* Build the menu bar: one button per menu plus its (hidden) dropdown.
*
* @param {object} ctx
* @param {boolean} ctx.editable - .xlsx that can be written
* @param {boolean} ctx.readOnly - .xls / .ods
* @returns {string} the `.xlsx-menubar` markup
*/
export function buildMenuBar({ editable = true, readOnly = false } = {}) {
const ctx = { editable, readOnly };
const bars = SHEETS_MENUS.map((menu) => {
const btnId = menu.btnId || `xlsx-menu-btn-${menu.id}`;
const dropId = menu.dropId || `xlsx-menu-${menu.id}`;
const label = escapeHtml(t(menu.labelKey));
return `<span class="xlsx-menuwrap${menu.id === "gemini" ? " xlsx-menuwrap-gemini" : ""}">`
+ `<button type="button" class="xlsx-menubtn" id="${btnId}" role="menuitem"`
+ ` aria-haspopup="menu" aria-expanded="false" aria-controls="${dropId}"`
+ ` data-xlsx-menu="${menu.id}">${label}</button>`
+ `<div class="xlsx-menudrop" id="${dropId}" role="menu"`
+ ` aria-label="${label}" style="display:none">`
+ `${menuItemsHtml(menu, ctx)}`
+ `</div></span>`;
});
return `<div class="xlsx-menubar" role="menubar" aria-label="${escapeHtml(t("xlsx.mbar_label"))}">`
+ `${bars.join("")}</div>`;
}
+28 -1
View File
@@ -24,9 +24,36 @@ export function columnName(col) {
return name;
}
// #184 — cell lookup cache. `findTd` used to run a `querySelector` per call;
// painting the grid out to A → Z × 1000 rows means a single "select column"
// asks for 26 000 cells, which was quadratic on the DOM. The index is built
// once per panel and rebuilt on demand whenever an entry no longer matches its
// own `data-cell` (the signature of a renumbered grid after a structure op).
const _cellIndex = new WeakMap();
function buildCellIndex(panel) {
const map = new Map();
panel.querySelectorAll("td[data-cell]").forEach((td) => {
map.set(td.dataset.cell, td);
});
_cellIndex.set(panel, map);
return map;
}
/** Drop a panel's lookup cache (bulk DOM changes). */
export function invalidateCellIndex(panel) {
if (panel) _cellIndex.delete(panel);
}
/** Find a rendered cell inside a sheet panel by (row, col). */
export function findTd(panel, row, col) {
return panel.querySelector(`td[data-cell="${columnName(col)}${row}"]`);
const ref = `${columnName(col)}${row}`;
const cached = _cellIndex.get(panel);
const hit = cached && cached.get(ref);
if (hit && hit.dataset.cell === ref) return hit;
// Miss, or a stale entry (the row was renumbered): rebuild once and retry.
const fresh = buildCellIndex(panel).get(ref);
return fresh && fresh.dataset.cell === ref ? fresh : null;
}
/** Sheet prefix of a range ref ("'Mon onglet'!$A$1" → "Mon onglet"), or null. */
+242 -4
View File
@@ -1461,6 +1461,16 @@
"modal.delete_permanently": "Delete permanently",
"modal.delete_warning": "Warning!",
"modal.dir_to_delete": "Folder to delete:",
"modal.ext_excalidraw": "Excalidraw (.excalidraw)",
"modal.ext_js": "JavaScript (.js)",
"modal.ext_json": "JSON (.json)",
"modal.ext_md": "Markdown (.md)",
"modal.ext_ps1": "PowerShell (.ps1)",
"modal.ext_py": "Python (.py)",
"modal.ext_sh": "Shell (.sh)",
"modal.ext_txt": "Plain text (.txt)",
"modal.ext_xlsx": "Excel (.xlsx)",
"modal.ext_yaml": "YAML (.yaml)",
"modal.file_name": "File name",
"modal.file_to_delete": "File to delete:",
"modal.file_type": "File type",
@@ -1847,8 +1857,8 @@
"xlsx.tabs_add_sheet": "Add a sheet",
"xlsx.readonly_badge": "Read-only",
"xlsx.readonly_hint": "This format (.xls / .ods) cannot be edited in ObsiGate — convert it to .xlsx to edit.",
"xlsx.formulas_note": "Formulas not recalculated",
"xlsx.formulas_note_title": "ObsiGate shows the formula as stored: Excel recalculates it on open. Dependent cells do not refresh on screen.",
"xlsx.formulas_note": "Formulas computed locally",
"xlsx.formulas_note_title": "ObsiGate computes common formulas on screen (arithmetic, SUM, AVERAGE, IF…). Unsupported functions show the formula as stored: Excel recalculates it on open.",
"xlsx.truncated_title": "Truncated sheet",
"xlsx.truncated_rows": "{shown} of {total} rows displayed.",
"xlsx.truncated_cols": "{shown} of {total} columns displayed.",
@@ -1876,8 +1886,31 @@
"xlsx.find_count": "{index}/{count}",
"xlsx.find_count_sheets": "{index}/{count} · {sheets} sheets",
"xlsx.csv_export": "Export the sheet or the selection as CSV",
"xlsx.colour_panel_font": "Text colour",
"xlsx.colour_panel_fill": "Fill colour",
"xlsx.colour_palette": "Colour palette",
"xlsx.colour_reset": "Reset",
"xlsx.colour_reset_font": "Reset the text colour",
"xlsx.colour_reset_fill": "Reset the fill colour",
"xlsx.colour_standard": "Standard",
"xlsx.colour_custom": "Custom",
"xlsx.colour_edit_standard": "Pick a custom colour",
"xlsx.colour_custom_pick": "Add a custom colour",
"xlsx.colour_conditional": "Conditional formatting",
"xlsx.colour_banded": "Banded colours",
"xlsx.colour_unavailable": "“{feature}” is not available in ObsiGate yet.",
"xlsx.colour_black": "Black",
"xlsx.colour_white": "White",
"xlsx.colour_blue": "Blue",
"xlsx.colour_red": "Red",
"xlsx.colour_yellow": "Yellow",
"xlsx.colour_green": "Green",
"xlsx.colour_orange": "Orange",
"xlsx.colour_cyan": "Cyan",
"xlsx.export_btn": "Export",
"xlsx.export_csv": "Export as CSV",
"xlsx.export_title": "Export the selection or the sheet",
"xlsx.file_menu": "File",
"xlsx.export_md": "Export as Markdown",
"xlsx.export_html": "Export as HTML",
"xlsx.print": "Print",
@@ -1885,6 +1918,47 @@
"xlsx.export_scope_selection": "the selection",
"xlsx.export_done": "Exported {scope}",
"xlsx.format_btn": "Formatting",
"xlsx.format_strike": "Strikethrough",
"xlsx.format_align_justify": "Justified",
"xlsx.tb_search": "Search in sheet",
"xlsx.tb_paint": "Paint format",
"xlsx.paint_pick_target": "Click the target cell or range",
"xlsx.tb_zoom": "Zoom",
"xlsx.tb_currency": "Currency format",
"xlsx.tb_percent": "Percent format",
"xlsx.tb_dec_minus": "Decrease decimals",
"xlsx.tb_dec_plus": "Increase decimals",
"xlsx.tb_number": "Number format",
"xlsx.tb_numfmt": "Number format",
"xlsx.tb_font_minus": "Decrease font size",
"xlsx.tb_font_plus": "Increase font size",
"xlsx.tb_font_size": "Font size",
"xlsx.tb_borders": "Borders",
"xlsx.border_all": "All borders",
"xlsx.border_outer": "Outer borders",
"xlsx.border_none": "No borders",
"xlsx.tb_merge": "Merge cells",
"xlsx.tb_alignh": "Horizontal alignment",
"xlsx.tb_alignv": "Vertical alignment",
"xlsx.valign_top": "Top",
"xlsx.valign_middle": "Middle",
"xlsx.valign_bottom": "Bottom",
"xlsx.tb_wrap": "Text wrapping",
"xlsx.tb_rotation": "Text rotation",
"xlsx.rotation_0": "Horizontal",
"xlsx.rotation_45": "Diagonal up",
"xlsx.rotation_315": "Diagonal down",
"xlsx.rotation_90": "Vertical",
"xlsx.tb_more": "More options",
"xlsx.comment_add": "Comment",
"xlsx.comment_prompt": "Comment text (empty to delete):",
"xlsx.link_add": "Insert link",
"xlsx.link_url": "Link address (https://…):",
"xlsx.link_label": "Label:",
"xlsx.link_invalid": "Invalid address (https://… expected)",
"xlsx.sum_insert": "Sum",
"xlsx.sum_empty": "Nothing to total (numbers above or a selection)",
"xlsx.paint_pick_source": "Select a formatted source cell first",
"xlsx.format_bold": "Bold",
"xlsx.format_italic": "Italic",
"xlsx.format_underline": "Underline",
@@ -1906,9 +1980,13 @@
"xlsx.format_freeze": "Freeze panes here",
"xlsx.format_unfreeze": "Unfreeze panes",
"xlsx.format_col_width": "Column width…",
"xlsx.format_col_prompt": "Width of column {col} (0 to 255)",
"xlsx.format_col_prompt": "Width of column {col} — in characters (0 to 255, 0 = default width)",
"xlsx.format_row_height": "Row height…",
"xlsx.format_row_prompt": "Height of row {row} (0 to 409)",
"xlsx.format_row_prompt": "Height of row {row} — in points (0 to 409, 0 = default height)",
"xlsx.format_col_fit": "Fit column width to data",
"xlsx.format_row_fit": "Fit row height to data",
"xlsx.mi_resize": "Resize",
"xlsx.fit_nothing": "Nothing to fit (empty content or already fitted)",
"xlsx.format_applied": "Formatting saved",
"xlsx.format_error": "Formatting failed",
"xlsx.sort_asc": "Sort column A→Z",
@@ -1969,6 +2047,166 @@
"xlsx.feature_signature": "digital signature",
"xlsx.feature_rich_comments": "rich comments",
"xlsx.feature_macros": "macros",
"xlsx.mbar_label": "Spreadsheet menus",
"xlsx.cmdbar_label": "Spreadsheet command bar",
"xlsx.mbar_file": "File",
"xlsx.mbar_edit": "Edit",
"xlsx.mbar_view": "View",
"xlsx.mbar_insert": "Insert",
"xlsx.mbar_format": "Format",
"xlsx.mbar_data": "Data",
"xlsx.mbar_tools": "Tools",
"xlsx.mbar_gemini": "Gemini",
"xlsx.mbar_extensions": "Extensions",
"xlsx.mbar_help": "Help",
"xlsx.menu_unavailable": "“{item}” is not available in ObsiGate.",
"xlsx.menu_unavailable_hint": "This option does not exist in ObsiGate's spreadsheet editor: it is listed to stay faithful to Google Sheets.",
"xlsx.mi_new": "New",
"xlsx.mi_open": "Open",
"xlsx.mi_import": "Import",
"xlsx.mi_make_copy": "Make a copy",
"xlsx.mi_share": "Share",
"xlsx.mi_email": "Email",
"xlsx.mi_download": "Download",
"xlsx.mi_rename": "Rename",
"xlsx.mi_trash": "Move to trash",
"xlsx.mi_history": "Version history",
"xlsx.mi_offline": "Make available offline",
"xlsx.mi_details": "Details",
"xlsx.mi_settings": "Settings",
"xlsx.mi_paste_special": "Paste special",
"xlsx.mi_paste_all": "Paste all",
"xlsx.mi_paste_values": "Paste values only",
"xlsx.mi_move": "Move",
"xlsx.mi_move_rows": "Selected rows down",
"xlsx.mi_move_cols": "Selected columns right",
"xlsx.mi_delete": "Delete",
"xlsx.mi_delete_rows": "Delete selected rows",
"xlsx.mi_delete_cols": "Delete selected columns",
"xlsx.mi_select_all": "Select all",
"xlsx.mi_replace": "Find and replace",
"xlsx.mi_replace_find": "Find",
"xlsx.mi_replace_with": "Replace with",
"xlsx.mi_replace_one": "Replace",
"xlsx.mi_replace_all": "Replace all",
"xlsx.mi_replace_none": "No match found",
"xlsx.mi_replace_done": "{n} cell(s) replaced",
"xlsx.mi_freeze": "Freeze",
"xlsx.mi_freeze_here": "Freeze up to active cell",
"xlsx.mi_freeze_row": "Freeze active row",
"xlsx.mi_freeze_col": "Freeze active column",
"xlsx.mi_show": "Show",
"xlsx.mi_show_formula": "Formula bar",
"xlsx.mi_show_grid": "Gridlines",
"xlsx.mi_show_headers": "Headers",
"xlsx.mi_show_dashboard": "Dashboard",
"xlsx.mi_group": "Group",
"xlsx.mi_group_rows": "Group selected rows",
"xlsx.mi_group_cols": "Group selected columns",
"xlsx.mi_ungroup_rows": "Ungroup rows",
"xlsx.mi_ungroup_cols": "Ungroup columns",
"xlsx.mi_hidden_sheets": "Hidden sheets",
"xlsx.mi_hide_sheet": "Hide active sheet",
"xlsx.mi_unhide_sheets": "Show hidden sheets",
"xlsx.mi_zoom": "Zoom",
"xlsx.mi_fullscreen": "Full screen",
"xlsx.mi_exit_fullscreen": "Exit full screen",
"xlsx.mi_insert_rows": "Rows",
"xlsx.mi_insert_cols": "Columns",
"xlsx.mi_insert_cells": "Cells",
"xlsx.mi_image": "Image",
"xlsx.mi_chart": "Chart",
"xlsx.mi_drawing": "Drawing",
"xlsx.mi_function": "Function",
"xlsx.mi_function_hint": "Inserts the function and puts the caret inside the parentheses",
"xlsx.mi_pivot": "Pivot table",
"xlsx.mi_smart_chips": "Smart chips",
"xlsx.mi_form": "Form",
"xlsx.mi_number": "Number",
"xlsx.mi_theme": "Theme",
"xlsx.mi_font_size": "Font size",
"xlsx.mi_align": "Alignment",
"xlsx.mi_align_h": "Horizontal alignment",
"xlsx.mi_align_v": "Vertical alignment",
"xlsx.mi_wrap": "Text wrapping",
"xlsx.mi_wrap_on": "On",
"xlsx.mi_wrap_off": "Off",
"xlsx.mi_rotation": "Text rotation",
"xlsx.mi_conditional": "Conditional formatting",
"xlsx.mi_banded": "Banded colours",
"xlsx.mi_banded_hint": "Alternates the fill colour every other row in the selection",
"xlsx.mi_banded_done": "Banded colours applied to {n} row(s)",
"xlsx.mi_banded_default": "#eef3fb",
"xlsx.mi_sort": "Sort range",
"xlsx.mi_filter": "Create filter",
"xlsx.mi_filter_hint": "Filters the rows on the active cell's value",
"xlsx.mi_validation": "Data validation",
"xlsx.mi_named": "Named ranges",
"xlsx.mi_protect": "Protect sheets and ranges",
"xlsx.mi_cleanup": "Data cleanup",
"xlsx.mi_cleanup_dupes": "Remove duplicates",
"xlsx.mi_cleanup_trim": "Trim extra spaces",
"xlsx.mi_cleanup_dupes_none": "No duplicate in the selection",
"xlsx.mi_cleanup_dupes_done": "{n} duplicate row(s) removed",
"xlsx.mi_cleanup_trim_done": "{n} cell(s) cleaned",
"xlsx.mi_split": "Split text to columns",
"xlsx.mi_split_hint": "Splits the active cell's content on a separator",
"xlsx.mi_split_sep": "Separator",
"xlsx.mi_split_done": "{n} column(s) filled from the active cell",
"xlsx.mi_form_create": "Create a form",
"xlsx.mi_spellcheck": "Spelling",
"xlsx.mi_autocomplete": "Autocomplete",
"xlsx.mi_autocomplete_on": "Autocomplete on",
"xlsx.mi_autocomplete_off": "Autocomplete off",
"xlsx.mi_notifications": "Notification rules",
"xlsx.mi_macros": "Macros",
"xlsx.mi_script_editor": "Script editor",
"xlsx.mi_a11y": "Accessibility",
"xlsx.mi_a11y_on": "Enhanced accessibility on (bigger cells, higher-contrast grid)",
"xlsx.mi_a11y_off": "Enhanced accessibility off",
"xlsx.mi_ask_gemini": "Ask Gemini",
"xlsx.mi_gem_table": "Create tables",
"xlsx.mi_gem_formula": "Create formulas",
"xlsx.mi_gem_insights": "Analysis and insights",
"xlsx.mi_gem_chart": "Create charts",
"xlsx.mi_gem_summarize": "Summarize emails and files",
"xlsx.mi_gem_actions": "Perform actions",
"xlsx.mi_gem_more": "More options",
"xlsx.mi_addons": "Add-ons",
"xlsx.mi_apps_script": "Apps Script",
"xlsx.mi_appsheet": "AppSheet",
"xlsx.mi_looker": "Looker Studio",
"xlsx.mi_help_sheets": "Spreadsheets help",
"xlsx.mi_training": "Training",
"xlsx.mi_whatsnew": "What's new",
"xlsx.mi_shortcuts": "Keyboard shortcuts",
"xlsx.mi_report": "Report a problem",
"xlsx.mi_abuse": "Report abuse",
"xlsx.details_title": "File details",
"xlsx.details_body": "Vault: {vault}\nFile: {path}\nSheets: {sheets}\nDisplayed cells: {cells}\nLast revision: {revision}\nUnsaved changes: {dirty}",
"xlsx.shortcuts_title": "Keyboard shortcuts",
"xlsx.shortcuts_body": "Ctrl/Cmd + Z — Undo\nCtrl/Cmd + Y — Redo\nCtrl/Cmd + C / X / V — Copy / Cut / Paste\nCtrl/Cmd + A — Select all\nCtrl/Cmd + F — Search in sheet\nEnter — Commit and move down\nF2 — Edit cell\nAlt + arrow — Line break inside the cell\nEscape — Leave edit mode\nDelete — Clear the selection\nDouble-click — Edit in place\nShift + click — Extend selection",
"xlsx.version_title": "What's new",
"xlsx.version_body": "ObsiGate {version} — {date}\n{status}",
"xlsx.report_copied": "Diagnostic copied to the clipboard.",
"xlsx.themes_title": "Sheet theme",
"xlsx.function_prompt": "Function to insert",
"xlsx.rename_prompt": "New file name",
"xlsx.trash_confirm": "Move “{name}” to trash? The workbook will close.",
"xlsx.rename_done": "File renamed to {name}",
"xlsx.trash_done": "File moved to trash",
"viewer.download_md": "Download as .md",
"viewer.download_file": "Download file",
"viewer.pretty": "Pretty",
+242 -4
View File
@@ -1461,6 +1461,16 @@
"modal.delete_permanently": "Supprimer définitivement",
"modal.delete_warning": "Attention !",
"modal.dir_to_delete": "Dossier à supprimer:",
"modal.ext_excalidraw": "Excalidraw (.excalidraw)",
"modal.ext_js": "JavaScript (.js)",
"modal.ext_json": "JSON (.json)",
"modal.ext_md": "Markdown (.md)",
"modal.ext_ps1": "PowerShell (.ps1)",
"modal.ext_py": "Python (.py)",
"modal.ext_sh": "Shell (.sh)",
"modal.ext_txt": "Texte (.txt)",
"modal.ext_xlsx": "Excel (.xlsx)",
"modal.ext_yaml": "YAML (.yaml)",
"modal.file_name": "Nom du fichier",
"modal.file_to_delete": "Fichier à supprimer:",
"modal.file_type": "Type de fichier",
@@ -1847,8 +1857,8 @@
"xlsx.tabs_add_sheet": "Ajouter une feuille",
"xlsx.readonly_badge": "Lecture seule",
"xlsx.readonly_hint": "Ce format (.xls / .ods) n'est pas modifiable dans ObsiGate — convertissez-le en .xlsx pour l'éditer.",
"xlsx.formulas_note": "Formules non recalculées",
"xlsx.formulas_note_title": "ObsiGate affiche la formule telle qu'elle est enregistrée : Excel la recalcule à l'ouverture. Les cellules dépendantes ne se rafraîchissent pas à l'écran.",
"xlsx.formulas_note": "Formules calculées localement",
"xlsx.formulas_note_title": "ObsiGate calcule les formules courantes à l'écran (arithmétique, SOMME, MOYENNE, SI…). Les fonctions non prises en charge affichent la formule telle qu'enregistrée : Excel la recalcule à l'ouverture.",
"xlsx.truncated_title": "Feuille tronquée",
"xlsx.truncated_rows": "{shown} lignes affichées sur {total}.",
"xlsx.truncated_cols": "{shown} colonnes affichées sur {total}.",
@@ -1876,8 +1886,31 @@
"xlsx.find_count": "{index}/{count}",
"xlsx.find_count_sheets": "{index}/{count} · {sheets} feuilles",
"xlsx.csv_export": "Exporter la feuille ou la sélection en CSV",
"xlsx.colour_panel_font": "Couleur du texte",
"xlsx.colour_panel_fill": "Couleur de fond",
"xlsx.colour_palette": "Palette de couleurs",
"xlsx.colour_reset": "Réinitialiser",
"xlsx.colour_reset_font": "Réinitialiser la couleur du texte",
"xlsx.colour_reset_fill": "Réinitialiser la couleur de fond",
"xlsx.colour_standard": "Standard",
"xlsx.colour_custom": "Personnalisé",
"xlsx.colour_edit_standard": "Choisir une couleur personnalisée",
"xlsx.colour_custom_pick": "Ajouter une couleur personnalisée",
"xlsx.colour_conditional": "Mise en forme conditionnelle",
"xlsx.colour_banded": "Couleurs en alternance",
"xlsx.colour_unavailable": "« {feature} » n'est pas encore disponible dans ObsiGate.",
"xlsx.colour_black": "Noir",
"xlsx.colour_white": "Blanc",
"xlsx.colour_blue": "Bleu",
"xlsx.colour_red": "Rouge",
"xlsx.colour_yellow": "Jaune",
"xlsx.colour_green": "Vert",
"xlsx.colour_orange": "Orange",
"xlsx.colour_cyan": "Cyan",
"xlsx.export_btn": "Exporter",
"xlsx.export_csv": "Exporter en CSV",
"xlsx.export_title": "Exporter la sélection ou la feuille",
"xlsx.file_menu": "Fichier",
"xlsx.export_md": "Exporter en Markdown",
"xlsx.export_html": "Exporter en HTML",
"xlsx.print": "Imprimer",
@@ -1885,6 +1918,47 @@
"xlsx.export_scope_selection": "la sélection",
"xlsx.export_done": "Export de {scope} terminé",
"xlsx.format_btn": "Mise en forme",
"xlsx.format_strike": "Barré",
"xlsx.format_align_justify": "Justifié",
"xlsx.tb_search": "Rechercher dans la feuille",
"xlsx.tb_paint": "Peindre le format",
"xlsx.paint_pick_target": "Cliquez sur la cellule ou la plage cible du format",
"xlsx.tb_zoom": "Zoom",
"xlsx.tb_currency": "Format monétaire",
"xlsx.tb_percent": "Format pourcentage",
"xlsx.tb_dec_minus": "Diminuer les décimales",
"xlsx.tb_dec_plus": "Augmenter les décimales",
"xlsx.tb_number": "Format nombre",
"xlsx.tb_numfmt": "Format de nombre",
"xlsx.tb_font_minus": "Réduire la taille de police",
"xlsx.tb_font_plus": "Augmenter la taille de police",
"xlsx.tb_font_size": "Taille de police",
"xlsx.tb_borders": "Bordures",
"xlsx.border_all": "Toutes les bordures",
"xlsx.border_outer": "Bordures extérieures",
"xlsx.border_none": "Aucune bordure",
"xlsx.tb_merge": "Fusionner les cellules",
"xlsx.tb_alignh": "Alignement horizontal",
"xlsx.tb_alignv": "Alignement vertical",
"xlsx.valign_top": "En haut",
"xlsx.valign_middle": "Au milieu",
"xlsx.valign_bottom": "En bas",
"xlsx.tb_wrap": "Retour à la ligne automatique",
"xlsx.tb_rotation": "Rotation du texte",
"xlsx.rotation_0": "Horizontal",
"xlsx.rotation_45": "Diagonale vers le haut",
"xlsx.rotation_315": "Diagonale vers le bas",
"xlsx.rotation_90": "Vertical",
"xlsx.tb_more": "Plus d'options",
"xlsx.comment_add": "Commentaire",
"xlsx.comment_prompt": "Texte du commentaire (vide pour supprimer) :",
"xlsx.link_add": "Insérer un lien",
"xlsx.link_url": "Adresse du lien (https://…) :",
"xlsx.link_label": "Libellé :",
"xlsx.link_invalid": "Adresse invalide (https://… attendue)",
"xlsx.sum_insert": "Somme",
"xlsx.sum_empty": "Aucune plage à totaliser (nombres au-dessus ou sélection)",
"xlsx.paint_pick_source": "Sélectionnez d'abord une cellule source mise en forme",
"xlsx.format_bold": "Gras",
"xlsx.format_italic": "Italique",
"xlsx.format_underline": "Souligné",
@@ -1906,9 +1980,13 @@
"xlsx.format_freeze": "Figer les volets ici",
"xlsx.format_unfreeze": "Libérer les volets",
"xlsx.format_col_width": "Largeur de colonne…",
"xlsx.format_col_prompt": "Largeur de la colonne {col} (0 à 255)",
"xlsx.format_col_prompt": "Largeur de la colonne {col} — en caractères (0 à 255, 0 = largeur par défaut)",
"xlsx.format_row_height": "Hauteur de ligne…",
"xlsx.format_row_prompt": "Hauteur de la ligne {row} (0 à 409)",
"xlsx.format_row_prompt": "Hauteur de la ligne {row} — en points (0 à 409, 0 = hauteur par défaut)",
"xlsx.format_col_fit": "Ajuster la largeur au contenu",
"xlsx.format_row_fit": "Ajuster la hauteur au contenu",
"xlsx.mi_resize": "Redimensionner",
"xlsx.fit_nothing": "Rien à ajuster (contenu vide ou déjà à la bonne taille)",
"xlsx.format_applied": "Mise en forme enregistrée",
"xlsx.format_error": "Échec de la mise en forme",
"xlsx.sort_asc": "Trier la colonne A→Z",
@@ -1969,6 +2047,166 @@
"xlsx.feature_signature": "signature numérique",
"xlsx.feature_rich_comments": "commentaires enrichis",
"xlsx.feature_macros": "macros",
"xlsx.mbar_label": "Menus du tableur",
"xlsx.cmdbar_label": "Barre de commandes du tableur",
"xlsx.mbar_file": "Fichier",
"xlsx.mbar_edit": "Modifier",
"xlsx.mbar_view": "Affichage",
"xlsx.mbar_insert": "Insertion",
"xlsx.mbar_format": "Format",
"xlsx.mbar_data": "Données",
"xlsx.mbar_tools": "Outils",
"xlsx.mbar_gemini": "Gemini",
"xlsx.mbar_extensions": "Extensions",
"xlsx.mbar_help": "Aide",
"xlsx.menu_unavailable": "« {item} » n'est pas disponible dans ObsiGate.",
"xlsx.menu_unavailable_hint": "Cette option n'existe pas dans l'éditeur tableur d'ObsiGate : elle est listée pour rester fidèle à Google Sheets.",
"xlsx.mi_new": "Nouveau",
"xlsx.mi_open": "Ouvrir",
"xlsx.mi_import": "Importer",
"xlsx.mi_make_copy": "Créer une copie",
"xlsx.mi_share": "Partager",
"xlsx.mi_email": "Envoyer par e-mail",
"xlsx.mi_download": "Télécharger",
"xlsx.mi_rename": "Renommer",
"xlsx.mi_trash": "Déplacer vers la corbeille",
"xlsx.mi_history": "Historique des versions",
"xlsx.mi_offline": "Rendre disponible hors connexion",
"xlsx.mi_details": "Détails",
"xlsx.mi_settings": "Paramètres",
"xlsx.mi_paste_special": "Collage spécial",
"xlsx.mi_paste_all": "Tout coller",
"xlsx.mi_paste_values": "Coller les valeurs uniquement",
"xlsx.mi_move": "Déplacer",
"xlsx.mi_move_rows": "Lignes sélectionnées vers le bas",
"xlsx.mi_move_cols": "Colonnes sélectionnées vers la droite",
"xlsx.mi_delete": "Supprimer",
"xlsx.mi_delete_rows": "Supprimer les lignes sélectionnées",
"xlsx.mi_delete_cols": "Supprimer les colonnes sélectionnées",
"xlsx.mi_select_all": "Tout sélectionner",
"xlsx.mi_replace": "Rechercher et remplacer",
"xlsx.mi_replace_find": "Rechercher",
"xlsx.mi_replace_with": "Remplacer par",
"xlsx.mi_replace_one": "Remplacer",
"xlsx.mi_replace_all": "Tout remplacer",
"xlsx.mi_replace_none": "Aucune occurrence trouvée",
"xlsx.mi_replace_done": "{n} cellule(s) remplacée(s)",
"xlsx.mi_freeze": "Figer",
"xlsx.mi_freeze_here": "Figer jusqu'à la cellule active",
"xlsx.mi_freeze_row": "Figer la ligne active",
"xlsx.mi_freeze_col": "Figer la colonne active",
"xlsx.mi_show": "Afficher",
"xlsx.mi_show_formula": "Barre de formule",
"xlsx.mi_show_grid": "Grille",
"xlsx.mi_show_headers": "En-têtes",
"xlsx.mi_show_dashboard": "Tableau de bord",
"xlsx.mi_group": "Grouper",
"xlsx.mi_group_rows": "Grouper les lignes sélectionnées",
"xlsx.mi_group_cols": "Grouper les colonnes sélectionnées",
"xlsx.mi_ungroup_rows": "Dégrouper les lignes",
"xlsx.mi_ungroup_cols": "Dégrouper les colonnes",
"xlsx.mi_hidden_sheets": "Feuilles masquées",
"xlsx.mi_hide_sheet": "Masquer la feuille active",
"xlsx.mi_unhide_sheets": "Afficher les feuilles masquées",
"xlsx.mi_zoom": "Zoom",
"xlsx.mi_fullscreen": "Plein écran",
"xlsx.mi_exit_fullscreen": "Quitter le plein écran",
"xlsx.mi_insert_rows": "Lignes",
"xlsx.mi_insert_cols": "Colonnes",
"xlsx.mi_insert_cells": "Cellules",
"xlsx.mi_image": "Image",
"xlsx.mi_chart": "Graphique",
"xlsx.mi_drawing": "Dessin",
"xlsx.mi_function": "Fonction",
"xlsx.mi_function_hint": "Insère la fonction et place le curseur dans les parenthèses",
"xlsx.mi_pivot": "Tableau croisé dynamique",
"xlsx.mi_smart_chips": "Chips intelligents",
"xlsx.mi_form": "Formulaire",
"xlsx.mi_number": "Nombre",
"xlsx.mi_theme": "Thème",
"xlsx.mi_font_size": "Taille de police",
"xlsx.mi_align": "Alignement",
"xlsx.mi_align_h": "Alignement horizontal",
"xlsx.mi_align_v": "Alignement vertical",
"xlsx.mi_wrap": "Retour à la ligne",
"xlsx.mi_wrap_on": "Activer",
"xlsx.mi_wrap_off": "Désactiver",
"xlsx.mi_rotation": "Rotation du texte",
"xlsx.mi_conditional": "Mise en forme conditionnelle",
"xlsx.mi_banded": "Couleurs alternées",
"xlsx.mi_banded_hint": "Alterne la couleur de fond une ligne sur deux dans la sélection",
"xlsx.mi_banded_done": "Couleurs alternées appliquées à {n} ligne(s)",
"xlsx.mi_banded_default": "#eef3fb",
"xlsx.mi_sort": "Trier la plage",
"xlsx.mi_filter": "Créer un filtre",
"xlsx.mi_filter_hint": "Filtre les lignes selon la valeur de la cellule active",
"xlsx.mi_validation": "Validation des données",
"xlsx.mi_named": "Plages nommées",
"xlsx.mi_protect": "Protéger les feuilles et les plages",
"xlsx.mi_cleanup": "Nettoyage des données",
"xlsx.mi_cleanup_dupes": "Supprimer les doublons",
"xlsx.mi_cleanup_trim": "Supprimer les espaces superflus",
"xlsx.mi_cleanup_dupes_none": "Aucun doublon dans la sélection",
"xlsx.mi_cleanup_dupes_done": "{n} ligne(s) en doublon supprimée(s)",
"xlsx.mi_cleanup_trim_done": "{n} cellule(s) nettoyée(s)",
"xlsx.mi_split": "Diviser le texte en colonnes",
"xlsx.mi_split_hint": "Sépare le contenu de la cellule active sur un séparateur",
"xlsx.mi_split_sep": "Séparateur",
"xlsx.mi_split_done": "{n} colonne(s) remplie(s) à partir de la cellule active",
"xlsx.mi_form_create": "Créer un formulaire",
"xlsx.mi_spellcheck": "Vérifier l'orthographe",
"xlsx.mi_autocomplete": "Saisie semi-automatique",
"xlsx.mi_autocomplete_on": "Saisie semi-automatique activée",
"xlsx.mi_autocomplete_off": "Saisie semi-automatique désactivée",
"xlsx.mi_notifications": "Règles de notification",
"xlsx.mi_macros": "Macros",
"xlsx.mi_script_editor": "Éditeur de script",
"xlsx.mi_a11y": "Accessibilité",
"xlsx.mi_a11y_on": "Accessibilité renforcée activée (cellules plus grandes, grille plus contrastée)",
"xlsx.mi_a11y_off": "Accessibilité renforcée désactivée",
"xlsx.mi_ask_gemini": "Demander à Gemini",
"xlsx.mi_gem_table": "Créer des tableaux",
"xlsx.mi_gem_formula": "Créer des formules",
"xlsx.mi_gem_insights": "Analyse et insights",
"xlsx.mi_gem_chart": "Créer des graphiques",
"xlsx.mi_gem_summarize": "Résumer des e-mails et des fichiers",
"xlsx.mi_gem_actions": "Effectuer des actions",
"xlsx.mi_gem_more": "Plus d'options",
"xlsx.mi_addons": "Modules complémentaires",
"xlsx.mi_apps_script": "Apps Script",
"xlsx.mi_appsheet": "AppSheet",
"xlsx.mi_looker": "Looker Studio",
"xlsx.mi_help_sheets": "Aide sur les feuilles de calcul",
"xlsx.mi_training": "Formation",
"xlsx.mi_whatsnew": "Mises à jour",
"xlsx.mi_shortcuts": "Raccourcis clavier",
"xlsx.mi_report": "Signaler un problème",
"xlsx.mi_abuse": "Signaler un abus",
"xlsx.details_title": "Détails du fichier",
"xlsx.details_body": "Vault : {vault}\nFichier : {path}\nFeuilles : {sheets}\nCellules affichées : {cells}\nDernière révision : {revision}\nModification en attente : {dirty}",
"xlsx.shortcuts_title": "Raccourcis clavier",
"xlsx.shortcuts_body": "Ctrl/Cmd + Z — Annuler\nCtrl/Cmd + Y — Rétablir\nCtrl/Cmd + C / X / V — Copier / Couper / Coller\nCtrl/Cmd + A — Tout sélectionner\nCtrl/Cmd + F — Rechercher dans la feuille\nEntrée — Valider et descendre d'une cellule\nF2 — Modifier la cellule\nAlt + flèche — Saut de ligne dans la cellule\nÉchap — Quitter la saisie\nSuppr — Effacer le contenu de la sélection\nDouble-clic — Modifier la cellule en place\nMaj + clic — Étendre la sélection",
"xlsx.version_title": "Mises à jour",
"xlsx.version_body": "ObsiGate {version} — {date}\n{status}",
"xlsx.report_copied": "Diagnostic copié dans le presse-papiers.",
"xlsx.themes_title": "Thème de la feuille",
"xlsx.function_prompt": "Fonction à insérer",
"xlsx.rename_prompt": "Nouveau nom du fichier",
"xlsx.trash_confirm": "Déplacer « {name} » vers la corbeille ? Le classeur sera fermé.",
"xlsx.rename_done": "Fichier renommé en {name}",
"xlsx.trash_done": "Fichier déplacé vers la corbeille",
"viewer.download_md": "Télécharger en .md",
"viewer.download_file": "Télécharger le fichier",
"viewer.pretty": "Pretty",
+732 -52
View File
@@ -62,7 +62,7 @@
--grid-bg: #161b22;
--grid-header-bg: #1f2430;
--grid-header-text: #e6edf3;
--grid-border: #30363d;
--grid-border: #3d444d;
--grid-zebra: rgba(255, 255, 255, 0.025);
}
@@ -111,7 +111,7 @@
--grid-bg: #161b22;
--grid-header-bg: #1f2430;
--grid-header-text: #e6edf3;
--grid-border: #30363d;
--grid-border: #3d444d;
--grid-zebra: rgba(255, 255, 255, 0.025);
}
@@ -160,10 +160,28 @@
--grid-bg: #ffffff;
--grid-header-bg: #eaeef2;
--grid-header-text: #1f2328;
--grid-border: #d0d7de;
--grid-border: #b6bec9;
--grid-zebra: rgba(0, 0, 0, 0.025);
}
/* ===== THEME — HIGH-CONTRAST (generated mode, see themes.js) ===== */
:root[data-theme="high-contrast"] {
--grid-bg: #000000;
--grid-header-bg: #141414;
--grid-header-text: #ffffff;
--grid-border: #6b6b6b;
--grid-zebra: rgba(255, 255, 255, 0.045);
}
/* ===== THEME — SEPIA (generated mode, see themes.js) ===== */
:root[data-theme="sepia"] {
--grid-bg: #f5ecd5;
--grid-header-bg: #e8dcc0;
--grid-header-text: #3d2e1a;
--grid-border: #b09a6d;
--grid-zebra: rgba(61, 46, 26, 0.04);
}
/* ===== BASE ===== */
html {
font-size: 16px;
@@ -1491,10 +1509,12 @@ select {
max-width: 1200px;
}
/* Full-bleed viewers (PDF, images, Excalidraw) must use the whole width when
the navigation sidebar is hidden instead of the centered reading column. */
/* Full-bleed viewers (PDF, images, Excalidraw, spreadsheets) must use the
whole width when the navigation sidebar is hidden instead of the centered
reading column. */
.sidebar.hidden ~ .content-wrapper .content-area:has(.pdf-viewer-container),
.sidebar.hidden ~ .content-wrapper .content-area:has(.image-viewer-container),
.sidebar.hidden ~ .content-wrapper .content-area:has(.xlsx-viewer),
.sidebar.hidden ~ .content-wrapper .content-area:has(iframe[src*="excalidraw-editor.html"]) {
margin: 0;
max-width: none;
@@ -10998,24 +11018,33 @@ body.desktop-mode .editor-container {
padding: 6px 12px;
border-bottom: 1px solid var(--border-light, var(--border));
}
.csv-table tr:hover td {
background: var(--surface);
}
/* Google Sheets : le survol d'une ligne ne teinte rien (jamais de highlight
de ligne entière au survol). */
/* ── XLSX Viewer ── */
/* #154-A1 — the viewer shell is a grouped command bar: sheet tabs on the left,
action groups (Formules · Insertion · Vue · Fichier) on the right, then a
status row stating the viewer's limits (read-only, formulas not recalculated). */
/* #154-A1 — the viewer shell is a grouped command bar (edition commands),
then a sheet strip (tabs on the left, File menu + Save on the right), then
a status row stating the viewer's limits (read-only). #180 pins the bar to
the top edge of the page, full content width. */
.xlsx-toolbar {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 8px;
padding: 8px 10px;
position: sticky; /* #180 — stays on the top edge while the grid scrolls */
/* La marge haute négative (pleine largeur) tirait la barre 40 px sous sa
position statique : `top: 0` la replaquait et elle recouvrait le contenu
(en-tête A–Z, ligne 1) de 32 px. La contrainte reprend la même expression
que la marge : aucun déplacement au repos, épinglage intact au scroll. */
top: calc(-1 * clamp(16px, 3vw, 40px));
z-index: 30;
margin: calc(-1 * clamp(16px, 3vw, 40px)) calc(-1 * clamp(16px, 4vw, 40px)) 8px;
padding: 8px clamp(16px, 4vw, 40px);
border: 1px solid var(--border);
border-radius: var(--radius);
border-left: none;
border-right: none;
border-top: none;
border-radius: 0;
background: var(--surface2);
position: relative; /* anchors the A14 structure menu */
}
.xlsx-cmdbar {
display: flex;
@@ -11023,6 +11052,277 @@ body.desktop-mode .editor-container {
gap: 10px;
flex-wrap: wrap;
}
/* #185 — the Google Sheets menu bar: a flat row of text buttons above the
ribbon. No chrome, no borders: only the open menu gets a filled pill. */
.xlsx-menubar {
display: flex;
align-items: center;
gap: 2px;
flex-wrap: wrap;
margin: -2px 0 -2px;
}
/* No `position: relative` here on purpose: the dropdown is positioned by
anchorUnder() (viewer.js) relative to the sticky `.xlsx-toolbar`, exactly like
the Structure / Mise en forme / ribbon menus. Making the wrapper a containing
block would shift every dropdown by the button's offset. */
.xlsx-menuwrap {
display: inline-flex;
}
.xlsx-menubtn {
appearance: none;
border: none;
background: transparent;
color: var(--text-secondary);
font-family: inherit;
font-size: 0.82rem;
line-height: 1.4;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
white-space: nowrap;
}
.xlsx-menubtn:hover {
background: var(--bg-hover);
color: var(--text-primary);
}
.xlsx-menubtn[aria-expanded="true"] {
background: var(--accent-bg, var(--bg-hover));
color: var(--accent-text, var(--accent, #4a90d9));
}
/* The Gemini entry keeps its own accent so it reads as the AI corner of the
bar, like the themed icon in Google Sheets. */
.xlsx-menuwrap-gemini .xlsx-menubtn {
color: var(--accent, #4a90d9);
font-weight: 600;
}
.xlsx-menudrop {
min-width: 260px;
max-height: min(70vh, 560px);
overflow-y: auto;
z-index: 40;
}
/* Accordion section (Nombre, Thème, Zoom, Alignement, …). */
.xlsx-menu-sub {
display: flex;
flex-direction: column;
gap: 2px;
padding-left: 18px;
border-left: 2px solid var(--border);
margin: 2px 0 4px 8px;
}
.xlsx-menu-sub[hidden] {
display: none;
}
.xlsx-menu-item {
width: 100%;
}
.xlsx-menu-item-d2 {
padding-left: 18px;
}
.xlsx-menu-caret {
width: 14px;
height: 14px;
flex: 0 0 auto;
margin-left: auto;
color: var(--text-muted);
transition: transform 0.12s ease;
}
.xlsx-menu-item[aria-expanded="true"] > .xlsx-menu-caret {
transform: rotate(90deg);
}
/* An entry ObsiGate does not implement: dimmed but still clickable, so it
answers instead of pretending. */
.xlsx-menu-item-na {
opacity: 0.55;
}
.xlsx-menu-item-na:hover {
opacity: 1;
}
.xlsx-menu-empty {
padding: 6px 10px;
font-size: 0.78rem;
color: var(--text-muted);
}
/* #185 — Google Sheets' ribbon look: flat square icon buttons, no border and
no resting background, grouped by thin vertical rules. The old rounded /
bordered chrome fought with the theme of every one of the 15 themes. */
.xlsx-toolbar .btn-action {
border: 1px solid transparent;
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
min-width: 30px;
height: 30px;
padding: 0 6px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.xlsx-toolbar .btn-action:hover:not(:disabled) {
background: var(--bg-hover);
color: var(--text-primary);
}
.xlsx-toolbar .btn-action.active {
background: var(--accent-bg, var(--bg-hover));
color: var(--accent-text, var(--accent, #4a90d9));
}
.xlsx-toolbar .btn-action:disabled {
opacity: 0.4;
cursor: default;
}
.xlsx-toolbar .xlsx-cmd-sep {
width: 1px;
height: 22px;
background: var(--border);
}
.xlsx-toolbar .xlsx-select {
height: 30px;
border-color: transparent;
background: transparent;
}
.xlsx-toolbar .xlsx-select:hover {
background: var(--bg-hover);
}
/* Save stays the one solid pill: it is the only command with a consequence
outside the browser. */
.xlsx-toolbar .xlsx-save-primary {
border-color: var(--accent);
background: var(--accent);
color: #fff;
font-size: 0.8rem;
}
.xlsx-toolbar .xlsx-save-primary:hover:not(:disabled) {
background: var(--accent);
color: #fff;
filter: brightness(1.08);
}
.xlsx-formula-bar[hidden] {
display: none;
}
/* Wrapped command groups: every control stays visible, no scrollbar. */
.xlsx-cmdbar > .xlsx-toolbar-actions {
display: flex;
align-items: center;
gap: 8px;
flex: 1 1 auto;
min-width: 0;
flex-wrap: wrap;
overflow: visible;
}
.xlsx-cmdbar .xlsx-cmd-group,
.xlsx-cmdbar .xlsx-cmd-sep {
flex: 0 0 auto;
}
/* Native selects (zoom, number format): no custom dropdown to dismiss. */
.xlsx-select {
font-family: inherit;
font-size: 0.75rem;
color: var(--text-secondary);
background: transparent;
border: 1px solid var(--border);
border-radius: 6px;
padding: 4px 6px;
cursor: pointer;
max-width: 130px;
}
.xlsx-select:hover {
color: var(--accent);
border-color: var(--accent);
}
/* B/I/S/U letter buttons + decimal shorthands. */
.xlsx-fontstyle {
font-family: Georgia, "Times New Roman", serif;
min-width: 28px;
}
.xlsx-dec {
font-family: "JetBrains Mono", monospace;
}
.xlsx-fontsize {
min-width: 26px;
text-align: center;
font-size: 0.75rem;
color: var(--text-secondary);
}
/* Colour pickers: a letter/swatch label wrapping the native input. */
.xlsx-colorpick {
position: relative;
overflow: hidden;
}
.xlsx-colorpick input[type="color"] {
position: absolute;
inset: 0;
opacity: 0;
cursor: pointer;
width: 100%;
height: 100%;
padding: 0;
border: none;
}
/* #182 — colour swatch under the picker: mirrors the chosen colour so applying
one to a selection is visible on the button itself. Empty (transparent)
until a colour is actually picked, so the default ribbon stays clean. */
.xlsx-color-swatch {
width: 14px;
height: 4px;
border-radius: 2px;
border: 1px solid var(--border);
background: transparent;
flex: 0 0 auto;
}
.xlsx-colorletter {
font-family: Georgia, serif;
font-weight: 700;
border-bottom: 3px solid var(--accent);
line-height: 1;
padding: 0 2px;
}
/* Ribbon dropdown menus share the structure-menu look. */
.xlsx-ribbon-menu {
min-width: 220px;
}
/* Floating contextual mini-bar (multi-cell selections). */
.xlsx-minibar {
position: fixed;
z-index: 10060;
display: flex;
align-items: center;
gap: 2px;
padding: 4px 6px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--surface);
box-shadow: 0 8px 24px var(--shadow, rgba(0, 0, 0, 0.25));
}
.xlsx-minibar[hidden] {
display: none;
}
.xlsx-minibar button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border: none;
border-radius: 6px;
background: transparent;
color: var(--text-secondary);
cursor: pointer;
}
.xlsx-minibar button:hover {
background: var(--bg-hover);
color: var(--accent);
}
.xlsx-minibar button svg,
.xlsx-minibar button i[data-lucide] {
width: 15px;
height: 15px;
}
@media (pointer: coarse) {
.xlsx-minibar button {
width: 44px;
height: 44px;
}
}
.xlsx-toolbar-actions {
margin-left: auto;
display: flex;
@@ -11082,6 +11382,31 @@ body.desktop-mode .editor-container {
border-color: var(--accent);
color: var(--accent);
}
/* #180 — sheet strip: tabs on the left, File menu + Save pinned right. */
.xlsx-sheetbar {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.xlsx-sheetbar .xlsx-tabs {
flex: 1 1 auto;
min-width: 0;
}
.xlsx-sheetbar-end {
margin-left: auto;
display: inline-flex;
align-items: center;
gap: 6px;
flex: 0 0 auto;
}
.xlsx-file-dropdown {
position: relative;
display: inline-block;
}
.xlsx-file-item {
text-align: left;
}
.xlsx-status-bar {
display: flex;
align-items: center;
@@ -11162,28 +11487,45 @@ body.desktop-mode .editor-container {
white-space: pre-line;
}
.xlsx-table {
background: var(--grid-bg);
background: var(--grid-bg, var(--surface));
}
/* #185 — one uniform 1px grid line on EVERY side of every cell (header rows
included), the way Sheets draws it. Previously only the bottom edge existed
and its colour came from `--border`, which is far too close to the cell
background on most themes: the grid read as a smear instead of a grid.
`--grid-border` is now derived from the theme by themes.js (same token for
every line, so the mesh stays perfectly regular). */
.xlsx-table td,
.xlsx-table th {
border: 1px solid var(--grid-border, var(--border));
}
.xlsx-table td {
border-bottom: 1px solid var(--grid-border);
border-bottom: 1px solid var(--grid-border, var(--border));
/* Cellules de données : une seule et même couleur (fond de grille). Pas de
variante une-ligne-sur-deux ici : sa spécificité écraserait la teinte de
sélection (une ligne sur deux non teintée). */
background: var(--grid-bg, var(--surface));
}
/* #154-A1 — zebra + hover make rows scannable; headers use dedicated tokens so
they are visually distinct from the cells. */
.xlsx-table tbody tr:nth-child(even) td {
background: var(--grid-zebra);
}
.xlsx-table tbody tr:hover td {
background: var(--bg-hover);
/* Cellules fusionnées : couleur d'en-tête, sauf en sélection (la teinte de
sélection gagne, uniforme sur toutes les cellules). */
.xlsx-table tbody td[rowspan]:not([rowspan="1"]):not(.xlsx-selected),
.xlsx-table tbody td[colspan]:not([colspan="1"]):not(.xlsx-selected) {
background: var(--grid-header-bg, var(--bg-hover));
color: var(--grid-header-text, var(--text-primary));
}
/* Google Sheets : aucun survol teinté — ni la ligne entière, ni la cellule.
Rien ne se met en couleur tant que l'utilisateur n'a pas sélectionné au
moins 2 cellules (voir `.xlsx-range-multi`). */
.xlsx-table th.xlsx-corner,
.xlsx-table th.xlsx-rownum {
background: var(--grid-header-bg);
color: var(--grid-header-text);
background: var(--grid-header-bg, var(--bg-hover));
color: var(--grid-header-text, var(--text-primary));
font-weight: 500;
text-align: right;
padding: 6px 8px;
border-bottom: 2px solid var(--grid-border);
border-right: 1px solid var(--grid-border);
/* #185 — the same 1px line as the cells: the header is told apart by its
fill, not by a heavier rule that broke the grid's regularity. */
border: 1px solid var(--grid-border, var(--border));
position: sticky;
left: 0;
/* #153 A8 — `top: auto` is load-bearing: `.csv-table th` pins EVERY `th`
@@ -11194,7 +11536,9 @@ body.desktop-mode .editor-container {
}
.xlsx-table th.xlsx-corner {
left: 0;
top: 0;
/* Suit `--xlsx-stick` comme l'en-tête : mesuré en JS sur le recouvrement
réel de la toolbar sticky, sinon la ligne A–Z glisse dessous. */
top: var(--xlsx-stick, 0px);
z-index: 4;
}
/* #153 A8 — the column headers stay visible while the sheet scrolls down.
@@ -11202,11 +11546,43 @@ body.desktop-mode .editor-container {
order is intentional: thead (3) < row numbers (2) < corner (4). */
.xlsx-table thead th {
position: sticky;
top: 0;
top: var(--xlsx-stick, 0px);
z-index: 3;
background: var(--grid-header-bg);
color: var(--grid-header-text);
border-bottom: 2px solid var(--grid-border);
background: var(--grid-header-bg, var(--bg-hover));
color: var(--grid-header-text, var(--text-primary));
border-bottom: 1px solid var(--grid-border, var(--border));
}
/* #185 — Affichage ▸ Afficher ▸ Grille / En-têtes, and Outils ▸ Accessibilité:
display concerns only, never a change to the file. */
.xlsx-viewer.xlsx-no-grid .xlsx-table td,
.xlsx-viewer.xlsx-no-grid .xlsx-table th {
border-width: 0;
}
.xlsx-viewer.xlsx-no-headers thead,
.xlsx-viewer.xlsx-no-headers th.xlsx-rownum,
.xlsx-viewer.xlsx-no-headers th.xlsx-corner {
display: none;
}
.xlsx-viewer.xlsx-a11y .xlsx-table td {
padding: 8px 10px;
font-size: 0.95rem;
}
.xlsx-viewer.xlsx-a11y {
--grid-border: color-mix(in srgb, var(--text-primary, #888) 42%, var(--surface, #000));
}
/* #180 — while the pointer rides a header edge, the representative resize
icon must win over the cell (`cell`) and header (`pointer`) cursors. The
edge header itself is mirrored inline by the viewer (its inline
`cursor:pointer` beats any stylesheet rule). */
.xlsx-table.xlsx-resize-col,
.xlsx-table.xlsx-resize-col th,
.xlsx-table.xlsx-resize-col td {
cursor: col-resize;
}
.xlsx-table.xlsx-resize-row,
.xlsx-table.xlsx-resize-row th,
.xlsx-table.xlsx-resize-row td {
cursor: row-resize;
}
.xlsx-table td[contenteditable] {
/* #155 — Excel-style cross cursor over the cells. */
@@ -11218,6 +11594,57 @@ body.desktop-mode .editor-container {
outline: 2px solid var(--accent, #4a90d9);
outline-offset: -2px;
}
/* #181-A1 — SELECTION vs EDITION, like Google Sheets / Excel.
A selected cell is outlined but must NOT show a text caret; the caret is
only revealed in edit mode (double-click, F2 or the first keystroke).
`caret-color: transparent` hides it without leaving `contenteditable`, so the
click-to-select / type-to-replace flow stays native. */
.xlsx-table td.xlsx-cell {
caret-color: transparent;
}
.xlsx-table td.xlsx-editing {
caret-color: auto;
cursor: text;
}
/* The editing cell also reads as "open": a solid accent frame plus a raised
shadow, so the state is visible even on a row that is part of a range. */
.xlsx-table td.xlsx-editing {
outline: 2px solid var(--accent, #4a90d9);
outline-offset: -2px;
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
z-index: 1;
position: relative;
}
/* #181-A2 — range indicator: the four edges of the selected block trace it
exactly (Excel/Sheets draw a rectangle, not a flat wash), and the covered
row/column headers are highlighted too. `outline` on inner edges would be
overdrawn by the next cell, so the four borders are declared separately and
win over `.xlsx-selected`'s background. */
.xlsx-table tbody td.xlsx-sel-top {
border-top: 2px solid var(--accent, #4a90d9);
}
.xlsx-table tbody td.xlsx-sel-bottom {
border-bottom: 2px solid var(--accent, #4a90d9);
}
.xlsx-table tbody td.xlsx-sel-left {
border-left: 2px solid var(--accent, #4a90d9);
}
.xlsx-table tbody td.xlsx-sel-right {
border-right: 2px solid var(--accent, #4a90d9);
}
/* A one-cell selection keeps its four accent edges (a framed box) but NO fill:
`.xlsx-range-multi` is toggled on the viewer by applySelection() and gates
the tint, which starts at 2 cells — Google Sheets behaviour. */
.xlsx-viewer.xlsx-range-multi .xlsx-table tbody td.xlsx-selected {
background: var(--accent-bg);
}
.xlsx-table thead th.xlsx-hdr-selected,
.xlsx-table th.xlsx-rownum.xlsx-hdr-selected {
background: var(--accent-bg);
color: var(--accent-text, var(--accent, #4a90d9));
font-weight: 700;
}
/* #153 A7 — the active cell keeps its outline even when focus moves to the
formula bar, so the user never loses track of what the bar edits.
#154-A1 — solid (not dashed) for a stronger active-cell affordance. */
@@ -11226,25 +11653,47 @@ body.desktop-mode .editor-container {
outline-offset: -2px;
}
/* #153 A7 — formula bar under the toolbar: [ A1 | > | input ] */
/* Barre d'édition de la cellule, juste au-dessus de la grille :
[ position | champ d'édition ] + recherche. Bandeau distinct du fond pour
rester identifiable dans tous les thèmes (le fond transparent la rendait
invisible). Elle vit DANS la barre d'outils sticky (dernier rang) : la
toolbar restait sinon peinte par-dessus au défilement. */
.xlsx-formula-bar {
display: flex;
align-items: center;
gap: 6px;
gap: 8px;
margin-bottom: 8px;
padding: 6px 8px;
background: var(--surface2, var(--surface));
border: 1px solid var(--border);
border-radius: 8px;
}
/* Dernier rang de la toolbar sticky : l'écart est déjà géré par son `gap`. */
.xlsx-toolbar .xlsx-formula-bar {
margin-bottom: 0;
}
/* Zone d'édition : position de la cellule | champ d'édition. */
.xlsx-editbar {
display: flex;
align-items: center;
gap: 6px;
flex: 1 1 auto;
min-width: 0;
}
/* #156-A7 — the Name Box is editable (“Atteindre”): a plain input styled like
the read-only badge it replaced. */
.xlsx-active-cell {
width: 84px;
flex: 0 0 auto;
box-sizing: border-box;
padding: 4px 8px;
border: 1px solid var(--border);
border: 1px solid var(--grid-border, var(--border));
border-radius: 4px;
background: var(--surface);
color: var(--text-primary);
font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
font-size: 0.8rem;
font-weight: 700;
text-align: center;
font-variant-numeric: tabular-nums;
}
@@ -11252,17 +11701,22 @@ body.desktop-mode .editor-container {
outline: 2px solid var(--accent, #4a90d9);
outline-offset: -2px;
}
.xlsx-formula-sep {
width: 14px;
height: 14px;
/* Pastille « fx » façon tableur : repère visuel du champ d'édition. */
.xlsx-edit-fx {
flex: 0 0 auto;
font-family: Georgia, 'Times New Roman', serif;
font-style: italic;
font-weight: 700;
font-size: 0.85rem;
color: var(--text-muted);
padding: 0 2px;
user-select: none;
}
.xlsx-formula-input {
flex: 1;
min-width: 0;
padding: 5px 10px;
border: 1px solid var(--border);
border: 1px solid var(--grid-border, var(--border));
border-radius: 4px;
background: var(--surface);
color: var(--text-primary);
@@ -11334,7 +11788,7 @@ body.desktop-mode .editor-container {
min-width: 200px;
max-width: 86vw;
padding: 4px;
background: var(--bg, #fff);
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
@@ -11393,18 +11847,23 @@ body.desktop-mode .editor-container {
.xlsx-table tr.xlsx-frozen-row td,
.xlsx-table tr.xlsx-frozen-row th {
position: sticky;
top: 33px; /* thead height — keeps the frozen row below the header */
/* Hauteur de l'en-tête + décalage toolbar sticky (`--xlsx-stick`). */
top: calc(var(--xlsx-stick, 0px) + 33px); /* thead height — keeps the frozen row below the header */
z-index: 2;
background: var(--grid-header-bg);
background: var(--grid-header-bg, var(--bg-hover));
}
.xlsx-table td.xlsx-frozen-col {
position: sticky;
left: 44px; /* the row-number column width */
background: var(--grid-bg);
background: var(--grid-bg, var(--surface));
}
/* #153 A14 — structure menu (sheets / rows / columns) */
.xlsx-structure-menu {
/* #185 — the menu-bar dropdowns share the toolbar menus' look; the toolbar
menus keep the `.xlsx-structure-menu` class to themselves so `.xlsx-structure-menu`
queries (viewer, tests, E2E) only ever match the open toolbar menu. */
.xlsx-structure-menu,
.xlsx-menudrop {
position: absolute;
z-index: 30;
display: flex;
@@ -11412,7 +11871,8 @@ body.desktop-mode .editor-container {
gap: 2px;
min-width: 240px;
max-width: min(320px, 92vw);
margin-top: 4px;
/* Positioned under its toggle by anchorUnder() (viewer.js), which already
adds the 4px gap. */
padding: 6px;
border: 1px solid var(--border);
border-radius: 6px;
@@ -11610,6 +12070,29 @@ body.desktop-mode .editor-container {
background: var(--border);
}
/* Resize ghost: fixed guide line following the pointer while dragging a
header edge (column widths / row heights). */
.xlsx-resize-ghost {
position: fixed;
z-index: 10060;
margin: 0;
background: var(--accent, #4a90d9);
pointer-events: none;
}
.xlsx-resize-ghost[data-kind="col"] { width: 2px; }
.xlsx-resize-ghost[data-kind="row"] { height: 2px; }
/* Comment marker: content-free so copy/export/save text stays clean. */
.xlsx-comment-dot::after {
content: "\1F4AC";
font-size: 0.68em;
margin-left: 3px;
vertical-align: super;
cursor: help;
}
/* Computed formula links behave like spreadsheet links. */
.xlsx-formula-link { color: var(--accent, #4a90d9); text-decoration: underline; }
/* #179 — shared menu-entry icon (grid context menu, structure, format, export). */
.xlsx-menu-icon {
width: 14px;
@@ -11636,10 +12119,9 @@ body.desktop-mode .editor-container {
outline: 2px solid var(--accent, #4a90d9);
outline-offset: -2px;
}
/* #155 — Excel-like range selection + right-click / long-press context menu. */
.xlsx-table tbody td.xlsx-selected {
background: var(--accent-bg);
}
/* #155 — Excel-like range selection + right-click / long-press context menu.
Le remplissage de la sélection est déclaré plus haut et conditionné par
`.xlsx-range-multi` : pas de fond teinté pour une sélection d'une cellule. */
.xlsx-viewer.xlsx-selecting,
.xlsx-viewer.xlsx-selecting td {
user-select: none;
@@ -11673,7 +12155,8 @@ body.desktop-mode .editor-container {
.xlsx-context-menu {
min-width: min(260px, 86vw);
}
.xlsx-structure-menu {
.xlsx-structure-menu,
.xlsx-menudrop {
max-width: 92vw;
}
}
@@ -11703,6 +12186,203 @@ body.desktop-mode .editor-container {
background: var(--border);
}
/* #183 — Sheets-like colour panel (text + fill). The chrome follows the
active theme (variables only); the swatches carry their own colour inline,
which is data, not decoration. */
.xlsx-colorpick-wrap {
position: relative;
display: inline-flex;
}
.xlsx-color-native {
position: absolute;
width: 0;
height: 0;
opacity: 0;
pointer-events: none;
border: none;
padding: 0;
}
.xlsx-colour-panel {
position: absolute;
z-index: 40;
display: flex;
flex-direction: column;
width: 236px;
padding: 10px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--surface);
box-shadow: 0 6px 18px var(--shadow, rgba(0, 0, 0, 0.22));
font-size: 0.8rem;
}
.xlsx-colour-head {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.xlsx-colour-reset {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 8px;
border: 1px solid var(--border);
border-radius: 6px;
background: transparent;
color: var(--text-secondary);
font-size: 0.8rem;
cursor: pointer;
}
.xlsx-colour-reset:hover {
color: var(--accent);
border-color: var(--accent);
}
.xlsx-colour-icon {
width: 14px;
height: 14px;
flex: 0 0 auto;
}
/* 8 columns x 10 rows = the 80 curated swatches. */
.xlsx-colour-grid {
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 4px;
}
.xlsx-colour-swatch-btn {
position: relative;
width: 100%;
aspect-ratio: 1 / 1;
min-width: 20px;
padding: 0;
border: 1px solid var(--border);
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
.xlsx-colour-swatch-btn:hover {
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
}
.xlsx-colour-swatch-btn.selected {
box-shadow: 0 0 0 2px var(--accent);
}
.xlsx-colour-check {
width: 12px;
height: 12px;
pointer-events: none;
}
.xlsx-colour-section {
margin-top: 10px;
padding-top: 8px;
border-top: 1px solid var(--border);
}
.xlsx-colour-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
color: var(--text-muted);
font-size: 0.68rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.xlsx-colour-row {
display: flex;
align-items: center;
gap: 6px;
}
.xlsx-colour-row .xlsx-colour-swatch-btn {
width: 22px;
height: 22px;
}
.xlsx-colour-add {
display: inline-flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
padding: 0;
border: 1px dashed var(--border);
border-radius: 50%;
background: transparent;
color: var(--text-secondary);
cursor: pointer;
}
.xlsx-colour-add:hover {
color: var(--accent);
border-color: var(--accent);
}
.xlsx-colour-edit {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
border: none;
border-radius: 4px;
background: transparent;
color: var(--text-muted);
cursor: pointer;
}
.xlsx-colour-edit:hover {
color: var(--accent);
background: var(--bg-hover);
}
.xlsx-colour-foot {
margin-top: 10px;
padding-top: 6px;
border-top: 1px solid var(--border);
}
.xlsx-colour-foot-item {
display: block;
width: 100%;
padding: 6px 4px;
border: none;
border-radius: 4px;
background: none;
color: var(--text-primary);
font-size: 0.8rem;
text-align: left;
cursor: pointer;
}
.xlsx-colour-foot-item:hover {
background: var(--bg-hover);
}
/* Mise en forme menu: the colour rows now carry a trigger + a live dot. */
.xlsx-format-colour {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
color: var(--text-primary);
font-size: 13px;
}
.xlsx-format-colour-btn {
margin-left: auto;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 2px 4px;
border: 1px solid var(--border);
border-radius: 4px;
background: var(--surface);
cursor: pointer;
}
.xlsx-format-colour-btn:hover {
border-color: var(--accent);
color: var(--accent);
}
.xlsx-format-colour-dot {
width: 16px;
height: 16px;
border-radius: 50%;
border: 1px solid var(--border);
background: linear-gradient(135deg, var(--accent) 0%, var(--accent-green, var(--accent)) 100%);
}
.xlsx-colour-panel {
max-height: 70vh;
overflow-y: auto;
}
/* JSDOM shims for the tests that click anchors */
mark {
font: inherit;
@@ -11785,7 +12465,7 @@ mark {
align-items: flex-start;
gap: 8px;
padding: 8px 10px;
margin-bottom: 8px;
margin: 8px 0;
border: 1px solid var(--border);
border-left: 3px solid var(--accent, #4a90d9);
border-radius: 4px;