@je-es/client 0.2.3 → 0.2.5

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.
package/dist/main.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ApiInterceptors } from '@je-es/capi';
2
2
  export { ApiError, ApiInterceptors, ApiOptions, ApiResponse, ApiConfig as CapiConfig, HttpMethod, ParamValue, RequestData, api, configureApi, getApiConfig, http, resetApiConfig } from '@je-es/capi';
3
3
  import * as _je_es_vdom from '@je-es/vdom';
4
4
  import { VNode } from '@je-es/vdom';
5
- export { VNode, VNodeChild, VNodeProps, createDOMElement, createElement, html, patch } from '@je-es/vdom';
5
+ export { VNode, VNodeChild, VNodeChildren, VNodeProps, a, button, createDOMElement, createElement, div, form, h1, h2, h3, h4, h5, h6, html, i, img, input, isVNode, label, option, p, patch, select, span, textarea, validateVNode } from '@je-es/vdom';
6
6
 
7
7
  declare abstract class Component<P = Record<string, unknown>, S = Record<string, unknown>> {
8
8
  props: P;
@@ -125,6 +125,9 @@ interface I18nConfig {
125
125
  supportedLanguages?: LanguageCode[];
126
126
  staticPath?: string;
127
127
  }
128
+ interface FAConfig {
129
+ theme?: 'solid' | 'regular' | 'light' | 'thin' | 'duotone' | 'brands' | 'sharp-solid' | 'sharp-regular' | 'sharp-light' | 'sharp-thin' | 'sharp-duotone-solid' | 'sharp-duotone-regular' | 'sharp-duotone-light' | 'sharp-duotone-thin' | 'notdog' | 'notdog-duo' | 'jelly' | 'jelly-fill' | 'jelly-duo' | 'chisel' | 'etch' | 'slab' | 'slab-press' | 'thumbprint' | 'utility' | 'utility-fill' | 'utility-duo' | 'whiteboard';
130
+ }
128
131
  interface ClientConfig {
129
132
  build?: BuildConfig;
130
133
  app?: AppConfig;
@@ -133,6 +136,7 @@ interface ClientConfig {
133
136
  router?: RouterConfig;
134
137
  api?: ApiConfig;
135
138
  devTools?: DevToolsConfig;
139
+ fa?: FAConfig;
136
140
  }
137
141
  interface Route {
138
142
  path: string;
@@ -179,10 +183,21 @@ interface FormFieldOption {
179
183
  label: string;
180
184
  value: string | number;
181
185
  }
182
- interface FormFieldConfig {
183
- name: string;
186
+ interface FieldButtonConfig {
187
+ type: 'rules' | 'togglePassword' | 'custom';
188
+ icon?: string;
184
189
  label?: string;
190
+ title?: string;
191
+ onClick?: () => void | Promise<void>;
192
+ }
193
+ interface LabelConfig {
194
+ text?: string;
185
195
  icon?: string;
196
+ title?: string;
197
+ }
198
+ interface FormFieldConfig {
199
+ name: string;
200
+ label?: string | LabelConfig;
186
201
  type?: string;
187
202
  placeholder?: string;
188
203
  value?: unknown;
@@ -190,6 +205,8 @@ interface FormFieldConfig {
190
205
  validation?: ValidationRule;
191
206
  disabled?: boolean;
192
207
  className?: string;
208
+ fieldButtons?: (FieldButtonConfig | 'rules' | 'togglePassword')[];
209
+ showValidationRules?: boolean;
193
210
  }
194
211
  type FormSubmitHandler = (data: Record<string, unknown>, event: Event) => void | Promise<void>;
195
212
  type ClassValue = string | Record<string, boolean> | undefined | null | false;
@@ -733,284 +750,247 @@ declare class StyleManager {
733
750
  */
734
751
  declare function css(strings: TemplateStringsArray, ...values: (string | number | boolean | null | undefined)[]): string;
735
752
 
736
- declare class I18nManager {
737
- private translations;
738
- private currentLanguage;
739
- private defaultLanguage;
740
- private supportedLanguages;
741
- private cachePath;
742
- private readyListeners;
743
- constructor(config?: I18nConfig);
744
- /**
745
- * Load translations for a specific language
746
- * @param lang Language code (e.g., 'en', 'ar', 'fr')
747
- * @param translations Translation object
748
- */
749
- loadLanguage(lang: LanguageCode, translations: Record<string, string>): void;
753
+ interface ButtonConfig {
754
+ label?: string;
755
+ className?: string;
756
+ icon?: string;
757
+ title?: string;
758
+ loadingLabel?: string;
759
+ onClick?: 'submit' | (() => void | Promise<void>);
760
+ }
761
+ interface FormConfig {
762
+ fields: (FormFieldConfig | (FormFieldConfig | VNode)[])[];
763
+ endpoint?: string;
764
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
765
+ onSubmit?: (data: Record<string, unknown>, event: Event) => void | Promise<void>;
766
+ onSuccess?: (data: unknown) => void;
767
+ onError?: (error: unknown) => void;
768
+ onValidationError?: (errors: Record<string, string>) => void;
769
+ buttons?: Record<string, ButtonConfig>;
770
+ className?: string;
771
+ autoValidate?: boolean;
772
+ }
773
+ interface FormField extends FormFieldConfig {
774
+ error?: string;
775
+ touched?: boolean;
776
+ }
777
+ /**
778
+ * SmartForm Component
779
+ * Auto-validation, CSRF protection, API submission
780
+ */
781
+ declare class SmartFormComponent extends Component<FormConfig> {
782
+ fields: FormField[];
783
+ formData: Record<string, unknown>;
784
+ isSubmitting: boolean;
785
+ submitError: string;
786
+ submitSuccess: boolean;
787
+ passwordVisibility: Record<string, boolean>;
788
+ constructor(props: FormConfig);
789
+ onMount(): void;
750
790
  /**
751
- * Load all translations from static files
752
- * @param translations Object with language codes as keys and translation objects as values
791
+ * Handle field change
753
792
  */
754
- loadTranslations(translations: TranslationSet): void;
793
+ handleChange(fieldName: string, value: unknown): void;
755
794
  /**
756
- * Set the current language
757
- * @param lang Language code
795
+ * Handle field blur
758
796
  */
759
- setLanguage(lang: LanguageCode): void;
797
+ handleBlur(fieldName: string): void;
760
798
  /**
761
- * Get the current language
799
+ * Validate single field
762
800
  */
763
- getLanguage(): LanguageCode;
801
+ validateField(field: FormField, value: unknown): string | undefined;
764
802
  /**
765
- * Get all supported languages
803
+ * Validate all fields
766
804
  */
767
- getSupportedLanguages(): LanguageCode[];
805
+ validateForm(): boolean;
768
806
  /**
769
- * Translate a key with smart parameter replacement
770
- * Supports nested translation keys as parameter values
771
- *
772
- * @example
773
- * // Simple translation
774
- * t('hello') // => "Hello" or "مرحبا" depending on current language
775
- *
776
- * @example
777
- * // With parameters
778
- * t('welcome', { app_name: 'MyApp' })
779
- * // => "Welcome to MyApp"
780
- *
781
- * @example
782
- * // With nested translation keys as parameters
783
- * t('greeting', { salutation: 'hello' })
784
- * // => "Say Hello to everyone"
785
- *
786
- * @param key Translation key
787
- * @param params Optional parameters for replacement
788
- * @param defaultValue Optional default translation key
789
- * @returns Translated string with replaced parameters
807
+ * Handle form submission
790
808
  */
791
- t(key: string, params?: Record<string, string>, defaultValue?: string): string;
792
- private getTranslation;
809
+ handleSubmit(event: Event): Promise<void>;
793
810
  /**
794
- * Translate with a specific language (overrides current language temporarily)
795
- *
796
- * @param key Translation key
797
- * @param lang Language code
798
- * @param params Optional parameters
799
- * @returns Translated string
811
+ * Render label with optional icon
800
812
  */
801
- tLang(key: string, lang: LanguageCode, params?: Record<string, string>): string;
813
+ renderLabel(field: FormField): VNode | string;
802
814
  /**
803
- * Translate a key and convert HTML tags in the translation to VNode elements
804
- * Supports tags like <br>, <strong>, <em>, <b>, <i>, etc.
805
- * Useful for multiline translations with formatting
806
- *
807
- * @example
808
- * // Translation: "Hello <br> World"
809
- * tHtml('greeting') // => [text node, br element, text node]
810
- *
811
- * @param key Translation key
812
- * @param params Optional parameters for replacement
813
- * @param defaultValue Optional default translation key
814
- * @returns Array of VNode and string elements that can be used as children
815
+ * Get field buttons configuration
815
816
  */
816
- tHtml(key: string, params?: Record<string, string>, defaultValue?: string): (VNode | string)[];
817
+ getFieldButtons(field: FormField): FieldButtonConfig[];
817
818
  /**
818
- * Parse HTML string into VNode and text elements
819
- * Converts \n and /n sequences to <br> tags
820
- * @private
819
+ * Handle field button click
821
820
  */
822
- private parseHtmlString;
821
+ handleFieldButton(field: FormField, buttonType: string): void;
823
822
  /**
824
- * Get all translations for current language
823
+ * Render validation rules popup
825
824
  */
826
- getTranslations(): Record<string, string>;
825
+ renderValidationRules(field: FormField): VNode | string;
827
826
  /**
828
- * Check if a translation key exists
829
- * @param key Translation key
830
- * @returns true if key exists in current or default language
827
+ * Render field input buttons
831
828
  */
832
- hasKey(key: string): boolean;
829
+ renderFieldButtons(field: FormField): VNode | string;
833
830
  /**
834
- * Create a reactive translation function that listens to language changes
835
- * @param updateCallback Callback function to execute when language changes
836
- * @returns Function to unsubscribe from language changes
831
+ * Render form field
837
832
  */
838
- createTranslator(updateCallback: () => void): () => void;
833
+ renderField(field: FormField): VNode;
839
834
  /**
840
- * Load translations from URL(s)
841
- * Supports patterns like '/static/i18n/*.json' or specific URLs
842
- *
843
- * @example
844
- * // Load from a pattern
845
- * await loadFromUrl('/static/i18n/*.json');
846
- *
847
- * @example
848
- * // Load specific language files
849
- * await loadFromUrl(['/static/i18n/en.json', '/static/i18n/ar.json']);
850
- *
851
- * @param urlPattern String pattern or array of URLs
852
- * @returns Promise that resolves when all translations are loaded
835
+ * Render buttons section
853
836
  */
854
- loadFromUrl(urlPattern: string | string[]): Promise<void>;
837
+ renderButtons(): VNode;
838
+ render(): VNode;
839
+ styles(): string;
840
+ }
841
+ /**
842
+ * SmartForm helper function
843
+ */
844
+ declare function SmartForm(config: FormConfig): VNode;
845
+
846
+ type PopupType = 'confirm' | 'alert' | 'form' | 'custom' | 'prompt';
847
+ type PopupVariant = 'default' | 'danger' | 'warning' | 'success' | 'info';
848
+ type PopupSize = 'small' | 'medium' | 'large' | 'xlarge' | 'fullscreen';
849
+ interface PopupButton {
850
+ label: string;
851
+ translateKey?: string;
852
+ variant?: 'primary' | 'secondary' | 'danger' | 'success';
853
+ icon?: string;
854
+ onClick: () => void | Promise<void>;
855
+ loading?: boolean;
856
+ }
857
+ interface PopupFormOptions {
858
+ title: string;
859
+ titleTranslateKey?: string;
860
+ description?: string;
861
+ descriptionTranslateKey?: string;
862
+ formConfig: FormConfig;
863
+ variant?: PopupVariant;
864
+ icon?: string;
865
+ size?: PopupSize;
866
+ closeOnOverlay?: boolean;
867
+ closeOnEscape?: boolean;
868
+ showCloseButton?: boolean;
869
+ }
870
+ interface PopupOptions {
871
+ title: string;
872
+ titleTranslateKey?: string;
873
+ message?: string;
874
+ messageTranslateKey?: string;
875
+ description?: string;
876
+ descriptionTranslateKey?: string;
877
+ type?: PopupType;
878
+ variant?: PopupVariant;
879
+ size?: PopupSize;
880
+ buttons?: PopupButton[];
881
+ customContent?: VNode;
882
+ formConfig?: FormConfig;
883
+ closeOnOverlay?: boolean;
884
+ closeOnEscape?: boolean;
885
+ showCloseButton?: boolean;
886
+ icon?: string;
887
+ onConfirm?: () => void | Promise<void>;
888
+ onCancel?: () => void | Promise<void>;
889
+ }
890
+ interface ActivePopup extends PopupOptions {
891
+ id: number;
892
+ resolve?: (value: boolean | string | null | Record<string, unknown>) => void;
893
+ inputValue?: string;
894
+ isSubmitting?: boolean;
895
+ }
896
+ declare class Popup extends Component {
897
+ popups: ActivePopup[];
898
+ private nextId;
899
+ private handleEscapeKey?;
900
+ onMount(): Promise<void>;
901
+ onUnmount(): void;
902
+ render(): VNode;
903
+ renderPopup(popup: ActivePopup): VNode;
855
904
  /**
856
- * Register a callback for when i18n is ready
905
+ * Show a custom popup
857
906
  */
858
- onReady(callback: () => void): void;
907
+ show(options: PopupOptions): Promise<boolean | string | null | Record<string, unknown>>;
859
908
  /**
860
- * Notify all listeners that i18n is ready
909
+ * Show a form popup
861
910
  */
862
- private notifyReady;
911
+ showForm(options: PopupFormOptions): Promise<boolean | string | null | Record<string, unknown>>;
863
912
  /**
864
- * Get language from localStorage
913
+ * Show a confirmation dialog
865
914
  */
866
- private getStoredLanguage;
915
+ confirm(options: {
916
+ title: string;
917
+ titleTranslateKey?: string;
918
+ message: string;
919
+ messageTranslateKey?: string;
920
+ confirmLabel?: string;
921
+ confirmTranslateKey?: string;
922
+ cancelLabel?: string;
923
+ cancelTranslateKey?: string;
924
+ variant?: PopupVariant;
925
+ icon?: string;
926
+ size?: PopupSize;
927
+ onConfirm?: () => void | Promise<void>;
928
+ onCancel?: () => void | Promise<void>;
929
+ }): Promise<boolean>;
867
930
  /**
868
- * Store language in localStorage
931
+ * Show an alert dialog
869
932
  */
870
- private storeLanguage;
933
+ alert(options: {
934
+ title: string;
935
+ titleTranslateKey?: string;
936
+ message: string;
937
+ messageTranslateKey?: string;
938
+ okLabel?: string;
939
+ okTranslateKey?: string;
940
+ variant?: PopupVariant;
941
+ icon?: string;
942
+ size?: PopupSize;
943
+ onConfirm?: () => void | Promise<void>;
944
+ }): Promise<boolean>;
871
945
  /**
872
- * Dispatch language change event
946
+ * Show a prompt dialog
873
947
  */
874
- private dispatchLanguageChangeEvent;
875
- }
876
- /**
877
- * Get the global i18n instance
878
- */
879
- declare function getI18n(): I18nManager;
880
-
881
- /**
882
- * Global translation function
883
- * @param key Translation key
884
- * @param params Optional parameters
885
- * @param defaultValue Optional default translation key
886
- * @returns Translated string
887
- */
888
- declare function t(key: string, params?: Record<string, string>, defaultValue?: string): string;
889
- /**
890
- * Translate with a specific language (overrides current language temporarily)
891
- * @param key Translation key
892
- * @param lang Language code
893
- * @param params Optional parameters
894
- * @returns Translated string
895
- */
896
- declare function tLang(key: string, lang: string, params?: Record<string, string>): string;
897
- /**
898
- * Translate a key and convert HTML tags to VNode elements
899
- * Useful for multiline translations with formatting like <br>
900
- * @param key Translation key
901
- * @param params Optional parameters
902
- * @param defaultValue Optional default translation key
903
- * @returns Array of VNode and string elements that can be used as children
904
- */
905
- declare function tHtml(key: string, params?: Record<string, string>, defaultValue?: string): (VNode | string)[];
906
- /**
907
- * Set the current language globally (synchronous)
908
- * @param lang Language code
909
- */
910
- declare function setLanguage(lang: string): void;
911
- /**
912
- * Set the current language globally with lazy-loading support (asynchronous)
913
- * Use this when you want to lazy-load language files on demand
914
- * @param lang Language code
915
- * @param staticPath Path to language files for lazy-loading
916
- * @returns Promise that resolves when language is loaded and set
917
- */
918
- declare function setLanguageAsync(lang: string, staticPath?: string): Promise<void>;
919
- /**
920
- * Get the current language
921
- */
922
- declare function getCurrentLanguage(): string;
923
- /**
924
- * Load translations for a specific language
925
- * @param lang Language code
926
- * @param translations Translation object
927
- */
928
- declare function loadLanguage(lang: string, translations: Record<string, string>): void;
929
- /**
930
- * Load all translations
931
- * @param translations The translations object
932
- */
933
- declare function loadTranslations(translations: Record<string, Record<string, string>>): void;
934
- /**
935
- * Get all supported languages
936
- */
937
- declare function getSupportedLanguages(): string[];
938
- /**
939
- * Check if a translation key exists
940
- * @param key The translation key to check
941
- * @returns Whether the key exists
942
- */
943
- declare function hasKey(key: string): boolean;
944
- /**
945
- * Get all translations for current language
946
- */
947
- declare function getTranslations(): Record<string, string>;
948
- /**
949
- * Create a reactive translator that listens to language changes
950
- * @param updateCallback Callback function to execute when language changes
951
- * @returns Function to unsubscribe from language changes
952
- */
953
- declare function createTranslator(updateCallback: () => void): () => void;
954
- /**
955
- * Load translations from URL(s)
956
- * Supports patterns like '/static/i18n/*.json' or specific URLs
957
- *
958
- * @example
959
- * // Load from a pattern
960
- * await loadFromUrl('/static/i18n/*.json');
961
- *
962
- * @example
963
- * // Load specific language files
964
- * await loadFromUrl(['/static/i18n/en.json', '/static/i18n/ar.json']);
965
- *
966
- * @param urlPattern String pattern or array of URLs
967
- * @returns Promise that resolves when all translations are loaded
968
- */
969
- declare function loadFromUrl(urlPattern: string | string[]): Promise<void>;
970
- /**
971
- * Initialize i18n synchronously (useful for testing)
972
- * Creates a new I18nManager instance with the provided config
973
- *
974
- * @param config I18n configuration
975
- *
976
- * @example
977
- * initializeI18n({
978
- * defaultLanguage: 'en',
979
- * supportedLanguages: ['en', 'ar']
980
- * });
981
- */
982
- declare function initializeI18n(config?: I18nConfig): void;
983
- /**
984
- * Setup i18n: Initialize and load the currently selected language
985
- * Uses stored language from localStorage if available, otherwise uses default
986
- * Other languages are lazy-loaded when setLanguage is called
987
- *
988
- * @param config I18n configuration
989
- * @returns Promise that resolves when the selected language is loaded
990
- *
991
- * @example
992
- * await setupI18n({
993
- * defaultLanguage: 'en',
994
- * supportedLanguages: ['en', 'ar'],
995
- * staticPath: 'static/i18n'
996
- * });
997
- * console.log(t('hello')); // Ready to use in current language!
998
- */
999
- declare function setupI18n(config: I18nConfig): Promise<void>;
1000
- /**
1001
- * Load a specific language file on-demand
1002
- * Use this when user switches to a language that hasn't been loaded yet
1003
- *
1004
- * @param lang Language code (e.g., 'ar', 'fr')
1005
- * @param staticPath Optional path to language files (defaults to 'static/i18n')
1006
- * @returns Promise that resolves when language is loaded
1007
- *
1008
- * @example
1009
- * // User switches to Arabic - load it first if not already loaded
1010
- * await loadLanguageFile('ar');
1011
- * setLanguage('ar');
1012
- */
1013
- declare function loadLanguageFile(lang: string, staticPath?: string): Promise<void>;
948
+ prompt(options: {
949
+ title: string;
950
+ titleTranslateKey?: string;
951
+ message: string;
952
+ messageTranslateKey?: string;
953
+ defaultValue?: string;
954
+ confirmLabel?: string;
955
+ confirmTranslateKey?: string;
956
+ cancelLabel?: string;
957
+ cancelTranslateKey?: string;
958
+ icon?: string;
959
+ onConfirm?: (value: string) => void | Promise<void>;
960
+ onCancel?: () => void | Promise<void>;
961
+ }): Promise<string | null>;
962
+ /**
963
+ * Close a specific popup
964
+ */
965
+ closePopup(id: number, result: boolean | string | null | Record<string, unknown>): void;
966
+ /**
967
+ * Close all popups
968
+ */
969
+ closeAll(): void;
970
+ private applyBodyLock;
971
+ private removeBodyLock;
972
+ private setupKeyboardListener;
973
+ }
974
+ declare function initPopup(container?: HTMLElement): Popup;
975
+ declare function getPopup$1(): Popup;
976
+ declare const popup: {
977
+ show: (options: PopupOptions) => Promise<string | boolean | Record<string, unknown> | null>;
978
+ confirm: (options: Parameters<Popup["confirm"]>[0]) => Promise<boolean>;
979
+ alert: (options: Parameters<Popup["alert"]>[0]) => Promise<boolean>;
980
+ prompt: (options: {
981
+ title: string;
982
+ titleTranslateKey?: string;
983
+ message: string;
984
+ icon?: string;
985
+ messageTranslateKey?: string;
986
+ onConfirm?: () => void | Promise<void>;
987
+ }) => Promise<string | null>;
988
+ showForm: (options: PopupFormOptions) => Promise<string | boolean | Record<string, unknown> | null>;
989
+ closePopup: (id: number, result: boolean | string | null | Record<string, unknown>) => void;
990
+ closeLastPopup: () => void;
991
+ closeFirstPopup: () => void;
992
+ closeAll: () => void;
993
+ };
1014
994
 
1015
995
  type ToastType = 'success' | 'error' | 'info' | 'warning';
1016
996
  interface ToastMessage {
@@ -1033,11 +1013,11 @@ declare class Toast extends Component {
1033
1013
  error(message: string, duration?: number, translateKey?: string): void;
1034
1014
  info(message: string, duration?: number, translateKey?: string): void;
1035
1015
  warning(message: string, duration?: number, translateKey?: string): void;
1036
- render(): _je_es_vdom.VNode;
1037
- renderToast(msg: ToastMessage): _je_es_vdom.VNode;
1016
+ render(): VNode;
1017
+ renderToast(msg: ToastMessage): VNode;
1038
1018
  }
1039
1019
  declare function initToast(container?: HTMLElement): Toast;
1040
- declare function getToast(): Toast;
1020
+ declare function getToast$1(): Toast;
1041
1021
  declare const toast: {
1042
1022
  show: (message: string, type?: ToastType, duration?: number, translateKey?: string) => void;
1043
1023
  success: (message: string, duration?: number, translateKey?: string) => void;
@@ -1066,10 +1046,10 @@ declare class Loader extends Component {
1066
1046
  private hideTimeout;
1067
1047
  onMount(): Promise<void>;
1068
1048
  onUnmount(): void;
1069
- render(): _je_es_vdom.VNode;
1070
- renderSpinner(): _je_es_vdom.VNode;
1071
- renderMessage(): _je_es_vdom.VNode;
1072
- renderProgressBar(): _je_es_vdom.VNode;
1049
+ render(): VNode;
1050
+ renderSpinner(): VNode;
1051
+ renderMessage(): VNode;
1052
+ renderProgressBar(): VNode;
1073
1053
  show(options?: LoaderOptions | string): void;
1074
1054
  hide(delay?: number): void;
1075
1055
  setMessage(message: string): void;
@@ -1089,222 +1069,446 @@ declare class Loader extends Component {
1089
1069
  };
1090
1070
  }
1091
1071
 
1092
- interface FormConfig {
1093
- fields: FormFieldConfig[];
1094
- endpoint?: string;
1095
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1096
- onSubmit?: (data: Record<string, unknown>, event: Event) => void | Promise<void>;
1097
- onSuccess?: (data: unknown) => void;
1098
- onError?: (error: unknown) => void;
1099
- onValidationError?: (errors: Record<string, string>) => void;
1100
- submitButton?: {
1101
- label?: string;
1102
- loadingLabel?: string;
1072
+ declare const ClassMaker: {
1073
+ /**
1074
+ * Generate Font Awesome icon classes
1075
+ * @param icon Icon name (without 'fa-' prefix)
1076
+ * @param style Font Awesome style (default: global default theme or 'solid')
1077
+ */
1078
+ fa: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => string;
1079
+ /**
1080
+ * Generate button classes
1081
+ * @param level Button level (primary, secondary, tertiary)
1082
+ * @param className Additional classes
1083
+ */
1084
+ btn: (level: "primary" | "secondary" | "tertiary", className?: string) => string;
1085
+ };
1086
+ declare const CM: {
1087
+ /**
1088
+ * Generate Font Awesome icon classes
1089
+ * @param icon Icon name (without 'fa-' prefix)
1090
+ * @param style Font Awesome style (default: global default theme or 'solid')
1091
+ */
1092
+ fa: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => string;
1093
+ /**
1094
+ * Generate button classes
1095
+ * @param level Button level (primary, secondary, tertiary)
1096
+ * @param className Additional classes
1097
+ */
1098
+ btn: (level: "primary" | "secondary" | "tertiary", className?: string) => string;
1099
+ };
1100
+ declare const ElementCreator: {
1101
+ div: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1102
+ span: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1103
+ h1: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1104
+ h2: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1105
+ h3: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1106
+ h4: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1107
+ h5: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1108
+ h6: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1109
+ p: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1110
+ i: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1111
+ img: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1112
+ a: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1113
+ button: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1114
+ input: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1115
+ select: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1116
+ option: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1117
+ textarea: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1118
+ form: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1119
+ /**
1120
+ * Create icon element with Font Awesome classes
1121
+ * @param icon Icon name (without 'fa-' prefix)
1122
+ * @param style Font Awesome style (default: 'solid')
1123
+ */
1124
+ icon: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => VNode;
1125
+ /**
1126
+ * Create button element
1127
+ */
1128
+ btn: (args: {
1129
+ label: string;
1130
+ onClick?: () => void | Promise<void>;
1103
1131
  className?: string;
1104
- };
1105
- className?: string;
1106
- autoValidate?: boolean;
1107
- }
1108
- interface FormField extends FormFieldConfig {
1109
- error?: string;
1110
- touched?: boolean;
1132
+ icon?: string;
1133
+ iconStyle?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard";
1134
+ level?: "primary" | "secondary" | "tertiary";
1135
+ disabled?: boolean;
1136
+ }) => VNode;
1137
+ };
1138
+ declare const EC: {
1139
+ div: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1140
+ span: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1141
+ h1: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1142
+ h2: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1143
+ h3: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1144
+ h4: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1145
+ h5: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1146
+ h6: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1147
+ p: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1148
+ i: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1149
+ img: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1150
+ a: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1151
+ button: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1152
+ input: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1153
+ select: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1154
+ option: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1155
+ textarea: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1156
+ form: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
1157
+ /**
1158
+ * Create icon element with Font Awesome classes
1159
+ * @param icon Icon name (without 'fa-' prefix)
1160
+ * @param style Font Awesome style (default: 'solid')
1161
+ */
1162
+ icon: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => VNode;
1163
+ /**
1164
+ * Create button element
1165
+ */
1166
+ btn: (args: {
1167
+ label: string;
1168
+ onClick?: () => void | Promise<void>;
1169
+ className?: string;
1170
+ icon?: string;
1171
+ iconStyle?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard";
1172
+ level?: "primary" | "secondary" | "tertiary";
1173
+ disabled?: boolean;
1174
+ }) => VNode;
1175
+ };
1176
+ declare class EventsManager {
1177
+ private _handlers;
1178
+ constructor();
1179
+ add(event: string, listener: EventListener): void;
1180
+ remove(event: string, listener: EventListener): void;
1181
+ removeAll(event?: string): void;
1182
+ get(event: string): Set<EventListener> | undefined;
1183
+ has(event: string): boolean;
1184
+ count(event?: string): number;
1111
1185
  }
1112
- /**
1113
- * SmartForm Component
1114
- * Auto-validation, CSRF protection, API submission
1115
- */
1116
- declare class SmartFormComponent extends Component<FormConfig> {
1117
- fields: FormField[];
1118
- formData: Record<string, unknown>;
1119
- isSubmitting: boolean;
1120
- submitError: string;
1121
- submitSuccess: boolean;
1122
- constructor(props: FormConfig);
1123
- onMount(): void;
1186
+ declare function getToast(): Toast;
1187
+ declare function getPopup(): Popup;
1188
+ declare function getLoader(): Loader;
1189
+ declare function hideLoader(): void;
1190
+ declare function showLoader(message?: string): void;
1191
+ declare const Window$1: {
1192
+ Events: EventsManager;
1193
+ toast: typeof getToast;
1194
+ popup: typeof getPopup;
1195
+ loader: typeof getLoader;
1196
+ showLoader: typeof showLoader;
1197
+ hideLoader: typeof hideLoader;
1198
+ reload: () => void;
1199
+ getPathName: () => string;
1200
+ setAttributes: (key: string, value: string) => void;
1201
+ getAttributes: (key: string) => string | null;
1202
+ setLocalStorage: (key: string, value: string) => void;
1203
+ getLocalStorage: (key: string) => string | null;
1204
+ addEventListener: (event: string, listener: EventListener) => void;
1205
+ removeEventListener: (event: string, listener: EventListener) => void;
1206
+ dispatchEvent: (event: CustomEvent) => void;
1207
+ onScroll: (callback: () => void) => void;
1208
+ getScrollY: () => number;
1209
+ };
1210
+
1211
+ declare class I18nManager {
1212
+ private translations;
1213
+ private currentLanguage;
1214
+ private defaultLanguage;
1215
+ private supportedLanguages;
1216
+ private cachePath;
1217
+ private readyListeners;
1218
+ constructor(config?: I18nConfig);
1124
1219
  /**
1125
- * Handle field change
1220
+ * Load translations for a specific language
1221
+ * @param lang Language code (e.g., 'en', 'ar', 'fr')
1222
+ * @param translations Translation object (can be nested)
1126
1223
  */
1127
- handleChange(fieldName: string, value: unknown): void;
1224
+ loadLanguage(lang: LanguageCode, translations: Record<string, any>): void;
1128
1225
  /**
1129
- * Handle field blur
1226
+ * Flatten nested object into dot notation
1227
+ * @param obj Nested object
1228
+ * @param prefix Current prefix
1229
+ * @returns Flattened object with dot notation keys
1130
1230
  */
1131
- handleBlur(fieldName: string): void;
1231
+ private flattenObject;
1132
1232
  /**
1133
- * Validate single field
1233
+ * Load all translations from static files
1234
+ * @param translations Object with language codes as keys and translation objects as values
1134
1235
  */
1135
- validateField(field: FormField, value: unknown): string | undefined;
1236
+ loadTranslations(translations: TranslationSet): void;
1136
1237
  /**
1137
- * Validate all fields
1238
+ * Set the current language
1239
+ * @param lang Language code
1138
1240
  */
1139
- validateForm(): boolean;
1241
+ setLanguage(lang: LanguageCode): void;
1140
1242
  /**
1141
- * Handle form submission
1243
+ * Get the current language
1142
1244
  */
1143
- handleSubmit(event: Event): Promise<void>;
1245
+ getLanguage(): LanguageCode;
1144
1246
  /**
1145
- * Render label with optional icon
1247
+ * Get all supported languages
1146
1248
  */
1147
- renderLabel(field: FormField): VNode | string;
1249
+ getSupportedLanguages(): LanguageCode[];
1148
1250
  /**
1149
- * Render form field
1251
+ * Translate a key with smart parameter replacement
1252
+ * Supports nested translation keys as parameter values
1253
+ *
1254
+ * @example
1255
+ * // Simple translation
1256
+ * t('button.login') // => "Login" or "دخـول" depending on current language
1257
+ *
1258
+ * @example
1259
+ * // With parameters
1260
+ * t('nav.credits', { count: '100' })
1261
+ * // => "Available Credits: 100"
1262
+ *
1263
+ * @example
1264
+ * // With nested translation keys as parameters
1265
+ * t('language.switching_to', { language: 'button.login' })
1266
+ * // => "Switching to Login..."
1267
+ *
1268
+ * @param key Translation key (supports dot notation for nested keys)
1269
+ * @param params Optional parameters for replacement
1270
+ * @param defaultValue Optional default translation key
1271
+ * @returns Translated string with replaced parameters
1150
1272
  */
1151
- renderField(field: FormField): VNode;
1152
- render(): VNode;
1153
- styles(): string;
1154
- }
1155
- /**
1156
- * SmartForm helper function
1157
- */
1158
- declare function SmartForm(config: FormConfig): VNode;
1159
-
1160
- type PopupType = 'confirm' | 'alert' | 'form' | 'custom' | 'prompt';
1161
- type PopupVariant = 'default' | 'danger' | 'warning' | 'success' | 'info';
1162
- type PopupSize = 'small' | 'medium' | 'large' | 'xlarge' | 'fullscreen';
1163
- interface PopupButton {
1164
- label: string;
1165
- translateKey?: string;
1166
- variant?: 'primary' | 'secondary' | 'danger' | 'success';
1167
- icon?: string;
1168
- onClick: () => void | Promise<void>;
1169
- loading?: boolean;
1170
- }
1171
- interface PopupFormOptions {
1172
- title: string;
1173
- titleTranslateKey?: string;
1174
- description?: string;
1175
- descriptionTranslateKey?: string;
1176
- formConfig: FormConfig;
1177
- variant?: PopupVariant;
1178
- icon?: string;
1179
- size?: PopupSize;
1180
- closeOnOverlay?: boolean;
1181
- closeOnEscape?: boolean;
1182
- showCloseButton?: boolean;
1183
- }
1184
- interface PopupOptions {
1185
- title: string;
1186
- titleTranslateKey?: string;
1187
- message?: string;
1188
- messageTranslateKey?: string;
1189
- description?: string;
1190
- descriptionTranslateKey?: string;
1191
- type?: PopupType;
1192
- variant?: PopupVariant;
1193
- size?: PopupSize;
1194
- buttons?: PopupButton[];
1195
- customContent?: VNode;
1196
- formConfig?: FormConfig;
1197
- closeOnOverlay?: boolean;
1198
- closeOnEscape?: boolean;
1199
- showCloseButton?: boolean;
1200
- icon?: string;
1201
- onConfirm?: () => void | Promise<void>;
1202
- onCancel?: () => void | Promise<void>;
1203
- }
1204
- interface ActivePopup extends PopupOptions {
1205
- id: number;
1206
- resolve?: (value: boolean | string | null | Record<string, unknown>) => void;
1207
- inputValue?: string;
1208
- isSubmitting?: boolean;
1209
- }
1210
- declare class Popup extends Component {
1211
- popups: ActivePopup[];
1212
- private nextId;
1213
- private handleEscapeKey?;
1214
- onMount(): Promise<void>;
1215
- onUnmount(): void;
1216
- render(): VNode;
1217
- renderPopup(popup: ActivePopup): VNode;
1273
+ t(key: string, params?: Record<string, string>, defaultValue?: string): string;
1274
+ private getTranslation;
1218
1275
  /**
1219
- * Show a custom popup
1276
+ * Translate with a specific language (overrides current language temporarily)
1277
+ *
1278
+ * @param key Translation key
1279
+ * @param lang Language code
1280
+ * @param params Optional parameters
1281
+ * @returns Translated string
1282
+ */
1283
+ tLang(key: string, lang: LanguageCode, params?: Record<string, string>): string;
1284
+ /**
1285
+ * Translate a key and convert HTML tags in the translation to VNode elements
1286
+ * Supports tags like <br>, <strong>, <em>, <b>, <i>, etc.
1287
+ * Useful for multiline translations with formatting
1288
+ *
1289
+ * @example
1290
+ * // Translation: "Hello <br> World"
1291
+ * tHtml('page.home.title') // => [text node, br element, text node]
1292
+ *
1293
+ * @param key Translation key
1294
+ * @param params Optional parameters for replacement
1295
+ * @param defaultValue Optional default translation key
1296
+ * @returns Array of VNode and string elements that can be used as children
1297
+ */
1298
+ tHtml(key: string, params?: Record<string, string>, defaultValue?: string): (VNode | string)[];
1299
+ /**
1300
+ * Parse HTML string into VNode and text elements
1301
+ * Converts \n and /n sequences to <br> tags
1302
+ * @private
1303
+ */
1304
+ private parseHtmlString;
1305
+ /**
1306
+ * Get all translations for current language
1307
+ */
1308
+ getTranslations(): Record<string, string>;
1309
+ /**
1310
+ * Check if a translation key exists
1311
+ * @param key Translation key
1312
+ * @returns true if key exists in current or default language
1313
+ */
1314
+ hasKey(key: string): boolean;
1315
+ /**
1316
+ * Create a reactive translation function that listens to language changes
1317
+ * @param updateCallback Callback function to execute when language changes
1318
+ * @returns Function to unsubscribe from language changes
1220
1319
  */
1221
- show(options: PopupOptions): Promise<boolean | string | null | Record<string, unknown>>;
1320
+ createTranslator(updateCallback: () => void): () => void;
1222
1321
  /**
1223
- * Show a form popup
1322
+ * Load translations from URL(s)
1323
+ * Supports patterns like '/static/i18n/*.json' or specific URLs
1324
+ *
1325
+ * @example
1326
+ * // Load from a pattern
1327
+ * await loadFromUrl('/static/i18n/*.json');
1328
+ *
1329
+ * @example
1330
+ * // Load specific language files
1331
+ * await loadFromUrl(['/static/i18n/en.json', '/static/i18n/ar.json']);
1332
+ *
1333
+ * @param urlPattern String pattern or array of URLs
1334
+ * @returns Promise that resolves when all translations are loaded
1224
1335
  */
1225
- showForm(options: PopupFormOptions): Promise<boolean | string | null | Record<string, unknown>>;
1336
+ loadFromUrl(urlPattern: string | string[]): Promise<void>;
1226
1337
  /**
1227
- * Show a confirmation dialog
1338
+ * Register a callback for when i18n is ready
1228
1339
  */
1229
- confirm(options: {
1230
- title: string;
1231
- titleTranslateKey?: string;
1232
- message: string;
1233
- messageTranslateKey?: string;
1234
- confirmLabel?: string;
1235
- confirmTranslateKey?: string;
1236
- cancelLabel?: string;
1237
- cancelTranslateKey?: string;
1238
- variant?: PopupVariant;
1239
- icon?: string;
1240
- size?: PopupSize;
1241
- onConfirm?: () => void | Promise<void>;
1242
- onCancel?: () => void | Promise<void>;
1243
- }): Promise<boolean>;
1340
+ onReady(callback: () => void): void;
1244
1341
  /**
1245
- * Show an alert dialog
1342
+ * Notify all listeners that i18n is ready
1246
1343
  */
1247
- alert(options: {
1248
- title: string;
1249
- titleTranslateKey?: string;
1250
- message: string;
1251
- messageTranslateKey?: string;
1252
- okLabel?: string;
1253
- okTranslateKey?: string;
1254
- variant?: PopupVariant;
1255
- icon?: string;
1256
- size?: PopupSize;
1257
- onConfirm?: () => void | Promise<void>;
1258
- }): Promise<boolean>;
1344
+ private notifyReady;
1259
1345
  /**
1260
- * Show a prompt dialog
1346
+ * Get language from localStorage
1261
1347
  */
1262
- prompt(options: {
1263
- title: string;
1264
- titleTranslateKey?: string;
1265
- message: string;
1266
- messageTranslateKey?: string;
1267
- defaultValue?: string;
1268
- confirmLabel?: string;
1269
- confirmTranslateKey?: string;
1270
- cancelLabel?: string;
1271
- cancelTranslateKey?: string;
1272
- icon?: string;
1273
- onConfirm?: (value: string) => void | Promise<void>;
1274
- onCancel?: () => void | Promise<void>;
1275
- }): Promise<string | null>;
1348
+ private getStoredLanguage;
1276
1349
  /**
1277
- * Close a specific popup
1350
+ * Store language in localStorage
1278
1351
  */
1279
- closePopup(id: number, result: boolean | string | null | Record<string, unknown>): void;
1352
+ private storeLanguage;
1280
1353
  /**
1281
- * Close all popups
1354
+ * Dispatch language change event
1282
1355
  */
1283
- closeAll(): void;
1284
- private applyBodyLock;
1285
- private removeBodyLock;
1286
- private setupKeyboardListener;
1356
+ private dispatchLanguageChangeEvent;
1287
1357
  }
1288
- declare function initPopup(container?: HTMLElement): Popup;
1289
- declare function getPopup(): Popup;
1290
- declare const popup: {
1291
- show: (options: PopupOptions) => Promise<string | boolean | Record<string, unknown> | null>;
1292
- confirm: (options: Parameters<Popup["confirm"]>[0]) => Promise<boolean>;
1293
- alert: (options: Parameters<Popup["alert"]>[0]) => Promise<boolean>;
1294
- prompt: (options: {
1295
- title: string;
1296
- titleTranslateKey?: string;
1297
- message: string;
1298
- icon?: string;
1299
- messageTranslateKey?: string;
1300
- onConfirm?: () => void | Promise<void>;
1301
- }) => Promise<string | null>;
1302
- showForm: (options: PopupFormOptions) => Promise<string | boolean | Record<string, unknown> | null>;
1303
- closePopup: (id: number, result: boolean | string | null | Record<string, unknown>) => void;
1304
- closeLastPopup: () => void;
1305
- closeFirstPopup: () => void;
1306
- closeAll: () => void;
1307
- };
1358
+ /**
1359
+ * Get the global i18n instance
1360
+ */
1361
+ declare function getI18n(): I18nManager;
1362
+
1363
+ /**
1364
+ * Global translation function
1365
+ * @param key Translation key (supports dot notation for nested keys)
1366
+ * @param params Optional parameters
1367
+ * @param defaultValue Optional default translation key
1368
+ * @returns Translated string
1369
+ */
1370
+ declare function t(key: string, params?: Record<string, string>, defaultValue?: string): string;
1371
+ /**
1372
+ * Translate with a specific language (overrides current language temporarily)
1373
+ * @param key Translation key
1374
+ * @param lang Language code
1375
+ * @param params Optional parameters
1376
+ * @returns Translated string
1377
+ */
1378
+ declare function tLang(key: string, lang: string, params?: Record<string, string>): string;
1379
+ /**
1380
+ * Translate a key and convert HTML tags to VNode elements
1381
+ * Useful for multiline translations with formatting like <br>
1382
+ * @param key Translation key
1383
+ * @param params Optional parameters
1384
+ * @param defaultValue Optional default translation key
1385
+ * @returns Array of VNode and string elements that can be used as children
1386
+ */
1387
+ declare function tHtml(key: string, params?: Record<string, string>, defaultValue?: string): (VNode | string)[];
1388
+ /**
1389
+ * Set the current language globally (synchronous)
1390
+ * @param lang Language code
1391
+ */
1392
+ declare function setLanguage(lang: string): void;
1393
+ /**
1394
+ * Set the current language globally with lazy-loading support (asynchronous)
1395
+ * Use this when you want to lazy-load language files on demand
1396
+ * @param lang Language code
1397
+ * @param staticPath Path to language files for lazy-loading
1398
+ * @returns Promise that resolves when language is loaded and set
1399
+ */
1400
+ declare function setLanguageAsync(lang: string, staticPath?: string): Promise<void>;
1401
+ /**
1402
+ * Get the current language
1403
+ */
1404
+ declare function getCurrentLanguage(): string;
1405
+ /**
1406
+ * Load translations for a specific language
1407
+ * @param lang Language code
1408
+ * @param translations Translation object (can be nested)
1409
+ */
1410
+ declare function loadLanguage(lang: string, translations: Record<string, any>): void;
1411
+ /**
1412
+ * Load all translations
1413
+ * @param translations The translations object (can be nested)
1414
+ */
1415
+ declare function loadTranslations(translations: Record<string, Record<string, any>>): void;
1416
+ /**
1417
+ * Get all supported languages
1418
+ */
1419
+ declare function getSupportedLanguages(): string[];
1420
+ /**
1421
+ * Check if a translation key exists
1422
+ * @param key The translation key to check
1423
+ * @returns Whether the key exists
1424
+ */
1425
+ declare function hasKey(key: string): boolean;
1426
+ /**
1427
+ * Get all translations for current language
1428
+ */
1429
+ declare function getTranslations(): Record<string, string>;
1430
+ /**
1431
+ * Create a reactive translator that listens to language changes
1432
+ * @param updateCallback Callback function to execute when language changes
1433
+ * @returns Function to unsubscribe from language changes
1434
+ */
1435
+ declare function createTranslator(updateCallback: () => void): () => void;
1436
+ /**
1437
+ * Load translations from URL(s)
1438
+ * Supports patterns like '/static/i18n/*.json' or specific URLs
1439
+ *
1440
+ * @example
1441
+ * // Load from a pattern
1442
+ * await loadFromUrl('/static/i18n/*.json');
1443
+ *
1444
+ * @example
1445
+ * // Load specific language files
1446
+ * await loadFromUrl(['/static/i18n/en.json', '/static/i18n/ar.json']);
1447
+ *
1448
+ * @param urlPattern String pattern or array of URLs
1449
+ * @returns Promise that resolves when all translations are loaded
1450
+ */
1451
+ declare function loadFromUrl(urlPattern: string | string[]): Promise<void>;
1452
+ /**
1453
+ * Initialize i18n synchronously (useful for testing)
1454
+ * Creates a new I18nManager instance with the provided config
1455
+ *
1456
+ * @param config I18n configuration
1457
+ *
1458
+ * @example
1459
+ * initializeI18n({
1460
+ * defaultLanguage: 'en',
1461
+ * supportedLanguages: ['en', 'ar']
1462
+ * });
1463
+ */
1464
+ declare function initializeI18n(config?: I18nConfig): void;
1465
+ /**
1466
+ * Setup i18n: Initialize and load the currently selected language
1467
+ * Uses stored language from localStorage if available, otherwise uses default
1468
+ * Other languages are lazy-loaded when setLanguage is called
1469
+ *
1470
+ * @param config I18n configuration
1471
+ * @returns Promise that resolves when the selected language is loaded
1472
+ *
1473
+ * @example
1474
+ * await setupI18n({
1475
+ * defaultLanguage: 'en',
1476
+ * supportedLanguages: ['en', 'ar'],
1477
+ * staticPath: 'static/i18n'
1478
+ * });
1479
+ * console.log(t('button.login')); // Ready to use in current language!
1480
+ */
1481
+ declare function setupI18n(config: I18nConfig): Promise<void>;
1482
+ /**
1483
+ * Load a specific language file on-demand
1484
+ * Use this when user switches to a language that hasn't been loaded yet
1485
+ *
1486
+ * @param lang Language code (e.g., 'ar', 'fr')
1487
+ * @param staticPath Optional path to language files (defaults to 'static/i18n')
1488
+ * @returns Promise that resolves when language is loaded
1489
+ *
1490
+ * @example
1491
+ * // User switches to Arabic - load it first if not already loaded
1492
+ * await loadLanguageFile('ar');
1493
+ * setLanguage('ar');
1494
+ */
1495
+ declare function loadLanguageFile(lang: string, staticPath?: string): Promise<void>;
1496
+
1497
+ type FATheme = 'solid' | 'regular' | 'light' | 'thin' | 'duotone' | 'brands' | 'sharp-solid' | 'sharp-regular' | 'sharp-light' | 'sharp-thin' | 'sharp-duotone-solid' | 'sharp-duotone-regular' | 'sharp-duotone-light' | 'sharp-duotone-thin' | 'notdog' | 'notdog-duo' | 'jelly' | 'jelly-fill' | 'jelly-duo' | 'chisel' | 'etch' | 'slab' | 'slab-press' | 'thumbprint' | 'utility' | 'utility-fill' | 'utility-duo' | 'whiteboard';
1498
+ /**
1499
+ * Get the default FontAwesome theme
1500
+ */
1501
+ declare function getDefaultFATheme(): FATheme;
1502
+ /**
1503
+ * Set the default FontAwesome theme
1504
+ * @param theme The FontAwesome theme to use as default
1505
+ */
1506
+ declare function setDefaultFATheme(theme: FATheme): void;
1507
+ /**
1508
+ * Initialize FontAwesome config from ClientConfig
1509
+ * @param faConfig The FA configuration from ClientConfig
1510
+ */
1511
+ declare function initializeFAConfig(faConfig?: FAConfig): void;
1308
1512
 
1309
1513
  type TabPosition = 'top' | 'side';
1310
1514
  type TabStyle = 'default' | 'pills' | 'minimal';
@@ -1375,7 +1579,7 @@ declare class TabbedView extends Component {
1375
1579
  renderTabList(): VNode;
1376
1580
  renderTab(tab: Tab): VNode;
1377
1581
  renderTabContent(): VNode;
1378
- renderActiveTabContent(tab: Tab): any;
1582
+ renderActiveTabContent(tab: Tab): VNode;
1379
1583
  }
1380
1584
  /**
1381
1585
  * Create a new TabbedView instance with options
@@ -1520,6 +1724,7 @@ declare class Dropdown extends Component {
1520
1724
  config: DropdownConfig;
1521
1725
  isOpen: boolean;
1522
1726
  private mounted;
1727
+ private bb_;
1523
1728
  constructor(config: DropdownConfig);
1524
1729
  onMount(): void;
1525
1730
  onUnmount(): void;
@@ -1732,4 +1937,111 @@ declare function formatTimeAgo(timestamp: string | Date): string;
1732
1937
  */
1733
1938
  declare function getTimeTitle(timestamp: string | Date): string;
1734
1939
 
1735
- export { type ApiConfig, type AppConfig, type BuildConfig, type ClassValue, type ClientConfig, CombinedContext, Component, type ComponentConstructor, Context, type ContextSubscriber, type DeepPartial, type DevToolsConfig, Dropdown, type DropdownConfig, type DropdownItemConfig, type EventHandler, type FormConfig, type FormField, type FormFieldConfig, type FormFieldOption, type FormSubmitHandler, type FormsConfig, type I18nConfig, I18nManager, type IntersectionConfig, ItemsLoader, type ItemsLoaderConfig, type LanguageCode, Loader, type LoaderOptions, type LoaderSize, type LoaderVariant, type NavigationGuard, Popup, type PopupButton, type PopupFormOptions, type PopupOptions, type PopupSize, type PopupType, type PopupVariant, Provider, type ProviderProps, type Route, type RouteConfig, Router, type RouterConfig, SmartForm, SmartFormComponent, type StateConfig, Store, type StoreMiddleware, type StoreOptions, type StoreSubscriber, StyleManager, type Tab, type TabPosition, type TabStyle, TabbedView, type TabbedViewOptions, Toast, type ToastMessage, type ToastType, type TranslationSet, type ValidationRule, VisibilityObserver, camelCase, capitalize, clamp, classNames, clearHookContext, client, computed, connect, createCombinedContext, createComputedStore, createContext, createDropdown, createFunctionalComponent, createItemsLoader, createStore, createTabbedView, createTranslator, css, debounce, deepClone, deepMerge, formatDate, formatRelativeTime, formatTimeAgo, getCurrentLanguage, getCurrentPath, getI18n, getPopup, getQueryParam, getQueryParams, getSupportedLanguages, getTimeDisplay, getTimeTitle, getToast, getTranslations, goBack, goForward, hasKey, initPopup, initToast, initializeI18n, isBrowser, isCurrentPath, isCurrentPathPrefix, isEmpty, kebabCase, loadFromUrl, loadLanguage, loadLanguageFile, loadTranslations, mountTabbedView, navigate, navigateWithQuery, observeVisibility, parseQuery, pascalCase, popup, reloadRoute, router, safeJsonParse, scheduler, setHookContext, setLanguage, setLanguageAsync, setupI18n, sleep, state, stringifyQuery, t, tHtml, tLang, throttle, toast, truncate, uniqueId, useCallback, useContext, useDebounce, useEffect, useEventListener, useFetch, useInterval, useLocalStorage, useMemo, usePrevious, useReducer, useRef, useState, useToggle, useWindowSize, utils, watch };
1940
+ declare const bbMap: {
1941
+ form: {
1942
+ base: string;
1943
+ field: string;
1944
+ fieldCheckbox: string;
1945
+ fieldInput: string;
1946
+ fieldInputContainer: string;
1947
+ fieldInputButtons: string;
1948
+ fieldInputButton: string;
1949
+ fieldInputButtonRules: string;
1950
+ fieldInputButtonRulesContent: string;
1951
+ fieldTextarea: string;
1952
+ fieldSelect: string;
1953
+ fieldLabel: string;
1954
+ fieldError: string;
1955
+ fieldTitle: string;
1956
+ buttonsContainer: string;
1957
+ button: string;
1958
+ alert: string;
1959
+ alertError: string;
1960
+ alertSuccess: string;
1961
+ };
1962
+ toast: {
1963
+ container: string;
1964
+ toast: string;
1965
+ icon: string;
1966
+ msg: string;
1967
+ };
1968
+ loader: {
1969
+ container: string;
1970
+ containerOverlay: string;
1971
+ bg: string;
1972
+ loader: string;
1973
+ spinner: {
1974
+ container: string;
1975
+ icon: string;
1976
+ dot: string;
1977
+ pulse: string;
1978
+ text: string;
1979
+ };
1980
+ progress: {
1981
+ container: string;
1982
+ bar: string;
1983
+ text: string;
1984
+ };
1985
+ };
1986
+ popup: {
1987
+ container: string;
1988
+ overlay: string;
1989
+ popup: {
1990
+ base: string;
1991
+ close: string;
1992
+ };
1993
+ header: {
1994
+ container: string;
1995
+ icon: string;
1996
+ content: string;
1997
+ title: string;
1998
+ description: string;
1999
+ };
2000
+ body: {
2001
+ container: string;
2002
+ message: string;
2003
+ input: string;
2004
+ formContainer: string;
2005
+ };
2006
+ footer: string;
2007
+ button: string;
2008
+ };
2009
+ dropdown: {
2010
+ container: string;
2011
+ trigger: string;
2012
+ menu: string;
2013
+ item: string;
2014
+ divider: string;
2015
+ icon: string;
2016
+ };
2017
+ itemsLoader: {
2018
+ container: string;
2019
+ list: string;
2020
+ searchbar: string;
2021
+ loading: string;
2022
+ error: string;
2023
+ trigger: string;
2024
+ end: string;
2025
+ emptyState: string;
2026
+ button: string;
2027
+ item: string;
2028
+ formFieldInput: string;
2029
+ };
2030
+ tabbedView: {
2031
+ container: string;
2032
+ header: string;
2033
+ tab: {
2034
+ base: string;
2035
+ active: string;
2036
+ disabled: string;
2037
+ badge: string;
2038
+ };
2039
+ content: {
2040
+ container: string;
2041
+ emptyState: string;
2042
+ error: string;
2043
+ };
2044
+ };
2045
+ };
2046
+
2047
+ export { type ApiConfig, type AppConfig, type BuildConfig, type ButtonConfig, CM, ClassMaker, type ClassValue, type ClientConfig, CombinedContext, Component, type ComponentConstructor, Context, type ContextSubscriber, type DeepPartial, type DevToolsConfig, Dropdown, type DropdownConfig, type DropdownItemConfig, EC, ElementCreator, type EventHandler, type FAConfig, type FieldButtonConfig, type FormConfig, type FormFieldConfig, type FormFieldOption, type FormSubmitHandler, type FormsConfig, type I18nConfig, I18nManager, type IntersectionConfig, ItemsLoader, type ItemsLoaderConfig, type LabelConfig, type LanguageCode, Loader, type LoaderOptions, type LoaderSize, type LoaderVariant, type NavigationGuard, Popup, type PopupButton, type PopupFormOptions, type PopupOptions, type PopupSize, type PopupType, type PopupVariant, Provider, type ProviderProps, type Route, type RouteConfig, Router, type RouterConfig, SmartForm, SmartFormComponent, type StateConfig, Store, type StoreMiddleware, type StoreOptions, type StoreSubscriber, StyleManager, type Tab, type TabPosition, type TabStyle, TabbedView, type TabbedViewOptions, Toast, type ToastMessage, type ToastType, type TranslationSet, type ValidationRule, VisibilityObserver, Window$1 as Window, bbMap, camelCase, capitalize, clamp, classNames, clearHookContext, client, computed, connect, createCombinedContext, createComputedStore, createContext, createDropdown, createFunctionalComponent, createItemsLoader, createStore, createTabbedView, createTranslator, css, debounce, deepClone, deepMerge, formatDate, formatRelativeTime, formatTimeAgo, getCurrentLanguage, getCurrentPath, getDefaultFATheme, getI18n, getPopup$1 as getPopup, getQueryParam, getQueryParams, getSupportedLanguages, getTimeDisplay, getTimeTitle, getToast$1 as getToast, getTranslations, goBack, goForward, hasKey, initPopup, initToast, initializeFAConfig, initializeI18n, isBrowser, isCurrentPath, isCurrentPathPrefix, isEmpty, kebabCase, loadFromUrl, loadLanguage, loadLanguageFile, loadTranslations, mountTabbedView, navigate, navigateWithQuery, observeVisibility, parseQuery, pascalCase, popup, reloadRoute, router, safeJsonParse, scheduler, setDefaultFATheme, setHookContext, setLanguage, setLanguageAsync, setupI18n, sleep, state, stringifyQuery, t, tHtml, tLang, throttle, toast, truncate, uniqueId, useCallback, useContext, useDebounce, useEffect, useEventListener, useFetch, useInterval, useLocalStorage, useMemo, usePrevious, useReducer, useRef, useState, useToggle, useWindowSize, utils, watch };