valtech-components 2.0.674 → 2.0.676

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 (26) hide show
  1. package/esm2022/lib/components/atoms/button/button.component.mjs +2 -2
  2. package/esm2022/lib/components/molecules/action-card/action-card.component.mjs +2 -2
  3. package/esm2022/lib/components/molecules/footer-links/footer-links.component.mjs +2 -2
  4. package/esm2022/lib/components/molecules/glow-card/glow-card.component.mjs +2 -2
  5. package/esm2022/lib/components/molecules/link/link.component.mjs +2 -2
  6. package/esm2022/lib/components/organisms/bottom-nav/bottom-nav.component.mjs +2 -2
  7. package/esm2022/lib/components/templates/page-content/page-content.component.mjs +2 -2
  8. package/esm2022/lib/components/templates/page-wrapper/page-wrapper.component.mjs +2 -2
  9. package/esm2022/lib/services/navigation/index.mjs +3 -0
  10. package/esm2022/lib/services/navigation/navigation.service.mjs +216 -0
  11. package/esm2022/lib/services/navigation/types.mjs +16 -0
  12. package/esm2022/lib/version.mjs +2 -2
  13. package/esm2022/public-api.mjs +2 -2
  14. package/fesm2022/valtech-components.mjs +377 -215
  15. package/fesm2022/valtech-components.mjs.map +1 -1
  16. package/lib/components/atoms/button/button.component.d.ts +1 -1
  17. package/lib/components/molecules/link/link.component.d.ts +1 -1
  18. package/lib/components/templates/page-content/page-content.component.d.ts +1 -1
  19. package/lib/services/navigation/index.d.ts +2 -0
  20. package/lib/services/navigation/navigation.service.d.ts +134 -0
  21. package/lib/services/navigation/types.d.ts +67 -0
  22. package/lib/version.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/public-api.d.ts +1 -1
  25. package/esm2022/lib/services/navigation.service.mjs +0 -68
  26. package/lib/services/navigation.service.d.ts +0 -45
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Injectable, makeEnvironmentProviders, APP_INITIALIZER, inject, EventEmitter, Component, Input, Output, HostListener, Pipe, input, computed, ChangeDetectionStrategy, ViewChild, ChangeDetectorRef, ElementRef, ContentChild, PLATFORM_ID, Inject, ErrorHandler, DestroyRef, InjectionToken, runInInjectionContext, effect, Optional, TemplateRef, ViewContainerRef, isSignal, Directive, ViewEncapsulation } from '@angular/core';
2
+ import { signal, Injectable, makeEnvironmentProviders, APP_INITIALIZER, inject, EventEmitter, Component, Input, Output, computed, HostListener, Pipe, input, ChangeDetectionStrategy, ViewChild, ChangeDetectorRef, ElementRef, ContentChild, PLATFORM_ID, Inject, ErrorHandler, DestroyRef, InjectionToken, runInInjectionContext, effect, Optional, TemplateRef, ViewContainerRef, isSignal, Directive, ViewEncapsulation } from '@angular/core';
3
3
  import * as i2$1 from '@ionic/angular/standalone';
4
4
  import { IonAvatar, IonCard, IonIcon, IonButton, IonSpinner, IonText, IonModal, IonHeader, IonToolbar, IonContent, IonButtons, IonTitle, IonProgressBar, IonSkeletonText, IonFab, IonFabButton, IonFabList, IonLabel, IonCardContent, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCheckbox, IonTextarea, IonDatetime, IonDatetimeButton, IonInput, IonSelect, IonSelectOption, IonPopover, IonList, IonItem, IonRadioGroup, IonRadio, IonRange, IonSearchbar, IonSegment, IonSegmentButton, IonToggle, IonAccordion, IonAccordionGroup, IonTabBar, IonTabButton, IonBadge, IonBreadcrumb, IonBreadcrumbs, IonChip, IonNote, ToastController as ToastController$1, IonCol, IonRow, IonRefresher, IonRefresherContent, IonRippleEffect, AlertController, IonMenuButton, IonFooter, IonListHeader, IonInfiniteScroll, IonInfiniteScrollContent, IonGrid, MenuController, IonMenu, IonMenuToggle, IonSplitPane } from '@ionic/angular/standalone';
5
5
  import * as i1 from '@angular/common';
@@ -49,7 +49,7 @@ import 'prismjs/components/prism-json';
49
49
  * Current version of valtech-components.
50
50
  * This is automatically updated during the publish process.
51
51
  */
52
- const VERSION = '2.0.674';
52
+ const VERSION = '2.0.676';
53
53
 
