@dxtmisha/functional-basic 1.8.3 → 1.8.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.8.4] - 2026-08-05
6
+
7
+ ### Changed
8
+ - **AI Documentation**: Modularized package documentation and generated `ai-mcp.json` resource definitions alongside updated `ai-description.md` and `ai-types.md`.
9
+
10
+ ## [1.8.3] - 2026-08-01
11
+
12
+ ### Changed
13
+ - **Documentation**: Updated `ai-doc.md` and `ai-doc.ru.md` with explicit class method sorting order guidelines (`get/set`, `is/has`, `get.../set...`, `add/remove`, `update/reset`, sorted alphabetically within subgroups).
14
+
15
+ ## [1.8.2] - 2026-07-31
16
+
17
+ ### Changed
18
+ - **Package Metadata**: Standardized package exports and AI documentation files (`ai-description.md`, `ai-types.md`).
19
+
5
20
  ## [1.8.1] - 2026-07-31
6
21
 
7
22
  ### Added
package/ai-description.md CHANGED
@@ -1,5 +1,11 @@
1
- This library is an isomorphic utility framework designed for full-stack JavaScript and TypeScript applications, providing unified abstractions for API data fetching, SSR hydration, state persistence, internationalization, DOM event management, and SEO metadata. The API and Network module manages HTTP requests via Fetch with automated retries, hook-based request preparation, response caching, SSR client hydration, error storage matching, and mock response emulation. The Storage module delivers cross-environment persistence across browser cookies, local or session storage, and request-isolated server rendering contexts. The Localization and Formatting module handles locale detection, phone number masking, localized unit conversions, translation retrieval, and date, number, or plural formatting using native Intl APIs. The DOM, Events, and Navigation module offers memory-safe event listening with automatic DOM removal checks, reactive URL query and hash state tracking, inter-tab broadcast messaging, global loading state coordination, and meta tag management for OpenGraph and Twitter cards. The Search and Utilities module facilitates in-memory multi-column searching with match highlighting, centralized error logging, resumable timers, and type-safe array or object transformations. Studying type definitions in ai-types.md is mandatory when constructing strongly typed API fetch parameters, handling custom response wrappers, defining error storage criteria, configuring complex list formatters, or supplying generic type arguments to search, storage, and event handlers. The library connects as a foundational utility layer bridging client-side UI frameworks with server-side rendering environments and REST backend endpoints.
1
+ This library serves as a comprehensive isomorphic runtime toolkit providing core utility primitives for HTTP networking, state persistence, internationalization, metadata management, DOM manipulation, and data transformation across browser and server-side rendering environments.
2
+
3
+ Its main capabilities are organized into high-level functional groupings: API and network utilities handle HTTP request orchestration, response caching, structured error normalization, retry strategies, and SSR hydration script generation; storage utilities manage cookies, local and session storage, request-isolated server storage, and inter-tab broadcast messaging; internationalization and localization modules process geographic standards, timezone conversions, localized number/date/unit formatting, phone masking, and pluralization rules; DOM and event helpers provide lifecycle-managed event listeners, smooth scrolling, visibility checks, element creation, and global loading indicators; metadata modules provide a unified interface to generate and manage HTML, Open Graph, and Twitter Card tags; and data processing functions handle string transformations, deep copying, template replacement, fuzzy searching with query highlighting, and list sorting.
4
+
5
+ It is mandatory to study "ai-types.md" when configuring typed API request payloads and hooks, defining custom error center callbacks, constructing complex localized formatter options, implementing schema-driven search or sorting parameters, or working with environment-specific storage contracts.
6
+
7
+ The library integrates into modern web application stacks by offering framework-agnostic utilities that safely detect browser versus SSR runtimes while supporting seamless client hydration workflows.
2
8
  ## Mandatory Rules
3
9
  Read the corresponding file if your task relates to:
4
- - 'node_modules/@dxtmisha/functional-basic/ai-prompts/api-reference.md': HTTP client, caching, storage management, geolocation, localization, DOM events, and general utilities
5
- - 'node_modules/@dxtmisha/functional-basic/ai-prompts/coding-standards.md': Class structure, naming and typing standards, SSR safety, and primitive helper functions
10
+ - 'node_modules/@dxtmisha/functional-basic/ai-prompts/api-reference.md': HTTP client, caching, storage, geolocation, localization, formatting, DOM events, and utility helpers
11
+ - 'node_modules/@dxtmisha/functional-basic/ai-prompts/coding-standards.md': Class structure, typing standards, SSR safety, and primitive helper functions
package/ai-mcp.json CHANGED
@@ -1,14 +1,26 @@
1
1
  [
2
+ {
3
+ "uri": "@dxtmisha/functional-basic/ai-types.md",
4
+ "name": "TypeScript Type Definitions",
5
+ "mimeType": "text/markdown",
6
+ "description": "Comprehensive TypeScript type definitions, enums, class interfaces, and utility function signatures for API request handling, internationalization, and client-side data management."
7
+ },
8
+ {
9
+ "uri": "@dxtmisha/functional-basic/ai-description.md",
10
+ "name": "Isomorphic Utility Toolkit",
11
+ "mimeType": "text/markdown",
12
+ "description": "Provides an architectural overview of the isomorphic runtime toolkit covering HTTP networking, state persistence, i18n, DOM helpers, and metadata management across browser and SSR environments. Details core utility capabilities and outlines mandatory cross-referencing rules for API references, types, and coding standards."
13
+ },
2
14
  {
3
15
  "uri": "@dxtmisha/functional-basic/ai-prompts/api-reference.md",
4
- "name": "API Reference",
16
+ "name": "API Reference Guide",
5
17
  "mimeType": "text/markdown",
6
- "description": "Comprehensive API reference and code examples for the functional-basic library, covering HTTP requests, state storage, localization, DOM manipulation, and utility helpers."
18
+ "description": "API reference and code usage examples for @dxtmisha/functional-basic, detailing HTTP clients, caching, storage, geolocation, DOM events, and general utilities."
7
19
  },
8
20
  {
9
21
  "uri": "@dxtmisha/functional-basic/ai-prompts/coding-standards.md",
10
22
  "name": "Coding Standards",
11
23
  "mimeType": "text/markdown",
12
- "description": "Defines class structure ordering, TypeScript styling and typing conventions, isomorphic SSR safety rules, and standard primitive helper function usage."
24
+ "description": "Architectural conventions, class structure rules, SSR safety guidelines, and TypeScript typing standards for code implementation."
13
25
  }
14
26
  ]
