uix(color): abre `color` en float-panel

El accent (regla del header, focus ring, grip de resize) pasa de 8 bloques
per-rol al forward compartido en la parte `content` (el panel portala y
estampa su propio `data-color` via ctx). El default real NO era el "fantasma"
que temia el handoff: la recipe SI tiene `accent: neutral-border` y el root
siempre estampa `color='neutral'` por defecto → estampa-siempre + regla
generica es fiel (host del forward = neutral-border, el valor del default).
El fallback sin-ctx (`var(--float-panel-accent)`) queda intacto.

Tipos: `FloatPanelColor = ComponentColorProp` (era ColorRole); el Content
resuelve via resolveComponentColor con seed `--color-custom` para raw values.

Verificado en Chrome: default neutral = probe exacto; threat/iris = token
compartido; sin estampa → fallback neutral-border; custom → color-mix del
seed. Contract test sin fallos nuevos.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
alpha-0.1-sec-dom
dev 3 months ago
parent c9db0a8d26
commit 18026dfd84

@ -1,18 +1,28 @@
<script lang="ts">
import * as FloatPanel from '$soma/components/float-panel';
import { composeInlineStyle } from '$uix/eidos/lib/style';
import { resolveComponentColor } from '$uix/eidos/lib/component-color';
import { getFloatPanelCtx } from './context';
import type { FloatPanelContentProps } from './types';
let { motion = 'scale-fade', children, ...rest }: FloatPanelContentProps = $props();
let { motion = 'scale-fade', style, children, ...rest }: FloatPanelContentProps = $props();
const ctx = getFloatPanelCtx();
// `color` accepts the full system: canonical → `data-color`, raw value →
// `data-color-custom` + the `--color-custom` seed. Without a root ctx
// nothing stamps and the base no-accent fallback applies, as before.
const colorAttrs = $derived(resolveComponentColor(ctx?.color));
const mergedStyle = $derived(composeInlineStyle(style, colorAttrs.customStyle));
</script>
<FloatPanel.Content
{...rest}
data-variant={ctx?.variant}
data-color={ctx?.color}
data-color={colorAttrs.dataColor}
data-color-custom={colorAttrs.isCustom ? '' : undefined}
data-depth="overlay"
data-animation-style={motion === 'none' ? undefined : motion}
style={mergedStyle}
>
{@render children?.()}
</FloatPanel.Content>

@ -84,29 +84,13 @@
}
/* Accent per color role (focus ring + resize-active + header rule emphasis). */
[data-float-panel-content][data-color='primary'] {
--_float-panel-accent: var(--color-primary-border);
}
[data-float-panel-content][data-color='secondary'] {
--_float-panel-accent: var(--color-secondary-border);
}
[data-float-panel-content][data-color='neutral'] {
--_float-panel-accent: var(--color-neutral-border);
}
[data-float-panel-content][data-color='affirm'] {
--_float-panel-accent: var(--color-affirm-border);
}
[data-float-panel-content][data-color='fulfill'] {
--_float-panel-accent: var(--color-fulfill-border);
}
[data-float-panel-content][data-color='risk'] {
--_float-panel-accent: var(--color-risk-border);
}
[data-float-panel-content][data-color='threat'] {
--_float-panel-accent: var(--color-threat-border);
}
[data-float-panel-content][data-color='loss'] {
--_float-panel-accent: var(--color-loss-border);
/* Accent colour comes from the shared palette forward
(`--_float-panel-palette-border`, part `content`): any role / 33 scale /
custom value routes through. Without a stamped colour (no root ctx) the
base no-accent fallback above stays in charge. */
[data-float-panel-content][data-color],
[data-float-panel-content][data-color-custom] {
--_float-panel-accent: var(--_float-panel-palette-border);
}
/* Header = drag handle. */

@ -12,14 +12,17 @@ import type {
ResizeHandleProps,
ResizeGripProps
} from '$soma/components/float-panel';
import type { ColorRole, ControlVariant, ResponsiveProp } from '$uix/eidos/lib/types';
import type { ComponentColorProp, ControlVariant, ResponsiveProp } from '$uix/eidos/lib/types';
import type { MotionPresetName } from '$uix/eidos/lib/motion/registry';
import type { ButtonVariant, ButtonSize, ButtonProps } from '$uix/eidos/components/button';
/** Surface treatment of the panel — canonical control variants (no invented values). */
export type FloatPanelVariant = ControlVariant;
/** Accent palette (header rule, focus ring, resize-handle active). */
export type FloatPanelColor = ColorRole;
/**
* Accent (header rule, focus ring, resize-handle active) — any role / intent /
* 33 donor scales / raw CSS color.
*/
export type FloatPanelColor = ComponentColorProp;
/**
* Props for the eidos `<FloatPanel>` root.

@ -4316,6 +4316,14 @@
--_image-palette-track: var(--palette-track, var(--color-primary-track));
}
[data-float-panel-content] {
--_float-panel-palette-border: var(--color-neutral-border);
}
[data-float-panel-content][data-color], [data-float-panel-content][data-color-custom] {
--_float-panel-palette-border: var(--palette-border, var(--color-neutral-border));
}
[data-color-picker-trigger], [data-color-picker-content] {
--_color-picker-palette-border: var(--color-primary-border);
}

@ -1260,6 +1260,14 @@ export const THEME_BASE_RECIPE_TOKENS = defineRecipes({
'button-size': 'var(--space-7)',
'grip-size': 'var(--space-5)',
accent: 'var(--color-neutral-border)',
// Accent palette forward (THM-2) — `color` tints the header rule, focus
// ring and resize grip via the shared layer (roles + 33 scales + custom)
// on the `content` part (the panel portals; it stamps its own
// `data-color`). Host = neutral-border, the stamped default's value.
'_palette-border': {
parts: ['content'],
declarations: [{ value: 'var(--color-neutral-border)', scope: 'host' }]
},
'transition-duration': 'var(--duration-fast)',
'transition-ease': 'var(--ease-default)'
},

Loading…
Cancel
Save

Powered by TurnKey Linux.