54
54
  /**
55
55
  * Servicio para gestionar presets de componentes.
@@ -579,6 +579,230 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
579
579
  }]
580
580
  }] });
581
581
 
582
+ /**
583
+ * Valores por defecto de configuración
584
+ */
585
+ const DEFAULT_I18N_CONFIG = {
586
+ defaultLanguage: 'es',
587
+ supportedLanguages: ['es', 'en'],
588
+ detectBrowserLanguage: true,
589
+ content: {},
590
+ includeDefaultContent: true,
591
+ };
592
+ /**
593
+ * Clave para persistir idioma en localStorage
594
+ */
595
+ const LANG_STORAGE_KEY$1 = 'app_lang';
596
+
597
+ /**
598
+ * Servicio de internacionalización basado en Angular Signals.
599
+ *
600
+ * Características:
601
+ * - Sin RxJS: usa Signals para evitar memory leaks y congelamiento
602
+ * - Namespace-based: organiza traducciones por contexto
603
+ * - Fallback multi-nivel: namespace → _global → placeholder
604
+ * - Interpolación: soporta {variable} en textos
605
+ *
606
+ * @example
607
+ * // En un componente
608
+ * i18n = inject(I18nService);
609
+ *
610
+ * // Obtener texto
611
+ * const title = this.i18n.t('title', 'Login');
612
+ *
613
+ * // Con interpolación
614
+ * const welcome = this.i18n.t('welcome', 'Login', { name: 'Juan' });
615
+ *
616
+ * // Cambiar idioma
617
+ * this.i18n.setLanguage('en');
618
+ */
619
+ class I18nService {
620
+ constructor() {
621
+ // Estado interno con Signals
622
+ this._lang = signal(DEFAULT_I18N_CONFIG.defaultLanguage);
623
+ this._content = signal({});
624
+ this._supportedLanguages = signal(DEFAULT_I18N_CONFIG.supportedLanguages);
625
+ // Públicos readonly
626
+ this.lang = this._lang.asReadonly();
627
+ this.supportedLanguages = this._supportedLanguages.asReadonly();
628
+ // Computed para verificaciones rápidas
629
+ this.isSpanish = computed(() => this._lang() === 'es');
630
+ this.isEnglish = computed(() => this._lang() === 'en');
631
+ this.loadStoredLanguage();
632
+ }
633
+ /**
634
+ * Obtiene texto traducido (alias corto de getText)
635
+ *
636
+ * @param key Clave del texto
637
+ * @param namespace Namespace (default: '_global')
638
+ * @param data Variables para interpolación
639
+ * @returns Texto traducido o placeholder [namespace.key]
640
+ *
641
+ * @example
642
+ * i18n.t('submit'); // busca en _global
643
+ * i18n.t('title', 'Login'); // busca en Login
644
+ * i18n.t('welcome', 'Login', {name}); // con interpolación
645
+ */
646
+ t(key, namespace, data) {
647
+ return this.getText(key, namespace, data);
648
+ }
649
+ /**
650
+ * Obtiene texto traducido
651
+ *
652
+ * Fallback order:
653
+ * 1. content[namespace][lang][key]
654
+ * 2. content['_global'][lang][key]
655
+ * 3. "[namespace.key]" (placeholder)
656
+ */
657
+ getText(key, namespace, data) {
658
+ const content = this._content();
659
+ const lang = this._lang();
660
+ const ns = namespace || '_global';
661
+ // Buscar en namespace específico
662
+ let text = content[ns]?.[lang]?.[key];
663
+ // Fallback a _global
664
+ if (!text && ns !== '_global') {
665
+ text = content['_global']?.[lang]?.[key];
666
+ }
667
+ // Fallback a placeholder
668
+ if (!text) {
669
+ console.warn(`[i18n] Missing translation: ${ns}.${key} (${lang})`);
670
+ return `[${ns}.${key}]`;
671
+ }
672
+ // Aplicar interpolación si hay data
673
+ if (data) {
674
+ return this.interpolate(text, data);
675
+ }
676
+ return text;
677
+ }
678
+ /**
679
+ * Cambia el idioma de la aplicación
680
+ *
681
+ * @param lang Nuevo idioma
682
+ * @param forceReload Si true, recarga la página (fallback si reactividad falla)
683
+ */
684
+ setLanguage(lang, forceReload = false) {
685
+ if (!this._supportedLanguages().includes(lang)) {
686
+ console.warn(`[i18n] Language '${lang}' not in supported languages`);
687
+ return;
688
+ }
689
+ if (lang === this._lang()) {
690
+ return;
691
+ }
692
+ // Persistir en localStorage
693
+ localStorage.setItem(LANG_STORAGE_KEY$1, lang);
694
+ // Actualizar signal
695
+ this._lang.set(lang);
696
+ // Fallback: recargar si se solicita
697
+ if (forceReload) {
698
+ window.location.reload();
699
+ }
700
+ }
701
+ /**
702
+ * Registra contenido de traducciones para un namespace
703
+ *
704
+ * @param namespace Nombre del namespace
705
+ * @param content Contenido de traducciones
706
+ *
707
+ * @example
708
+ * i18n.registerContent('Login', {
709
+ * es: { title: 'Iniciar sesión' },
710
+ * en: { title: 'Sign in' }
711
+ * });
712
+ */
713
+ registerContent(namespace, content) {
714
+ this._content.update((store) => ({
715
+ ...store,
716
+ [namespace]: content,
717
+ }));
718
+ }
719
+ /**
720
+ * Registra múltiples namespaces de una vez
721
+ *
722
+ * @param contentStore Objeto con namespaces como keys
723
+ */
724
+ registerContentBulk(contentStore) {
725
+ this._content.update((store) => ({
726
+ ...store,
727
+ ...contentStore,
728
+ }));
729
+ }
730
+ /**
731
+ * Configura los idiomas soportados
732
+ */
733
+ setI18nLanguages(languages) {
734
+ this._supportedLanguages.set(languages);
735
+ }
736
+ /**
737
+ * Obtiene todos los namespaces registrados
738
+ */
739
+ getNamespaces() {
740
+ return Object.keys(this._content());
741
+ }
742
+ /**
743
+ * Verifica si un namespace tiene traducciones
744
+ */
745
+ hasNamespace(namespace) {
746
+ return namespace in this._content();
747
+ }
748
+ /**
749
+ * Carga idioma guardado en localStorage o detecta del navegador
750
+ */
751
+ loadStoredLanguage() {
752
+ const stored = localStorage.getItem(LANG_STORAGE_KEY$1);
753
+ if (stored && this.isValidLanguage(stored)) {
754
+ this._lang.set(stored);
755
+ return;
756
+ }
757
+ // Detectar idioma del navegador
758
+ const browserLang = navigator.language.split('-')[0];
759
+ if (this.isValidLanguage(browserLang)) {
760
+ this._lang.set(browserLang);
761
+ localStorage.setItem(LANG_STORAGE_KEY$1, browserLang);
762
+ }
763
+ }
764
+ /**
765
+ * Valida si un idioma está soportado
766
+ */
767
+ isValidLanguage(lang) {
768
+ return this._supportedLanguages().includes(lang);
769
+ }
770
+ /**
771
+ * Reemplaza {variable} en texto con valores de data
772
+ *
773
+ * @example
774
+ * interpolate('Hola {name}', { name: 'Juan' }) // 'Hola Juan'
775
+ */
776
+ interpolate(text, data) {
777
+ return Object.entries(data).reduce((result, [key, value]) => {
778
+ const regex = new RegExp(`\\{${key}\\}`, 'g');
779
+ return result.replace(regex, value);
780
+ }, text);
781
+ }
782
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: I18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
783
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: I18nService, providedIn: 'root' }); }
784
+ }
785
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: I18nService, decorators: [{
786
+ type: Injectable,
787
+ args: [{ providedIn: 'root' }]
788
+ }], ctorParameters: () => [] });
789
+
790
+ /**
791
+ * Configuracion por defecto para header tipo 'home'
792
+ */
793
+ const DEFAULT_HOME_HEADER = {
794
+ type: 'home',
795
+ withMenu: false,
796
+ actions: [],
797
+ };
798
+ /**
799
+ * Configuracion por defecto para header tipo 'back'
800
+ */
801
+ const DEFAULT_BACK_HEADER = {
802
+ type: 'back',
803
+ titleKey: '',
804
+ };
805
+
582
806
  /* eslint-disable no-underscore-dangle */
