@ -404,34 +404,11 @@
assembleRouteStyles(route, style);
}
// Palette editing — recolour existing entries (add / remove / rename = v2).
// The delta stores the FULL array (names ride along); clearing a swatch
// restores that entry from the app palette, and when every entry matches the
// app again the whole delta is dropped.
const paletteModified = $derived(docDeltas?.palette !== undefined);
// Palette entry → its hex. The Paleta grid is a DISPLAY of the document's
// colours (scheme-driven); per-swatch recolour was removed 2026-07-18 (the
// palette comes from the esquema, like typography — not edited color-by-color).
const paletteValueOf = (e: PalabrasPaletteEntry | undefined) =>
e === undefined ? undefined : typeof e === 'string' ? e : e.value;
function writePaletteColor(index: number, hex: string | undefined) {
const base = baseScheme.palette ?? [];
const next = (scheme.palette ?? []).map((e, i) => {
if (i !== index) return e;
const value = hex ?? paletteValueOf(base[i]);
if (value === undefined) return e;
return typeof e === 'string' ? value : { ... e , value } ;
});
const equalsApp =
next.length === base.length & &
next.every((e, i) => paletteValueOf(e) === paletteValueOf(base[i]));
const bag: Record< string , unknown > = { ... docDeltas } ;
if (equalsApp) delete bag.palette;
else bag.palette = next;
commitDocScheme(bag);
}
function resetPalette() {
const bag: Record< string , unknown > = { ... docDeltas } ;
delete bag.palette;
commitDocScheme(bag);
}
// Doc pills — measure, canvas margins (inline padding) and vertical rhythm.
// All anchored steps (palanca #1); raw values live in the bag. EVERY control
@ -1589,36 +1566,15 @@
< ScrollArea autosize scrollbars = "vertical" type = "auto" size = "sm" data-palabras-scroll >
< ScrollArea.Viewport >
< div data-palabras-panel-fields >
{ #if paletteModified }
< div data-palabras-section-reset-row >
< Button
variant="ghost"
size="sm"
iconOnly
data-palabras-section-reset
aria-label="{ ts (
'#?components.palabras.action.reset-section|Restablecer'
)} { ts ( PALETTE_SECTION )} "
title={ ts (
'#?components.palabras.action.reset-section-title|Restablecer la sección a los valores por defecto'
)}
onclick={ resetPalette }
>
{ # snippet icon ()} < RotateCcw /> { /snippet }
< / Button >
< / div >
{ /if }
<!-- Palette = a GRID of swatches, not a row - per - colour (that read as a
tall, scrolling list). Each swatch opens the full picker; its name
rides as a hover tooltip (user 2026-07-18). -->
<!-- Palette = a DISPLAY grid of swatches (the document's colours, the
name in a tooltip). Scheme-driven, not edited per-swatch here
(user 2026-07-18: the palette comes from the document's esquema). -->
< div data-palabras-palette-grid >
{ #each scheme . palette ?? [] as entry , i ( i )}
< PalabrasColorRow
swatchOnly
label={ typeof entry === 'string' ? entry : entry.name }
current={ paletteValueOf ( entry )}
presets={ schemePaletteValues ( scheme )}
onPick={( hex ) => writePaletteColor ( i , hex )}
/>
{ /each }
< / div >