From 329f30cf306af57f2c18eca2f9c8f07935e0f133 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 2 Jun 2026 21:59:32 +0200 Subject: [PATCH] feat(words): text + background colour in the bubble menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The floating selection menu now carries text + background colour, applied to the selection like bold/italic. A 'Color' (A) dropdown opens Text + Background swatch grids; each swatch is a Words.CommandButton whose color:#hex / bgcolor:#hex command the provider already parses into a parametric toggleMark on the live selection — reusing the same range-restoring path the mark buttons use, no bespoke selection wiring. The 'Default' chip clears the mark (empty value). - words-bubble.svelte: colour DropdownMenu (Baseline / Highlighter icons), 9-hue palette + clear, marked data-words-bubble-color. - words-provider: add [data-words-bubble-color] to the bubble's keep-selection-alive closed surface so interacting with the dropdown doesn't collapse the model selection. - words.css: swatch-grid styling (hue from inline --words-swatch; clear chip is a diagonal strike). Verified: selecting a word → A → blue swatch recolours it (rendered rgb(0,145,255), model carries {type:'color',value:'#0091ff'}); bubble + selection stay alive so multiple swatches can be applied in a row. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/words/words-bubble.svelte | 90 ++++++++++++++++++- src/uix/eidos/components/words/words.css | 55 ++++++++++++ .../components/words/words-provider.svelte.ts | 1 + 3 files changed, 145 insertions(+), 1 deletion(-) diff --git a/src/uix/eidos/components/words/words-bubble.svelte b/src/uix/eidos/components/words/words-bubble.svelte index 633e2cdfb..c3494511d 100644 --- a/src/uix/eidos/components/words/words-bubble.svelte +++ b/src/uix/eidos/components/words/words-bubble.svelte @@ -32,7 +32,9 @@ Link, Unlink, ChevronDown, - Check + Check, + Baseline, + Highlighter } from '$uix/eidos/components/icon'; import type { ProviderSnippetProps, @@ -44,10 +46,30 @@ let { api }: { api: ProviderSnippetProps } = $props(); let turnIntoOpen = $state(false); + let colorOpen = $state(false); let linkOpen = $state(false); let linkValue = $state(''); let linkInput = $state(null); + // Swatch palette for the bubble's text / background color marks — the + // SAME hues the inspector's color rows offer, minus pure white (invisible + // as a text color on a light surface; the "Default" chip clears instead). + // Each swatch applies via `Words.CommandButton` (command `color:#hex` / + // `bgcolor:#hex`) which the provider parses to a parametric `toggleMark` + // on the live selection — exactly how bold / italic apply, so a recolor + // rides the same range-restoring path with no bespoke wiring. + const COLOR_SWATCHES = [ + '#e5484d', + '#f76b15', + '#ffc53d', + '#46a758', + '#0091ff', + '#8e4ec6', + '#e93d82', + '#646a73', + '#1a1a1a' + ] as const; + // Blocks whose content the engine can reinterpret (setBlock / toggleList // no-op on table / image / divider / callout), so turn-into is disabled // elsewhere instead of offering inert options. @@ -263,6 +285,72 @@ + + + + {#snippet icon()}{/snippet} + + +
+ Text +
+ + {#snippet child({ props })} + + {/snippet} + + {#each COLOR_SWATCHES as hex (hex)} + + {#snippet child({ props })} + + {/snippet} + + {/each} +
+
+
+ Background +
+ + {#snippet child({ props })} + + {/snippet} + + {#each COLOR_SWATCHES as hex (hex)} + + {#snippet child({ props })} + + {/snippet} + + {/each} +
+
+
+
+ + +