583
807
  /**
584
808
  * Service for opening URLs using Capacitor's InAppBrowser plugin.
@@ -612,15 +836,146 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
612
836
  }], ctorParameters: () => [] });
613
837
 
614
838
  /**
615
- * Service for navigation and routing within the application.
616
- * Supports navigation with data transfer, in-app browser, and opening links in new tabs.
839
+ * NavigationService
840
+ *
841
+ * Servicio centralizado para navegacion y configuracion de headers.
842
+ * Permite a las paginas declarar su tipo de header de forma simple.
843
+ *
844
+ * @example
845
+ * // En una pagina con header de tipo "back"
846
+ * export class ProfilePage {
847
+ * private nav = inject(NavigationService);
848
+ *
849
+ * constructor() {
850
+ * this.nav.setBackHeader('pageTitle', 'Settings.Profile');
851
+ * }
852
+ * }
853
+ *
854
+ * @example
855
+ * // En el layout principal (tabs.page.ts)
856
+ * export class TabsPage {
857
+ * private nav = inject(NavigationService);
858
+ *
859
+ * headerConfig = this.nav.headerConfig;
860
+ * headerTitle = this.nav.headerTitle;
861
+ * }
617
862
  */
618
863
  class NavigationService {
619
864
  constructor(router, location, inAppBrowser) {
620
865
  this.router = router;
621
866
  this.location = location;
622
867
  this.inAppBrowser = inAppBrowser;
868
+ this.i18n = inject(I18nService);
869
+ // ============================================
870
+ // Header State (Signals)
871
+ // ============================================
872
+ this._headerConfig = signal(DEFAULT_HOME_HEADER);
873
+ /**
874
+ * Configuracion actual del header (readonly signal)
875
+ */
876
+ this.headerConfig = this._headerConfig.asReadonly();
877
+ /**
878
+ * Titulo del header traducido y reactivo al cambio de idioma.
879
+ * Solo aplica para headers tipo 'back' o 'custom' con titleKey.
880
+ */
881
+ this.headerTitle = computed(() => {
882
+ const config = this._headerConfig();
883
+ this.i18n.lang(); // Dependencia reactiva al idioma
884
+ if (config.type === 'back' && config.titleKey) {
885
+ return this.translateKey(config.titleKey);
886
+ }
887
+ if (config.type === 'custom') {
888
+ if (config.titleKey) {
889
+ return this.translateKey(config.titleKey);
890
+ }
891
+ return config.title || '';
892
+ }
893
+ return '';
894
+ });
895
+ /**
896
+ * Indica si el header actual tiene boton volver
897
+ */
898
+ this.hasBackButton = computed(() => {
899
+ const config = this._headerConfig();
900
+ return config.type === 'back' || (config.type === 'custom' && config.withBack);
901
+ });
902
+ }
903
+ // ============================================
904
+ // Header Configuration Methods
905
+ // ============================================
906
+ /**
907
+ * Configura un header tipo "back" con titulo traducido.
908
+ *
909
+ * @param key Clave i18n (ej: 'pageTitle')
910
+ * @param namespace Namespace i18n (ej: 'Settings.Profile')
911
+ * @param options Opciones adicionales (backText, withMenu)
912
+ *
913
+ * @example
914
+ * // Sin menu
915
+ * this.nav.setBackHeader('pageTitle', 'Settings.Profile');
916
+ *
917
+ * @example
918
+ * // Con menu hamburguesa
919
+ * this.nav.setBackHeader('pageTitle', 'Settings.Profile', { withMenu: true });
920
+ */
921
+ setBackHeader(key, namespace, options) {
922
+ const config = {
923
+ type: 'back',
924
+ titleKey: `${namespace}.${key}`,
925
+ backText: options?.backText,
926
+ withMenu: options?.withMenu,
927
+ };
928
+ this._headerConfig.set(config);
929
+ }
930
+ /**
931
+ * Configura un header tipo "home" con logo y acciones.
932
+ *
933
+ * @param options Opciones del header home
934
+ *
935
+ * @example
936
+ * this.nav.setHomeHeader({
937
+ * withMenu: true,
938
+ * actions: [
939
+ * { type: 'ICON', token: 'notifications', position: 'right', description: 'notifications-outline' }
940
+ * ]
941
+ * });
942
+ */
943
+ setHomeHeader(options = {}) {
944
+ const config = {
945
+ type: 'home',
946
+ withMenu: options.withMenu ?? false,
947
+ actions: options.actions ?? [],
948
+ logoSrc: options.logoSrc,
949
+ };
950
+ this._headerConfig.set(config);
951
+ }
952
+ /**
953
+ * Configura un header personalizado.
954
+ *
955
+ * @param options Opciones del header
956
+ */
957
+ setCustomHeader(options) {
958
+ const config = {
959
+ type: 'custom',
960
+ ...options,
961
+ };
962
+ this._headerConfig.set(config);
623
963
  }
964
+ /**
965
+ * Oculta el header completamente.
966
+ */
967
+ hideHeader() {
968
+ this._headerConfig.set({ type: 'none' });
969
+ }
970
+ /**
971
+ * Resetea el header al estado por defecto (home).
972
+ */
973
+ resetHeader() {
974
+ this._headerConfig.set(DEFAULT_HOME_HEADER);
975
+ }
976
+ // ============================================
977
+ // Navigation Methods
978
+ // ============================================
624
979
  /**
625
980
  * Opens a URL using the in-app browser service.
626
981
  * @param url The URL to open
@@ -648,8 +1003,8 @@ class NavigationService {
648
1003
  navigateByUrl(url) {
649
1004
  this.router
650
1005
  .navigateByUrl(url)
651
- .then(response => { })
652
- .catch(error => { });
1006
+ .then(() => { })
1007
+ .catch(() => { });
653
1008
  }
654
1009
  /**
655
1010
  * Opens a URL in a new browser tab.
@@ -664,6 +1019,21 @@ class NavigationService {
664
1019
  back() {
665
1020
  this.location.back();
666
1021
  }
1022
+ // ============================================
1023
+ // Private Helpers
1024
+ // ============================================
1025
+ /**
1026
+ * Traduce una clave i18n en formato 'namespace.key'
1027
+ */
1028
+ translateKey(fullKey) {
1029
+ const lastDot = fullKey.lastIndexOf('.');
1030
+ if (lastDot === -1) {
1031
+ return this.i18n.t(fullKey);
1032
+ }
1033
+ const namespace = fullKey.substring(0, lastDot);
1034
+ const key = fullKey.substring(lastDot + 1);
1035
+ return this.i18n.t(key, namespace);
1036
+ }
667
1037
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NavigationService, deps: [{ token: i1$1.Router }, { token: i1.Location }, { token: InAppBrowserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
668
1038
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NavigationService, providedIn: 'root' }); }
669
1039
  }