package/ai-types.md CHANGED
@@ -1,14 +1,4 @@
1
- 1) All these methods are in the @dxtmisha/functional-basic library.
2
- 2) Everything that is exported can be used.
3
- 3) Use what is in this library if it exists; do not use other libraries if there is an analogue here. Do not create new ones if an analogue already exists here.
4
-
5
- The following is the content of "exports" from package.json:
6
- {
7
- ".": {
8
- "import": "./dist/library.js",
9
- "types": "./dist/library.d.ts"
10
- }
11
- }
1
+ All these methods are in the @dxtmisha/functional-basic library.
12
2
 
13
3
  export declare enum ApiMethodItem {
14
4
  delete = "DELETE",
@@ -545,47 +535,7 @@ export type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
545
535
  export type TranslateDataFile = Record<string, TranslateDataFileItem>;
546
536
  export declare const TRANSLATE_GLOBAL_PREFIX = "global";
547
537
  export declare const TRANSLATE_TIME_OUT = 160;
548
- export type IconsItem = string | Promise<string | any> | (() => Promise<string | any>);
549
- export type IconsConfig = {
550
- url?: string;
551
- list?: Record<string, IconsItem>;
552
- };
553
- export type CookieSameSite = 'strict' | 'lax';
554
- export type CookieOptions = {
555
- age?: number;
556
- sameSite?: CookieSameSite;
557
- path?: string;
558
- domain?: string;
559
- secure?: boolean;
560
- httpOnly?: boolean;
561
- partitioned?: boolean;
562
- arguments?: string[] | Record<string, string | number | boolean>;
563
- };
564
- export type LoadingDetail = {
565
- loading: boolean;
566
- };
567
- export type LoadingRegistrationItem = {
568
- item: EventItem<Window, CustomEvent, LoadingDetail>;
569
- listener: EventListenerDetail<CustomEvent, LoadingDetail>;
570
- element?: ElementOrString<HTMLElement>;
571
- };
572
- export type ApiInstanceOptions = {
573
- headersClass?: typeof ApiHeaders;
574
- requestDefaultClass?: typeof ApiDefault;
575
- statusClass?: typeof ApiStatus;
576
- responseClass?: typeof ApiResponse;
577
- preparationClass?: typeof ApiPreparation;
578
- loadingClass?: LoadingInstance;
579
- errorCenterClass?: ErrorCenterInstance;
580
- hydrationClass?: typeof ApiHydration;
581
- wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
582
- };
583
- export declare const GEO_FLAG_ICON_NAME = "f";
584
- export declare const UI_GEO_COOKIE_KEY = "ui-geo-code";
585
538
  export declare const errorCauseList: ErrorCenterCauseList;
586
- /**
587
- * Utility for making HTTP requests.
588
- */
589
539
  export declare class Api {
590
540
  static isLocalhost(): boolean;
591
541
  static getItem(): ApiInstance;
@@ -613,9 +563,6 @@ export declare class Api {
613
563
  static patch<T>(request: ApiFetch): Promise<T>;
614
564
  static delete<T>(request: ApiFetch): Promise<T>;
615
565
  }
616
- /**
617
- * Class for caching API responses.
618
- */
619
566
  export declare class ApiCache {
620
567
  static init(getListener: (key: string) => Promise<ApiCacheItem | undefined>, setListener: (key: string, value: ApiCacheItem) => Promise<boolean>, removeListener: (key: string) => Promise<boolean>, cacheStepAgeClearOld?: number): void;
621
568
  static reset(): void;
@@ -625,9 +572,6 @@ export declare class ApiCache {
625
572
  static setByFetch<T>(fetch: ApiFetch, value: T): Promise<void>;
626
573
  static remove(key: string): Promise<void>;
627
574
  }
628
- /**
629
- * Class for handling and processing data returned from an API request.
630
- */
631
575
  export declare class ApiDataReturn<T = any> {
632
576
  constructor(apiFetch: ApiFetch, query: Response, end: ApiPreparationEnd, error?: ApiErrorItem | undefined);
633
577
  init(): Promise<this>;
@@ -635,26 +579,17 @@ export declare class ApiDataReturn<T = any> {
635
579
  getAndStatus(status: ApiStatus): ApiData<T>;
636
580
  getData(): ApiData<T> | undefined;
637
581
  }
638
- /**
639
- * Class for working with default API request data.
640
- */
641
582
  export declare class ApiDefault {
642
583
  is(): boolean;
643
584
  get(): Record<string, any> | undefined;
644
585
  request(request: ApiFetch['request']): ApiFetch['request'];
645
586
  set(request: ApiDefaultValue): this;
646
587
  }
647
- /**
648
- * Utility class for managing the API error storage and creating error items.
649
- */
650
588
  export declare class ApiError {
651
589
  static getStorage(): ApiErrorStorage;
652
590
  static add(item: Partial<ApiErrorStorageItem> | Partial<ApiErrorStorageItem>[], url?: string | RegExp, method?: ApiMethodItem): void;
653
591
  static getItem(method: ApiMethodItem, response: Response): Promise<ApiErrorItem>;
654
592
  }
655
- /**
656
- * Class for managing and extracting data from an API error response.
657
- */
658
593
  export declare class ApiErrorItem {
659
594
  constructor(method: ApiMethodItem, response: Response, error: ApiErrorStorageItem);
660
595
  getMethod(): ApiMethodItem;
@@ -664,32 +599,31 @@ export declare class ApiErrorItem {
664
599
  getMessage(): string | undefined;
665
600
  getStatus(): number;
666
601
  }
667
- /**
668
- * Manager for handling and identifying API error states.
669
- */
670
602
  export declare class ApiErrorStorage {
671
603
  find(method: ApiMethodItem, response: Response): Promise<ApiErrorStorageItem>;
672
604
  add(item: Partial<ApiErrorStorageItem> | Partial<ApiErrorStorageItem>[], url?: string | RegExp, method?: ApiMethodItem): this;
673
605
  }
674
- /**
675
- * Class for managing HTTP request headers.
676
- */
677
606
  export declare class ApiHeaders {
678
607
  get(value?: Record<string, string> | null, type?: string | undefined | null): Record<string, string> | undefined;
679
608
  getByRequest(request: ApiFetch['request'], value?: Record<string, string> | null, type?: string): Record<string, string> | undefined;
680
609
  set(headers: ApiHeadersValue): this;
681
610
  }
682
- /**
683
- * Class for collecting API data for hydration on the client side during SSR.
684
- */
685
611
  export declare class ApiHydration {
686
612
  initResponse(response: ApiResponse): void;
687
613
  toClient<T>(apiFetch: ApiFetch, response: T): void;
688
614
  toString(): string;
689
615
  }
690
- /**
691
- * Core class for managing HTTP requests using the Fetch API.
692
- */
616
+ export type ApiInstanceOptions = {
617
+ headersClass?: typeof ApiHeaders;
618
+ requestDefaultClass?: typeof ApiDefault;
619
+ statusClass?: typeof ApiStatus;
620
+ responseClass?: typeof ApiResponse;
621
+ preparationClass?: typeof ApiPreparation;
622
+ loadingClass?: LoadingInstance;
623
+ errorCenterClass?: ErrorCenterInstance;
624
+ hydrationClass?: typeof ApiHydration;
625
+ wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
626
+ };
693
627
  export declare class ApiInstance {
694
628
  constructor(url?: string, options?: ApiInstanceOptions);
695
629
  isLocalhost(): boolean;
@@ -716,18 +650,12 @@ export declare class ApiInstance {
716
650
  patch<T>(request: ApiFetch): Promise<T>;
717
651
  delete<T>(request: ApiFetch): Promise<T>;
718
652
  }
719
- /**
720
- * Class for preparing requests before and after execution.
721
- */
722
653
  export declare class ApiPreparation {
723
654
  make(active: boolean, apiFetch: ApiFetch): Promise<void>;
724
655
  makeEnd(active: boolean, query: Response, apiFetch: ApiFetch): Promise<ApiPreparationEnd>;
725
656
  set(callback: (apiFetch: ApiFetch) => Promise<void>): this;
726
657
  setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
727
658
  }
728
- /**
729
- * Class for working with API responses.
730
- */
731
659
  export declare class ApiResponse {
732
660
  constructor(requestDefault: ApiDefault);
733
661
  get(path: string | undefined, method: ApiMethod, request?: ApiFetch['request'], devMode?: boolean): ApiResponseItem | undefined;
@@ -737,9 +665,6 @@ export declare class ApiResponse {
737
665
  emulator<T>(apiFetch: ApiFetch): Promise<T | undefined>;
738
666
  emulatorAsync<T>(apiFetch: ApiFetch): T | undefined;
739
667
  }
740
- /**
741
- * Class for managing API request status.
742
- */
743
668
  export declare class ApiStatus {
744
669
  get(): ApiStatusItem | undefined;
745
670
  getStatus(): number | undefined;
@@ -757,9 +682,6 @@ export declare class ApiStatus {
757
682
  setLastCode(code?: string): this;
758
683
  setLastMessage(message?: string): this;
759
684
  }
760
- /**
761
- * Class for working with BroadcastChannel messages.
762
- */
763
685
  export declare class BroadcastMessage<Message = any> {
764
686
  constructor(name: string, callback?: ((event: MessageEvent<Message>) => void) | undefined, callbackError?: ((event: MessageEvent<Message>) => void) | undefined, errorCenter?: ErrorCenterInstance);
765
687
  getChannel(): BroadcastChannel | undefined;
@@ -768,35 +690,34 @@ export declare class BroadcastMessage<Message = any> {
768
690
  setCallbackError(callbackError: (event: MessageEvent<Message>) => void): this;
769
691
  destroy(): this;
770
692
  }
771
- /**
772
- * Simple in-memory cache class that stores computed values by key.
773
- * @deprecated
774
- */
693
+ /** @deprecated This class is obsolete and should not be used */
775
694
  export declare class Cache {
776
695
  get<T>(name: string, callback: () => T, comparison?: any[]): T;
777
696
  getAsync<T>(name: string, callback: () => T, comparison?: any[]): Promise<T>;
778
697
  }
779
- /**
780
- * Class for managing a single cached value with dependency tracking.
781
- * @deprecated
782
- */
698
+ /** @deprecated This class is obsolete and should not be used */
783
699
  export declare class CacheItem<T> {
784
700
  constructor(callback: () => T);
785
701
  getCache(comparison: any[]): T;
786
702
  getCacheOld(): T | undefined;
787
703
  getCacheAsync(comparison: any[]): Promise<T>;
788
704
  }
789
- /**
790
- * Static cache class that uses ServerStorage for persistent caching across the application.
791
- * @deprecated
792
- */
705
+ /** @deprecated This class is obsolete and should not be used */
793
706
  export declare class CacheStatic {
794
707
  static get<T>(name: string, callback: () => T, comparison?: any[]): T;
795
708
  static getAsync<T>(name: string, callback: () => T, comparison?: any[]): Promise<T>;
796
709
  }
797
- /**
798
- * Class for managing browser cookies.
799
- */
710
+ export type CookieSameSite = 'strict' | 'lax';
711
+ export type CookieOptions = {
712
+ age?: number;
713
+ sameSite?: CookieSameSite;
714
+ path?: string;
715
+ domain?: string;
716
+ secure?: boolean;
717
+ httpOnly?: boolean;
718
+ partitioned?: boolean;
719
+ arguments?: string[] | Record<string, string | number | boolean>;
720
+ };
800
721
  export declare class Cookie<T> {
801
722
  static getInstance<T>(name: string): Cookie<T>;
802
723
  constructor(name: string);
@@ -804,24 +725,15 @@ export declare class Cookie<T> {
804
725
  set(value?: T | string | (() => (T | string)), options?: CookieOptions): void;
805
726
  remove(): void;
806
727
  }
807
- /**
808
- * Class for changing cookie access status.
809
- */
810
728
  export declare class CookieBlock {
811
729
  static getItem(): CookieBlockInstance;
812
730
  static get(): boolean;
813
731
  static set(value: boolean): void;
814
732
  }
815
- /**
816
- * Class for changing cookie access status instance.
817
- */
818
733
  export declare class CookieBlockInstance {
819
734
  get(): boolean;
820
735
  set(value: boolean): void;
821
736
  }
822
- /**
823
- * Class for managing cookie storage with support for custom listeners.
824
- */
825
737
  export declare class CookieStorage {
826
738
  static init(getListener?: (key: string) => any | undefined, getListenerRaw?: () => string, setListener?: (key: string, value: any, cookie: string, options?: CookieOptions) => void): void;
827
739
  static reset(): void;
@@ -830,9 +742,6 @@ export declare class CookieStorage {
830
742
  static remove(name: string): void;
831
743
  static update(): void;
832
744
  }
833
- /**
834
- * Class for working with localStorage and sessionStorage.
835
- */
836
745
  export declare class DataStorage<T> {
837
746
  static setPrefix(newPrefix: string): void;
838
747
  constructor(name: string, isSession?: boolean, errorCenter?: ErrorCenterInstance);
@@ -842,7 +751,9 @@ export declare class DataStorage<T> {
842
751
  update(): this;
843
752
  }
844
753
  /**
845
- * Class for date manipulation and formatting.
754
+ * @remarks
755
+ * Creating a `Datetime` instance without a specific date (using current time)
756
+ * in SSR may lead to hydration mismatches.
846
757
  */
847
758
  export declare class Datetime {
848
759
  constructor(date?: NumberOrStringOrDate, type?: GeoDate, code?: string);
@@ -917,9 +828,6 @@ export declare class Datetime {
917
828
  cloneDayNext(): Datetime;
918
829
  cloneDayPrevious(): Datetime;
919
830
  }
920
- /**
921
- * Class for managing application error handling globally.
922
- */
923
831
  export declare class ErrorCenter {
924
832
  static getItem(): ErrorCenterInstance;
925
833
  static has(code: string, group?: string): boolean;
@@ -932,9 +840,6 @@ export declare class ErrorCenter {
932
840
  static setIsConsole(isConsole: ErrorCenterHandlerIsConsole): void;
933
841
  static on(cause: ErrorCenterCauseItem): void;
934
842
  }
935
- /**
936
- * Class for managing and triggering error handlers.
937
- */
938
843
  export declare class ErrorCenterHandler {
939
844
  constructor(handlers?: ErrorCenterHandlerList, isConsole?: ErrorCenterHandlerIsConsole);
940
845
  has(group: ErrorCenterGroup): boolean;
@@ -945,9 +850,6 @@ export declare class ErrorCenterHandler {
945
850
  setIsConsole(isConsole: ErrorCenterHandlerIsConsole): this;
946
851
  on(cause: ErrorCenterCauseItem): this;
947
852
  }
948
- /**
949
- * Class for managing error storage and handling within an instance.
950
- */
951
853
  export declare class ErrorCenterInstance {
952
854
  constructor(causes?: ErrorCenterCauseList, handler?: ErrorCenterHandler);
953
855
  has(code: string, group?: string): boolean;
@@ -960,9 +862,6 @@ export declare class ErrorCenterInstance {
960
862
  setIsConsole(isConsole: ErrorCenterHandlerIsConsole): this;
961
863
  on(cause: ErrorCenterCauseItem): this;
962
864
  }
963
- /**
964
- * Wrapper for managing DOM or window event listeners.
965
- */
966
865
  export declare class EventItem<E extends ElementOrWindow, O extends Event, D extends Record<string, any> = Record<string, any>> {
967
866
  constructor(elementSelector?: ElementOrString<E>, type?: string | string[], listener?: EventListenerDetail<O, D> | undefined, options?: EventOptions, detail?: D | undefined);
968
867
  isActive(): boolean;
@@ -979,9 +878,6 @@ export declare class EventItem<E extends ElementOrWindow, O extends Event, D ext
979
878
  toggle(activity: boolean): this;
980
879
  reset(): this;
981
880
  }
982
- /**
983
- * Class for formatting a list of data based on provided options.
984
- */
985
881
  export declare class Formatters<Options extends FormattersOptionsList = FormattersOptionsList, List extends FormattersListProp = FormattersListProp, Item extends FormattersItemProp<List> = FormattersItemProp<List>> {
986
882
  constructor(options: Options, list?: List | undefined);
987
883
  is(): boolean;
@@ -994,9 +890,6 @@ export declare class Formatters<Options extends FormattersOptionsList = Formatte
994
890
  setList(list?: List): this;
995
891
  to(): FormattersReturn<List, Options>;
996
892
  }
997
- /**
998
- * Static class for working with geographical data.
999
- */
1000
893
  export declare class Geo {
1001
894
  static getObject(): GeoInstance;
1002
895
  static get(): GeoItemFull;
@@ -1021,9 +914,7 @@ export declare class Geo {
1021
914
  static setTimezone(timezone: number): void;
1022
915
  static setValueDefault(code?: string | (() => string)): void;
1023
916
  }
1024
- /**
1025
- * Class for working with flags and geographic information.
1026
- */
917
+ export declare const GEO_FLAG_ICON_NAME = "f";
1027
918
  export declare class GeoFlag {
1028
919
  static flags: Record<string, string>;
1029
920
  constructor(code?: string);
@@ -1037,9 +928,7 @@ export declare class GeoFlag {
1037
928
  getNationalLanguage(codes?: string[], sort?: boolean): GeoFlagNational[];
1038
929
  setCode(code: string): this;
1039
930
  }
1040
- /**
1041
- * Base class for working with geographic data.
1042
- */
931
+ export declare const UI_GEO_COOKIE_KEY = "ui-geo-code";
1043
932
  export declare class GeoInstance {
1044
933
  constructor();
1045
934
  get(): GeoItemFull;
@@ -1064,9 +953,6 @@ export declare class GeoInstance {
1064
953
  setTimezone(timezone: number): void;
1065
954
  setValueDefault(code?: string | (() => string)): void;
1066
955
  }
1067
- /**
1068
- * Internationalization wrapper for numbers, dates, currencies, and plurals.
1069
- */
1070
956
  export declare class GeoIntl {
1071
957
  static isItem(code?: string): boolean;
1072
958
  static getLocation(code?: string): string;
@@ -1098,9 +984,6 @@ export declare class GeoIntl {
1098
984
  time(value: NumberOrStringOrDate): string;
1099
985
  sort<T>(data: T[], compareFn?: (a: T, b: T) => [string, string]): T[];
1100
986
  }
1101
- /**
1102
- * Utility for phone number formatting and country phone codes.
1103
- */
1104
987
  export declare class GeoPhone {
1105
988
  static get(code: string): GeoPhoneValue | undefined;
1106
989
  static getByPhone(phone: string): GeoPhoneMapInfo;
@@ -1110,9 +993,6 @@ export declare class GeoPhone {
1110
993
  static toMask(phone: string, masks?: string[]): string | undefined;
1111
994
  static removeZero(phone: string): string;
1112
995
  }
1113
- /**
1114
- * Class for localized unit formatting and automatic conversions.
1115
- */
1116
996
  export declare class GeoUnit {
1117
997
  static getInstance(code?: string): GeoUnit;
1118
998
  constructor(code?: string);
@@ -1132,17 +1012,11 @@ export declare class GeoUnit {
1132
1012
  kilometerPerHour(value: NumberOrString, options?: Intl.NumberFormatOptions): string;
1133
1013
  format(value: NumberOrString, unit: string, options?: Intl.NumberFormatOptions): string;
1134
1014
  }
1135
- /**
1136
- * Static utility class for global application data.
1137
- */
1138
1015
  export declare class Global {
1139
1016
  static getItem(): Record<string, any>;
1140
1017
  static get<R = any>(name: string): R;
1141
1018
  static add(data: Record<string, any>): void;
1142
1019
  }
1143
- /**
1144
- * Static class for working with URL hash data.
1145
- */
1146
1020
  export declare class Hash {
1147
1021
  static getItem(): HashInstance;
1148
1022
  static get<T>(name: string, defaultValue?: T | (() => T)): T;
@@ -1151,13 +1025,12 @@ export declare class Hash {
1151
1025
  static removeWatch<T>(name: string, callback: (value: T) => void): void;
1152
1026
  static reload(): void;
1153
1027
  }
1154
- /**
1155
- * Instance class for working with URL hash parameters.
1156
- */
1157
1028
  export declare class HashInstance extends UrlInstanceAbstract {}
1158
- /**
1159
- * Class for managing icons.
1160
- */
1029
+ export type IconsItem = string | Promise<string | any> | (() => Promise<string | any>);
1030
+ export type IconsConfig = {
1031
+ url?: string;
1032
+ list?: Record<string, IconsItem>;
1033
+ };
1161
1034
  export declare class Icons {
1162
1035
  static is(index: string): boolean;
1163
1036
  static get(index: string, url?: string, wait?: number): Promise<string>;
@@ -1171,9 +1044,6 @@ export declare class Icons {
1171
1044
  static setUrl(url: string): void;
1172
1045
  static setConfig(config: IconsConfig): void;
1173
1046
  }
1174
- /**
1175
- * Class for managing global loading state.
1176
- */
1177
1047
  export declare class Loading {
1178
1048
  static is(): boolean;
1179
1049
  static get(): number;
@@ -1183,9 +1053,14 @@ export declare class Loading {
1183
1053
  static registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
1184
1054
  static unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
1185
1055
  }
1186
- /**
1187
- * Instance class for managing loading state.
1188
- */
1056
+ export type LoadingDetail = {
1057
+ loading: boolean;
1058
+ };
1059
+ export type LoadingRegistrationItem = {
1060
+ item: EventItem<Window, CustomEvent, LoadingDetail>;
1061
+ listener: EventListenerDetail<CustomEvent, LoadingDetail>;
1062
+ element?: ElementOrString<HTMLElement>;
1063
+ };
1189
1064
  export declare class LoadingInstance {
1190
1065
  constructor(eventName?: string);
1191
1066
  is(): boolean;
@@ -1195,9 +1070,6 @@ export declare class LoadingInstance {
1195
1070
  registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
1196
1071
  unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
1197
1072
  }
1198
- /**
1199
- * Class for managing meta tags.
1200
- */
1201
1073
  export declare class Meta extends MetaManager<MetaTag[]> {
1202
1074
  constructor();
1203
1075
  getOg(): MetaOg;
@@ -1224,9 +1096,9 @@ export declare class Meta extends MetaManager<MetaTag[]> {
1224
1096
  html(): string;
1225
1097
  htmlTitle(): string;
1226
1098
  }
1227
- /**
1228
- * Manager class for meta tags.
1229
- */
1099
+ type MetaList<T extends readonly string[]> = {
1100
+ [K in T[number]]?: string;
1101
+ };
1230
1102
  export declare class MetaManager<T extends readonly string[], Key extends keyof MetaList<T> = keyof MetaList<T>> {
1231
1103
  constructor(listMeta: T, isProperty?: boolean);
1232
1104
  getListMeta(): T;
@@ -1236,12 +1108,6 @@ export declare class MetaManager<T extends readonly string[], Key extends keyof
1236
1108
  set(name: Key, content: string): this;
1237
1109
  setByList(metaList: MetaList<T>): this;
1238
1110
  }
1239
- type MetaList<T extends readonly string[]> = {
1240
- [K in T[number]]?: string;
1241
- };
1242
- /**
1243
- * Class for Open Graph meta tags.
1244
- */
1245
1111
  export declare class MetaOg extends MetaManager<MetaOpenGraphTag[]> {
1246
1112
  constructor();
1247
1113
  getTitle(): string;
@@ -1259,9 +1125,6 @@ export declare class MetaOg extends MetaManager<MetaOpenGraphTag[]> {
1259
1125
  setLocale(locale: string): this;
1260
1126
  setSiteName(siteName: string): this;
1261
1127
  }
1262
- /**
1263
- * Static accessor for Meta management.
1264
- */
1265
1128
  export declare class MetaStatic {
1266
1129
  static getItem(): Meta;
1267
1130
  static getOg(): MetaOg;
@@ -1288,9 +1151,6 @@ export declare class MetaStatic {
1288
1151
  static html(): string;
1289
1152
  static htmlTitle(): string;
1290
1153
  }
1291
- /**
1292
- * Class for Twitter Card meta tags.
1293
- */
1294
1154
  export declare class MetaTwitter extends MetaManager<MetaTwitterTag[]> {
1295
1155
  constructor();
1296
1156
  getCard(): MetaTwitterCard;
@@ -1308,9 +1168,6 @@ export declare class MetaTwitter extends MetaManager<MetaTwitterTag[]> {
1308
1168
  setDescription(description: string): this;
1309
1169
  setImage(image: string): this;
1310
1170
  }
1311
- /**
1312
- * Static class for URL query parameter management.
1313
- */
1314
1171
  export declare class Query {
1315
1172
  static getItem(): QueryInstance;
1316
1173
  static get<T>(name: string, defaultValue?: T | (() => T)): T;
@@ -1319,13 +1176,7 @@ export declare class Query {
1319
1176
  static removeWatch<T>(name: string, callback: (value: T) => void): void;
1320
1177
  static reload(): void;
1321
1178
  }
1322
- /**
1323
- * Instance class for URL query parameters.
1324
- */
1325
1179
  export declare class QueryInstance extends UrlInstanceAbstract {}
1326
- /**
1327
- * Class for creating a timer that can be paused and resumed.
1328
- */
1329
1180
  export declare class ResumableTimer {
1330
1181
  constructor(callback: FunctionVoid, delay?: number, blockStart?: boolean);
1331
1182
  resume(): this;
@@ -1333,18 +1184,12 @@ export declare class ResumableTimer {
1333
1184
  reset(): this;
1334
1185
  clear(): this;
1335
1186
  }
1336
- /**
1337
- * Utility class for scrollbar calculations.
1338
- */
1339
1187
  export declare class ScrollbarWidth {
1340
1188
  static is(): Promise<boolean>;
1341
1189
  static get(): Promise<number>;
1342
1190
  static getStorage(): DataStorage<number>;
1343
1191
  static getCalculate(): boolean;
1344
1192
  }
1345
- /**
1346
- * Class for managing search lists.
1347
- */
1348
1193
  export declare class SearchList<T extends SearchItem, K extends SearchColumns<T>> {
1349
1194
  constructor(list: SearchListValue<T>, columns?: K, value?: string, options?: SearchOptions);
1350
1195
  getData(): SearchListData<T, K>;
@@ -1359,9 +1204,6 @@ export declare class SearchList<T extends SearchItem, K extends SearchColumns<T>
1359
1204
  setOptions(options: SearchOptions): this;
1360
1205
  to(): SearchFormatList<T, K>;
1361
1206
  }
1362
- /**
1363
- * Data manager for search lists.
1364
- */
1365
1207
  export declare class SearchListData<T extends SearchItem, K extends SearchColumns<T>> {
1366
1208
  constructor(list: SearchListValue<T>, columns: K | undefined, item: SearchListItem, options: SearchListOptions);
1367
1209
  is(): this is this & {
@@ -1379,9 +1221,6 @@ export declare class SearchListData<T extends SearchItem, K extends SearchColumn
1379
1221
  forEach(callback: (item: SearchCacheItem<T>['item'], value: SearchCacheItem<T>['value']) => SearchFormatItem<T, K> | undefined): SearchFormatList<T, K>;
1380
1222
  toFormatItem(item: T, selection: boolean): SearchFormatItem<T, K>;
1381
1223
  }
1382
- /**
1383
- * Search list item wrapper.
1384
- */
1385
1224
  export declare class SearchListItem {
1386
1225
  constructor(value: string | undefined, options: SearchListOptions);
1387
1226
  is(): this is this & {
@@ -1391,9 +1230,6 @@ export declare class SearchListItem {
1391
1230
  get(): string;
1392
1231
  set(value?: string): this;
1393
1232
  }
1394
- /**
1395
- * Matcher for search list evaluation.
1396
- */
1397
1233
  export declare class SearchListMatcher {
1398
1234
  constructor(item: SearchListItem, options: SearchListOptions);
1399
1235
  is(): boolean;
@@ -1401,9 +1237,6 @@ export declare class SearchListMatcher {
1401
1237
  get(): RegExp | undefined;
1402
1238
  update(): void;
1403
1239
  }
1404
- /**
1405
- * Options container for search lists.
1406
- */
1407
1240
  export declare class SearchListOptions {
1408
1241
  constructor(options?: SearchOptions | undefined);
1409
1242
  getOptions(): SearchOptions;
@@ -1414,22 +1247,16 @@ export declare class SearchListOptions {
1414
1247
  getClassName(): string;
1415
1248
  setOptions(options: SearchOptions): this;
1416
1249
  }
1417
- /**
1418
- * Storage manager for Server-Side Rendering context.
1419
- */
1420
1250
  export declare class ServerStorage {
1421
1251
  static init(listener: () => Record<string, any> | undefined): typeof ServerStorage;
1422
1252
  static reset(): void;
1423
1253
  static has(key: string): boolean;
1424
1254
  static get<T = any>(key: string, defaultValue?: () => T, hydration?: boolean): T;
1425
- static set<T = any>(key: string, value: () => T, hydration?: boolean, storageList?: Record<string, any>): T;
1255
+ static set<T = any>(key: string, value: () => T, hydration?: boolean, storageList?: ServerStorageList): T;
1426
1256
  static setErrorStatus(hide: boolean): void;
1427
1257
  static remove(key: string): void;
1428
1258
  static toString(): string;
1429
1259
  }
1430
- /**
1431
- * Callback queue for storage mechanisms.
1432
- */
1433
1260
  export declare class StorageCallback<T = any, Callback = (value: T) => void | Promise<void>> {
1434
1261
  static getInstance<T>(name: string, group?: string): StorageCallback<T, (value: T) => void | Promise<void>>;
1435
1262
  constructor(name: string, group?: string);
@@ -1441,9 +1268,6 @@ export declare class StorageCallback<T = any, Callback = (value: T) => void | Pr
1441
1268
  preparation(): this;
1442
1269
  run(value: T): Promise<this>;
1443
1270
  }
1444
- /**
1445
- * Utility for translation text retrieval.
1446
- */
1447
1271
  export declare class Translate {
1448
1272
  static get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
1449
1273
  static getItem(): TranslateInstance;
@@ -1460,9 +1284,6 @@ export declare class Translate {
1460
1284
  static setReadApi(value: boolean): void;
1461
1285
  static setConfig(config: TranslateConfig): void;
1462
1286
  }
1463
- /**
1464
- * Translation file provider.
1465
- */
1466
1287
  export declare class TranslateFile {
1467
1288
  constructor(data?: TranslateDataFile, language?: string | (() => string), location?: string | (() => string));
1468
1289
  isFile(): boolean;
@@ -1471,9 +1292,6 @@ export declare class TranslateFile {
1471
1292
  getList(): Promise<TranslateDataFileList | undefined>;
1472
1293
  add(data: TranslateDataFile): void;
1473
1294
  }
1474
- /**
1475
- * Translation engine instance.
1476
- */
1477
1295
  export declare class TranslateInstance {
1478
1296
  constructor(url?: string, propsName?: string, files?: TranslateFile);
1479
1297
  get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
@@ -1489,9 +1307,6 @@ export declare class TranslateInstance {
1489
1307
  setPropsName(name: string): this;
1490
1308
  setReadApi(value: boolean): this;
1491
1309
  }
1492
- /**
1493
- * Abstract class for URL state instances.
1494
- */
1495
1310
  export declare abstract class UrlInstanceAbstract {
1496
1311
  get<T>(name: string, defaultValue?: T | (() => T)): T;
1497
1312
  set<T>(name: string, callback: T | (() => T)): this;
@@ -1499,9 +1314,6 @@ export declare abstract class UrlInstanceAbstract {
1499
1314
  removeWatch<T>(name: string, callback: (value: T) => void): this;
1500
1315
  reload(): this;
1501
1316
  }
1502
- /**
1503
- * Isomorphic utility class for URL management.
1504
- */
1505
1317
  export declare class UrlItem {
1506
1318
  static getInstance(): UrlItem;
1507
1319
  constructor(url?: string | URL);
@@ -1529,12 +1341,16 @@ export declare class UrlItem {
1529
1341
  }
1530
1342
  export declare function addTagHighlightMatch(value: string, search?: string | RegExp, className?: string, shouldEscape?: boolean): string;
1531
1343
  export declare function anyToString<V>(value: V, isArrayString?: boolean, trim?: boolean): string;
1532
- export declare const applyTemplate: (text: string, replacement?: Record<string, string | number | boolean> | string[]) => string;
1344
+ export declare function applyTemplate(text: string, replacement?: Record<string, string | number | boolean> | string[]): string;
1533
1345
  export declare function arrFill<T>(value: T, count: number): T[];
1534
1346
  export declare function blobToBase64(blob: Blob, clean?: boolean): Promise<string | undefined>;
1535
1347
  export declare function capitalize(value: string, isLocale?: boolean): string;
1536
1348
  export declare function copyObject<T>(value: T): T;
1537
1349
  export declare function copyObjectLite<T, R = T>(value: T, source?: any): R;
1350
+ /**
1351
+ * @remarks
1352
+ * Always returns `undefined` when running on server.
1353
+ */
1538
1354
  export declare function createElement<T extends HTMLElement>(parentElement?: HTMLElement, tagName?: string, options?: Partial<T> | Record<keyof T, T[keyof T]> | ((element: T) => void), referenceElement?: HTMLElement): T | undefined;
1539
1355
  export declare function domContentLoaded<T = void>(callback: () => T | Promise<T>): Promise<T>;
1540
1356
  export declare function domQuerySelector<E extends Element = Element>(selectors: string): E | undefined;
@@ -1552,10 +1368,27 @@ export declare function getArrayHighlightMatch(value: string, search?: string |
1552
1368
  export declare function getAttributes<E extends ElementOrWindow>(element?: ElementOrString<E>): Record<string, string | undefined>;
1553
1369
  export declare function getClipboardData(event?: ClipboardEvent): Promise<string>;
1554
1370
  export declare function getColumn<T, K extends keyof T>(array: ObjectOrArray<T>, column: K): (T[K] | undefined)[];
1371
+ /**
1372
+ * @remarks
1373
+ * Using in SSR may cause hydration mismatches.
1374
+ */
1555
1375
  export declare function getCurrentDate(format?: GeoDate): string;
1376
+ /**
1377
+ * @remarks
1378
+ * Using in SSR will cause hydration mismatches.
1379
+ */
1556
1380
  export declare function getCurrentTime(): number;
1557
1381
  export declare function getElement<E extends ElementOrWindow, R extends Exclude<E, Window>>(element?: ElementOrString<E>): R | undefined;
1558
1382
  export declare function getElementId<E extends ElementOrWindow>(element?: ElementOrString<E>, selector?: string): string;
1383
+ /**
1384
+ * @warning Initialization mandatory for correct SSR functioning.
1385
+ * @example
1386
+ * ```typescript
1387
+ * import { useId } from 'vue'
1388
+ * import { initGetElementId } from '@dxtmisha/functional-basic'
1389
+ * initGetElementId(() => useId())
1390
+ * ```
1391
+ */
1559
1392
  export declare function initGetElementId(newListener: () => string | number): void;
1560
1393
  export declare function getElementImage(image: HTMLImageElement | string): HTMLImageElement | undefined;
1561
1394
  export declare function getElementItem<T extends ElementOrWindow, K extends keyof T, D>(element: ElementOrString<T>, index: K | string, defaultValue?: D): T[K] | D | undefined;
@@ -1623,7 +1456,7 @@ export declare function removeCommonPrefix(mainStr: string, prefix: string): str
1623
1456
  export declare const replaceComponentName: (text: string | undefined, name: string, componentName: string) => string | undefined;
1624
1457
  export declare function replaceRecursive<I>(array: ObjectItem<I>, replacement?: ObjectOrArray<I>, isMerge?: boolean): ObjectItem<I>;
1625
1458
  export declare function replaceTemplate(value: string, replaces: Record<string, string | FunctionReturn<string>>): string;
1626
- type ResizeImageByMaxType = 'auto' | 'width' | 'height';
1459
+ export type ResizeImageByMaxType = 'auto' | 'width' | 'height';
1627
1460
  export declare function resizeImageByMax(image: HTMLImageElement | string, maxSize: number, type?: ResizeImageByMaxType, typeData?: string): string | undefined;
1628
1461
  export declare function secondToTime(second: number | string | undefined, hasHour?: boolean): string;
1629
1462
  export declare function setElementItem<E extends ElementOrWindow, K extends keyof E, V extends E[K] = E[K]>(element: ElementOrString<E>, index: K, value: V | Record<string, V>): E | undefined;
@@ -1649,9 +1482,6 @@ export declare function toNumberPositive(value?: number | string | null, default
1649
1482
  export declare function toPercent(maxValue: number, value: number): number;
1650
1483
  export declare function toPercentBy100(maxValue: number, value: number): number;
1651
1484
  export declare function toString<T>(value: T): string;
1652
- /**
1653
- * Transforms a string into the corresponding primitive data type or object.
1654
- */
1655
1485
  export declare function transformation(value: any, isFunction?: boolean): any;
1656
1486
  export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
1657
1487
  export declare function uniqueArray<T>(value: T[]): T[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/functional-basic",
3
3
  "private": false,
4
- "version": "1.8.3",
4
+ "version": "1.8.4",
5
5
  "type": "module",
6
6
  "description": "Foundational isomorphic utility library for modern web and SSR development — HTTP client, state storage, i18n localization, SEO metadata, DOM events, formatting, and data utilities. Framework-agnostic, TypeScript-first.",
7
7
  "keywords": [