feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
<script lang="ts">
|
|
|
|
|
/**
|
|
|
|
|
* Eidos `<Trans>` — i18n primitive. Resolves an idlangref or path
|
|
|
|
|
* through the active langs catalog and renders the translated text
|
|
|
|
|
* in a configurable element (default `<span>`).
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
*
|
|
|
|
|
* <Trans>#?common.save|Save</Trans> <!-- children → idlangref -->
|
|
|
|
|
* <Trans value="#?common.save|Save" /> <!-- value prop -->
|
|
|
|
|
* <Trans path="common.save">Save</Trans> <!-- path + children=fallback -->
|
|
|
|
|
* <Trans path="common.greet" params={{name: 'Juan'}} />
|
|
|
|
|
* <Trans as="strong">#?ui.required|Required</Trans>
|
|
|
|
|
*
|
|
|
|
|
* Reactive to locale changes — when the active locale flips, the
|
|
|
|
|
* rendered text updates without consumer plumbing.
|
|
|
|
|
*
|
|
|
|
|
* Designed as a greppable i18n marker — searching `<Trans` finds
|
|
|
|
|
* every site that touches the langs catalog, which is much harder
|
|
|
|
|
* to audit when consumers call `langs.ts(...)` inline.
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
*/
|
fix(eidos): use ActiveEidos.require() instead of getActiveUix() in 15 components
Cierra P1 #1 del audit Codex: «Eidos no importa `\$active-uix`
directamente — consume el runtime via `ActiveEidos.require()` que
expone la surface bounded (langs / format / prefs / dom / uix)».
`ActiveEidos` ya existe (src/uix/eidos/active-eidos.svelte.ts) y la
mayoria de eidos components la usan (accordion, alert-dialog, banner,
box, button, calendar, card, ~50 archivos). Estos 15 quedaban como
strugglers/adiciones recientes que se saltaron el patron.
Patron canonico aplicado en cada archivo:
-import { getActiveUix } from '\$active-uix';
-const uix = getActiveUix();
-uix.langs.t(...)
+import { ActiveEidos } from '\$uix/eidos';
+const eidos = ActiveEidos.require();
+eidos.langs.t(...)
Archivos (15):
- badge/badge.svelte
- format-date/format-date.svelte
- format-number/format-number.svelte
- image/image-{error,fallback,_}.svelte (3)
- password-field/password-field-caps-lock-indicator.svelte
- picker-shell/picker-shell-{cancel,clear,close}.svelte (3)
- relative-time/relative-time.svelte
- s-text/s-text.svelte
- skeleton/skeleton.svelte
- spinner/spinner.svelte
- trans/trans.svelte
Sin nueva surface introducida — todas las usages (langs, format.dates,
format.numbers, format.currency) ya estaban expuestas en
`ActiveEidos`.
Verificacion:
- `grep getActiveUix src/uix/eidos/components/ --include='*.svelte'`:
cero matches. Quedan referencias en comments/READMEs/types.ts
(informativas, no imports).
- `npm run check`: 0 errors mantenido.
- HTTP 200 en /uix/components/{trans,format-date,format-number,relative-time,badge,skeleton,spinner,image}.
Esto es el fix correcto del audit (no la migracion-a-soma del commit
anterior que se hizo por mal entendimiento de la regla — revertida en
el commit precedente «Revert ... service components from Eidos to
Soma»).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
import { ActiveEidos } from '$uix/eidos';
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
import type { LangString } from '$libs/langs';
|
|
|
|
|
import type { TransProps } from './types';
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
value,
|
|
|
|
|
path,
|
|
|
|
|
params,
|
|
|
|
|
locale,
|
|
|
|
|
as = 'span',
|
|
|
|
|
trim = true,
|
|
|
|
|
children,
|
|
|
|
|
...rest
|
|
|
|
|
}: TransProps = $props();
|
|
|
|
|
|
fix(eidos): use ActiveEidos.require() instead of getActiveUix() in 15 components
Cierra P1 #1 del audit Codex: «Eidos no importa `\$active-uix`
directamente — consume el runtime via `ActiveEidos.require()` que
expone la surface bounded (langs / format / prefs / dom / uix)».
`ActiveEidos` ya existe (src/uix/eidos/active-eidos.svelte.ts) y la
mayoria de eidos components la usan (accordion, alert-dialog, banner,
box, button, calendar, card, ~50 archivos). Estos 15 quedaban como
strugglers/adiciones recientes que se saltaron el patron.
Patron canonico aplicado en cada archivo:
-import { getActiveUix } from '\$active-uix';
-const uix = getActiveUix();
-uix.langs.t(...)
+import { ActiveEidos } from '\$uix/eidos';
+const eidos = ActiveEidos.require();
+eidos.langs.t(...)
Archivos (15):
- badge/badge.svelte
- format-date/format-date.svelte
- format-number/format-number.svelte
- image/image-{error,fallback,_}.svelte (3)
- password-field/password-field-caps-lock-indicator.svelte
- picker-shell/picker-shell-{cancel,clear,close}.svelte (3)
- relative-time/relative-time.svelte
- s-text/s-text.svelte
- skeleton/skeleton.svelte
- spinner/spinner.svelte
- trans/trans.svelte
Sin nueva surface introducida — todas las usages (langs, format.dates,
format.numbers, format.currency) ya estaban expuestas en
`ActiveEidos`.
Verificacion:
- `grep getActiveUix src/uix/eidos/components/ --include='*.svelte'`:
cero matches. Quedan referencias en comments/READMEs/types.ts
(informativas, no imports).
- `npm run check`: 0 errors mantenido.
- HTTP 200 en /uix/components/{trans,format-date,format-number,relative-time,badge,skeleton,spinner,image}.
Esto es el fix correcto del audit (no la migracion-a-soma del commit
anterior que se hizo por mal entendimiento de la regla — revertida en
el commit precedente «Revert ... service components from Eidos to
Soma»).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
const eidos = ActiveEidos.require();
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
|
|
|
|
|
// When neither `value` nor `path` is set, capture the children DOM
|
|
|
|
|
// text content and treat it as the source. This lets consumers
|
|
|
|
|
// write `<Trans>#?common.save|Save</Trans>` and we read the literal
|
|
|
|
|
// from the rendered output.
|
|
|
|
|
let captureNode = $state<HTMLElement | null>(null);
|
|
|
|
|
let capturedText = $state<string | undefined>(undefined);
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if (value !== undefined || path !== undefined) return;
|
|
|
|
|
if (!captureNode) return;
|
|
|
|
|
const raw = captureNode.textContent ?? '';
|
|
|
|
|
capturedText = trim ? raw.trim() : raw;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const resolved = $derived.by(() => {
|
|
|
|
|
// path-based: use t() for interpolation + fallback children.
|
|
|
|
|
// Cast: langs.t() types its first overload with a strict template
|
|
|
|
|
// literal (`${string}.${string}` ...); a free `string` doesn't
|
|
|
|
|
// match. The runtime accepts arbitrary dotted paths just fine,
|
|
|
|
|
// so the cast is safe — we route through the second overload.
|
|
|
|
|
if (path !== undefined) {
|
fix(eidos): use ActiveEidos.require() instead of getActiveUix() in 15 components
Cierra P1 #1 del audit Codex: «Eidos no importa `\$active-uix`
directamente — consume el runtime via `ActiveEidos.require()` que
expone la surface bounded (langs / format / prefs / dom / uix)».
`ActiveEidos` ya existe (src/uix/eidos/active-eidos.svelte.ts) y la
mayoria de eidos components la usan (accordion, alert-dialog, banner,
box, button, calendar, card, ~50 archivos). Estos 15 quedaban como
strugglers/adiciones recientes que se saltaron el patron.
Patron canonico aplicado en cada archivo:
-import { getActiveUix } from '\$active-uix';
-const uix = getActiveUix();
-uix.langs.t(...)
+import { ActiveEidos } from '\$uix/eidos';
+const eidos = ActiveEidos.require();
+eidos.langs.t(...)
Archivos (15):
- badge/badge.svelte
- format-date/format-date.svelte
- format-number/format-number.svelte
- image/image-{error,fallback,_}.svelte (3)
- password-field/password-field-caps-lock-indicator.svelte
- picker-shell/picker-shell-{cancel,clear,close}.svelte (3)
- relative-time/relative-time.svelte
- s-text/s-text.svelte
- skeleton/skeleton.svelte
- spinner/spinner.svelte
- trans/trans.svelte
Sin nueva surface introducida — todas las usages (langs, format.dates,
format.numbers, format.currency) ya estaban expuestas en
`ActiveEidos`.
Verificacion:
- `grep getActiveUix src/uix/eidos/components/ --include='*.svelte'`:
cero matches. Quedan referencias en comments/READMEs/types.ts
(informativas, no imports).
- `npm run check`: 0 errors mantenido.
- HTTP 200 en /uix/components/{trans,format-date,format-number,relative-time,badge,skeleton,spinner,image}.
Esto es el fix correcto del audit (no la migracion-a-soma del commit
anterior que se hizo por mal entendimiento de la regla — revertida en
el commit precedente «Revert ... service components from Eidos to
Soma»).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
const result = eidos.langs.t(path as Parameters<typeof eidos.langs.t>[0], params, locale);
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
// langs.t returns the path itself when missing — fall back to
|
|
|
|
|
// the captured children text if available.
|
|
|
|
|
if (result === path && capturedText) return capturedText;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// value-based or captured: pass through ts() which handles
|
|
|
|
|
// idlangrefs (`#?path|fallback`) and literal strings alike.
|
|
|
|
|
const source = value ?? capturedText;
|
|
|
|
|
if (source === undefined) return '';
|
fix(eidos): use ActiveEidos.require() instead of getActiveUix() in 15 components
Cierra P1 #1 del audit Codex: «Eidos no importa `\$active-uix`
directamente — consume el runtime via `ActiveEidos.require()` que
expone la surface bounded (langs / format / prefs / dom / uix)».
`ActiveEidos` ya existe (src/uix/eidos/active-eidos.svelte.ts) y la
mayoria de eidos components la usan (accordion, alert-dialog, banner,
box, button, calendar, card, ~50 archivos). Estos 15 quedaban como
strugglers/adiciones recientes que se saltaron el patron.
Patron canonico aplicado en cada archivo:
-import { getActiveUix } from '\$active-uix';
-const uix = getActiveUix();
-uix.langs.t(...)
+import { ActiveEidos } from '\$uix/eidos';
+const eidos = ActiveEidos.require();
+eidos.langs.t(...)
Archivos (15):
- badge/badge.svelte
- format-date/format-date.svelte
- format-number/format-number.svelte
- image/image-{error,fallback,_}.svelte (3)
- password-field/password-field-caps-lock-indicator.svelte
- picker-shell/picker-shell-{cancel,clear,close}.svelte (3)
- relative-time/relative-time.svelte
- s-text/s-text.svelte
- skeleton/skeleton.svelte
- spinner/spinner.svelte
- trans/trans.svelte
Sin nueva surface introducida — todas las usages (langs, format.dates,
format.numbers, format.currency) ya estaban expuestas en
`ActiveEidos`.
Verificacion:
- `grep getActiveUix src/uix/eidos/components/ --include='*.svelte'`:
cero matches. Quedan referencias en comments/READMEs/types.ts
(informativas, no imports).
- `npm run check`: 0 errors mantenido.
- HTTP 200 en /uix/components/{trans,format-date,format-number,relative-time,badge,skeleton,spinner,image}.
Esto es el fix correcto del audit (no la migracion-a-soma del commit
anterior que se hizo por mal entendimiento de la regla — revertida en
el commit precedente «Revert ... service components from Eidos to
Soma»).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
return eidos.langs.ts(source as LangString, locale);
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// `hasSource` is true once we have any source string to render.
|
|
|
|
|
// While the children-capture path runs $effect on mount, we render
|
|
|
|
|
// the children initially so the captureNode has text to read.
|
|
|
|
|
const hasSource = $derived(value !== undefined || path !== undefined || capturedText !== undefined);
|
feat(eidos): Card, Avatar ext, Image, SText, Badge, service components + dates engine fixes
Sprint completo:
- Card (eidos + sema): elevation/intent/interactive, eventos select+activate.
- Avatar: ring, AvatarBadge, AvatarGroup separados; demo Avatar standalone.
- Image: status surface (idle/loading/loaded/error) consumiendo soma ImageProvider.
- SText + STextVirtualList: canvas-text engine portado de morfo-driven-soma como
componentes separados para optimizar bundle (no se importa canvas si no se usa).
- Badge: primitivo eidos puro.
- Trans, FormatNumber, FormatDate, RelativeTime: 4 service components greppables
alrededor de uix.langs y uix.format. Nav group "Utilities".
Bugs fix arts/format/dates (engine-dates.ts):
1. Preset / per-axis conflict: Intl.DateTimeFormat rechaza dateStyle/timeStyle
con cualquier per-axis (weekday/era/year/month/day/dayPeriod/hour/minute/
second/fractionalSecondDigits) o con timeZoneName. Engine drop-ea ambos
presets por defecto cuando detecta conflict (regla estricta — un solo
per-axis hace ilegales los dos presets).
2. Per-call locale override: formatDate/Time/DateTime aceptan tercer arg
locale?: string. No muta engine state. Cache (getCachedDateFormat) keyea
por (locale x options). resolveCallHourCycle: cuando hay locale override
y pref auto, el ciclo horario se resuelve desde el locale OVERRIDE.
3. withHourCycle precedence: caller hourCycle/hour12 ahora gana sobre
preferencia del engine. Antes spread mal ordenado sobrescribia 'h12' del
caller con 'h23' del engine cuando locale resolvia a 24h.
FormatDate component vuelve a rutear siempre por uix.format.dates
(cache + hourCycle + locale reactivo), pasando locale como tercer arg.
Demos service components autonomos del toolbar global: cada uno owns su
demoLocale state con 7 chips (es-ES/en-US/en-GB/de-DE/fr-FR/ja-JP/ar-EG).
FormatDate stage filtra dateStyle/timeStyle por mode + chip hourCycle anadido.
Tests: 14/14 passing en engine-dates.test.ts (+6 nuevos: conflict handling,
locale override, hourCycle precedence).
Docs: arts/format/README.md (handoff 2026-05-25 con las 3 reglas),
README.md por service component, project_service_components_sprint_2026-05-25.md,
feedback_service_demos_own_locale.md (pattern reusable).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<svelte:element this={as} bind:this={captureNode} data-trans="" {...rest}>
|
|
|
|
|
{#if hasSource}
|
|
|
|
|
{resolved}
|
|
|
|
|
{:else}
|
|
|
|
|
{@render children?.()}
|
|
|
|
|
{/if}
|
|
|
|
|
</svelte:element>
|