@@ -3239,214 +3609,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
3239
3609
  }]
3240
3610
  }] });
3241
3611
 
3242
- /**
3243
- * Valores por defecto de configuración
3244
- */
3245
- const DEFAULT_I18N_CONFIG = {
3246
- defaultLanguage: 'es',
3247
- supportedLanguages: ['es', 'en'],
3248
- detectBrowserLanguage: true,
3249
- content: {},
3250
- includeDefaultContent: true,
3251
- };
3252
- /**
3253
- * Clave para persistir idioma en localStorage
3254
- */
3255
- const LANG_STORAGE_KEY$1 = 'app_lang';
3256
-
3257
- /**
3258
- * Servicio de internacionalización basado en Angular Signals.
3259
- *
3260
- * Características:
3261
- * - Sin RxJS: usa Signals para evitar memory leaks y congelamiento
3262
- * - Namespace-based: organiza traducciones por contexto
3263
- * - Fallback multi-nivel: namespace → _global → placeholder
3264
- * - Interpolación: soporta {variable} en textos
3265
- *
3266
- * @example
3267
- * // En un componente
3268
- * i18n = inject(I18nService);
3269
- *
3270
- * // Obtener texto
3271
- * const title = this.i18n.t('title', 'Login');
3272
- *
3273
- * // Con interpolación
3274
- * const welcome = this.i18n.t('welcome', 'Login', { name: 'Juan' });
3275
- *
3276
- * // Cambiar idioma
3277
- * this.i18n.setLanguage('en');
3278
- */
3279
- class I18nService {
3280
- constructor() {
3281
- // Estado interno con Signals
3282
- this._lang = signal(DEFAULT_I18N_CONFIG.defaultLanguage);
3283
- this._content = signal({});
3284
- this._supportedLanguages = signal(DEFAULT_I18N_CONFIG.supportedLanguages);
3285
- // Públicos readonly
3286
- this.lang = this._lang.asReadonly();
3287
- this.supportedLanguages = this._supportedLanguages.asReadonly();
3288
- // Computed para verificaciones rápidas
3289
- this.isSpanish = computed(() => this._lang() === 'es');
3290
- this.isEnglish = computed(() => this._lang() === 'en');
3291
- this.loadStoredLanguage();
3292
- }
3293
- /**
3294
- * Obtiene texto traducido (alias corto de getText)
3295
- *
3296
- * @param key Clave del texto
3297
- * @param namespace Namespace (default: '_global')
3298
- * @param data Variables para interpolación
3299
- * @returns Texto traducido o placeholder [namespace.key]
3300
- *
3301
- * @example
3302
- * i18n.t('submit'); // busca en _global
3303
- * i18n.t('title', 'Login'); // busca en Login
3304
- * i18n.t('welcome', 'Login', {name}); // con interpolación
3305
- */
3306
- t(key, namespace, data) {
3307
- return this.getText(key, namespace, data);
3308
- }
3309
- /**
3310
- * Obtiene texto traducido
3311
- *
3312
- * Fallback order:
3313
- * 1. content[namespace][lang][key]
3314
- * 2. content['_global'][lang][key]
3315
- * 3. "[namespace.key]" (placeholder)
3316
- */
3317
- getText(key, namespace, data) {
3318
- const content = this._content();
3319
- const lang = this._lang();
3320
- const ns = namespace || '_global';
3321
- // Buscar en namespace específico
3322
- let text = content[ns]?.[lang]?.[key];
3323
- // Fallback a _global
3324
- if (!text && ns !== '_global') {
3325
- text = content['_global']?.[lang]?.[key];
3326
- }
3327
- // Fallback a placeholder
3328
- if (!text) {
3329
- console.warn(`[i18n] Missing translation: ${ns}.${key} (${lang})`);
3330
- return `[${ns}.${key}]`;
3331
- }
3332
- // Aplicar interpolación si hay data
3333
- if (data) {
3334
- return this.interpolate(text, data);
3335
- }
3336
- return text;
3337
- }
3338
- /**
3339
- * Cambia el idioma de la aplicación
3340
- *
3341
- * @param lang Nuevo idioma
3342
- * @param forceReload Si true, recarga la página (fallback si reactividad falla)
3343
- */
3344
- setLanguage(lang, forceReload = false) {
3345
- if (!this._supportedLanguages().includes(lang)) {
3346
- console.warn(`[i18n] Language '${lang}' not in supported languages`);
3347
- return;
3348
- }
3349
- if (lang === this._lang()) {
3350
- return;
3351
- }
3352
- // Persistir en localStorage
3353
- localStorage.setItem(LANG_STORAGE_KEY$1, lang);
3354
- // Actualizar signal
3355
- this._lang.set(lang);
3356
- // Fallback: recargar si se solicita
3357
- if (forceReload) {
3358
- window.location.reload();
3359
- }
3360
- }
3361
- /**
3362
- * Registra contenido de traducciones para un namespace
3363
- *
3364
- * @param namespace Nombre del namespace
3365
- * @param content Contenido de traducciones
3366
- *
3367
- * @example
3368
- * i18n.registerContent('Login', {
3369
- * es: { title: 'Iniciar sesión' },
3370
- * en: { title: 'Sign in' }
3371
- * });
3372
- */
3373
- registerContent(namespace, content) {
3374
- this._content.update((store) => ({
3375
- ...store,
3376
- [namespace]: content,
3377
- }));
3378
- }
3379
- /**
3380
- * Registra múltiples namespaces de una vez
3381
- *
3382
- * @param contentStore Objeto con namespaces como keys
3383
- */
3384
- registerContentBulk(contentStore) {
3385
- this._content.update((store) => ({
3386
- ...store,
3387
- ...contentStore,
3388
- }));
3389
- }
3390
- /**
3391
- * Configura los idiomas soportados
3392
- */
3393
- setI18nLanguages(languages) {
3394
- this._supportedLanguages.set(languages);
3395
- }
3396
- /**
3397
- * Obtiene todos los namespaces registrados
3398
- */
3399
- getNamespaces() {
3400
- return Object.keys(this._content());
3401
- }
3402
- /**
3403
- * Verifica si un namespace tiene traducciones
3404
- */
3405
- hasNamespace(namespace) {
3406
- return namespace in this._content();
3407
- }
3408
- /**
3409
- * Carga idioma guardado en localStorage o detecta del navegador
3410
- */
3411
- loadStoredLanguage() {
3412
- const stored = localStorage.getItem(LANG_STORAGE_KEY$1);
3413
- if (stored && this.isValidLanguage(stored)) {
3414
- this._lang.set(stored);
3415
- return;
3416
- }
3417
- // Detectar idioma del navegador
3418
- const browserLang = navigator.language.split('-')[0];
3419
- if (this.isValidLanguage(browserLang)) {
3420
- this._lang.set(browserLang);
3421
- localStorage.setItem(LANG_STORAGE_KEY$1, browserLang);
3422
- }
3423
- }
3424
- /**
3425
- * Valida si un idioma está soportado
3426
- */
3427
- isValidLanguage(lang) {
3428
- return this._supportedLanguages().includes(lang);
3429
- }
3430
- /**
3431
- * Reemplaza {variable} en texto con valores de data
3432
- *
3433
- * @example
3434
- * interpolate('Hola {name}', { name: 'Juan' }) // 'Hola Juan'
3435
- */
3436
- interpolate(text, data) {
3437
- return Object.entries(data).reduce((result, [key, value]) => {
3438
- const regex = new RegExp(`\\{${key}\\}`, 'g');
3439
- return result.replace(regex, value);
3440
- }, text);
3441
- }
3442
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: I18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3443
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: I18nService, providedIn: 'root' }); }
3444
- }
3445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: I18nService, decorators: [{
3446
- type: Injectable,
3447
- args: [{ providedIn: 'root' }]
3448
- }], ctorParameters: () => [] });
3449
-
3450
3612
  /**
3451
3613
  * Helper para resolver traducciones i18n en InputMetadata y FormMetadata.
3452
3614
  *
@@ -40944,5 +41106,5 @@ function buildFooterLinks(links, t) {
40944
41106
  * Generated bundle index. Do not edit.
40945
41107
  */
