shirkasoft-ui-components 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +209 -53
  2. package/fesm2022/shirkasoft-ui-components-config.mjs +610 -72
  3. package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
  4. package/fesm2022/shirkasoft-ui-components-date-picker.mjs +79 -6
  5. package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
  6. package/fesm2022/shirkasoft-ui-components-file-upload.mjs +74 -3
  7. package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
  8. package/fesm2022/shirkasoft-ui-components-icons.mjs +6 -6
  9. package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
  10. package/fesm2022/shirkasoft-ui-components-price-input.mjs +70 -2
  11. package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
  12. package/fesm2022/shirkasoft-ui-components-select.mjs +76 -14
  13. package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
  14. package/fesm2022/shirkasoft-ui-components-table.mjs +11 -0
  15. package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
  16. package/fesm2022/shirkasoft-ui-components-text-field.mjs +80 -18
  17. package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
  18. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +262 -165
  19. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
  20. package/fesm2022/shirkasoft-ui-components-theme.mjs +2 -24
  21. package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
  22. package/fesm2022/shirkasoft-ui-components-utils.mjs +36 -1
  23. package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
  24. package/package.json +1 -1
  25. package/types/shirkasoft-ui-components-config.d.ts +246 -20
  26. package/types/shirkasoft-ui-components-date-picker.d.ts +35 -1
  27. package/types/shirkasoft-ui-components-file-upload.d.ts +35 -1
  28. package/types/shirkasoft-ui-components-icons.d.ts +6 -6
  29. package/types/shirkasoft-ui-components-price-input.d.ts +36 -2
  30. package/types/shirkasoft-ui-components-select.d.ts +36 -2
  31. package/types/shirkasoft-ui-components-text-field.d.ts +36 -4
  32. package/types/shirkasoft-ui-components-theme-picker.d.ts +40 -12
  33. package/types/shirkasoft-ui-components-theme.d.ts +17 -9
  34. package/types/shirkasoft-ui-components-utils.d.ts +34 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shirkasoft-ui-components-config.mjs","names":[],"sources":["../../../projects/ui-components/config/config.options.ts","../../../projects/ui-components/config/config.service.ts","../../../projects/ui-components/config/theme-palette.ts","../../../projects/ui-components/config/config.providers.ts","../../../projects/ui-components/config/formatting.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport type { ShkOptionDef } from './config.types';\n\n/** Locales offered by the built-in `select` options (any BCP 47 tag is still accepted via `set`). */\nconst LOCALE_CHOICES = [\n { value: 'es', label: 'Español' },\n { value: 'es-ES', label: 'Español (España)' },\n { value: 'es-MX', label: 'Español (México)' },\n { value: 'en-US', label: 'English (US)' },\n { value: 'en-GB', label: 'English (UK)' },\n { value: 'pt-BR', label: 'Português (Brasil)' },\n { value: 'fr-FR', label: 'Français' },\n] as const;\n\n/** Date options (`dates.*`), always registered. */\nexport const DATE_OPTIONS: readonly ShkOptionDef[] = [\n {\n key: 'dates.locale',\n module: 'dates',\n type: 'select',\n default: 'es',\n label: 'Idioma de las fechas',\n description: 'Nombres de meses y días del calendario.',\n choices: LOCALE_CHOICES,\n allowCustom: true,\n },\n {\n key: 'dates.format',\n module: 'dates',\n type: 'select',\n default: '',\n label: 'Formato de fecha',\n description: 'Cómo se escriben y muestran las fechas en campos y tablas.',\n allowCustom: true,\n choices: [\n { value: '', label: 'Automático según el idioma' },\n { value: 'dd/MM/yyyy', label: '31/12/2026' },\n { value: 'MM/dd/yyyy', label: '12/31/2026' },\n { value: 'yyyy-MM-dd', label: '2026-12-31' },\n { value: 'dd-MM-yyyy', label: '31-12-2026' },\n { value: 'dd.MM.yyyy', label: '31.12.2026' },\n { value: 'd MMM yyyy', label: '31 dic 2026' },\n ],\n },\n {\n key: 'dates.displayStyle',\n module: 'dates',\n type: 'select',\n default: 'long',\n label: 'Fecha seleccionada',\n description: 'Cómo muestra el selector de fecha el valor elegido.',\n choices: [\n { value: 'long', label: 'Larga (31 de diciembre de 2026)' },\n { value: 'medium', label: 'Media (31 dic 2026)' },\n { value: 'short', label: 'Corta (31/12/26)' },\n { value: 'format', label: 'Con el formato de fecha' },\n ],\n },\n {\n key: 'dates.hourFormat',\n module: 'dates',\n type: 'select',\n default: '24',\n label: 'Formato de hora',\n choices: [\n { value: '24', label: '24 horas (14:30)' },\n { value: '12', label: '12 horas (02:30 PM)' },\n ],\n },\n {\n key: 'dates.weekStart',\n module: 'dates',\n type: 'select',\n default: null,\n label: 'Primer día de la semana',\n choices: [\n { value: null, label: 'Según el idioma' },\n { value: 1, label: 'Lunes' },\n { value: 0, label: 'Domingo' },\n { value: 6, label: 'Sábado' },\n ],\n },\n];\n\n/** Number and currency options (`numbers.*`), always registered. */\nexport const NUMBER_OPTIONS: readonly ShkOptionDef[] = [\n {\n key: 'numbers.locale',\n module: 'numbers',\n type: 'select',\n default: 'en-US',\n label: 'Formato de números',\n description: 'Separadores de miles y decimales (1,234.56 o 1.234,56).',\n allowCustom: true,\n choices: [\n { value: 'en-US', label: '1,234.56' },\n { value: 'es-ES', label: '1.234,56' },\n { value: 'fr-FR', label: '1 234,56' },\n { value: 'de-CH', label: \"1'234.56\" },\n ],\n },\n {\n key: 'numbers.currency',\n module: 'numbers',\n type: 'select',\n default: 'USD',\n label: 'Moneda',\n description: 'Moneda por defecto de importes y columnas de moneda.',\n allowCustom: true,\n choices: [\n { value: 'USD', label: 'Dólar estadounidense (USD)' },\n { value: 'EUR', label: 'Euro (EUR)' },\n { value: 'CUP', label: 'Peso cubano (CUP)' },\n { value: 'MXN', label: 'Peso mexicano (MXN)' },\n { value: 'GBP', label: 'Libra esterlina (GBP)' },\n { value: 'BRL', label: 'Real brasileño (BRL)' },\n ],\n },\n {\n key: 'numbers.currencySymbol',\n module: 'numbers',\n type: 'string',\n default: '',\n label: 'Símbolo de moneda',\n description: 'Vacío = el de la moneda ($, €…).',\n },\n {\n key: 'numbers.decimals',\n module: 'numbers',\n type: 'select',\n default: null,\n label: 'Decimales',\n description: 'Decimales de los importes.',\n choices: [\n { value: null, label: 'Según la moneda (USD 2, JPY 0)' },\n { value: 0, label: '0' },\n { value: 1, label: '1' },\n { value: 2, label: '2' },\n { value: 3, label: '3' },\n { value: 4, label: '4' },\n ],\n },\n];\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport { DOCUMENT } from '@angular/common';\nimport {\n Injectable,\n InjectionToken,\n Signal,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { DATE_OPTIONS, NUMBER_OPTIONS } from './config.options';\nimport type {\n ShkConfigKey,\n ShkConfigValues,\n ShkOptionDef,\n ShkOptionEntry,\n} from './config.types';\n\n/** What a `with*()` feature contributes to the registry. */\nexport interface ShkConfigFeature {\n /** Extra option definitions to register. */\n options?: readonly ShkOptionDef[];\n /** App-level defaults for registered options (what `reset` returns to). */\n defaults?: Readonly<Record<string, unknown>>;\n}\n\n/** Features collected from `provideShk(...)`. */\nexport const SHK_CONFIG_FEATURES = new InjectionToken<readonly ShkConfigFeature[]>(\n 'SHK_CONFIG_FEATURES',\n);\n\n/** Storage settings enabled by `withPersistence()`. */\nexport interface ShkConfigPersistence {\n /** localStorage key. Defaults to `shk-config`. */\n storageKey: string;\n}\n\nexport const SHK_CONFIG_PERSISTENCE = new InjectionToken<ShkConfigPersistence>(\n 'SHK_CONFIG_PERSISTENCE',\n);\n\n/**\n * Value held outside the registry (e.g. by `ShkThemeService`). The registry\n * reads and writes through it, so both stay in sync.\n */\nexport interface ShkOptionSource<T = unknown> {\n value: Signal<T>;\n set(value: T): void;\n}\n\n/**\n * Registry of the library's configurable options (\"nomenclador\" de opciones).\n *\n * Every option has a key (`dates.format`), a module, a type and a default.\n * Components read options as signals, so changing one at runtime updates every\n * component that uses it. A settings screen can list them with `options()`.\n *\n * ```ts\n * const config = inject(ShkConfigService);\n * config.get('dates.format')(); // 'dd/MM/yyyy'\n * config.set('numbers.currency', 'EUR'); // every price input/table updates\n * config.options(); // definitions + current values\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ShkConfigService {\n private readonly win = inject(DOCUMENT).defaultView;\n private readonly persistence = inject(SHK_CONFIG_PERSISTENCE, { optional: true });\n\n /** Registered definitions, by key. */\n private readonly defs = signal<ReadonlyMap<string, ShkOptionDef>>(new Map());\n /** Values set explicitly (anything else falls back to the definition's default). */\n private readonly values = signal<Readonly<Record<string, unknown>>>({});\n /** Options whose value lives elsewhere. */\n private readonly sources = signal<ReadonlyMap<string, ShkOptionSource>>(new Map());\n /** Stored values whose option is not registered yet; applied on `register`. */\n private pending: Record<string, unknown> = {};\n /** Cached per-key signals returned by `get`. */\n private readonly cache = new Map<string, Signal<unknown>>();\n\n /** Every registered option with its current value, in registration order. */\n readonly options: Signal<ShkOptionEntry[]> = computed(() =>\n [...this.defs().values()].map((def) => {\n const value = this.read(def.key);\n return { ...def, value, isDefault: sameValue(value, def.default) } as ShkOptionEntry;\n }),\n );\n\n /** Module names in registration order (`dates`, `numbers`, `theme`, …). */\n readonly modules: Signal<string[]> = computed(() => [\n ...new Set([...this.defs().values()].map((def) => def.module)),\n ]);\n\n constructor() {\n this.pending = this.loadStored();\n this.register([...DATE_OPTIONS, ...NUMBER_OPTIONS]);\n\n for (const feature of inject(SHK_CONFIG_FEATURES, { optional: true }) ?? []) {\n if (feature.options) this.register(feature.options);\n if (feature.defaults) this.setDefaults(feature.defaults);\n }\n\n if (this.persistence) {\n effect(() => this.save(this.values()));\n }\n }\n\n /** Current value of an option as a signal. Throws for unknown keys. */\n get<K extends ShkConfigKey>(key: K): Signal<ShkConfigValues[K]>;\n get<T = unknown>(key: string): Signal<T>;\n get(key: string): Signal<unknown> {\n this.requireDef(key);\n let sig = this.cache.get(key);\n if (!sig) {\n sig = computed(() => this.read(key));\n this.cache.set(key, sig);\n }\n return sig;\n }\n\n /** Whether an option is registered (e.g. `theme.*` only exists with `withTheme()`). */\n has(key: string): boolean {\n return untracked(this.defs).has(key);\n }\n\n /** Current value of an option (non-reactive read). */\n value<K extends ShkConfigKey>(key: K): ShkConfigValues[K];\n value<T = unknown>(key: string): T;\n value(key: string): unknown {\n return untracked(this.get(key));\n }\n\n /**\n * Sets an option. The value is validated against the definition (type,\n * choices, bounds); an invalid value throws and changes nothing.\n */\n set<K extends ShkConfigKey>(key: K, value: ShkConfigValues[K]): void;\n set(key: string, value: unknown): void;\n set(key: string, value: unknown): void {\n const def = this.requireDef(key);\n const valid = this.validate(def, value);\n const source = untracked(this.sources).get(key);\n if (source) {\n source.set(valid);\n return;\n }\n this.values.update((current) => ({ ...current, [key]: valid }));\n }\n\n /** Restores one option (or all of them) to its default. */\n reset(key?: string): void {\n const keys = key ? [key] : [...untracked(this.defs).keys()];\n for (const k of keys) {\n const def = this.requireDef(k);\n const source = untracked(this.sources).get(k);\n if (source) source.set(def.default);\n }\n this.values.update((current) => {\n if (!key) return {};\n const { [key]: _removed, ...rest } = current;\n return rest;\n });\n }\n\n /**\n * Adds option definitions (or replaces existing ones with the same key).\n * Stored values for them are applied if they are still valid.\n */\n register(defs: readonly ShkOptionDef[]): void {\n this.defs.update((current) => {\n const next = new Map(current);\n for (const def of defs) next.set(def.key, def);\n return next;\n });\n for (const def of defs) {\n if (!(def.key in this.pending)) continue;\n const stored = this.pending[def.key];\n delete this.pending[def.key];\n if (def.persist === false) continue;\n try {\n const valid = this.validate(def, stored);\n this.values.update((current) => ({ ...current, [def.key]: valid }));\n } catch {\n // Stale or hand-edited storage: ignore the value, keep the default.\n }\n }\n }\n\n /**\n * Binds an option to a value held elsewhere (used by `withTheme()` to share\n * `theme.name`/`theme.scheme` with `ShkThemeService`).\n */\n bind<T>(key: string, source: ShkOptionSource<T>): void {\n this.requireDef(key);\n this.sources.update((current) => new Map(current).set(key, source as ShkOptionSource));\n }\n\n /** Changes the defaults of registered options (`reset` returns to these). */\n private setDefaults(defaults: Readonly<Record<string, unknown>>): void {\n const updated: ShkOptionDef[] = [];\n for (const [key, value] of Object.entries(defaults)) {\n if (value === undefined) continue;\n const def = this.requireDef(key);\n updated.push({ ...def, default: this.validate(def, value) });\n }\n this.defs.update((current) => {\n const next = new Map(current);\n for (const def of updated) next.set(def.key, def);\n return next;\n });\n }\n\n private read(key: string): unknown {\n const source = this.sources().get(key);\n if (source) return source.value();\n const values = this.values();\n return key in values ? values[key] : this.defs().get(key)?.default;\n }\n\n private requireDef(key: string): ShkOptionDef {\n const def = untracked(this.defs).get(key);\n if (!def) {\n throw new Error(\n `[shk-config] Unknown option \"${key}\". Register it with withOptions() or ShkConfigService.register().`,\n );\n }\n return def;\n }\n\n /** Returns the value coerced to the option's type, or throws if it is not acceptable. */\n private validate(def: ShkOptionDef, value: unknown): unknown {\n const fail = (why: string): never => {\n throw new Error(`[shk-config] Invalid value for \"${def.key}\": ${why}.`);\n };\n\n switch (def.type) {\n case 'boolean':\n if (typeof value !== 'boolean') fail('expected a boolean');\n return value;\n case 'number': {\n const n = typeof value === 'string' && value.trim() !== '' ? Number(value) : value;\n if (typeof n !== 'number' || !isFinite(n)) fail('expected a number');\n if (def.min !== undefined && (n as number) < def.min) fail(`minimum is ${def.min}`);\n if (def.max !== undefined && (n as number) > def.max) fail(`maximum is ${def.max}`);\n return n;\n }\n case 'color':\n if (typeof value !== 'string') fail('expected a color string');\n if (value !== '' && !/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(value as string)) {\n fail('expected a hex color such as #2563eb (or empty)');\n }\n return value;\n case 'select': {\n const match = def.choices?.find((choice) => sameValue(choice.value, value));\n if (match) return match.value;\n if (def.allowCustom && typeof value === 'string' && value.trim() !== '') {\n return value.trim();\n }\n return fail('not one of the allowed choices');\n }\n default:\n if (typeof value !== 'string') fail('expected a string');\n return value;\n }\n }\n\n private loadStored(): Record<string, unknown> {\n if (!this.persistence) return {};\n try {\n const raw = this.win?.localStorage?.getItem(this.persistence.storageKey);\n const parsed = raw ? JSON.parse(raw) : null;\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};\n } catch {\n return {};\n }\n }\n\n private save(values: Readonly<Record<string, unknown>>): void {\n if (!this.persistence) return;\n const defs = untracked(this.defs);\n // Keep stored values of options that are not registered yet (registered later).\n const stored: Record<string, unknown> = { ...this.pending };\n for (const [key, value] of Object.entries(values)) {\n if (defs.get(key)?.persist !== false) stored[key] = value;\n }\n try {\n this.win?.localStorage?.setItem(this.persistence.storageKey, JSON.stringify(stored));\n } catch {\n // Storage can be blocked (private mode, quota); the option still applies.\n }\n }\n}\n\n/** Value equality for option values (primitives and `null`). */\nfunction sameValue(a: unknown, b: unknown): boolean {\n return a === b || (Number.isNaN(a) && Number.isNaN(b));\n}\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n *\n * Builds the `--shk-primary-*` scale from a single color with CSS `color-mix()`,\n * so the browser derives every shade and no color math ships in JavaScript.\n */\n\n/** A theme registered with `withTheme({ themes })`. */\nexport interface ShkCustomTheme {\n /** Main brand color (hex). It becomes `--shk-primary-600`, the shade buttons use. */\n primary: string;\n /** Name shown in settings screens. Defaults to the theme key. */\n label?: string;\n /** Extra CSS custom properties for the theme, e.g. `{ '--shk-surface-50': '#f8fafc' }`. */\n vars?: Readonly<Record<`--shk-${string}`, string>>;\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst THEME_NAME = /^[a-z][a-z0-9-]*$/i;\nconst CSS_VAR_NAME = /^--shk-[a-z0-9-]+$/i;\n\n/** How much of the base color each shade keeps, mixed with white (light) or black (dark). */\nconst SHADES: readonly [shade: number, base: number, mixWith: 'white' | 'black' | null][] = [\n [50, 6, 'white'],\n [100, 12, 'white'],\n [200, 24, 'white'],\n [300, 42, 'white'],\n [400, 66, 'white'],\n [500, 85, 'white'],\n [600, 100, null],\n [700, 84, 'black'],\n [800, 68, 'black'],\n [900, 54, 'black'],\n [950, 36, 'black'],\n];\n\n/** Custom properties a primary color controls (the scale + the decorative accent). */\nexport const PRIMARY_VARS: readonly string[] = [\n ...SHADES.map(([shade]) => `--shk-primary-${shade}`),\n '--shk-emerald-400',\n '--shk-emerald-600',\n '--shk-emerald-700',\n];\n\n/** Throws when `color` is not a hex color. */\nexport function assertHexColor(color: string, where: string): void {\n if (!HEX.test(color)) {\n throw new Error(`[shk-config] ${where}: \"${color}\" is not a hex color such as #2563eb.`);\n }\n}\n\n/** `--shk-primary-50` … `--shk-primary-950` (and the accent vars) derived from one color. */\nexport function primaryScale(color: string): Record<string, string> {\n const vars: Record<string, string> = {};\n for (const [shade, base, mixWith] of SHADES) {\n vars[`--shk-primary-${shade}`] = mixWith\n ? `color-mix(in oklab, ${color} ${base}%, ${mixWith})`\n : color;\n }\n // Themes keep the decorative gradient in the accent color.\n vars['--shk-emerald-400'] = vars['--shk-primary-400'];\n vars['--shk-emerald-600'] = vars['--shk-primary-600'];\n vars['--shk-emerald-700'] = vars['--shk-primary-700'];\n return vars;\n}\n\n/** Normalizes `'#2563eb' | { primary }` and validates name and colors. */\nexport function normalizeCustomTheme(name: string, theme: string | ShkCustomTheme): ShkCustomTheme {\n if (!THEME_NAME.test(name)) {\n throw new Error(\n `[shk-config] Theme name \"${name}\" must start with a letter and contain only letters, digits and dashes.`,\n );\n }\n const normalized = typeof theme === 'string' ? { primary: theme } : theme;\n assertHexColor(normalized.primary, `theme \"${name}\"`);\n for (const [prop, value] of Object.entries(normalized.vars ?? {})) {\n // The values are written into a CSS rule: reject anything that could end it.\n if (!CSS_VAR_NAME.test(prop) || typeof value !== 'string' || /[;{}<>]/.test(value)) {\n throw new Error(\n `[shk-config] theme \"${name}\": invalid variable ${prop}: ${String(value)} (names are --shk-…; values cannot contain ; { } < >).`,\n );\n }\n }\n return normalized;\n}\n\n/** CSS rule that activates a custom theme through `<html data-shk-theme=\"name\">`. */\nexport function customThemeCss(name: string, theme: ShkCustomTheme, attribute: string): string {\n const vars = { ...primaryScale(theme.primary), ...(theme.vars ?? {}) };\n const body = Object.entries(vars)\n .map(([prop, value]) => ` ${prop}: ${value};`)\n .join('\\n');\n return `[${attribute}='${name}'] {\\n${body}\\n}`;\n}\n\n/** Neutral palettes for `theme.surface` (Tailwind scales, 50 … 900). */\nexport const SURFACE_PALETTES: Readonly<Record<string, { label: string; scale: readonly string[] }>> = {\n slate: {\n label: 'Slate',\n scale: ['#f8fafc', '#f1f5f9', '#e2e8f0', '#cbd5e1', '#94a3b8', '#64748b', '#475569', '#334155', '#1e293b', '#0f172a'],\n },\n gray: {\n label: 'Gray',\n scale: ['#f9fafb', '#f3f4f6', '#e5e7eb', '#d1d5db', '#9ca3af', '#6b7280', '#4b5563', '#374151', '#1f2937', '#111827'],\n },\n zinc: {\n label: 'Zinc',\n scale: ['#fafafa', '#f4f4f5', '#e4e4e7', '#d4d4d8', '#a1a1aa', '#71717a', '#52525b', '#3f3f46', '#27272a', '#18181b'],\n },\n neutral: {\n label: 'Neutral',\n scale: ['#fafafa', '#f5f5f5', '#e5e5e5', '#d4d4d4', '#a3a3a3', '#737373', '#525252', '#404040', '#262626', '#171717'],\n },\n stone: {\n label: 'Stone',\n scale: ['#fafaf9', '#f5f5f4', '#e7e5e4', '#d6d3d1', '#a8a29e', '#78716c', '#57534e', '#44403c', '#292524', '#1c1917'],\n },\n};\n\nconst SURFACE_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900] as const;\n\n/**\n * CSS for every surface palette, activated with `<html data-shk-surface=\"slate\">`.\n * Dark mode uses the reversed scale (50 ↔ 900), like the built-in themes. The\n * doubled attribute selector out-ranks the theme packs (`html.dark[data-shk-theme]`).\n */\nexport function surfaceCss(attribute = 'data-shk-surface'): string {\n return Object.entries(SURFACE_PALETTES)\n .map(([name, { scale }]) => {\n const sel = `html[${attribute}='${name}'][${attribute}]`;\n const light = SURFACE_STEPS.map((step, i) => `--shk-surface-${step}: ${scale[i]};`).join(' ');\n const dark = SURFACE_STEPS.map((step, i) => `--shk-surface-${step}: ${scale[9 - i]};`).join(' ');\n return (\n `${sel} { ${light} --shk-scrollbar-thumb: ${scale[3]}; --shk-scrollbar-thumb-hover: ${scale[4]}; }\\n` +\n `html.dark[${attribute}='${name}'][${attribute}] { ${dark} --shk-scrollbar-thumb: ${scale[6]}; --shk-scrollbar-thumb-hover: ${scale[5]}; }`\n );\n })\n .join('\\n');\n}\n\n/** A selectable combination shown as a preset: a theme pack and its colors. */\nexport interface ShkThemePreset {\n /** Theme name (`theme.name`). */\n name: string;\n label: string;\n /** Its primary color (`--shk-primary-600`). */\n primary: string;\n /** Its surface palette (a `SURFACE_PALETTES` key), or '' when it has its own. */\n surface: string;\n}\n\n/** The built-in theme packs as presets. */\nexport const BUILT_IN_PRESETS: readonly ShkThemePreset[] = [\n { name: 'default', label: 'Esmeralda', primary: '#059669', surface: 'zinc' },\n { name: 'ocean', label: 'Océano', primary: '#0284c7', surface: 'slate' },\n { name: 'violet', label: 'Violeta', primary: '#7c3aed', surface: 'zinc' },\n { name: 'sunset', label: 'Atardecer', primary: '#ea580c', surface: 'stone' },\n];\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport { DOCUMENT } from '@angular/common';\nimport {\n CSP_NONCE,\n EnvironmentProviders,\n InjectionToken,\n Provider,\n effect,\n inject,\n makeEnvironmentProviders,\n provideAppInitializer,\n} from '@angular/core';\nimport {\n DEFAULT_SHK_THEME_CONFIG,\n SHK_THEME_CONFIG,\n ShkThemeConfig,\n ShkThemeService,\n} from 'shirkasoft-ui-components/theme';\n\nimport {\n SHK_CONFIG_FEATURES,\n SHK_CONFIG_PERSISTENCE,\n ShkConfigFeature,\n ShkConfigService,\n} from './config.service';\nimport type { ShkConfigValues, ShkOptionDef } from './config.types';\nimport {\n BUILT_IN_PRESETS,\n PRIMARY_VARS,\n SURFACE_PALETTES,\n ShkCustomTheme,\n ShkThemePreset,\n assertHexColor,\n customThemeCss,\n normalizeCustomTheme,\n primaryScale,\n surfaceCss,\n} from './theme-palette';\n\n/**\n * Theme packs offered as presets (built-in + `withTheme({ themes })`), with the\n * primary color and surface each one uses. Read by `shk-theme-picker`.\n */\nexport const SHK_THEME_PRESETS = new InjectionToken<readonly ShkThemePreset[]>('SHK_THEME_PRESETS', {\n providedIn: 'root',\n factory: () => BUILT_IN_PRESETS,\n});\n\n/** Attribute on `<html>` that activates a `theme.surface` palette. */\nconst SURFACE_ATTRIBUTE = 'data-shk-surface';\n\n/** A configuration module passed to `provideShk()`. */\nexport interface ShkFeature {\n /** @internal */\n readonly ɵproviders: (Provider | EnvironmentProviders)[];\n}\n\nfunction feature(value: ShkConfigFeature, extra: (Provider | EnvironmentProviders)[] = []): ShkFeature {\n return {\n ɵproviders: [{ provide: SHK_CONFIG_FEATURES, multi: true, useValue: value }, ...extra],\n };\n}\n\n/** Drops `undefined` entries and prefixes the keys with the module name. */\nfunction defaultsOf(module: string, values: object): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(values)) {\n if (value !== undefined) out[`${module}.${name}`] = value;\n }\n return out;\n}\n\n/**\n * Configures the library. Every module is optional; component inputs still\n * override the configured values.\n *\n * ```ts\n * bootstrapApplication(App, {\n * providers: [\n * provideShk(\n * withDates({ locale: 'es', format: 'dd/MM/yyyy' }),\n * withNumbers({ currency: 'EUR', locale: 'es-ES' }),\n * withTheme({ defaultTheme: 'marca', themes: { marca: '#2563eb' } }),\n * withPersistence(),\n * ),\n * ],\n * });\n * ```\n */\nexport function provideShk(...features: ShkFeature[]): EnvironmentProviders {\n return makeEnvironmentProviders(features.flatMap((f) => f.ɵproviders));\n}\n\n/** App defaults for the date options (`dates.*`). */\nexport interface ShkDatesConfig {\n locale?: ShkConfigValues['dates.locale'];\n format?: ShkConfigValues['dates.format'];\n displayStyle?: ShkConfigValues['dates.displayStyle'];\n hourFormat?: ShkConfigValues['dates.hourFormat'];\n weekStart?: ShkConfigValues['dates.weekStart'];\n}\n\n/** Date module: locale, pattern, display style, 12/24 h and first day of the week. */\nexport function withDates(config: ShkDatesConfig): ShkFeature {\n return feature({ defaults: defaultsOf('dates', config) });\n}\n\n/** App defaults for the number and currency options (`numbers.*`). */\nexport interface ShkNumbersConfig {\n locale?: ShkConfigValues['numbers.locale'];\n currency?: ShkConfigValues['numbers.currency'];\n currencySymbol?: ShkConfigValues['numbers.currencySymbol'];\n decimals?: ShkConfigValues['numbers.decimals'];\n}\n\n/** Number module: separators locale, currency, currency symbol and decimals. */\nexport function withNumbers(config: ShkNumbersConfig): ShkFeature {\n return feature({ defaults: defaultsOf('numbers', config) });\n}\n\n/** Theme module settings. */\nexport interface ShkThemeModuleConfig extends ShkThemeConfig {\n /**\n * Extra themes generated from one color: `{ marca: '#2563eb' }` or\n * `{ marca: { primary: '#2563eb', label: 'Marca', vars: { … } } }`.\n */\n themes?: Readonly<Record<string, string | ShkCustomTheme>>;\n /** Primary color applied on top of any theme (`theme.primary`). Empty = none. */\n primary?: string;\n /** Neutral palette applied on top of any theme (`theme.surface`). Empty = none. */\n surface?: string;\n}\n\n/**\n * Theme module: built-in and custom themes, light/dark/system scheme and a\n * runtime primary color. Replaces `provideShkTheme()` (do not use both).\n *\n * `theme.name` and `theme.scheme` are shared with `ShkThemeService` (which\n * persists them); `theme.primary` is stored by `withPersistence()`.\n */\nexport function withTheme(config: ShkThemeModuleConfig = {}): ShkFeature {\n const { themes = {}, primary = '', surface = '', ...themeConfig } = config;\n const resolved = { ...DEFAULT_SHK_THEME_CONFIG, ...themeConfig };\n const custom = Object.entries(themes).map(\n ([name, theme]) => [name, normalizeCustomTheme(name, theme)] as const,\n );\n if (primary) assertHexColor(primary, 'withTheme({ primary })');\n const presets: ShkThemePreset[] = [\n ...BUILT_IN_PRESETS,\n ...custom.map(([name, theme]) => ({\n name,\n label: theme.label ?? name,\n primary: theme.primary,\n surface: '',\n })),\n ];\n\n const options: ShkOptionDef[] = [\n {\n key: 'theme.name',\n module: 'theme',\n type: 'select',\n default: resolved.defaultTheme,\n label: 'Tema',\n description: 'Paleta de colores de la interfaz.',\n choices: presets.map((preset) => ({ value: preset.name, label: preset.label })),\n persist: false,\n },\n {\n key: 'theme.scheme',\n module: 'theme',\n type: 'select',\n default: resolved.defaultScheme,\n label: 'Modo',\n choices: [\n { value: 'system', label: 'Según el sistema' },\n { value: 'light', label: 'Claro' },\n { value: 'dark', label: 'Oscuro' },\n ],\n persist: false,\n },\n {\n key: 'theme.primary',\n module: 'theme',\n type: 'color',\n default: primary,\n label: 'Color principal',\n description: 'Sustituye el color principal del tema. Vacío = el del tema.',\n },\n {\n key: 'theme.surface',\n module: 'theme',\n type: 'select',\n default: surface,\n label: 'Superficie',\n description: 'Gama de grises de fondos, bordes y textos. Vacío = la del tema.',\n choices: [\n { value: '', label: 'La del tema' },\n ...Object.entries(SURFACE_PALETTES).map(([value, { label }]) => ({ value, label })),\n ],\n },\n ];\n\n return feature({ options }, [\n { provide: SHK_THEME_CONFIG, useValue: resolved },\n { provide: SHK_THEME_PRESETS, useValue: presets },\n provideAppInitializer(() => {\n const doc = inject(DOCUMENT);\n const themeService = inject(ShkThemeService);\n const configService = inject(ShkConfigService);\n const nonce = inject(CSP_NONCE, { optional: true });\n\n // Custom themes + surface palettes, as one stylesheet.\n const css = [\n surfaceCss(SURFACE_ATTRIBUTE),\n ...custom.map(([name, theme]) => customThemeCss(name, theme, resolved.attribute)),\n ].join('\\n');\n let style = doc.head?.querySelector<HTMLStyleElement>('style[data-shk-themes]');\n if (!style && doc.head) {\n style = doc.createElement('style');\n style.setAttribute('data-shk-themes', '');\n // Lets the rules through a strict Content-Security-Policy (style-src 'nonce-…').\n if (nonce) style.setAttribute('nonce', nonce);\n doc.head.appendChild(style);\n }\n if (style) style.textContent = css;\n\n configService.bind('theme.name', {\n value: themeService.theme,\n set: (name: string) => themeService.setTheme(name),\n });\n configService.bind('theme.scheme', {\n value: themeService.scheme,\n set: (scheme: ShkConfigValues['theme.scheme']) => themeService.setScheme(scheme),\n });\n\n // Runtime primary color: inline custom properties on <html> win over any theme.\n const root = doc.documentElement;\n effect(() => {\n const color = configService.get('theme.primary')();\n if (color) {\n for (const [prop, value] of Object.entries(primaryScale(color))) {\n root.style.setProperty(prop, value);\n }\n } else {\n for (const prop of PRIMARY_VARS) root.style.removeProperty(prop);\n }\n });\n\n // Runtime surface palette: an attribute selector, so light and dark both apply.\n effect(() => {\n const palette = configService.get('theme.surface')();\n if (palette) root.setAttribute(SURFACE_ATTRIBUTE, palette);\n else root.removeAttribute(SURFACE_ATTRIBUTE);\n });\n }),\n ]);\n}\n\n/** Registers app-defined options in the same registry (`app.pageSize`, …). */\nexport function withOptions(options: readonly ShkOptionDef[]): ShkFeature {\n return feature({ options });\n}\n\n/**\n * Persists changed options in localStorage so they survive reloads.\n * Options with `persist: false` are skipped (the theme service stores its own).\n */\nexport function withPersistence(config: { storageKey?: string } = {}): ShkFeature {\n return {\n ɵproviders: [\n {\n provide: SHK_CONFIG_PERSISTENCE,\n useValue: { storageKey: config.storageKey ?? 'shk-config' },\n },\n ],\n };\n}\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n *\n * Locale-aware formatting helpers used by the components and available to apps.\n * Pure functions on top of `Intl`: no Angular locale data needs registering.\n */\n\n/** `Intl` formatters are expensive to build; reuse them per locale/options. */\nconst formatterCache = new Map<string, Intl.DateTimeFormat | Intl.NumberFormat>();\n\nfunction dateFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `d|${locale}|${JSON.stringify(options)}`;\n let fmt = formatterCache.get(key) as Intl.DateTimeFormat | undefined;\n if (!fmt) {\n fmt = new Intl.DateTimeFormat(safeLocale(locale), options);\n formatterCache.set(key, fmt);\n }\n return fmt;\n}\n\nfunction numberFormatter(locale: string, options: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = `n|${locale}|${JSON.stringify(options)}`;\n let fmt = formatterCache.get(key) as Intl.NumberFormat | undefined;\n if (!fmt) {\n fmt = new Intl.NumberFormat(safeLocale(locale), options);\n formatterCache.set(key, fmt);\n }\n return fmt;\n}\n\n/** Falls back to the runtime default when the tag is not a valid BCP 47 locale. */\nfunction safeLocale(locale: string): string | undefined {\n try {\n return Intl.getCanonicalLocales(locale)[0];\n } catch {\n return undefined;\n }\n}\n\n/** Default numeric pattern for a locale: `MM/dd/yyyy` for English, `dd/MM/yyyy` otherwise. */\nexport function resolveDateFormat(format: string | null | undefined, locale: string): string {\n if (format) return format;\n return locale.toLowerCase().startsWith('en') ? 'MM/dd/yyyy' : 'dd/MM/yyyy';\n}\n\n/** Converts a value to a `Date`. ISO date-only strings (`2026-12-31`) are read as local dates. */\nexport function toDate(value: Date | string | number | null | undefined): Date | null {\n if (value === null || value === undefined || value === '') return null;\n if (value instanceof Date) return isNaN(value.getTime()) ? null : value;\n if (typeof value === 'string') {\n const dateOnly = /^(\\d{4})-(\\d{1,2})-(\\d{1,2})$/.exec(value.trim());\n if (dateOnly) {\n return new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3]));\n }\n }\n const date = new Date(value);\n return isNaN(date.getTime()) ? null : date;\n}\n\nconst pad = (n: number, width = 2) => String(n).padStart(width, '0');\n\n/**\n * Pattern tokens, longest first. Text between single quotes is copied verbatim.\n * Compatible with the common Angular `DatePipe` tokens (`y` = full year).\n */\nconst DATE_TOKENS = /'[^']*'|yyyy|yy|y|MMMM|MMM|MM|M|dd|d|EEEE|EEE|HH|H|hh|h|mm|ss|a/g;\n\n/**\n * Formats a date with a pattern (`dd/MM/yyyy`, `d MMM yyyy`, `yyyy-MM-dd HH:mm`…).\n *\n * Tokens: `yyyy y yy` year · `MMMM MMM MM M` month · `dd d` day · `EEEE EEE` weekday ·\n * `HH H` 0-23 · `hh h` 1-12 · `mm` minutes · `ss` seconds · `a` AM/PM ·\n * `'text'` literal. Month and weekday names follow `locale`, with its own casing\n * (\"31 dic 2026\" in Spanish, \"Dec 31, 2026\" in English).\n * Returns an empty string for empty or invalid values.\n */\nexport function formatDate(\n value: Date | string | number | null | undefined,\n pattern: string,\n locale: string,\n): string {\n const date = toDate(value);\n if (!date) return '';\n const name = (options: Intl.DateTimeFormatOptions) =>\n dateFormatter(locale, options).format(date).replace('.', '');\n const h = date.getHours();\n\n return pattern.replace(DATE_TOKENS, (token) => {\n switch (token) {\n case 'yyyy':\n case 'y': return String(date.getFullYear());\n case 'yy': return pad(date.getFullYear() % 100);\n case 'MMMM': return name({ month: 'long' });\n case 'MMM': return name({ month: 'short' });\n case 'MM': return pad(date.getMonth() + 1);\n case 'M': return String(date.getMonth() + 1);\n case 'dd': return pad(date.getDate());\n case 'd': return String(date.getDate());\n case 'EEEE': return name({ weekday: 'long' });\n case 'EEE': return name({ weekday: 'short' });\n case 'HH': return pad(h);\n case 'H': return String(h);\n case 'hh': return pad(h % 12 || 12);\n case 'h': return String(h % 12 || 12);\n case 'mm': return pad(date.getMinutes());\n case 'ss': return pad(date.getSeconds());\n case 'a': return h < 12 ? 'AM' : 'PM';\n default: return token.slice(1, -1); // 'literal'\n }\n });\n}\n\n/** An `Intl` date (and optional time) style. */\nexport type ShkIntlStyle = 'full' | 'long' | 'medium' | 'short';\n\n/**\n * Date formatted with an `Intl` style (`long`: \"31 de diciembre de 2026\"),\n * optionally followed by the time in `timeStyle`.\n */\nexport function formatDateStyle(\n value: Date | string | number | null | undefined,\n style: ShkIntlStyle,\n locale: string,\n timeStyle?: ShkIntlStyle,\n): string {\n const date = toDate(value);\n if (!date) return '';\n const options: Intl.DateTimeFormatOptions = timeStyle\n ? { dateStyle: style, timeStyle }\n : { dateStyle: style };\n return dateFormatter(locale, options).format(date);\n}\n\n/** A pattern reduced to the parts a user types: field order and separator. */\nexport interface TypedDateLayout {\n /** Order of day/month/year in the pattern. */\n order: readonly ('d' | 'm' | 'y')[];\n /** Separator between the parts (`/`, `-` or `.`). */\n separator: string;\n}\n\n/**\n * Field order and separator of a pattern, for typing dates in an input.\n * Named months and weekdays are typed as numbers (`d MMM yyyy` → `dd/MM/yyyy`).\n */\nexport function typedDateLayout(pattern: string): TypedDateLayout {\n const order: ('d' | 'm' | 'y')[] = [];\n for (const token of pattern.replace(/'[^']*'/g, '').match(/y+|M+|d+/g) ?? []) {\n const field = token[0] === 'y' ? 'y' : token[0] === 'M' ? 'm' : 'd';\n if (!order.includes(field)) order.push(field);\n }\n for (const field of ['d', 'm', 'y'] as const) {\n if (!order.includes(field)) order.push(field);\n }\n const separator = /[\\/\\-.]/.exec(pattern)?.[0] ?? '/';\n return { order, separator };\n}\n\n/** Narrow currency symbol (`USD` → `$`, `EUR` → `€`). Unknown codes are returned as-is. */\nexport function currencySymbol(currency: string, locale: string): string {\n try {\n const parts = numberFormatter(locale, {\n style: 'currency',\n currency,\n currencyDisplay: 'narrowSymbol',\n }).formatToParts(0);\n return parts.find((p) => p.type === 'currency')?.value ?? currency;\n } catch {\n return currency;\n }\n}\n\n/**\n * Formats an amount as money (`$1,234.50`, `1.234,50 €`, `¥1,000`).\n * `decimals` `null`/omitted = the currency's own digits (2 for USD, 0 for JPY).\n */\nexport function formatCurrency(\n value: number | string | null | undefined,\n currency: string,\n locale: string,\n decimals: number | null = null,\n): string {\n const n = typeof value === 'string' ? Number(value) : value;\n if (n === null || n === undefined || !isFinite(n)) return '';\n const digits =\n decimals === null ? {} : { minimumFractionDigits: decimals, maximumFractionDigits: decimals };\n try {\n return numberFormatter(locale, { style: 'currency', currency, ...digits }).format(n);\n } catch {\n // Unknown currency code: plain number followed by the code.\n const d = decimals ?? 2;\n return `${formatNumber(n, locale, d, d)} ${currency}`;\n }\n}\n\n/** Decimal digits a currency uses by default (USD → 2, JPY → 0, BHD → 3). Unknown codes → 2. */\nexport function currencyDecimals(currency: string): number {\n try {\n return numberFormatter('en-US', { style: 'currency', currency }).resolvedOptions()\n .maximumFractionDigits ?? 2;\n } catch {\n return 2;\n }\n}\n\n/** Formats a number with the locale's grouping and decimal separators. */\nexport function formatNumber(\n value: number,\n locale: string,\n maxDecimals = 2,\n minDecimals = 0,\n): string {\n if (!isFinite(value)) return '';\n return numberFormatter(locale, {\n minimumFractionDigits: minDecimals,\n maximumFractionDigits: maxDecimals,\n }).format(value);\n}\n\n/** Decimal and grouping separators of a locale (`es-ES` → `,` and `.`). */\nexport function numberSeparators(locale: string): { decimal: string; group: string } {\n const parts = numberFormatter(locale, {}).formatToParts(12345.6);\n return {\n decimal: parts.find((p) => p.type === 'decimal')?.value ?? '.',\n group: parts.find((p) => p.type === 'group')?.value ?? ',',\n };\n}\n"],"mappings":";;;;AAmBA,MAAa,eAAwC;CACnD;EACE,KAAK;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,OAAO;EACP,aAAa;EACb,SAAS;GAlBX;IAAE,OAAO;IAAM,OAAO;GAAS;GAC/B;IAAE,OAAO;IAAS,OAAO;GAAkB;GAC3C;IAAE,OAAO;IAAS,OAAO;GAAkB;GAC3C;IAAE,OAAO;IAAS,OAAO;GAAc;GACvC;IAAE,OAAO;IAAS,OAAO;GAAc;GACvC;IAAE,OAAO;IAAS,OAAO;GAAoB;GAC7C;IAAE,OAAO;IAAS,OAAO;GAAU;EAYxB;EACT,aAAa;CACd;CACD;EACE,KAAK;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,OAAO;EACP,aAAa;EACb,aAAa;EACb,SAAS;GACP;IAAE,OAAO;IAAI,OAAO;GAA4B;GAChD;I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AAG,CAAC,EAAC,GAAI;CAC7C;AACF;AAGA,SAAgB,iBAAiB,UAAgB;CAC/C,IAAI;EACF,OAAO,gBAAgB,SAAS;GAAE,OAAO;GAAY;EAAQ,CAAE,CAAC,CAAC,gBAAe,CAAE,CAC/E,yBAAyB;CAC9B,QAAQ;EACN,OAAO;CACT;AACF;AAGA,SAAgB,aACd,OACA,QACA,cAAc,GACd,cAAc,GAAC;CAEf,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO;CAC7B,OAAO,gBAAgB,QAAQ;EAC7B,uBAAuB;EACvB,uBAAuB;CACxB,CAAA,CAAC,CAAC,OAAO,KAAK;AACjB;AAGA,SAAgB,iBAAiB,QAAc;CAC7C,MAAM,QAAQ,gBAAgB,QAAQ,CAAA,CAAE,CAAC,CAAC,cAAc,OAAO;CAC/D,OAAO;EACL,SAAS,MAAM,MAAM,MAAM,EAAE,SAAS,SAAS,CAAC,EAAE,SAAS;EAC3D,OAAO,MAAM,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC,EAAE,SAAS;CACxD;AACH"}
1
+ {"version":3,"file":"shirkasoft-ui-components-config.mjs","names":[],"sources":["../../../projects/ui-components/config/config.options.ts","../../../projects/ui-components/config/labels.ts","../../../projects/ui-components/config/config.service.ts","../../../projects/ui-components/config/config.sync.ts","../../../projects/ui-components/config/theme-palette.ts","../../../projects/ui-components/config/config.providers.ts","../../../projects/ui-components/config/formatting.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport type { ShkOptionDef } from './config.types';\n\n/** Locales offered by the built-in `select` options (any BCP 47 tag is still accepted via `set`). */\nconst LOCALE_CHOICES = [\n { value: 'es', label: 'Español' },\n { value: 'es-ES', label: 'Español (España)' },\n { value: 'es-MX', label: 'Español (México)' },\n { value: 'en-US', label: 'English (US)' },\n { value: 'en-GB', label: 'English (UK)' },\n { value: 'pt-BR', label: 'Português (Brasil)' },\n { value: 'fr-FR', label: 'Français' },\n] as const;\n\n/** Date options (`dates.*`), always registered. */\nexport const DATE_OPTIONS: readonly ShkOptionDef[] = [\n {\n key: 'dates.locale',\n module: 'dates',\n type: 'select',\n default: 'es',\n label: 'Idioma de las fechas',\n description: 'Nombres de meses y días del calendario.',\n choices: LOCALE_CHOICES,\n allowCustom: true,\n },\n {\n key: 'dates.format',\n module: 'dates',\n type: 'select',\n default: '',\n label: 'Formato de fecha',\n description: 'Cómo se escriben y muestran las fechas en campos y tablas.',\n allowCustom: true,\n choices: [\n { value: '', label: 'Automático según el idioma' },\n { value: 'dd/MM/yyyy', label: '31/12/2026' },\n { value: 'MM/dd/yyyy', label: '12/31/2026' },\n { value: 'yyyy-MM-dd', label: '2026-12-31' },\n { value: 'dd-MM-yyyy', label: '31-12-2026' },\n { value: 'dd.MM.yyyy', label: '31.12.2026' },\n { value: 'd MMM yyyy', label: '31 dic 2026' },\n ],\n },\n {\n key: 'dates.displayStyle',\n module: 'dates',\n type: 'select',\n default: 'long',\n label: 'Fecha seleccionada',\n description: 'Cómo muestra el selector de fecha el valor elegido.',\n choices: [\n { value: 'long', label: 'Larga (31 de diciembre de 2026)' },\n { value: 'medium', label: 'Media (31 dic 2026)' },\n { value: 'short', label: 'Corta (31/12/26)' },\n { value: 'format', label: 'Con el formato de fecha' },\n ],\n },\n {\n key: 'dates.hourFormat',\n module: 'dates',\n type: 'select',\n default: '24',\n label: 'Formato de hora',\n choices: [\n { value: '24', label: '24 horas (14:30)' },\n { value: '12', label: '12 horas (02:30 PM)' },\n ],\n },\n {\n key: 'dates.weekStart',\n module: 'dates',\n type: 'select',\n default: null,\n label: 'Primer día de la semana',\n choices: [\n { value: null, label: 'Según el idioma' },\n { value: 1, label: 'Lunes' },\n { value: 0, label: 'Domingo' },\n { value: 6, label: 'Sábado' },\n ],\n },\n];\n\n/** Number and currency options (`numbers.*`), always registered. */\nexport const NUMBER_OPTIONS: readonly ShkOptionDef[] = [\n {\n key: 'numbers.locale',\n module: 'numbers',\n type: 'select',\n default: 'en-US',\n label: 'Formato de números',\n description: 'Separadores de miles y decimales (1,234.56 o 1.234,56).',\n allowCustom: true,\n choices: [\n { value: 'en-US', label: '1,234.56' },\n { value: 'es-ES', label: '1.234,56' },\n { value: 'fr-FR', label: '1 234,56' },\n { value: 'de-CH', label: \"1'234.56\" },\n ],\n },\n {\n key: 'numbers.currency',\n module: 'numbers',\n type: 'select',\n default: 'USD',\n label: 'Moneda',\n description: 'Moneda por defecto de importes y columnas de moneda.',\n allowCustom: true,\n choices: [\n { value: 'USD', label: 'Dólar estadounidense (USD)' },\n { value: 'EUR', label: 'Euro (EUR)' },\n { value: 'CUP', label: 'Peso cubano (CUP)' },\n { value: 'MXN', label: 'Peso mexicano (MXN)' },\n { value: 'GBP', label: 'Libra esterlina (GBP)' },\n { value: 'BRL', label: 'Real brasileño (BRL)' },\n ],\n },\n {\n key: 'numbers.currencySymbol',\n module: 'numbers',\n type: 'string',\n default: '',\n label: 'Símbolo de moneda',\n description: 'Vacío = el de la moneda ($, €…).',\n },\n {\n key: 'numbers.decimals',\n module: 'numbers',\n type: 'select',\n default: null,\n label: 'Decimales',\n description: 'Decimales de los importes.',\n choices: [\n { value: null, label: 'Según la moneda (USD 2, JPY 0)' },\n { value: 0, label: '0' },\n { value: 1, label: '1' },\n { value: 2, label: '2' },\n { value: 3, label: '3' },\n { value: 4, label: '4' },\n ],\n },\n];\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport { Injectable, InjectionToken, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { TranslocoService } from '@jsverse/transloco';\n\n/**\n * Labels the library shows for its own options and theme packs.\n *\n * Every definition carries an English fallback, so a translated label is\n * optional: when there is no translation the English one is used.\n */\n@Injectable({ providedIn: 'root' })\nexport class ShkLabels {\n /** Explicit translations registered with `withLabels()`. */\n private readonly overrides = inject(SHK_LABEL_OVERRIDES);\n /** Transloco is optional: without it only the overrides and fallbacks apply. */\n private readonly transloco = this.injectTransloco();\n /** Bumped on every language change so signals reading `get()` recompute. */\n private readonly revision = signal(0);\n\n constructor() {\n if (!this.transloco) return;\n this.transloco.langChanges$.pipe(takeUntilDestroyed()).subscribe(() => {\n this.revision.update((value) => value + 1);\n });\n }\n\n /**\n * Translation of `key`, or `fallback` when there is none. Reads the language\n * signal, so it can be used inside `computed`.\n */\n get(key: string | undefined, fallback: string): string {\n this.revision();\n if (!key) return fallback;\n\n const override = this.overrides[key];\n if (override) return override;\n\n const transloco = this.transloco;\n if (!transloco) return fallback;\n\n try {\n const value = transloco.translate(key);\n // Transloco returns the key (or an empty string) when it is missing.\n return value && value !== key ? value : fallback;\n } catch {\n return fallback;\n }\n }\n\n /** Transloco is an optional peer: a missing provider must not break the app. */\n private injectTransloco(): TranslocoService | null {\n try {\n return inject(TranslocoService, { optional: true }) ?? null;\n } catch {\n return null;\n }\n }\n}\n\n/** Explicit label translations (`withLabels()`), keyed by translation key. */\nexport const SHK_LABEL_OVERRIDES = new InjectionToken<Readonly<Record<string, string>>>(\n 'SHK_LABEL_OVERRIDES',\n { providedIn: 'root', factory: () => ({}) },\n);\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport { DOCUMENT } from '@angular/common';\nimport {\n Injectable,\n InjectionToken,\n Signal,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { DATE_OPTIONS, NUMBER_OPTIONS } from './config.options';\nimport { ShkLabels } from './labels';\nimport type {\n ShkConfigKey,\n ShkConfigLayer,\n ShkConfigSource,\n ShkConfigValues,\n ShkOptionDef,\n ShkOptionEntry,\n} from './config.types';\n\n/** What a `with*()` feature contributes to the registry. */\nexport interface ShkConfigFeature {\n /** Extra option definitions to register. */\n options?: readonly ShkOptionDef[];\n /** App-level defaults for registered options (what `reset` returns to). */\n defaults?: Readonly<Record<string, unknown>>;\n}\n\n/** Features collected from `provideShk(...)`. */\nexport const SHK_CONFIG_FEATURES = new InjectionToken<readonly ShkConfigFeature[]>(\n 'SHK_CONFIG_FEATURES',\n);\n\n/** Storage settings enabled by `withPersistence()`. */\nexport interface ShkConfigPersistence {\n /** localStorage key. Defaults to `shk-config`. */\n storageKey: string;\n}\n\nexport const SHK_CONFIG_PERSISTENCE = new InjectionToken<ShkConfigPersistence>(\n 'SHK_CONFIG_PERSISTENCE',\n);\n\n/**\n * Value held outside the registry. Kept for backwards compatibility: prefer\n * `ShkConfigService.apply()` so the registry keeps owning the value.\n *\n * @deprecated The registry stores option values now. Bind a callback with\n * `apply()` to react to changes instead of holding the value elsewhere.\n */\nexport interface ShkOptionSource<T = unknown> {\n value: Signal<T>;\n set(value: T): void;\n}\n\n/**\n * Registry of the library's configurable options (\"nomenclador\" de opciones).\n *\n * Every option has a key (`dates.format`), a module, a type and a default.\n * Components read options as signals, so changing one at runtime updates every\n * component that uses it. A settings screen can list them with `options()`.\n *\n * Values live in layers, read in this order:\n *\n * 1. `draft` — the preview an admin screen is editing (`ShkConfigSync.preview()`).\n * 2. `device` — the user's own choice (localStorage, `withPersistence()`).\n * 3. `shared` — the system-wide value (`withSharedConfig()`, usually the backend).\n * 4. the option's `default`.\n *\n * `set()` writes to the draft while a preview is active, otherwise to the\n * option's `scope` (`device` by default).\n *\n * ```ts\n * const config = inject(ShkConfigService);\n * config.get('dates.format')(); // 'dd/MM/yyyy'\n * config.set('numbers.currency', 'EUR'); // every price input/table updates\n * config.options(); // definitions + current values\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ShkConfigService {\n private readonly win = inject(DOCUMENT).defaultView;\n private readonly persistence = inject(SHK_CONFIG_PERSISTENCE, { optional: true });\n private readonly labels = inject(ShkLabels);\n\n /** Registered definitions, by key. */\n private readonly defs = signal<ReadonlyMap<string, ShkOptionDef>>(new Map());\n /** Values set explicitly on this device (persisted by `withPersistence()`). */\n private readonly deviceValues = signal<Readonly<Record<string, unknown>>>({});\n /** Values coming from the shared layer (`withSharedConfig()`). */\n private readonly sharedValues = signal<Readonly<Record<string, unknown>>>({});\n /** Values of the preview being edited (`null` when no preview is active). */\n private readonly draftValues = signal<Readonly<Record<string, unknown>> | null>(null);\n /** Options whose value lives elsewhere (legacy `bind`). */\n private readonly sources = signal<ReadonlyMap<string, ShkOptionSource>>(new Map());\n /** Callbacks registered with `apply()`, run on every value change. */\n private readonly appliers = signal<ReadonlyMap<string, (value: unknown) => void>>(new Map());\n /** Stored values whose option is not registered yet; applied on `register`. */\n private pending: Record<string, unknown> = {};\n /** Cached per-key signals returned by `get`. */\n private readonly cache = new Map<string, Signal<unknown>>();\n\n /** Values set on this device, by key. */\n readonly device = this.deviceValues.asReadonly();\n /** Values of the shared layer, by key. */\n readonly shared = this.sharedValues.asReadonly();\n /** Values of the preview being edited, or `null`. */\n readonly draft = this.draftValues.asReadonly();\n /** `true` while an admin screen is previewing changes. */\n readonly isPreviewing = computed(() => this.draftValues() !== null);\n\n /** Every registered option with its current value, in registration order. */\n readonly options: Signal<ShkOptionEntry[]> = computed(() =>\n [...this.defs().values()].map((def) => {\n const value = this.read(def.key);\n return {\n ...def,\n label: this.labels.get(def.labelKey, def.label ?? def.key),\n description: this.labels.get(def.descriptionKey, def.description ?? ''),\n choices: def.choices?.map((choice) => ({\n ...choice,\n label: this.labels.get(choice.labelKey, choice.label),\n })),\n value,\n isDefault: sameValue(value, def.default),\n source: this.sourceOf(def),\n } as ShkOptionEntry;\n }),\n );\n\n /** Module names in registration order (`dates`, `numbers`, `theme`, …). */\n readonly modules: Signal<string[]> = computed(() => [\n ...new Set([...this.defs().values()].map((def) => def.module)),\n ]);\n\n constructor() {\n this.pending = this.loadStored();\n this.register([...DATE_OPTIONS, ...NUMBER_OPTIONS]);\n\n for (const feature of inject(SHK_CONFIG_FEATURES, { optional: true }) ?? []) {\n if (feature.options) this.register(feature.options);\n if (feature.defaults) this.setDefaults(feature.defaults);\n }\n\n if (this.persistence) {\n effect(() => this.save(this.deviceValues()));\n }\n\n // Runs the `apply()` callbacks whenever any of their options changes. The\n // map is a signal so registering a callback re-runs the effect and starts\n // tracking the new option.\n //\n // The callbacks run untracked on purpose: they usually read the signals of\n // the service they drive (`ShkThemeService.setScheme` reads `scheme()`, for\n // example). Tracking those reads would make the effect depend on state it\n // writes itself, so applying a value would re-run the effect and put the\n // previous value back.\n effect(() => {\n for (const [key, callback] of this.appliers()) {\n const value = this.read(key);\n untracked(() => callback(value));\n }\n });\n }\n\n /** Current value of an option as a signal. Throws for unknown keys. */\n get<K extends ShkConfigKey>(key: K): Signal<ShkConfigValues[K]>;\n get<T = unknown>(key: string): Signal<T>;\n get(key: string): Signal<unknown> {\n this.requireDef(key);\n let sig = this.cache.get(key);\n if (!sig) {\n sig = computed(() => this.read(key));\n this.cache.set(key, sig);\n }\n return sig;\n }\n\n /** Whether an option is registered (e.g. `theme.*` only exists with `withTheme()`). */\n has(key: string): boolean {\n return untracked(this.defs).has(key);\n }\n\n /** Current value of an option (non-reactive read). */\n value<K extends ShkConfigKey>(key: K): ShkConfigValues[K];\n value<T = unknown>(key: string): T;\n value(key: string): unknown {\n return untracked(this.get(key));\n }\n\n /**\n * Sets an option. The value is validated against the definition (type,\n * choices, bounds); an invalid value throws and changes nothing.\n *\n * While a preview is active it is written to the draft; otherwise to\n * `layer`, or to the option's `scope` (`device` by default).\n */\n set<K extends ShkConfigKey>(key: K, value: ShkConfigValues[K], layer?: ShkConfigLayer): void;\n set(key: string, value: unknown, layer?: ShkConfigLayer): void;\n set(key: string, value: unknown, layer?: ShkConfigLayer): void {\n const def = this.requireDef(key);\n const valid = this.validate(def, value);\n const source = untracked(this.sources).get(key);\n if (source) {\n source.set(valid);\n return;\n }\n\n if (untracked(this.draftValues) !== null) {\n this.draftValues.update((draft) => ({ ...draft, [key]: valid }));\n return;\n }\n\n const target = layer ?? def.scope ?? 'device';\n if (target === 'shared') {\n this.sharedValues.update((current) => ({ ...current, [key]: valid }));\n } else {\n this.deviceValues.update((current) => ({ ...current, [key]: valid }));\n }\n }\n\n /** Restores one option (or all of them) to its default. */\n reset(key?: string): void {\n const keys = key ? [key] : [...untracked(this.defs).keys()];\n for (const k of keys) {\n const def = this.requireDef(k);\n const source = untracked(this.sources).get(k);\n if (source) source.set(def.default);\n }\n\n if (key) {\n const draft = untracked(this.draftValues);\n if (draft && key in draft) {\n this.draftValues.update((current) => {\n const { [key]: _removed, ...rest } = current ?? {};\n return rest;\n });\n return;\n }\n // Only the local layer is cleared: the shared value belongs to the system.\n this.deviceValues.update((current) => {\n const { [key]: _removed, ...rest } = current;\n return rest;\n });\n return;\n }\n\n this.draftValues.set(untracked(this.draftValues) === null ? null : {});\n this.deviceValues.set({});\n }\n\n /**\n * Adds option definitions (or replaces existing ones with the same key).\n * Stored values for them are applied if they are still valid.\n */\n register(defs: readonly ShkOptionDef[]): void {\n this.defs.update((current) => {\n const next = new Map(current);\n for (const def of defs) next.set(def.key, def);\n return next;\n });\n for (const def of defs) {\n if (!(def.key in this.pending)) continue;\n const stored = this.pending[def.key];\n delete this.pending[def.key];\n if (def.persist === false) continue;\n try {\n const valid = this.validate(def, stored);\n this.deviceValues.update((current) => ({ ...current, [def.key]: valid }));\n } catch {\n // Stale or hand-edited storage: ignore the value, keep the default.\n }\n }\n }\n\n /**\n * Binds an option to a value held elsewhere.\n *\n * @deprecated The registry owns option values now. Use `apply()` to react to\n * changes (`theme.*` uses it) and let the layers store the value.\n */\n bind<T>(key: string, source: ShkOptionSource<T>): void {\n this.requireDef(key);\n this.sources.update((current) => new Map(current).set(key, source as ShkOptionSource));\n }\n\n /**\n * Runs `callback` with the option's current value and again on every change\n * (any layer, including the preview). Used by `withTheme()` to apply\n * `theme.name`/`theme.scheme`/`theme.primary`/`theme.surface` to the DOM.\n */\n apply(key: string, callback: (value: unknown) => void): void {\n this.requireDef(key);\n callback(untracked(() => this.read(key)));\n this.appliers.update((current) => new Map(current).set(key, callback));\n }\n\n // ---------------------------------------------------------------------------\n // Shared layer (used by `ShkConfigSync`)\n // ---------------------------------------------------------------------------\n\n /**\n * Replaces the shared layer with values loaded from a store. Invalid or\n * unknown keys are ignored, so a store from a newer build cannot break the\n * app.\n */\n setShared(values: Readonly<Record<string, unknown>>): void {\n const accepted: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(values)) {\n const def = untracked(this.defs).get(key);\n if (!def || def.persist === false) continue;\n try {\n accepted[key] = this.validate(def, value);\n } catch {\n // Unknown choice or stale type: keep the default for this key.\n }\n }\n this.sharedValues.set(accepted);\n }\n\n /** Starts (or restarts) a preview: an empty draft on top of the current values. */\n beginDraft(): void {\n this.draftValues.set({});\n }\n\n /** Moves the preview values to the shared layer and closes the preview. */\n commitDraft(): void {\n const draft = untracked(this.draftValues) ?? {};\n this.sharedValues.update((current) => ({ ...current, ...draft }));\n this.draftValues.set(null);\n }\n\n /** Throws away the preview, keeping the previous values. */\n discardDraft(): void {\n this.draftValues.set(null);\n }\n\n /** Changes the defaults of registered options (`reset` returns to these). */\n private setDefaults(defaults: Readonly<Record<string, unknown>>): void {\n const updated: ShkOptionDef[] = [];\n for (const [key, value] of Object.entries(defaults)) {\n if (value === undefined) continue;\n const def = this.requireDef(key);\n updated.push({ ...def, default: this.validate(def, value) });\n }\n this.defs.update((current) => {\n const next = new Map(current);\n for (const def of updated) next.set(def.key, def);\n return next;\n });\n }\n\n private read(key: string): unknown {\n const source = this.sources().get(key);\n if (source) return source.value();\n\n const def = this.defs().get(key);\n const draft = this.draftValues();\n if (draft && key in draft) return draft[key];\n const device = this.deviceValues();\n if (key in device) return device[key];\n const shared = this.sharedValues();\n if (key in shared) return shared[key];\n return def?.default;\n }\n\n /** Layer the current value comes from (for settings screens). */\n private sourceOf(def: ShkOptionDef): ShkConfigSource {\n const source = this.sources().get(def.key);\n if (source) return 'device';\n const draft = this.draftValues();\n if (draft && def.key in draft) return 'draft';\n if (def.key in this.deviceValues()) return 'device';\n if (def.key in this.sharedValues()) return 'shared';\n return 'default';\n }\n\n private requireDef(key: string): ShkOptionDef {\n const def = untracked(this.defs).get(key);\n if (!def) {\n throw new Error(\n `[shk-config] Unknown option \"${key}\". Register it with withOptions() or ShkConfigService.register().`,\n );\n }\n return def;\n }\n\n /** Returns the value coerced to the option's type, or throws if it is not acceptable. */\n private validate(def: ShkOptionDef, value: unknown): unknown {\n const fail = (why: string): never => {\n throw new Error(`[shk-config] Invalid value for \"${def.key}\": ${why}.`);\n };\n\n switch (def.type) {\n case 'boolean':\n if (typeof value !== 'boolean') fail('expected a boolean');\n return value;\n case 'number': {\n const n = typeof value === 'string' && value.trim() !== '' ? Number(value) : value;\n if (typeof n !== 'number' || !isFinite(n)) fail('expected a number');\n if (def.min !== undefined && (n as number) < def.min) fail(`minimum is ${def.min}`);\n if (def.max !== undefined && (n as number) > def.max) fail(`maximum is ${def.max}`);\n return n;\n }\n case 'color':\n if (typeof value !== 'string') fail('expected a color string');\n if (value !== '' && !/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(value as string)) {\n fail('expected a hex color such as #2563eb (or empty)');\n }\n return value;\n case 'select': {\n const match = def.choices?.find((choice) => sameValue(choice.value, value));\n if (match) return match.value;\n if (def.allowCustom && typeof value === 'string' && value.trim() !== '') {\n return value.trim();\n }\n return fail('not one of the allowed choices');\n }\n default:\n if (typeof value !== 'string') fail('expected a string');\n return value;\n }\n }\n\n private loadStored(): Record<string, unknown> {\n if (!this.persistence) return {};\n try {\n const raw = this.win?.localStorage?.getItem(this.persistence.storageKey);\n const parsed = raw ? JSON.parse(raw) : null;\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};\n } catch {\n return {};\n }\n }\n\n private save(device: Readonly<Record<string, unknown>>): void {\n if (!this.persistence) return;\n const defs = untracked(this.defs);\n // Keep stored values of options that are not registered yet (registered later).\n const stored: Record<string, unknown> = { ...this.pending };\n for (const [key, value] of Object.entries(device)) {\n if (defs.get(key)?.persist !== false) stored[key] = value;\n }\n try {\n this.win?.localStorage?.setItem(this.persistence.storageKey, JSON.stringify(stored));\n } catch {\n // Storage can be blocked (private mode, quota); the option still applies.\n }\n }\n}\n\n/** Value equality for option values (primitives and `null`). */\nfunction sameValue(a: unknown, b: unknown): boolean {\n return a === b || (Number.isNaN(a) && Number.isNaN(b));\n}\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport { Injectable, InjectionToken, computed, inject, signal } from '@angular/core';\n\nimport { ShkConfigService } from './config.service';\n\n/** Values and revision returned by a {@link ShkConfigStore}. */\nexport interface ShkConfigSnapshot {\n /** Stored values, by option key. Keys equal to the default may be omitted. */\n values: Readonly<Record<string, unknown>>;\n /** Opaque revision of `values`; sent back on `save` to detect lost updates. */\n revision: string;\n}\n\n/**\n * Persistence of the shared layer (usually the backend).\n *\n * The library never talks to the network: the app implements this and passes\n * it to `withSharedConfig()`. `save` must fail with\n * {@link ShkConfigConflictError} when `revision` is not the current one.\n */\nexport interface ShkConfigStore {\n load(): Promise<ShkConfigSnapshot>;\n save(\n values: Readonly<Record<string, unknown>>,\n revision: string | null,\n ): Promise<ShkConfigSnapshot>;\n}\n\n/** The app's {@link ShkConfigStore}, enabled with `withSharedConfig()`. */\nexport const SHK_CONFIG_STORE = new InjectionToken<ShkConfigStore>('SHK_CONFIG_STORE');\n\n/** The shared values changed on the server since they were loaded. */\nexport class ShkConfigConflictError extends Error {\n constructor(readonly expected: string | null, readonly actual: string | null) {\n super(\n `[shk-config] The shared configuration changed on the server (expected revision ${expected}, got ${actual}). Load it again before saving.`,\n );\n this.name = 'ShkConfigConflictError';\n }\n}\n\n/** State of a {@link ShkConfigSync} operation. */\nexport type ShkConfigSyncStatus = 'idle' | 'loading' | 'saving' | 'error';\n\n/**\n * Loads, previews and saves the shared layer.\n *\n * ```ts\n * const sync = inject(ShkConfigSync);\n * await sync.load(); // shared values from the backend\n * sync.preview(); // the admin screen now edits a draft\n * sync.isDirty(); // true once something changed\n * await sync.save(); // draft → shared (backend)\n * sync.discard(); // throw the draft away\n * ```\n *\n * While a preview is active, every `ShkConfigService.set()` goes to the draft,\n * so the same settings screen (and the same `shk-theme-picker`) works for both\n * the user and the admin without knowing about layers.\n */\n@Injectable({ providedIn: 'root' })\nexport class ShkConfigSync {\n private readonly config = inject(ShkConfigService);\n private readonly store = inject(SHK_CONFIG_STORE, { optional: true });\n\n /** Whether a store is configured (`withSharedConfig()`). */\n readonly available = !!this.store;\n readonly status = signal<ShkConfigSyncStatus>('idle');\n /** Revision of the loaded values; `null` until the first load. */\n readonly revision = signal<string | null>(null);\n /** Last error (conflict, network…), or `null`. */\n readonly error = signal<unknown>(null);\n /** True when the draft differs from the shared values. */\n readonly isDirty = computed(() => {\n const draft = this.config.draft();\n if (!draft) return false;\n const shared = this.config.shared();\n return Object.entries(draft).some(([key, value]) => !(key in shared) || shared[key] !== value);\n });\n\n /** Reads the shared layer from the store. */\n async load(): Promise<void> {\n if (!this.store) return;\n this.status.set('loading');\n this.error.set(null);\n try {\n const snapshot = await this.store.load();\n this.config.setShared(snapshot.values);\n this.revision.set(snapshot.revision);\n this.status.set('idle');\n } catch (error) {\n this.error.set(error);\n this.status.set('error');\n }\n }\n\n /** Starts editing a draft of the shared layer (live preview). */\n preview(): void {\n this.config.beginDraft();\n }\n\n /** Saves the draft to the store and makes it the shared layer. */\n async save(): Promise<void> {\n if (!this.store) return;\n this.status.set('saving');\n this.error.set(null);\n const values = { ...this.config.shared(), ...(this.config.draft() ?? {}) };\n try {\n const snapshot = await this.store.save(values, this.revision());\n this.config.setShared(snapshot.values);\n this.revision.set(snapshot.revision);\n this.config.discardDraft();\n this.status.set('idle');\n } catch (error) {\n this.error.set(error);\n this.status.set('error');\n }\n }\n\n /** Throws the draft away and keeps the current shared values. */\n discard(): void {\n this.config.discardDraft();\n this.error.set(null);\n this.status.set('idle');\n }\n}\n\n/**\n * Revision of a set of values: `sha256(canonical_json(values))`, first 16 hex\n * characters. Key order does not matter, so equal values give equal revisions.\n *\n * Used by stores that keep the values locally; a backend can compute the same\n * string to reject lost updates.\n */\nexport async function configRevision(values: Readonly<Record<string, unknown>>): Promise<string> {\n const json = JSON.stringify(canonicalize(values));\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) return fnv1a(json);\n\n const digest = await subtle.digest('SHA-256', new TextEncoder().encode(json));\n return [...new Uint8Array(digest)]\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, 16);\n}\n\n/** Object with its keys sorted recursively (stable JSON). */\nfunction canonicalize(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(canonicalize);\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n out[key] = canonicalize((value as Record<string, unknown>)[key]);\n }\n return out;\n }\n return value;\n}\n\n/** Non-cryptographic fallback for environments without `crypto.subtle`. */\nfunction fnv1a(text: string): string {\n let hash = 0x811c9dc5;\n for (let i = 0; i < text.length; i++) {\n hash ^= text.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193) >>> 0;\n }\n return hash.toString(16).padStart(8, '0');\n}\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n *\n * Builds the `--shk-primary-*` scale from a single color with CSS `color-mix()`,\n * so the browser derives every shade and no color math ships in JavaScript.\n *\n * A theme pack is plain data (`vars` + `darkVars`), not a CSS file: the\n * stylesheet is generated at runtime, so `theme.name` works in any build\n * without importing `themes/*.css`. The published CSS files are still shipped\n * for apps that prefer a static import.\n */\n\n/** A theme pack: a primary color, an optional surface palette and overrides. */\nexport interface ShkCustomTheme {\n /** Main brand color (hex). It becomes `--shk-primary-600`, the shade buttons use. */\n primary: string;\n /** Name shown in settings screens. Defaults to the theme key. */\n label?: string;\n /** Translation key for `label`; `label` is the English fallback. */\n labelKey?: string;\n /** Neutral palette (`slate`, `gray`, `zinc`, `neutral`, `stone`). */\n surface?: string;\n /** Light-mode custom properties, e.g. `{ '--shk-surface-50': '#f8fafc' }`. */\n vars?: Readonly<Record<`--shk-${string}`, string>>;\n /** Dark-mode custom properties. Merged over the generated dark primary scale. */\n darkVars?: Readonly<Record<`--shk-${string}`, string>>;\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst THEME_NAME = /^[a-z][a-z0-9-]*$/i;\nconst CSS_VAR_NAME = /^--shk-[a-z0-9-]+$/i;\n\n/** How much of the base color each shade keeps, mixed with white (light) or black (dark). */\nconst SHADES: readonly [shade: number, base: number, mixWith: 'white' | 'black' | null][] = [\n [50, 6, 'white'],\n [100, 12, 'white'],\n [200, 24, 'white'],\n [300, 42, 'white'],\n [400, 66, 'white'],\n [500, 85, 'white'],\n [600, 100, null],\n [700, 84, 'black'],\n [800, 68, 'black'],\n [900, 54, 'black'],\n [950, 36, 'black'],\n];\n\n/**\n * Dark-mode shades. A light scale cannot be reused in dark mode: `primary-100`\n * is a background there, so it must be a dark tint, while `primary-300`/`700`\n * are text and must be light. The 600 keeps the brand color so buttons stay\n * readable with white text.\n */\nconst DARK_SHADES: readonly [shade: number, base: number, mixWith: 'white' | 'black' | null][] = [\n [50, 14, 'black'],\n [100, 20, 'black'],\n [200, 30, 'black'],\n [300, 52, 'white'],\n [400, 70, 'white'],\n [500, 86, 'white'],\n [600, 100, null],\n [700, 86, 'white'],\n [800, 66, 'black'],\n [900, 52, 'black'],\n [950, 28, 'black'],\n];\n\n/** Custom properties a primary color controls (the scale + the decorative accent). */\nexport const PRIMARY_VARS: readonly string[] = [\n ...SHADES.map(([shade]) => `--shk-primary-${shade}`),\n '--shk-emerald-400',\n '--shk-emerald-600',\n '--shk-emerald-700',\n];\n\n/** Primary color of the default theme (matches `tokens.css`). */\nexport const DEFAULT_PRIMARY = '#059669';\n\n/** Throws when `color` is not a hex color. */\nexport function assertHexColor(color: string, where: string): void {\n if (!HEX.test(color)) {\n throw new Error(`[shk-config] ${where}: \"${color}\" is not a hex color such as #2563eb.`);\n }\n}\n\n/** `--shk-primary-50` … `--shk-primary-950` (and the accent vars) derived from one color. */\nexport function primaryScale(color: string): Record<string, string> {\n const vars: Record<string, string> = {};\n for (const [shade, base, mixWith] of SHADES) {\n vars[`--shk-primary-${shade}`] = mixWith\n ? `color-mix(in oklab, ${color} ${base}%, ${mixWith})`\n : color;\n }\n // Themes keep the decorative gradient in the accent color.\n vars['--shk-emerald-400'] = vars['--shk-primary-400'];\n vars['--shk-emerald-600'] = vars['--shk-primary-600'];\n vars['--shk-emerald-700'] = vars['--shk-primary-700'];\n return vars;\n}\n\n/**\n * Dark-mode counterpart of {@link primaryScale}. Same variable names, shades\n * chosen for dark backgrounds: 50–200 are dark tints, 300–500 light accents,\n * 600 keeps the brand color and 700 is the light hover/text tone.\n */\nexport function primaryScaleDark(color: string): Record<string, string> {\n const vars: Record<string, string> = {};\n for (const [shade, base, mixWith] of DARK_SHADES) {\n vars[`--shk-primary-${shade}`] = mixWith\n ? `color-mix(in oklab, ${color} ${base}%, ${mixWith})`\n : color;\n }\n vars['--shk-emerald-400'] = vars['--shk-primary-400'];\n vars['--shk-emerald-600'] = vars['--shk-primary-600'];\n vars['--shk-emerald-700'] = vars['--shk-primary-700'];\n return vars;\n}\n\n/** Normalizes `'#2563eb' | { primary }` and validates name and colors. */\nexport function normalizeCustomTheme(name: string, theme: string | ShkCustomTheme): ShkCustomTheme {\n if (!THEME_NAME.test(name)) {\n throw new Error(\n `[shk-config] Theme name \"${name}\" must start with a letter and contain only letters, digits and dashes.`,\n );\n }\n const normalized = typeof theme === 'string' ? { primary: theme } : theme;\n assertHexColor(normalized.primary, `theme \"${name}\"`);\n for (const [prop, value] of Object.entries({ ...normalized.vars, ...normalized.darkVars })) {\n // The values are written into a CSS rule: reject anything that could end it.\n if (!CSS_VAR_NAME.test(prop) || typeof value !== 'string' || /[;{}<>]/.test(value)) {\n throw new Error(\n `[shk-config] theme \"${name}\": invalid variable ${prop}: ${String(value)} (names are --shk-…; values cannot contain ; { } < >).`,\n );\n }\n }\n return normalized;\n}\n\n/** Neutral palettes for `theme.surface` (Tailwind scales, 50 … 900). */\nexport const SURFACE_PALETTES: Readonly<Record<string, { label: string; scale: readonly string[] }>> = {\n slate: {\n label: 'Slate',\n scale: ['#f8fafc', '#f1f5f9', '#e2e8f0', '#cbd5e1', '#94a3b8', '#64748b', '#475569', '#334155', '#1e293b', '#0f172a'],\n },\n gray: {\n label: 'Gray',\n scale: ['#f9fafb', '#f3f4f6', '#e5e7eb', '#d1d5db', '#9ca3af', '#6b7280', '#4b5563', '#374151', '#1f2937', '#111827'],\n },\n zinc: {\n label: 'Zinc',\n scale: ['#fafafa', '#f4f4f5', '#e4e4e7', '#d4d4d8', '#a1a1aa', '#71717a', '#52525b', '#3f3f46', '#27272a', '#18181b'],\n },\n neutral: {\n label: 'Neutral',\n scale: ['#fafafa', '#f5f5f5', '#e5e5e5', '#d4d4d4', '#a3a3a3', '#737373', '#525252', '#404040', '#262626', '#171717'],\n },\n stone: {\n label: 'Stone',\n scale: ['#fafaf9', '#f5f5f4', '#e7e5e4', '#d6d3d1', '#a8a29e', '#78716c', '#57534e', '#44403c', '#292524', '#1c1917'],\n },\n};\n\nconst SURFACE_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900] as const;\n\n/** `--shk-surface-*` of a palette; `dark` reverses the scale (50 ↔ 900). */\nexport function surfaceVars(palette: string, dark = false): Record<string, string> {\n const entry = SURFACE_PALETTES[palette];\n if (!entry) return {};\n const vars: Record<string, string> = {};\n for (let i = 0; i < SURFACE_STEPS.length; i++) {\n vars[`--shk-surface-${SURFACE_STEPS[i]}`] = entry.scale[dark ? 9 - i : i];\n }\n vars['--shk-scrollbar-thumb'] = entry.scale[dark ? 6 : 3];\n vars['--shk-scrollbar-thumb-hover'] = entry.scale[dark ? 5 : 4];\n return vars;\n}\n\n/**\n * CSS for every surface palette, activated with `<html data-shk-surface=\"slate\">`.\n * Dark mode uses the reversed scale (50 ↔ 900), like the built-in themes. The\n * doubled attribute selector out-ranks the theme packs (`html.dark[data-shk-theme]`).\n */\nexport function surfaceCss(attribute = 'data-shk-surface'): string {\n return Object.entries(SURFACE_PALETTES)\n .map(([name]) => {\n const light = surfaceVars(name);\n const dark = surfaceVars(name, true);\n const sel = `html[${attribute}='${name}'][${attribute}]`;\n return (\n `${sel} { ${cssBody(light)} }\\n` +\n `html.dark[${attribute}='${name}'][${attribute}] { ${cssBody(dark)} }`\n );\n })\n .join('\\n');\n}\n\n/** `prop: value;` pairs on one line, for compact single-line rules. */\nfunction cssBody(vars: Readonly<Record<string, string>>): string {\n return Object.entries(vars)\n .map(([prop, value]) => `${prop}: ${value};`)\n .join(' ');\n}\n\n/**\n * CSS of one theme pack: the light rule plus its `html.dark` counterpart.\n * The dark primary scale is always generated, so a pack only has to declare\n * its surfaces (which is what `themes/*.css` used to do by hand).\n */\nexport function customThemeCss(name: string, theme: ShkCustomTheme, attribute: string): string {\n const light: Record<string, string> = {\n ...primaryScale(theme.primary),\n ...(theme.surface ? surfaceVars(theme.surface) : {}),\n ...(theme.vars ?? {}),\n };\n const dark: Record<string, string> = {\n ...primaryScaleDark(theme.primary),\n ...(theme.surface ? surfaceVars(theme.surface, true) : {}),\n ...(theme.darkVars ?? {}),\n };\n return (\n `[${attribute}='${name}'] {\\n${Object.entries(light)\n .map(([prop, value]) => ` ${prop}: ${value};`)\n .join('\\n')}\\n}\\n` +\n `html.dark[${attribute}='${name}'] {\\n${Object.entries(dark)\n .map(([prop, value]) => ` ${prop}: ${value};`)\n .join('\\n')}\\n}`\n );\n}\n\n/**\n * Base dark primary scale for the default theme (no `data-shk-theme`\n * attribute). Any theme pack overrides it by specificity and an explicit\n * `theme.primary` override out-ranks both.\n */\nexport function defaultDarkPrimaryCss(): string {\n return `html.dark {\\n${Object.entries(primaryScaleDark(DEFAULT_PRIMARY))\n .map(([prop, value]) => ` ${prop}: ${value};`)\n .join('\\n')}\\n}`;\n}\n\n/**\n * CSS of a `theme.primary` override. It needs an attribute (not an inline\n * style) so the dark variant can exist; the doubled attribute out-ranks the\n * theme packs.\n */\nexport function primaryOverrideCss(color: string, attribute = 'data-shk-primary'): string {\n const light = cssBody(primaryScale(color));\n const dark = cssBody(primaryScaleDark(color));\n return (\n `html[${attribute}][${attribute}] { ${light} }\\n` +\n `html.dark[${attribute}][${attribute}] { ${dark} }`\n );\n}\n\n/** A selectable combination shown as a preset: a theme pack and its colors. */\nexport interface ShkThemePreset extends ShkCustomTheme {\n /** Theme name (`theme.name`). */\n name: string;\n /** English label (fallback when there is no translation). */\n label: string;\n /** Translation key of the label. */\n labelKey: string;\n /** Its primary color (`--shk-primary-600`). */\n primary: string;\n /** Its surface palette (a `SURFACE_PALETTES` key), or '' when it has its own. */\n surface: string;\n}\n\n/** Built-in theme packs, as data. `default` is the `tokens.css` palette. */\nexport const BUILT_IN_PRESETS: readonly ShkThemePreset[] = [\n {\n name: 'default',\n label: 'Emerald',\n labelKey: 'theme.presets.default',\n primary: '#059669',\n surface: 'zinc',\n },\n {\n name: 'ocean',\n label: 'Ocean',\n labelKey: 'theme.presets.ocean',\n primary: '#0284c7',\n surface: 'slate',\n vars: {\n '--shk-primary-50': '#f0f9ff',\n '--shk-primary-100': '#e0f2fe',\n '--shk-primary-200': '#bae6fd',\n '--shk-primary-300': '#7dd3fc',\n '--shk-primary-400': '#38bdf8',\n '--shk-primary-500': '#0ea5e9',\n '--shk-primary-600': '#0284c7',\n '--shk-primary-700': '#0369a1',\n '--shk-primary-800': '#075985',\n '--shk-primary-900': '#0c4a6e',\n '--shk-primary-950': '#082f49',\n '--shk-surface-50': '#f8fafc',\n '--shk-surface-100': '#f1f5f9',\n '--shk-surface-200': '#e2e8f0',\n '--shk-surface-300': '#cbd5e1',\n '--shk-surface-400': '#94a3b8',\n '--shk-surface-500': '#64748b',\n '--shk-surface-600': '#475569',\n '--shk-surface-700': '#334155',\n '--shk-surface-800': '#1e293b',\n '--shk-surface-900': '#0f172a',\n '--shk-emerald-400': '#38bdf8',\n '--shk-emerald-600': '#0284c7',\n '--shk-emerald-700': '#0369a1',\n '--shk-scrollbar-thumb': '#cbd5e1',\n '--shk-scrollbar-thumb-hover': '#94a3b8',\n },\n darkVars: {\n '--shk-surface-50': '#0f172a',\n '--shk-surface-100': '#1e293b',\n '--shk-surface-200': '#334155',\n '--shk-surface-300': '#475569',\n '--shk-surface-400': '#64748b',\n '--shk-surface-500': '#94a3b8',\n '--shk-surface-600': '#cbd5e1',\n '--shk-surface-700': '#e2e8f0',\n '--shk-surface-800': '#f1f5f9',\n '--shk-surface-900': '#f8fafc',\n '--shk-scrollbar-thumb': '#475569',\n '--shk-scrollbar-thumb-hover': '#64748b',\n },\n },\n {\n name: 'violet',\n label: 'Violet',\n labelKey: 'theme.presets.violet',\n primary: '#7c3aed',\n surface: 'zinc',\n vars: {\n '--shk-primary-50': '#f5f3ff',\n '--shk-primary-100': '#ede9fe',\n '--shk-primary-200': '#ddd6fe',\n '--shk-primary-300': '#c4b5fd',\n '--shk-primary-400': '#a78bfa',\n '--shk-primary-500': '#8b5cf6',\n '--shk-primary-600': '#7c3aed',\n '--shk-primary-700': '#6d28d9',\n '--shk-primary-800': '#5b21b6',\n '--shk-primary-900': '#4c1d95',\n '--shk-primary-950': '#2e1065',\n '--shk-emerald-400': '#a78bfa',\n '--shk-emerald-600': '#7c3aed',\n '--shk-emerald-700': '#6d28d9',\n },\n },\n {\n name: 'sunset',\n label: 'Sunset',\n labelKey: 'theme.presets.sunset',\n primary: '#ea580c',\n surface: 'stone',\n vars: {\n '--shk-primary-50': '#fff7ed',\n '--shk-primary-100': '#ffedd5',\n '--shk-primary-200': '#fed7aa',\n '--shk-primary-300': '#fdba74',\n '--shk-primary-400': '#fb923c',\n '--shk-primary-500': '#f97316',\n '--shk-primary-600': '#ea580c',\n '--shk-primary-700': '#c2410c',\n '--shk-primary-800': '#9a3412',\n '--shk-primary-900': '#7c2d12',\n '--shk-primary-950': '#431407',\n '--shk-surface-50': '#fafaf9',\n '--shk-surface-100': '#f5f5f4',\n '--shk-surface-200': '#e7e5e4',\n '--shk-surface-300': '#d6d3d1',\n '--shk-surface-400': '#a8a29e',\n '--shk-surface-500': '#78716c',\n '--shk-surface-600': '#57534e',\n '--shk-surface-700': '#44403c',\n '--shk-surface-800': '#292524',\n '--shk-surface-900': '#1c1917',\n '--shk-emerald-400': '#fb923c',\n '--shk-emerald-600': '#ea580c',\n '--shk-emerald-700': '#c2410c',\n '--shk-scrollbar-thumb': '#d6d3d1',\n '--shk-scrollbar-thumb-hover': '#a8a29e',\n },\n darkVars: {\n '--shk-surface-50': '#1c1917',\n '--shk-surface-100': '#292524',\n '--shk-surface-200': '#44403c',\n '--shk-surface-300': '#57534e',\n '--shk-surface-400': '#78716c',\n '--shk-surface-500': '#a8a29e',\n '--shk-surface-600': '#d6d3d1',\n '--shk-surface-700': '#e7e5e4',\n '--shk-surface-800': '#f5f5f4',\n '--shk-surface-900': '#fafaf9',\n '--shk-scrollbar-thumb': '#57534e',\n '--shk-scrollbar-thumb-hover': '#78716c',\n },\n },\n];\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport { DOCUMENT } from '@angular/common';\nimport {\n CSP_NONCE,\n EnvironmentProviders,\n InjectionToken,\n Provider,\n inject,\n makeEnvironmentProviders,\n provideAppInitializer,\n} from '@angular/core';\nimport {\n DEFAULT_SHK_THEME_CONFIG,\n SHK_THEME_CONFIG,\n ShkColorScheme,\n ShkThemeConfig,\n ShkThemeService,\n} from 'shirkasoft-ui-components/theme';\n\nimport {\n SHK_CONFIG_FEATURES,\n SHK_CONFIG_PERSISTENCE,\n ShkConfigFeature,\n ShkConfigService,\n} from './config.service';\nimport { SHK_CONFIG_STORE, ShkConfigStore } from './config.sync';\nimport { SHK_LABEL_OVERRIDES } from './labels';\nimport type { ShkConfigLayer, ShkConfigValues, ShkOptionDef } from './config.types';\nimport {\n BUILT_IN_PRESETS,\n SURFACE_PALETTES,\n ShkCustomTheme,\n ShkThemePreset,\n assertHexColor,\n customThemeCss,\n defaultDarkPrimaryCss,\n normalizeCustomTheme,\n primaryOverrideCss,\n surfaceCss,\n} from './theme-palette';\n\n/**\n * Theme packs offered as presets (built-in + `withTheme({ themes })`), with the\n * primary color and surface each one uses. Read by `shk-theme-picker`.\n */\nexport const SHK_THEME_PRESETS = new InjectionToken<readonly ShkThemePreset[]>('SHK_THEME_PRESETS', {\n providedIn: 'root',\n factory: () => BUILT_IN_PRESETS,\n});\n\n/** Attribute on `<html>` that activates a `theme.surface` palette. */\nconst SURFACE_ATTRIBUTE = 'data-shk-surface';\n\n/** Attribute on `<html>` that activates a `theme.primary` override. */\nconst PRIMARY_ATTRIBUTE = 'data-shk-primary';\n\n/** Theme packs removed in previous releases; a stored value falls back to the default. */\nconst RETIRED_THEMES: readonly string[] = ['rose'];\n\n/** A configuration module passed to `provideShk()`. */\nexport interface ShkFeature {\n /** @internal */\n readonly ɵproviders: (Provider | EnvironmentProviders)[];\n}\n\nfunction feature(value: ShkConfigFeature, extra: (Provider | EnvironmentProviders)[] = []): ShkFeature {\n return {\n ɵproviders: [{ provide: SHK_CONFIG_FEATURES, multi: true, useValue: value }, ...extra],\n };\n}\n\n/** Drops `undefined` entries and prefixes the keys with the module name. */\nfunction defaultsOf(module: string, values: object): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(values)) {\n if (value !== undefined) out[`${module}.${name}`] = value;\n }\n return out;\n}\n\n/**\n * Configures the library. Every module is optional; component inputs still\n * override the configured values.\n *\n * ```ts\n * bootstrapApplication(App, {\n * providers: [\n * provideShk(\n * withDates({ locale: 'es', format: 'dd/MM/yyyy' }),\n * withNumbers({ currency: 'EUR', locale: 'es-ES' }),\n * withTheme({ defaultTheme: 'marca', themes: { marca: '#2563eb' } }),\n * withPersistence(),\n * ),\n * ],\n * });\n * ```\n *\n * Options persist in localStorage by default; add `withPersistence()` to use a\n * different key.\n */\nexport function provideShk(...features: ShkFeature[]): EnvironmentProviders {\n const provided = features.flatMap((f) => f.ɵproviders);\n // Options (theme included) persist by default. Prepended so an explicit\n // `withPersistence({ storageKey })` still wins.\n const hasPersistence = provided.some(\n (provider) =>\n (provider as { provide?: unknown }).provide === SHK_CONFIG_PERSISTENCE,\n );\n const defaults: Provider[] = hasPersistence\n ? []\n : [{ provide: SHK_CONFIG_PERSISTENCE, useValue: { storageKey: 'shk-config' } }];\n return makeEnvironmentProviders([...defaults, ...provided]);\n}\n\n/** App defaults for the date options (`dates.*`). */\nexport interface ShkDatesConfig {\n locale?: ShkConfigValues['dates.locale'];\n format?: ShkConfigValues['dates.format'];\n displayStyle?: ShkConfigValues['dates.displayStyle'];\n hourFormat?: ShkConfigValues['dates.hourFormat'];\n weekStart?: ShkConfigValues['dates.weekStart'];\n}\n\n/** Date module: locale, pattern, display style, 12/24 h and first day of the week. */\nexport function withDates(config: ShkDatesConfig): ShkFeature {\n return feature({ defaults: defaultsOf('dates', config) });\n}\n\n/** App defaults for the number and currency options (`numbers.*`). */\nexport interface ShkNumbersConfig {\n locale?: ShkConfigValues['numbers.locale'];\n currency?: ShkConfigValues['numbers.currency'];\n currencySymbol?: ShkConfigValues['numbers.currencySymbol'];\n decimals?: ShkConfigValues['numbers.decimals'];\n}\n\n/** Number module: separators locale, currency, currency symbol and decimals. */\nexport function withNumbers(config: ShkNumbersConfig): ShkFeature {\n return feature({ defaults: defaultsOf('numbers', config) });\n}\n\n/** Theme module settings. */\nexport interface ShkThemeModuleConfig extends ShkThemeConfig {\n /**\n * Extra themes generated from one color: `{ marca: '#2563eb' }` or\n * `{ marca: { primary: '#2563eb', label: 'Marca', vars: { … } } }`.\n */\n themes?: Readonly<Record<string, string | ShkCustomTheme>>;\n /** Primary color applied on top of any theme (`theme.primary`). Empty = none. */\n primary?: string;\n /** Neutral palette applied on top of any theme (`theme.surface`). Empty = none. */\n surface?: string;\n /**\n * Layer `theme.*` writes to outside a preview. Defaults to `device`: the\n * picker is the user's own preference and the admin screen edits a draft.\n */\n scope?: ShkConfigLayer;\n}\n\n/**\n * Theme module: built-in and custom themes, light/dark/system scheme and a\n * runtime primary color. Replaces `provideShkTheme()` (do not use both).\n *\n * Theme packs are data (`vars` + `darkVars`), so `theme.name` works without\n * importing `themes/*.css` and every pack has a dark variant.\n */\nexport function withTheme(config: ShkThemeModuleConfig = {}): ShkFeature {\n const { themes = {}, primary = '', surface = '', scope = 'device', ...themeConfig } = config;\n const resolved = { ...DEFAULT_SHK_THEME_CONFIG, ...themeConfig };\n const custom = Object.entries(themes).map(\n ([name, theme]) => [name, normalizeCustomTheme(name, theme)] as const,\n );\n if (primary) assertHexColor(primary, 'withTheme({ primary })');\n\n const customPresets: ShkThemePreset[] = custom.map(([name, theme]) => ({\n ...theme,\n name,\n label: theme.label ?? name,\n labelKey: theme.labelKey ?? `theme.presets.${name}`,\n primary: theme.primary,\n surface: theme.surface ?? '',\n }));\n const presets: ShkThemePreset[] = [...BUILT_IN_PRESETS, ...customPresets];\n // `default` is `tokens.css` (no attribute), so it needs no rule of its own.\n const generated = [...BUILT_IN_PRESETS, ...customPresets].filter(\n (preset) => preset.name !== 'default',\n );\n\n const options: ShkOptionDef[] = [\n {\n key: 'theme.name',\n module: 'theme',\n type: 'select',\n default: resolved.defaultTheme,\n label: 'Theme',\n labelKey: 'theme.options.name',\n description: 'Color palette of the interface.',\n descriptionKey: 'theme.options.nameDescription',\n choices: presets.map((preset) => ({\n value: preset.name,\n label: preset.label,\n labelKey: preset.labelKey,\n })),\n scope,\n },\n {\n key: 'theme.scheme',\n module: 'theme',\n type: 'select',\n default: resolved.defaultScheme,\n label: 'Mode',\n labelKey: 'theme.options.scheme',\n choices: [\n { value: 'system', label: 'System', labelKey: 'theme.schemes.system' },\n { value: 'light', label: 'Light', labelKey: 'theme.schemes.light' },\n { value: 'dark', label: 'Dark', labelKey: 'theme.schemes.dark' },\n ],\n // Light/dark is the user's own preference, never a system-wide setting.\n scope: 'device',\n },\n {\n key: 'theme.primary',\n module: 'theme',\n type: 'color',\n default: primary,\n label: 'Primary color',\n labelKey: 'theme.options.primary',\n description: \"Overrides the theme's primary color. Empty = the theme's own.\",\n descriptionKey: 'theme.options.primaryDescription',\n scope,\n },\n {\n key: 'theme.surface',\n module: 'theme',\n type: 'select',\n default: surface,\n label: 'Surface',\n labelKey: 'theme.options.surface',\n description: \"Greys for backgrounds, borders and text. Empty = the theme's own.\",\n descriptionKey: 'theme.options.surfaceDescription',\n choices: [\n { value: '', label: \"The theme's own\", labelKey: 'theme.surfaces.theme' },\n ...Object.entries(SURFACE_PALETTES).map(([value, { label }]) => ({\n value,\n label,\n labelKey: `theme.surfaces.${value}`,\n })),\n ],\n scope,\n },\n ];\n\n return feature({ options }, [\n { provide: SHK_THEME_CONFIG, useValue: resolved },\n { provide: SHK_THEME_PRESETS, useValue: presets },\n provideAppInitializer(() => {\n const doc = inject(DOCUMENT);\n const themeService = inject(ShkThemeService);\n const configService = inject(ShkConfigService);\n const nonce = inject(CSP_NONCE, { optional: true });\n\n // Theme packs + surface palettes, as one stylesheet. Generated at runtime\n // so `theme.name` does not depend on importing `themes/*.css`.\n const css = [\n defaultDarkPrimaryCss(),\n surfaceCss(SURFACE_ATTRIBUTE),\n ...generated.map((preset) => customThemeCss(preset.name, preset, resolved.attribute)),\n ].join('\\n');\n let style = doc.head?.querySelector<HTMLStyleElement>('style[data-shk-themes]');\n if (!style && doc.head) {\n style = doc.createElement('style');\n style.setAttribute('data-shk-themes', '');\n // Lets the rules through a strict Content-Security-Policy (style-src 'nonce-…').\n if (nonce) style.setAttribute('nonce', nonce);\n doc.head.appendChild(style);\n }\n if (style) style.textContent = css;\n\n // Stylesheet of the primary override (an inline style cannot have a dark\n // variant, so it is a rule with an attribute selector).\n let primaryStyle = doc.head?.querySelector<HTMLStyleElement>('style[data-shk-primary-css]');\n if (!primaryStyle && doc.head) {\n primaryStyle = doc.createElement('style');\n primaryStyle.setAttribute('data-shk-primary-css', '');\n if (nonce) primaryStyle.setAttribute('nonce', nonce);\n doc.head.appendChild(primaryStyle);\n }\n\n migrateLegacyTheme(doc, configService, resolved);\n\n // The registry owns the value; the service only applies it.\n configService.apply('theme.name', (name) =>\n themeService.setTheme(name as string),\n );\n configService.apply('theme.scheme', (scheme) =>\n themeService.setScheme(scheme as ShkColorScheme),\n );\n\n const root = doc.documentElement;\n configService.apply('theme.primary', (color) => {\n if (primaryStyle) primaryStyle.textContent = color ? primaryOverrideCss(color as string, PRIMARY_ATTRIBUTE) : '';\n if (color) root.setAttribute(PRIMARY_ATTRIBUTE, '');\n else root.removeAttribute(PRIMARY_ATTRIBUTE);\n });\n\n // Runtime surface palette: an attribute selector, so light and dark both apply.\n configService.apply('theme.surface', (palette) => {\n if (palette) root.setAttribute(SURFACE_ATTRIBUTE, palette as string);\n else root.removeAttribute(SURFACE_ATTRIBUTE);\n });\n }),\n ]);\n}\n\n/**\n * Reads the pre-2.1 `shk-theme`/`shk-scheme` keys once and moves them into the\n * registry, so existing users keep their theme after upgrading.\n */\nfunction migrateLegacyTheme(\n doc: Document,\n configService: ShkConfigService,\n resolved: typeof DEFAULT_SHK_THEME_CONFIG,\n): void {\n const storage = doc.defaultView?.localStorage;\n if (!storage) return;\n\n const legacyTheme = readItem(storage, resolved.storageKey);\n const legacyScheme = readItem(storage, resolved.schemeStorageKey);\n\n if (\n legacyTheme &&\n !RETIRED_THEMES.includes(legacyTheme) &&\n configService.value('theme.name') === resolved.defaultTheme\n ) {\n try {\n configService.set('theme.name', legacyTheme);\n } catch {\n // A theme that no longer exists: keep the default.\n }\n }\n\n if (\n (legacyScheme === 'light' || legacyScheme === 'dark' || legacyScheme === 'system') &&\n configService.value('theme.scheme') === resolved.defaultScheme\n ) {\n configService.set('theme.scheme', legacyScheme);\n }\n\n removeItem(storage, resolved.storageKey);\n removeItem(storage, resolved.schemeStorageKey);\n}\n\nfunction readItem(storage: Storage, key: string): string | null {\n try {\n return storage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction removeItem(storage: Storage, key: string): void {\n try {\n storage.removeItem(key);\n } catch {\n // Storage can be blocked; the migration is simply skipped next time.\n }\n}\n\n/** Registers app-defined options in the same registry (`app.pageSize`, …). */\nexport function withOptions(options: readonly ShkOptionDef[]): ShkFeature {\n return feature({ options });\n}\n\n/**\n * Persists changed options in localStorage so they survive reloads.\n * Options with `persist: false` are skipped.\n */\nexport function withPersistence(config: { storageKey?: string } = {}): ShkFeature {\n return {\n ɵproviders: [\n {\n provide: SHK_CONFIG_PERSISTENCE,\n useValue: { storageKey: config.storageKey ?? 'shk-config' },\n },\n ],\n };\n}\n\n/**\n * Enables the shared layer: the system-wide values an admin screen edits.\n *\n * ```ts\n * provideShk(withSharedConfig({ provide: SHK_CONFIG_STORE, useClass: ApiConfigStore }))\n * ```\n */\nexport function withSharedConfig(store: ShkConfigStore | Provider): ShkFeature {\n const provider: Provider =\n typeof store === 'object' && store !== null && 'provide' in store\n ? (store as Provider)\n : { provide: SHK_CONFIG_STORE, useValue: store as ShkConfigStore };\n return { ɵproviders: [provider] };\n}\n\n/**\n * Explicit label translations for the library's own texts (theme names, option\n * labels…). Transloco is used automatically when it is configured; this is for\n * apps that use another i18n system. Untranslated labels fall back to English.\n *\n * ```ts\n * withLabels({ 'theme.presets.ocean': 'Océano', 'theme.options.name': 'Tema' })\n * ```\n */\nexport function withLabels(labels: Readonly<Record<string, string>>): ShkFeature {\n return { ɵproviders: [{ provide: SHK_LABEL_OVERRIDES, useValue: labels }] };\n}\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n *\n * Locale-aware formatting helpers used by the components and available to apps.\n * Pure functions on top of `Intl`: no Angular locale data needs registering.\n */\n\n/** `Intl` formatters are expensive to build; reuse them per locale/options. */\nconst formatterCache = new Map<string, Intl.DateTimeFormat | Intl.NumberFormat>();\n\nfunction dateFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `d|${locale}|${JSON.stringify(options)}`;\n let fmt = formatterCache.get(key) as Intl.DateTimeFormat | undefined;\n if (!fmt) {\n fmt = new Intl.DateTimeFormat(safeLocale(locale), options);\n formatterCache.set(key, fmt);\n }\n return fmt;\n}\n\nfunction numberFormatter(locale: string, options: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = `n|${locale}|${JSON.stringify(options)}`;\n let fmt = formatterCache.get(key) as Intl.NumberFormat | undefined;\n if (!fmt) {\n fmt = new Intl.NumberFormat(safeLocale(locale), options);\n formatterCache.set(key, fmt);\n }\n return fmt;\n}\n\n/** Falls back to the runtime default when the tag is not a valid BCP 47 locale. */\nfunction safeLocale(locale: string): string | undefined {\n try {\n return Intl.getCanonicalLocales(locale)[0];\n } catch {\n return undefined;\n }\n}\n\n/** Default numeric pattern for a locale: `MM/dd/yyyy` for English, `dd/MM/yyyy` otherwise. */\nexport function resolveDateFormat(format: string | null | undefined, locale: string): string {\n if (format) return format;\n return locale.toLowerCase().startsWith('en') ? 'MM/dd/yyyy' : 'dd/MM/yyyy';\n}\n\n/** Converts a value to a `Date`. ISO date-only strings (`2026-12-31`) are read as local dates. */\nexport function toDate(value: Date | string | number | null | undefined): Date | null {\n if (value === null || value === undefined || value === '') return null;\n if (value instanceof Date) return isNaN(value.getTime()) ? null : value;\n if (typeof value === 'string') {\n const dateOnly = /^(\\d{4})-(\\d{1,2})-(\\d{1,2})$/.exec(value.trim());\n if (dateOnly) {\n return new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3]));\n }\n }\n const date = new Date(value);\n return isNaN(date.getTime()) ? null : date;\n}\n\nconst pad = (n: number, width = 2) => String(n).padStart(width, '0');\n\n/**\n * Pattern tokens, longest first. Text between single quotes is copied verbatim.\n * Compatible with the common Angular `DatePipe` tokens (`y` = full year).\n */\nconst DATE_TOKENS = /'[^']*'|yyyy|yy|y|MMMM|MMM|MM|M|dd|d|EEEE|EEE|HH|H|hh|h|mm|ss|a/g;\n\n/**\n * Formats a date with a pattern (`dd/MM/yyyy`, `d MMM yyyy`, `yyyy-MM-dd HH:mm`…).\n *\n * Tokens: `yyyy y yy` year · `MMMM MMM MM M` month · `dd d` day · `EEEE EEE` weekday ·\n * `HH H` 0-23 · `hh h` 1-12 · `mm` minutes · `ss` seconds · `a` AM/PM ·\n * `'text'` literal. Month and weekday names follow `locale`, with its own casing\n * (\"31 dic 2026\" in Spanish, \"Dec 31, 2026\" in English).\n * Returns an empty string for empty or invalid values.\n */\nexport function formatDate(\n value: Date | string | number | null | undefined,\n pattern: string,\n locale: string,\n): string {\n const date = toDate(value);\n if (!date) return '';\n const name = (options: Intl.DateTimeFormatOptions) =>\n dateFormatter(locale, options).format(date).replace('.', '');\n const h = date.getHours();\n\n return pattern.replace(DATE_TOKENS, (token) => {\n switch (token) {\n case 'yyyy':\n case 'y': return String(date.getFullYear());\n case 'yy': return pad(date.getFullYear() % 100);\n case 'MMMM': return name({ month: 'long' });\n case 'MMM': return name({ month: 'short' });\n case 'MM': return pad(date.getMonth() + 1);\n case 'M': return String(date.getMonth() + 1);\n case 'dd': return pad(date.getDate());\n case 'd': return String(date.getDate());\n case 'EEEE': return name({ weekday: 'long' });\n case 'EEE': return name({ weekday: 'short' });\n case 'HH': return pad(h);\n case 'H': return String(h);\n case 'hh': return pad(h % 12 || 12);\n case 'h': return String(h % 12 || 12);\n case 'mm': return pad(date.getMinutes());\n case 'ss': return pad(date.getSeconds());\n case 'a': return h < 12 ? 'AM' : 'PM';\n default: return token.slice(1, -1); // 'literal'\n }\n });\n}\n\n/** An `Intl` date (and optional time) style. */\nexport type ShkIntlStyle = 'full' | 'long' | 'medium' | 'short';\n\n/**\n * Date formatted with an `Intl` style (`long`: \"31 de diciembre de 2026\"),\n * optionally followed by the time in `timeStyle`.\n */\nexport function formatDateStyle(\n value: Date | string | number | null | undefined,\n style: ShkIntlStyle,\n locale: string,\n timeStyle?: ShkIntlStyle,\n): string {\n const date = toDate(value);\n if (!date) return '';\n const options: Intl.DateTimeFormatOptions = timeStyle\n ? { dateStyle: style, timeStyle }\n : { dateStyle: style };\n return dateFormatter(locale, options).format(date);\n}\n\n/** A pattern reduced to the parts a user types: field order and separator. */\nexport interface TypedDateLayout {\n /** Order of day/month/year in the pattern. */\n order: readonly ('d' | 'm' | 'y')[];\n /** Separator between the parts (`/`, `-` or `.`). */\n separator: string;\n}\n\n/**\n * Field order and separator of a pattern, for typing dates in an input.\n * Named months and weekdays are typed as numbers (`d MMM yyyy` → `dd/MM/yyyy`).\n */\nexport function typedDateLayout(pattern: string): TypedDateLayout {\n const order: ('d' | 'm' | 'y')[] = [];\n for (const token of pattern.replace(/'[^']*'/g, '').match(/y+|M+|d+/g) ?? []) {\n const field = token[0] === 'y' ? 'y' : token[0] === 'M' ? 'm' : 'd';\n if (!order.includes(field)) order.push(field);\n }\n for (const field of ['d', 'm', 'y'] as const) {\n if (!order.includes(field)) order.push(field);\n }\n const separator = /[\\/\\-.]/.exec(pattern)?.[0] ?? '/';\n return { order, separator };\n}\n\n/** Narrow currency symbol (`USD` → `$`, `EUR` → `€`). Unknown codes are returned as-is. */\nexport function currencySymbol(currency: string, locale: string): string {\n try {\n const parts = numberFormatter(locale, {\n style: 'currency',\n currency,\n currencyDisplay: 'narrowSymbol',\n }).formatToParts(0);\n return parts.find((p) => p.type === 'currency')?.value ?? currency;\n } catch {\n return currency;\n }\n}\n\n/**\n * Formats an amount as money (`$1,234.50`, `1.234,50 €`, `¥1,000`).\n * `decimals` `null`/omitted = the currency's own digits (2 for USD, 0 for JPY).\n */\nexport function formatCurrency(\n value: number | string | null | undefined,\n currency: string,\n locale: string,\n decimals: number | null = null,\n): string {\n const n = typeof value === 'string' ? Number(value) : value;\n if (n === null || n === undefined || !isFinite(n)) return '';\n const digits =\n decimals === null ? {} : { minimumFractionDigits: decimals, maximumFractionDigits: decimals };\n try {\n return numberFormatter(locale, { style: 'currency', currency, ...digits }).format(n);\n } catch {\n // Unknown currency code: plain number followed by the code.\n const d = decimals ?? 2;\n return `${formatNumber(n, locale, d, d)} ${currency}`;\n }\n}\n\n/** Decimal digits a currency uses by default (USD → 2, JPY → 0, BHD → 3). Unknown codes → 2. */\nexport function currencyDecimals(currency: string): number {\n try {\n return numberFormatter('en-US', { style: 'currency', currency }).resolvedOptions()\n .maximumFractionDigits ?? 2;\n } catch {\n return 2;\n }\n}\n\n/** Formats a number with the locale's grouping and decimal separators. */\nexport function formatNumber(\n value: number,\n locale: string,\n maxDecimals = 2,\n minDecimals = 0,\n): string {\n if (!isFinite(value)) return '';\n return numberFormatter(locale, {\n minimumFractionDigits: minDecimals,\n maximumFractionDigits: maxDecimals,\n }).format(value);\n}\n\n/** Decimal and grouping separators of a locale (`es-ES` → `,` and `.`). */\nexport function numberSeparators(locale: string): { decimal: string; group: string } {\n const parts = numberFormatter(locale, {}).formatToParts(12345.6);\n return {\n decimal: parts.find((p) => p.type === 'decimal')?.value ?? '.',\n group: parts.find((p) => p.type === 'group')?.value ?? ',',\n };\n}\n"],"mappings":";;;;;;AAmBA,MAAa,eAAwC;CACnD;EACE,KAAK;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,OAAO;EACP,aAAa;EACb,SAAS;GAlBX;IAAE,OAAO;IAAM,OAAO;GAAS;GAC/B;IAAE,OAAO;IAAS,OAAO;GAAkB;GAC3C;IAAE,OAAO;IAAS,OAAO;GAAkB;GAC3C;IAAE,OAAO;IAAS,OAAO;GAAc;GACvC;IAAE,OAAO;IAAS,OAAO;GAAc;GACvC;IAAE,OAAO;IAAS,OAAO;GAAoB;GAC7C;IAAE,OAAO;IAAS,OAAO;GAAU;EAYxB;EACT,aAAa;CACd;CACD;EACE,KAAK;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,OAAO;EACP,aAAa;EACb,aAAa;EACb,SAAS;GACP;IAAE,OAAO;IAAI,OAAO;GAA4B;G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OACA,QACA,cAAc,GACd,cAAc,GAAC;CAEf,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO;CAC7B,OAAO,gBAAgB,QAAQ;EAC7B,uBAAuB;EACvB,uBAAuB;CACxB,CAAA,CAAC,CAAC,OAAO,KAAK;AACjB;AAGA,SAAgB,iBAAiB,QAAc;CAC7C,MAAM,QAAQ,gBAAgB,QAAQ,CAAA,CAAE,CAAC,CAAC,cAAc,OAAO;CAC/D,OAAO;EACL,SAAS,MAAM,MAAM,MAAM,EAAE,SAAS,SAAS,CAAC,EAAE,SAAS;EAC3D,OAAO,MAAM,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC,EAAE,SAAS;CACxD;AACH"}
@@ -5,7 +5,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, Elem
5
5
  import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from "@angular/forms";
6
6
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
7
7
  import { TranslocoService } from "@jsverse/transloco";
8
- import { PortalDirective } from "shirkasoft-ui-components/utils";
8
+ import { PortalDirective, errorMessagesFromMap, signalErrorsToMap } from "shirkasoft-ui-components/utils";
9
9
  import { ShkConfigService, formatDate, formatDateStyle, resolveDateFormat, typedDateLayout } from "shirkasoft-ui-components/config";
10
10
  var DatePickerComponent = class DatePickerComponent {
11
11
  get _value() {
@@ -28,6 +28,10 @@ var DatePickerComponent = class DatePickerComponent {
28
28
  this.controlName = input("", ...ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []);
29
29
  this.control = input(void 0, ...ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []);
30
30
  this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
31
+ this.errors = input([], ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
32
+ this.invalid = input(false, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
33
+ this.touched = input(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
34
+ this.dirty = input(false, ...ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []);
31
35
  this.errorMessage = input("", ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
32
36
  this.errorMessages = input({}, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
33
37
  this.minValue = input("", ...ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []);
@@ -89,12 +93,15 @@ var DatePickerComponent = class DatePickerComponent {
89
93
  if (!name) return void 0;
90
94
  return fg.get(name) ?? void 0;
91
95
  }, ...ngDevMode ? [{ debugName: "actualControl" }] : /* istanbul ignore next */ []);
96
+ this.usesSignalForms = computed(() => !this.actualControl(), ...ngDevMode ? [{ debugName: "usesSignalForms" }] : /* istanbul ignore next */ []);
92
97
  this.shouldShowError = computed(() => {
98
+ if (this.usesSignalForms()) return this.invalid() && (this.touched() || this.dirty());
93
99
  this.errorTracker();
94
100
  const ctrl = this.actualControl();
95
101
  return ctrl?.invalid && (ctrl?.dirty || ctrl?.touched);
96
102
  }, ...ngDevMode ? [{ debugName: "shouldShowError" }] : /* istanbul ignore next */ []);
97
103
  this.wasFixedError = computed(() => {
104
+ if (this.usesSignalForms()) return this.hadError() && !this.invalid() && this.touched();
98
105
  this.errorTracker();
99
106
  const ctrl = this.actualControl();
100
107
  return this.hadError() && ctrl?.valid && ctrl?.touched;
@@ -103,13 +110,12 @@ var DatePickerComponent = class DatePickerComponent {
103
110
  this.errorTracker();
104
111
  const customError = this.errorMessage();
105
112
  if (customError) return [customError];
113
+ const customErrors = this.errorMessages();
114
+ const translate = (key, params) => this.transloco.translate(key, params);
115
+ if (this.usesSignalForms()) return errorMessagesFromMap(signalErrorsToMap(this.errors()), customErrors, translate);
106
116
  const ctrl = this.actualControl();
107
117
  if (!ctrl?.errors) return [];
108
- const customErrors = this.errorMessages();
109
- return Object.keys(ctrl.errors).map((key) => {
110
- if (customErrors[key]) return customErrors[key];
111
- return key === "required" ? this.transloco.translate("validation.required") : this.transloco.translate("validation.invalid");
112
- });
118
+ return errorMessagesFromMap(ctrl.errors, customErrors, translate);
113
119
  }, ...ngDevMode ? [{ debugName: "getErrorMessages" }] : /* istanbul ignore next */ []);
114
120
  this.texts = computed(() => this.effectiveLocale().startsWith("en") ? {
115
121
  today: "Today",
@@ -325,6 +331,10 @@ var DatePickerComponent = class DatePickerComponent {
325
331
  this.secondOptions = Array.from({ length: 60 }, (_, i) => i);
326
332
  this.timeText = computed(() => this.formatTime(this.viewHour(), this.viewMinute(), this.viewSecond()), ...ngDevMode ? [{ debugName: "timeText" }] : /* istanbul ignore next */ []);
327
333
  this.timeTextError = signal(false, ...ngDevMode ? [{ debugName: "timeTextError" }] : /* istanbul ignore next */ []);
334
+ effect(() => {
335
+ if (!this.usesSignalForms()) return;
336
+ if (this.invalid() && (this.touched() || this.dirty())) this.hadError.set(true);
337
+ });
328
338
  const doc = this.elementRef.nativeElement.ownerDocument;
329
339
  const onScroll = () => this.onViewportChange();
330
340
  doc.addEventListener("scroll", onScroll, true);
@@ -780,6 +790,9 @@ var DatePickerComponent = class DatePickerComponent {
780
790
  this.typingValid.set(null);
781
791
  }
782
792
  onInputBlur() {
793
+ this.onTouched();
794
+ this.touch.emit();
795
+ this.errorTracker.update((v) => v + 1);
783
796
  const text = this.typedValue().trim();
784
797
  this.isTyping.set(false);
785
798
  if (!text || text === this.typedFormOfValue()) return;
@@ -1197,6 +1210,34 @@ var DatePickerComponent = class DatePickerComponent {
1197
1210
  isRequired: false,
1198
1211
  transformFunction: null
1199
1212
  },
1213
+ errors: {
1214
+ classPropertyName: "errors",
1215
+ publicName: "errors",
1216
+ isSignal: true,
1217
+ isRequired: false,
1218
+ transformFunction: null
1219
+ },
1220
+ invalid: {
1221
+ classPropertyName: "invalid",
1222
+ publicName: "invalid",
1223
+ isSignal: true,
1224
+ isRequired: false,
1225
+ transformFunction: null
1226
+ },
1227
+ touched: {
1228
+ classPropertyName: "touched",
1229
+ publicName: "touched",
1230
+ isSignal: true,
1231
+ isRequired: false,
1232
+ transformFunction: null
1233
+ },
1234
+ dirty: {
1235
+ classPropertyName: "dirty",
1236
+ publicName: "dirty",
1237
+ isSignal: true,
1238
+ isRequired: false,
1239
+ transformFunction: null
1240
+ },
1200
1241
  errorMessage: {
1201
1242
  classPropertyName: "errorMessage",
1202
1243
  publicName: "errorMessage",
@@ -1475,6 +1516,38 @@ i0.ɵɵngDeclareClassMetadata({
1475
1516
  required: false
1476
1517
  }]
1477
1518
  }],
1519
+ errors: [{
1520
+ type: i0.Input,
1521
+ args: [{
1522
+ isSignal: true,
1523
+ alias: "errors",
1524
+ required: false
1525
+ }]
1526
+ }],
1527
+ invalid: [{
1528
+ type: i0.Input,
1529
+ args: [{
1530
+ isSignal: true,
1531
+ alias: "invalid",
1532
+ required: false
1533
+ }]
1534
+ }],
1535
+ touched: [{
1536
+ type: i0.Input,
1537
+ args: [{
1538
+ isSignal: true,
1539
+ alias: "touched",
1540
+ required: false
1541
+ }]
1542
+ }],
1543
+ dirty: [{
1544
+ type: i0.Input,
1545
+ args: [{
1546
+ isSignal: true,
1547
+ alias: "dirty",
1548
+ required: false
1549
+ }]
1550
+ }],
1478
1551
  errorMessage: [{
1479
1552
  type: i0.Input,
1480
1553
  args: [{