40946
41108
 
40947
- export { ACTION_CARD_DEFAULTS, AD_SIZE_MAP, API_TABLE_COLUMN_LABELS, ARTICLE_SPACING, AccordionComponent, ActionCardComponent, ActionHeaderComponent, ActionType, AdSlotComponent, AdsLoaderService, AdsService, AlertBoxComponent, AnalyticsErrorHandler, AnalyticsRouterTracker, AnalyticsService, AppConfigService, ArticleBuilder, ArticleComponent, AuthBackgroundComponent, AuthService, AuthStateService, AuthStorageService, AuthSyncService, AvatarComponent, BOTTOM_NAV_DEFAULTS, BannerComponent, BaseDefault, BottomNavComponent, BoxComponent, BreadcrumbComponent, ButtonComponent, ButtonGroupComponent, COMMON_COUNTRY_CODES, COMMON_CURRENCIES, CURRENCY_INFO, CardComponent, CardSection, CardType, CardsCarouselComponent, CheckInputComponent, ChipGroupComponent, ClearDefault, ClearDefaultBlock, ClearDefaultFull, ClearDefaultRound, ClearDefaultRoundBlock, ClearDefaultRoundFull, CodeDisplayComponent, CommandDisplayComponent, CommentComponent, CommentInputComponent, CommentSectionComponent, CompanyFooterComponent, ComponentStates, ConfirmationDialogService, ContentLoaderComponent, ContentReactionComponent, CountdownComponent, CurrencyInputComponent, DEFAULT_ADS_CONFIG, DEFAULT_APP_CONFIG_SERVICE_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CANCEL_BUTTON, DEFAULT_CONFIRM_BUTTON, DEFAULT_COUNTDOWN_LABELS, DEFAULT_COUNTDOWN_LABELS_EN, DEFAULT_EMPTY_STATE, DEFAULT_EMULATOR_CONFIG, DEFAULT_FEEDBACK_CONFIG, DEFAULT_FEEDBACK_TYPE_OPTIONS, DEFAULT_INFINITE_LIST_METADATA, DEFAULT_LEGEND_LABELS, DEFAULT_MODAL_CANCEL_BUTTON, DEFAULT_MODAL_CONFIRM_BUTTON, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PAYMENT_STATUS_COLORS, DEFAULT_PAYMENT_STATUS_LABELS, DEFAULT_PLATFORMS, DEFAULT_REFRESHER_METADATA, DEFAULT_SKELETON_CONFIG, DEFAULT_STATUS_COLORS, DEFAULT_STATUS_LABELS, DEFAULT_WINNER_LABELS, DataTableComponent, DateInputComponent, DateRangeInputComponent, DetailSkeletonComponent, DeviceService, DisplayComponent, DividerComponent, DocsApiTableComponent, DocsBreadcrumbComponent, DocsCalloutComponent, DocsCodeExampleComponent, DocsLayoutComponent, DocsNavLinksComponent, DocsNavigationService, DocsPageComponent, DocsSearchComponent, DocsSectionComponent, DocsShellComponent, DocsSidebarComponent, DocsTocComponent, DownloadService, EmailInputComponent, ExpandableTextComponent, FEATURES_LIST_DEFAULTS, FabComponent, FeaturesListComponent, FeedbackFormComponent, FeedbackService, FileInputComponent, FirebaseService, FirestoreCollectionFactory, FirestoreService, FooterComponent, FooterLinksComponent, FormComponent, FormFooterComponent, FormSkeletonComponent, FunHeaderComponent, GlowCardComponent, GridSkeletonComponent, HeaderComponent, HintComponent, HorizontalScrollComponent, HourInputComponent, HrefComponent, I18nService, INITIAL_AUTH_STATE, INITIAL_MFA_STATE, Icon, IconComponent, IconService, ImageComponent, InAppBrowserService, InfiniteListComponent, InfoComponent, InputI18nHelper, InputType, ItemListComponent, LANG_STORAGE_KEY$1 as LANG_STORAGE_KEY, LOGIN_DEFAULTS, LanguageSelectorComponent, LayeredCardComponent, LayoutComponent, LinkComponent, LinkProcessorService, LinkedProvidersComponent, LinksAccordionComponent, LinksCakeComponent, ListSkeletonComponent, LoadingDirective, LocalStorageService, LocaleService, LoginComponent, MODAL_SIZES, MOTION, MaintenancePageComponent, MenuComponent, MessagingService, MetaService, ModalService, MultiSelectSearchComponent, NavigationService, NoContentComponent, NotesBoxComponent, NotificationsService, NumberFromToComponent, NumberInputComponent, NumberStepperComponent, OAUTH_PROVIDERS_INFO, OAuthCallbackComponent, OAuthService, OutlineDefault, OutlineDefaultBlock, OutlineDefaultFull, OutlineDefaultRound, OutlineDefaultRoundBlock, OutlineDefaultRoundFull, PLATFORM_CONFIGS, PageContentComponent, PageTemplateComponent, PageWrapperComponent, PaginationComponent, PaginationService, ParticipantCardComponent, PasswordInputComponent, PhoneInputComponent, PillComponent, PinInputComponent, PlainCodeBoxComponent, PopoverSelectorComponent, PresetService, PriceTagComponent, PrimarySolidBlockButton, PrimarySolidBlockHrefButton, PrimarySolidBlockIconButton, PrimarySolidBlockIconHrefButton, PrimarySolidDefaultRoundButton, PrimarySolidDefaultRoundHrefButton, PrimarySolidDefaultRoundIconButton, PrimarySolidDefaultRoundIconHrefButton, PrimarySolidFullButton, PrimarySolidFullHrefButton, PrimarySolidFullIconButton, PrimarySolidFullIconHrefButton, PrimarySolidLargeRoundButton, PrimarySolidLargeRoundHrefButton, PrimarySolidLargeRoundIconButton, PrimarySolidLargeRoundIconHrefButton, PrimarySolidSmallRoundButton, PrimarySolidSmallRoundHrefButton, PrimarySolidSmallRoundIconButton, PrimarySolidSmallRoundIconHrefButton, ProcessLinksPipe, ProfileSkeletonComponent, ProgressBarComponent, ProgressRingComponent, ProgressStatusComponent, PrompterComponent, QR_PRESETS, QrCodeComponent, QrGeneratorService, QueryBuilder, QuoteBoxComponent, RadioInputComponent, RaffleStatusCardComponent, RangeInputComponent, RatingComponent, RecapCardComponent, RefresherComponent, RightsFooterComponent, RotatingTextComponent, SKELETON_PRESETS, SearchSelectorComponent, SearchbarComponent, SecondarySolidBlockButton, SecondarySolidBlockHrefButton, SecondarySolidBlockIconButton, SecondarySolidBlockIconHrefButton, SecondarySolidDefaultRoundButton, SecondarySolidDefaultRoundHrefButton, SecondarySolidDefaultRoundIconButton, SecondarySolidDefaultRoundIconHrefButton, SecondarySolidFullButton, SecondarySolidFullHrefButton, SecondarySolidFullIconButton, SecondarySolidFullIconHrefButton, SecondarySolidLargeRoundButton, SecondarySolidLargeRoundHrefButton, SecondarySolidLargeRoundIconButton, SecondarySolidLargeRoundIconHrefButton, SecondarySolidSmallRoundButton, SecondarySolidSmallRoundHrefButton, SecondarySolidSmallRoundIconButton, SecondarySolidSmallRoundIconHrefButton, SegmentControlComponent, SelectSearchComponent, SessionService, ShareButtonsComponent, SimpleComponent, SkeletonComponent, SkeletonService, SolidBlockButton, SolidDefault, SolidDefaultBlock, SolidDefaultButton, SolidDefaultFull, SolidDefaultRound, SolidDefaultRoundBlock, SolidDefaultRoundButton, SolidDefaultRoundFull, SolidFullButton, SolidLargeButton, SolidLargeRoundButton, SolidSmallButton, SolidSmallRoundButton, StatsCardComponent, StepperComponent, StorageService, SwipeCarouselComponent, TabbedContentComponent, TableSkeletonComponent, TabsComponent, Terminal404Component, TestimonialCardComponent, TestimonialCarouselComponent, TextComponent, TextInputComponent, TextareaInputComponent, ThemeOption, ThemeService, TicketGridComponent, TimelineComponent, TitleBlockComponent, TitleComponent, ToastService, ToggleInputComponent, TokenService, ToolbarActionType, ToolbarComponent, TranslatePipe, TypedCollection, UpdateBannerComponent, UsernameInputComponent, VALTECH_ADS_CONFIG, VALTECH_APP_CONFIG, VALTECH_AUTH_CONFIG, VALTECH_COMPANY_LINKS, VALTECH_DEFAULT_CONTENT, VALTECH_FEEDBACK_CONFIG, VALTECH_FIREBASE_CONFIG, VALTECH_FOOTER_I18N, VALTECH_FOOTER_LOGO, VALTECH_LANGUAGE_SELECTOR, VALTECH_SOCIAL_LINKS, VERSION, WinnerDisplayComponent, WizardComponent, WizardFooterComponent, applyDefaultValueToControl, authGuard, authInterceptor, buildFooterLinks, buildPath, collections, createFirebaseConfig, createGlowCardProps, createInitialPaginationState, createNumberFromToField, createTitleProps, extractPathParams, getAppInfo, getAppVersion, getCollectionPath, getDocumentId, goToTop, guestGuard, hasEmulators, isAtEnd, isCollectionPath, isDocumentPath, isEmulatorMode, isValidPath, joinPath, maxLength, permissionGuard, permissionGuardFromRoute, provideValtechAds, provideValtechAppConfig, provideValtechAuth, provideValtechAuthInterceptor, provideValtechFeedback, provideValtechFirebase, provideValtechI18n, provideValtechPresets, provideValtechSkeleton, query, replaceSpecialChars, resolveColor, resolveInputDefaultValue, roleGuard, storagePaths, superAdminGuard };
41109
+ export { ACTION_CARD_DEFAULTS, AD_SIZE_MAP, API_TABLE_COLUMN_LABELS, ARTICLE_SPACING, AccordionComponent, ActionCardComponent, ActionHeaderComponent, ActionType, AdSlotComponent, AdsLoaderService, AdsService, AlertBoxComponent, AnalyticsErrorHandler, AnalyticsRouterTracker, AnalyticsService, AppConfigService, ArticleBuilder, ArticleComponent, AuthBackgroundComponent, AuthService, AuthStateService, AuthStorageService, AuthSyncService, AvatarComponent, BOTTOM_NAV_DEFAULTS, BannerComponent, BaseDefault, BottomNavComponent, BoxComponent, BreadcrumbComponent, ButtonComponent, ButtonGroupComponent, COMMON_COUNTRY_CODES, COMMON_CURRENCIES, CURRENCY_INFO, CardComponent, CardSection, CardType, CardsCarouselComponent, CheckInputComponent, ChipGroupComponent, ClearDefault, ClearDefaultBlock, ClearDefaultFull, ClearDefaultRound, ClearDefaultRoundBlock, ClearDefaultRoundFull, CodeDisplayComponent, CommandDisplayComponent, CommentComponent, CommentInputComponent, CommentSectionComponent, CompanyFooterComponent, ComponentStates, ConfirmationDialogService, ContentLoaderComponent, ContentReactionComponent, CountdownComponent, CurrencyInputComponent, DEFAULT_ADS_CONFIG, DEFAULT_APP_CONFIG_SERVICE_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_BACK_HEADER, DEFAULT_CANCEL_BUTTON, DEFAULT_CONFIRM_BUTTON, DEFAULT_COUNTDOWN_LABELS, DEFAULT_COUNTDOWN_LABELS_EN, DEFAULT_EMPTY_STATE, DEFAULT_EMULATOR_CONFIG, DEFAULT_FEEDBACK_CONFIG, DEFAULT_FEEDBACK_TYPE_OPTIONS, DEFAULT_HOME_HEADER, DEFAULT_INFINITE_LIST_METADATA, DEFAULT_LEGEND_LABELS, DEFAULT_MODAL_CANCEL_BUTTON, DEFAULT_MODAL_CONFIRM_BUTTON, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PAYMENT_STATUS_COLORS, DEFAULT_PAYMENT_STATUS_LABELS, DEFAULT_PLATFORMS, DEFAULT_REFRESHER_METADATA, DEFAULT_SKELETON_CONFIG, DEFAULT_STATUS_COLORS, DEFAULT_STATUS_LABELS, DEFAULT_WINNER_LABELS, DataTableComponent, DateInputComponent, DateRangeInputComponent, DetailSkeletonComponent, DeviceService, DisplayComponent, DividerComponent, DocsApiTableComponent, DocsBreadcrumbComponent, DocsCalloutComponent, DocsCodeExampleComponent, DocsLayoutComponent, DocsNavLinksComponent, DocsNavigationService, DocsPageComponent, DocsSearchComponent, DocsSectionComponent, DocsShellComponent, DocsSidebarComponent, DocsTocComponent, DownloadService, EmailInputComponent, ExpandableTextComponent, FEATURES_LIST_DEFAULTS, FabComponent, FeaturesListComponent, FeedbackFormComponent, FeedbackService, FileInputComponent, FirebaseService, FirestoreCollectionFactory, FirestoreService, FooterComponent, FooterLinksComponent, FormComponent, FormFooterComponent, FormSkeletonComponent, FunHeaderComponent, GlowCardComponent, GridSkeletonComponent, HeaderComponent, HintComponent, HorizontalScrollComponent, HourInputComponent, HrefComponent, I18nService, INITIAL_AUTH_STATE, INITIAL_MFA_STATE, Icon, IconComponent, IconService, ImageComponent, InAppBrowserService, InfiniteListComponent, InfoComponent, InputI18nHelper, InputType, ItemListComponent, LANG_STORAGE_KEY$1 as LANG_STORAGE_KEY, LOGIN_DEFAULTS, LanguageSelectorComponent, LayeredCardComponent, LayoutComponent, LinkComponent, LinkProcessorService, LinkedProvidersComponent, LinksAccordionComponent, LinksCakeComponent, ListSkeletonComponent, LoadingDirective, LocalStorageService, LocaleService, LoginComponent, MODAL_SIZES, MOTION, MaintenancePageComponent, MenuComponent, MessagingService, MetaService, ModalService, MultiSelectSearchComponent, NavigationService, NoContentComponent, NotesBoxComponent, NotificationsService, NumberFromToComponent, NumberInputComponent, NumberStepperComponent, OAUTH_PROVIDERS_INFO, OAuthCallbackComponent, OAuthService, OutlineDefault, OutlineDefaultBlock, OutlineDefaultFull, OutlineDefaultRound, OutlineDefaultRoundBlock, OutlineDefaultRoundFull, PLATFORM_CONFIGS, PageContentComponent, PageTemplateComponent, PageWrapperComponent, PaginationComponent, PaginationService, ParticipantCardComponent, PasswordInputComponent, PhoneInputComponent, PillComponent, PinInputComponent, PlainCodeBoxComponent, PopoverSelectorComponent, PresetService, PriceTagComponent, PrimarySolidBlockButton, PrimarySolidBlockHrefButton, PrimarySolidBlockIconButton, PrimarySolidBlockIconHrefButton, PrimarySolidDefaultRoundButton, PrimarySolidDefaultRoundHrefButton, PrimarySolidDefaultRoundIconButton, PrimarySolidDefaultRoundIconHrefButton, PrimarySolidFullButton, PrimarySolidFullHrefButton, PrimarySolidFullIconButton, PrimarySolidFullIconHrefButton, PrimarySolidLargeRoundButton, PrimarySolidLargeRoundHrefButton, PrimarySolidLargeRoundIconButton, PrimarySolidLargeRoundIconHrefButton, PrimarySolidSmallRoundButton, PrimarySolidSmallRoundHrefButton, PrimarySolidSmallRoundIconButton, PrimarySolidSmallRoundIconHrefButton, ProcessLinksPipe, ProfileSkeletonComponent, ProgressBarComponent, ProgressRingComponent, ProgressStatusComponent, PrompterComponent, QR_PRESETS, QrCodeComponent, QrGeneratorService, QueryBuilder, QuoteBoxComponent, RadioInputComponent, RaffleStatusCardComponent, RangeInputComponent, RatingComponent, RecapCardComponent, RefresherComponent, RightsFooterComponent, RotatingTextComponent, SKELETON_PRESETS, SearchSelectorComponent, SearchbarComponent, SecondarySolidBlockButton, SecondarySolidBlockHrefButton, SecondarySolidBlockIconButton, SecondarySolidBlockIconHrefButton, SecondarySolidDefaultRoundButton, SecondarySolidDefaultRoundHrefButton, SecondarySolidDefaultRoundIconButton, SecondarySolidDefaultRoundIconHrefButton, SecondarySolidFullButton, SecondarySolidFullHrefButton, SecondarySolidFullIconButton, SecondarySolidFullIconHrefButton, SecondarySolidLargeRoundButton, SecondarySolidLargeRoundHrefButton, SecondarySolidLargeRoundIconButton, SecondarySolidLargeRoundIconHrefButton, SecondarySolidSmallRoundButton, SecondarySolidSmallRoundHrefButton, SecondarySolidSmallRoundIconButton, SecondarySolidSmallRoundIconHrefButton, SegmentControlComponent, SelectSearchComponent, SessionService, ShareButtonsComponent, SimpleComponent, SkeletonComponent, SkeletonService, SolidBlockButton, SolidDefault, SolidDefaultBlock, SolidDefaultButton, SolidDefaultFull, SolidDefaultRound, SolidDefaultRoundBlock, SolidDefaultRoundButton, SolidDefaultRoundFull, SolidFullButton, SolidLargeButton, SolidLargeRoundButton, SolidSmallButton, SolidSmallRoundButton, StatsCardComponent, StepperComponent, StorageService, SwipeCarouselComponent, TabbedContentComponent, TableSkeletonComponent, TabsComponent, Terminal404Component, TestimonialCardComponent, TestimonialCarouselComponent, TextComponent, TextInputComponent, TextareaInputComponent, ThemeOption, ThemeService, TicketGridComponent, TimelineComponent, TitleBlockComponent, TitleComponent, ToastService, ToggleInputComponent, TokenService, ToolbarActionType, ToolbarComponent, TranslatePipe, TypedCollection, UpdateBannerComponent, UsernameInputComponent, VALTECH_ADS_CONFIG, VALTECH_APP_CONFIG, VALTECH_AUTH_CONFIG, VALTECH_COMPANY_LINKS, VALTECH_DEFAULT_CONTENT, VALTECH_FEEDBACK_CONFIG, VALTECH_FIREBASE_CONFIG, VALTECH_FOOTER_I18N, VALTECH_FOOTER_LOGO, VALTECH_LANGUAGE_SELECTOR, VALTECH_SOCIAL_LINKS, VERSION, WinnerDisplayComponent, WizardComponent, WizardFooterComponent, applyDefaultValueToControl, authGuard, authInterceptor, buildFooterLinks, buildPath, collections, createFirebaseConfig, createGlowCardProps, createInitialPaginationState, createNumberFromToField, createTitleProps, extractPathParams, getAppInfo, getAppVersion, getCollectionPath, getDocumentId, goToTop, guestGuard, hasEmulators, isAtEnd, isCollectionPath, isDocumentPath, isEmulatorMode, isValidPath, joinPath, maxLength, permissionGuard, permissionGuardFromRoute, provideValtechAds, provideValtechAppConfig, provideValtechAuth, provideValtechAuthInterceptor, provideValtechFeedback, provideValtechFirebase, provideValtechI18n, provideValtechPresets, provideValtechSkeleton, query, replaceSpecialChars, resolveColor, resolveInputDefaultValue, roleGuard, storagePaths, superAdminGuard };
40948
41110
  //# sourceMappingURL=valtech-components.mjs.map