@dxtmisha/functional-basic 1.3.13 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/ai-description.md +25 -0
- package/ai-doc.md +341 -0
- package/{ai-types.txt → ai-types.md} +630 -134
- package/dist/library.js +440 -358
- package/dist/src/classes/Geo.d.ts +14 -0
- package/dist/src/classes/GeoInstance.d.ts +16 -1
- package/dist/src/classes/HashInstance.d.ts +8 -74
- package/dist/src/classes/Query.d.ts +57 -0
- package/dist/src/classes/QueryInstance.d.ts +29 -0
- package/dist/src/classes/UrlInstanceAbstract.d.ts +94 -0
- package/dist/src/classes/UrlItem.d.ts +48 -0
- package/dist/src/library.d.ts +3 -0
- package/dist/src/types/geoTypes.d.ts +6 -0
- package/package.json +4 -4
- package/ai-description.txt +0 -18
- package/ai-doc.txt +0 -54
|
@@ -57,6 +57,20 @@ export declare class Geo {
|
|
|
57
57
|
* @returns location string / строка местоположения
|
|
58
58
|
*/
|
|
59
59
|
static getLocation(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the country code extracted from the location string.
|
|
62
|
+
*
|
|
63
|
+
* Возвращает код страны, извлеченный из строки местоположения.
|
|
64
|
+
* @returns country code / код страны
|
|
65
|
+
*/
|
|
66
|
+
static getLocationCountry(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the language code extracted from the location string.
|
|
69
|
+
*
|
|
70
|
+
* Возвращает код языка, извлеченный из строки местоположения.
|
|
71
|
+
* @returns language code / код языка
|
|
72
|
+
*/
|
|
73
|
+
static getLocationLanguage(): string;
|
|
60
74
|
/**
|
|
61
75
|
* Returns fully processed geo data updated with the current language.
|
|
62
76
|
*
|
|
@@ -92,6 +92,20 @@ export declare class GeoInstance {
|
|
|
92
92
|
* @returns location string / строка местоположения
|
|
93
93
|
*/
|
|
94
94
|
getLocation(): string;
|
|
95
|
+
/**
|
|
96
|
+
* Getting the country code from the location.
|
|
97
|
+
*
|
|
98
|
+
* Получение кода страны из местоположения.
|
|
99
|
+
* @returns country code / код страны
|
|
100
|
+
*/
|
|
101
|
+
getLocationCountry(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Getting the language code from the location.
|
|
104
|
+
*
|
|
105
|
+
* Получение кода языка из местоположения.
|
|
106
|
+
* @returns language code / код языка
|
|
107
|
+
*/
|
|
108
|
+
getLocationLanguage(): string;
|
|
95
109
|
/**
|
|
96
110
|
* Getting processed data including the current language.
|
|
97
111
|
*
|
|
@@ -167,7 +181,7 @@ export declare class GeoInstance {
|
|
|
167
181
|
* @param item geo item data / данные гео-объекта
|
|
168
182
|
* @returns standard code string / строка стандартного кода
|
|
169
183
|
*/
|
|
170
|
-
toStandard(item: GeoItem): string;
|
|
184
|
+
toStandard(item: GeoItem, language?: string): string;
|
|
171
185
|
/**
|
|
172
186
|
* Updates the current location and related data.
|
|
173
187
|
*
|
|
@@ -242,6 +256,7 @@ export declare class GeoInstance {
|
|
|
242
256
|
*
|
|
243
257
|
* Внутренний метод для заполнения отсутствующих полей в гео-объекте.
|
|
244
258
|
* @param item basic geo item / базовый гео-объект
|
|
259
|
+
* @param code country code, full form language-country or one of them / код страны, полный вид язык-страна или один из них
|
|
245
260
|
* @returns full geo item data / полные данные гео-объекта
|
|
246
261
|
*/
|
|
247
262
|
private toFull;
|
|
@@ -1,95 +1,29 @@
|
|
|
1
|
+
import { UrlInstanceAbstract } from './UrlInstanceAbstract';
|
|
1
2
|
/**
|
|
2
3
|
* Class for working with data stored in the URL hash.
|
|
3
4
|
*
|
|
4
5
|
* Класс для работы с данными, сохранёнными в хеше URL.
|
|
5
6
|
*/
|
|
6
|
-
export declare class HashInstance {
|
|
7
|
-
private hash?;
|
|
8
|
-
private watch;
|
|
9
|
-
private block;
|
|
10
|
-
private time?;
|
|
7
|
+
export declare class HashInstance extends UrlInstanceAbstract {
|
|
11
8
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Получение данных из хэша.
|
|
15
|
-
* @param name variable name / название переменной
|
|
16
|
-
* @param defaultValue value or function to change data / значение или функция для изменения данных
|
|
17
|
-
* @returns stored value / сохранённое значение
|
|
18
|
-
*/
|
|
19
|
-
get<T>(name: string, defaultValue?: T | (() => T)): T;
|
|
20
|
-
/**
|
|
21
|
-
* Change data in hash.
|
|
22
|
-
*
|
|
23
|
-
* Изменение данных в хэше.
|
|
24
|
-
* @param name variable name / название переменной
|
|
25
|
-
* @param callback value or function to change data / значение или функция для изменения данных
|
|
26
|
-
* @returns this instance / текущий экземпляр
|
|
27
|
-
*/
|
|
28
|
-
set<T>(name: string, callback: T | (() => T)): this;
|
|
29
|
-
/**
|
|
30
|
-
* Adding an event when data is changed.
|
|
31
|
-
*
|
|
32
|
-
* Добавление события при изменении данных.
|
|
33
|
-
* @param name variable name / название переменной
|
|
34
|
-
* @param callback the function is called when the data is changed / функция вызывается при изменении данных
|
|
35
|
-
* @returns this instance / текущий экземпляр
|
|
36
|
-
*/
|
|
37
|
-
addWatch<T>(name: string, callback: (value: T) => void): this;
|
|
38
|
-
/**
|
|
39
|
-
* Removing an event when data is changed.
|
|
40
|
-
*
|
|
41
|
-
* Удаление события при изменении данных.
|
|
42
|
-
* @param name variable name / название переменной
|
|
43
|
-
* @param callback the function is called when the data is changed / функция вызывается при изменении данных
|
|
44
|
-
* @returns this instance / текущий экземпляр
|
|
45
|
-
*/
|
|
46
|
-
removeWatch<T>(name: string, callback: (value: T) => void): this;
|
|
47
|
-
/**
|
|
48
|
-
* Update hash variable from URL string.
|
|
9
|
+
* Initializes hash data and registers the hashchange listener.
|
|
49
10
|
*
|
|
50
|
-
*
|
|
11
|
+
* Инициализирует данные хэша и регистрирует слушатель hashchange.
|
|
51
12
|
* @returns this instance / текущий экземпляр
|
|
52
13
|
*/
|
|
53
|
-
|
|
14
|
+
protected init(): this;
|
|
54
15
|
/**
|
|
55
16
|
* Obtaining data from the URL string.
|
|
56
17
|
*
|
|
57
18
|
* Получение данных из строки URL.
|
|
58
19
|
* @returns Record<string, any> hash data / данные хэша
|
|
59
20
|
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Returns the hash object, initializing if needed.
|
|
63
|
-
*
|
|
64
|
-
* Возвращает объект хэша, инициализируя при необходимости.
|
|
65
|
-
* @returns Record<string, any> hash object / объект хэша
|
|
66
|
-
*/
|
|
67
|
-
private getHash;
|
|
68
|
-
/**
|
|
69
|
-
* Initializes hash data and registers the hashchange listener.
|
|
70
|
-
*
|
|
71
|
-
* Инициализирует данные хэша и регистрирует слушатель hashchange.
|
|
72
|
-
* @returns this instance / текущий экземпляр
|
|
73
|
-
*/
|
|
74
|
-
private init;
|
|
75
|
-
/**
|
|
76
|
-
* Reads hash data from the URL and triggers watchers.
|
|
77
|
-
*
|
|
78
|
-
* Считывает данные хэша из URL и вызывает наблюдателей.
|
|
79
|
-
* @returns this instance / текущий экземпляр
|
|
80
|
-
*/
|
|
81
|
-
private initData;
|
|
21
|
+
protected getLocation(): Record<string, any>;
|
|
82
22
|
/**
|
|
83
23
|
* Update hash string in URL.
|
|
84
24
|
*
|
|
85
25
|
* Обновление строки хэша в URL.
|
|
26
|
+
* @returns this instance / текущий экземпляр
|
|
86
27
|
*/
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Calling all functions whose data has changed.
|
|
90
|
-
*
|
|
91
|
-
* Вызов всех функций, у которых были изменены данные.
|
|
92
|
-
* @param location fresh data / свежие данные
|
|
93
|
-
*/
|
|
94
|
-
private makeWatch;
|
|
28
|
+
protected update(): this;
|
|
95
29
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { QueryInstance } from './QueryInstance';
|
|
2
|
+
/**
|
|
3
|
+
* Static class for working with data stored in the URL query parameters.
|
|
4
|
+
* Provides a centralized interface delegating to QueryInstance.
|
|
5
|
+
*
|
|
6
|
+
* Статический класс для работы с данными, сохранёнными в query-параметрах URL.
|
|
7
|
+
* Предоставляет централизованный интерфейс, делегируя вызовы QueryInstance.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Query {
|
|
10
|
+
/**
|
|
11
|
+
* Returns a request-isolated instance of QueryInstance.
|
|
12
|
+
*
|
|
13
|
+
* Возвращает изолированный в рамках запроса экземпляр QueryInstance.
|
|
14
|
+
* @returns QueryInstance instance / экземпляр QueryInstance
|
|
15
|
+
*/
|
|
16
|
+
static getItem(): QueryInstance;
|
|
17
|
+
/**
|
|
18
|
+
* Get data from query.
|
|
19
|
+
*
|
|
20
|
+
* Получение данных из query-параметров.
|
|
21
|
+
* @param name variable name / название переменной
|
|
22
|
+
* @param defaultValue value or function to change data / значение или функция для изменения данных
|
|
23
|
+
* @returns stored value / сохранённое значение
|
|
24
|
+
*/
|
|
25
|
+
static get<T>(name: string, defaultValue?: T | (() => T)): T;
|
|
26
|
+
/**
|
|
27
|
+
* Change data in query.
|
|
28
|
+
*
|
|
29
|
+
* Изменение данных в query-параметрах.
|
|
30
|
+
* @param name variable name / название переменной
|
|
31
|
+
* @param callback value or function to change data / значение или функция для изменения данных
|
|
32
|
+
*/
|
|
33
|
+
static set<T>(name: string, callback: T | (() => T)): void;
|
|
34
|
+
/**
|
|
35
|
+
* Adding an event when data is changed.
|
|
36
|
+
*
|
|
37
|
+
* Добавление события при изменении данных.
|
|
38
|
+
* @param name variable name / название переменной
|
|
39
|
+
* @param callback the function is called when the data is changed / функция вызывается при изменении данных
|
|
40
|
+
*/
|
|
41
|
+
static addWatch<T>(name: string, callback: (value: T) => void): void;
|
|
42
|
+
/**
|
|
43
|
+
* Removing an event when data is changed.
|
|
44
|
+
*
|
|
45
|
+
* Удаление события при изменении данных.
|
|
46
|
+
* @param name variable name / название переменной
|
|
47
|
+
* @param callback the function is called when the data is changed / функция вызывается при изменении данных
|
|
48
|
+
*/
|
|
49
|
+
static removeWatch<T>(name: string, callback: (value: T) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Update query variables from URL string.
|
|
52
|
+
*
|
|
53
|
+
* Обновление переменных query-параметров из строки URL.
|
|
54
|
+
* @returns void
|
|
55
|
+
*/
|
|
56
|
+
static reload(): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UrlInstanceAbstract } from './UrlInstanceAbstract';
|
|
2
|
+
/**
|
|
3
|
+
* Class for working with data stored in the URL query parameters.
|
|
4
|
+
*
|
|
5
|
+
* Класс для работы с данными, сохранёнными в query-параметрах URL.
|
|
6
|
+
*/
|
|
7
|
+
export declare class QueryInstance extends UrlInstanceAbstract {
|
|
8
|
+
/**
|
|
9
|
+
* Initializes query data and registers the popstate listener.
|
|
10
|
+
*
|
|
11
|
+
* Инициализирует данные query-параметров и регистрирует слушатель popstate.
|
|
12
|
+
* @returns this instance / текущий экземпляр
|
|
13
|
+
*/
|
|
14
|
+
protected init(): this;
|
|
15
|
+
/**
|
|
16
|
+
* Obtaining data from the URL string.
|
|
17
|
+
*
|
|
18
|
+
* Получение данных из строки URL.
|
|
19
|
+
* @returns Record<string, any> query data / данные query-параметров
|
|
20
|
+
*/
|
|
21
|
+
protected getLocation(): Record<string, any>;
|
|
22
|
+
/**
|
|
23
|
+
* Update query string in URL.
|
|
24
|
+
*
|
|
25
|
+
* Обновление строки query-параметров в URL.
|
|
26
|
+
* @returns this instance / текущий экземпляр
|
|
27
|
+
*/
|
|
28
|
+
protected update(): this;
|
|
29
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base abstract class for working with URL-based states (Hash, Query).
|
|
3
|
+
*
|
|
4
|
+
* Базовый абстрактный класс для работы с состояниями на основе URL (Hash, Query).
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class UrlInstanceAbstract {
|
|
7
|
+
protected data?: Record<string, any>;
|
|
8
|
+
protected watch: Record<string, ((value: any) => void)[]>;
|
|
9
|
+
protected block: boolean;
|
|
10
|
+
protected time?: any;
|
|
11
|
+
/**
|
|
12
|
+
* Get data.
|
|
13
|
+
*
|
|
14
|
+
* Получение данных.
|
|
15
|
+
* @param name variable name / название переменной
|
|
16
|
+
* @param defaultValue value or function to change data / значение или функция для изменения данных
|
|
17
|
+
* @returns stored value / сохранённое значение
|
|
18
|
+
*/
|
|
19
|
+
get<T>(name: string, defaultValue?: T | (() => T)): T;
|
|
20
|
+
/**
|
|
21
|
+
* Change data.
|
|
22
|
+
*
|
|
23
|
+
* Изменение данных.
|
|
24
|
+
* @param name variable name / название переменной
|
|
25
|
+
* @param callback value or function to change data / значение или функция для изменения данных
|
|
26
|
+
* @returns this instance / текущий экземпляр
|
|
27
|
+
*/
|
|
28
|
+
set<T>(name: string, callback: T | (() => T)): this;
|
|
29
|
+
/**
|
|
30
|
+
* Adding an event when data is changed.
|
|
31
|
+
*
|
|
32
|
+
* Добавление события при изменении данных.
|
|
33
|
+
* @param name variable name / название переменной
|
|
34
|
+
* @param callback the function is called when the data is changed / функция вызывается при изменении данных
|
|
35
|
+
* @returns this instance / текущий экземпляр
|
|
36
|
+
*/
|
|
37
|
+
addWatch<T>(name: string, callback: (value: T) => void): this;
|
|
38
|
+
/**
|
|
39
|
+
* Removing an event when data is changed.
|
|
40
|
+
*
|
|
41
|
+
* Удаление события при изменении данных.
|
|
42
|
+
* @param name variable name / название переменной
|
|
43
|
+
* @param callback the function is called when the data is changed / функция вызывается при изменении данных
|
|
44
|
+
* @returns this instance / текущий экземпляр
|
|
45
|
+
*/
|
|
46
|
+
removeWatch<T>(name: string, callback: (value: T) => void): this;
|
|
47
|
+
/**
|
|
48
|
+
* Update variables from URL string.
|
|
49
|
+
*
|
|
50
|
+
* Обновление переменных из строки URL.
|
|
51
|
+
* @returns this instance / текущий экземпляр
|
|
52
|
+
*/
|
|
53
|
+
reload(): this;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the query/hash data object, initializing if needed.
|
|
56
|
+
*
|
|
57
|
+
* Возвращает объект данных, инициализируя при необходимости.
|
|
58
|
+
* @returns Record<string, any> data object / объект данных
|
|
59
|
+
*/
|
|
60
|
+
protected getData(): Record<string, any>;
|
|
61
|
+
/**
|
|
62
|
+
* Reads data from the URL and triggers watchers.
|
|
63
|
+
*
|
|
64
|
+
* Считывает данные из URL и вызывает наблюдателей.
|
|
65
|
+
* @returns this instance / текущий экземпляр
|
|
66
|
+
*/
|
|
67
|
+
protected initData(): this;
|
|
68
|
+
/**
|
|
69
|
+
* Calling all functions whose data has changed.
|
|
70
|
+
*
|
|
71
|
+
* Вызов всех функций, у которых были изменены данные.
|
|
72
|
+
* @param location fresh data / свежие данные
|
|
73
|
+
* @returns this instance / текущий экземпляр
|
|
74
|
+
*/
|
|
75
|
+
protected makeWatch(location: Record<string, any>): this;
|
|
76
|
+
/**
|
|
77
|
+
* Initializes data and event listeners.
|
|
78
|
+
*
|
|
79
|
+
* Инициализирует данные и слушатели событий.
|
|
80
|
+
*/
|
|
81
|
+
protected abstract init(): this;
|
|
82
|
+
/**
|
|
83
|
+
* Obtaining data from the URL string.
|
|
84
|
+
*
|
|
85
|
+
* Получение данных из строки URL.
|
|
86
|
+
*/
|
|
87
|
+
protected abstract getLocation(): Record<string, any>;
|
|
88
|
+
/**
|
|
89
|
+
* Update string in URL.
|
|
90
|
+
*
|
|
91
|
+
* Обновление строки в URL.
|
|
92
|
+
*/
|
|
93
|
+
protected abstract update(): this;
|
|
94
|
+
}
|
|
@@ -46,6 +46,29 @@ export declare class UrlItem {
|
|
|
46
46
|
get hash(): string;
|
|
47
47
|
/** Origin of the URL (readonly) / Источник URL (только для чтения) */
|
|
48
48
|
get origin(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the specified query parameter exists.
|
|
51
|
+
*
|
|
52
|
+
* Проверяет, существует ли указанный параметр запроса.
|
|
53
|
+
* @param name parameter name / имя параметра
|
|
54
|
+
* @returns check result / результат проверки
|
|
55
|
+
*/
|
|
56
|
+
hasParam(name: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the value of a query parameter.
|
|
59
|
+
*
|
|
60
|
+
* Возвращает значение параметра запроса.
|
|
61
|
+
* @param name parameter name / имя параметра
|
|
62
|
+
* @returns parameter value or undefined if not found / значение параметра или undefined, если не найдено
|
|
63
|
+
*/
|
|
64
|
+
getParam(name: string): string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Returns all query parameters as an object with transformed types.
|
|
67
|
+
*
|
|
68
|
+
* Возвращает все параметры запроса в виде объекта с преобразованными типами.
|
|
69
|
+
* @returns Record<string, any> object of parameters / объект параметров
|
|
70
|
+
*/
|
|
71
|
+
getParams(): Record<string, any>;
|
|
49
72
|
/**
|
|
50
73
|
* Updates the URL value.
|
|
51
74
|
*
|
|
@@ -54,6 +77,31 @@ export declare class UrlItem {
|
|
|
54
77
|
* @returns this Url instance / текущий экземпляр Url
|
|
55
78
|
*/
|
|
56
79
|
set(url?: string | URL): this;
|
|
80
|
+
/**
|
|
81
|
+
* Sets the value of a query parameter.
|
|
82
|
+
*
|
|
83
|
+
* Устанавливает значение параметра запроса.
|
|
84
|
+
* @param name parameter name / имя параметра
|
|
85
|
+
* @param value parameter value / значение параметра
|
|
86
|
+
* @returns this UrlItem instance / текущий экземпляр UrlItem
|
|
87
|
+
*/
|
|
88
|
+
setParam(name: string, value: string): this;
|
|
89
|
+
/**
|
|
90
|
+
* Replaces all query parameters with the specified object.
|
|
91
|
+
*
|
|
92
|
+
* Заменяет все параметры запроса на указанный объект.
|
|
93
|
+
* @param params parameters to set / параметры для установки
|
|
94
|
+
* @returns this UrlItem instance / текущий экземпляр UrlItem
|
|
95
|
+
*/
|
|
96
|
+
setParams(params: Record<string, any>): this;
|
|
97
|
+
/**
|
|
98
|
+
* Deletes a query parameter.
|
|
99
|
+
*
|
|
100
|
+
* Удаляет параметр запроса.
|
|
101
|
+
* @param name parameter name / имя параметра
|
|
102
|
+
* @returns this UrlItem instance / текущий экземпляр UrlItem
|
|
103
|
+
*/
|
|
104
|
+
deleteParam(name: string): this;
|
|
57
105
|
/**
|
|
58
106
|
* Converts the Url instance to its string representation.
|
|
59
107
|
*
|
package/dist/src/library.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export * from './classes/MetaManager';
|
|
|
42
42
|
export * from './classes/MetaOg';
|
|
43
43
|
export * from './classes/MetaStatic';
|
|
44
44
|
export * from './classes/MetaTwitter';
|
|
45
|
+
export * from './classes/Query';
|
|
46
|
+
export * from './classes/QueryInstance';
|
|
45
47
|
export * from './classes/ResumableTimer';
|
|
46
48
|
export * from './classes/ScrollbarWidth';
|
|
47
49
|
export * from './classes/SearchList';
|
|
@@ -54,6 +56,7 @@ export * from './classes/StorageCallback';
|
|
|
54
56
|
export * from './classes/Translate';
|
|
55
57
|
export * from './classes/TranslateFile';
|
|
56
58
|
export * from './classes/TranslateInstance';
|
|
59
|
+
export * from './classes/UrlInstanceAbstract';
|
|
57
60
|
export * from './classes/UrlItem';
|
|
58
61
|
export * from './functions/addTagHighlightMatch';
|
|
59
62
|
export * from './functions/anyToString';
|
|
@@ -38,6 +38,12 @@ export interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
|
|
|
38
38
|
standard: string;
|
|
39
39
|
/** First day of week (required)/ Первый день недели (обязательный) */
|
|
40
40
|
firstDay: string;
|
|
41
|
+
/** Current location string/ Строка текущего местоположения */
|
|
42
|
+
location: string;
|
|
43
|
+
/** Current country code from location/ Текущий код страны из местоположения */
|
|
44
|
+
locationCountry: string;
|
|
45
|
+
/** Current language code from location/ Текущий код языка из местоположения */
|
|
46
|
+
locationLanguage: string;
|
|
41
47
|
}
|
|
42
48
|
/** Geographic flag item for country flag display/ Элемент географического флага для отображения флага страны */
|
|
43
49
|
export interface GeoFlagItem {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/functional-basic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Foundational utility library for modern web development — HTTP client, geolocation, i18n, SEO meta tags, caching, storage, DOM utilities, and more. Framework-agnostic, zero dependencies, TypeScript-first.",
|
|
7
7
|
"keywords": [
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
},
|
|
60
60
|
"files": [
|
|
61
61
|
"dist",
|
|
62
|
-
"ai-description.
|
|
63
|
-
"ai-doc.
|
|
64
|
-
"ai-types.
|
|
62
|
+
"ai-description.md",
|
|
63
|
+
"ai-doc.md",
|
|
64
|
+
"ai-types.md",
|
|
65
65
|
"CHANGELOG.md",
|
|
66
66
|
"LICENSE",
|
|
67
67
|
"package.json",
|
package/ai-description.txt
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
This library is a comprehensive, isomorphic utility toolkit for TypeScript applications, focusing on data management, HTTP communication, internationalization, and DOM manipulation.
|
|
2
|
-
|
|
3
|
-
1. Core Purpose:
|
|
4
|
-
The library acts as a centralized foundation for common application tasks. It provides a robust HTTP client (Fetch wrapper with built-in retries, caching, and hydration support), state management (localized storage, cookie handling, URL hash synchronization), internationalization (translation management, date/time/currency formatting), and DOM utility functions (event listeners, scroll management, meta tag management).
|
|
5
|
-
|
|
6
|
-
2. Usage Scenarios:
|
|
7
|
-
- API Orchestration: Use the Api/ApiInstance classes for unified fetch requests, centralized error handling (ErrorCenter), and automatic response caching.
|
|
8
|
-
- State Synchronization: Essential for SSR-compliant state management (ServerStorage) and syncing application state with URL hashes or Cookies.
|
|
9
|
-
- Localization: Indispensable for applications requiring multi-language support (Translate), dynamic date/time formatting (GeoIntl, Datetime), and locale-aware number/currency formatting.
|
|
10
|
-
- DOM & Event Management: Use EventItem for lifecycle-safe event listeners (with automatic cleanup) and scroll/resize optimizations; use Meta and its derivatives for SEO and social media metadata management.
|
|
11
|
-
- Data Processing: Highly useful for search-as-you-type implementations (SearchList) and complex data transformations (Formatters).
|
|
12
|
-
|
|
13
|
-
3. Integration Context:
|
|
14
|
-
- SSR & Hydration: The library includes specialized handlers (ApiHydration, ServerStorage, getHydrationData) designed to bridge the gap between server-rendered state and client-side execution, preventing hydration mismatches.
|
|
15
|
-
- Architecture: It follows a singleton-friendly patterns (e.g., Api.getItem(), Geo.getObject()) that facilitate global access to state and configurations across disparate modules without tight coupling.
|
|
16
|
-
- Type Safety: Extensively typed (TypeScript), providing full autocompletion and structural validation for search, API, translation, and formatting configurations.
|
|
17
|
-
|
|
18
|
-
An AI assistant should study this library when tasked with building enterprise-grade, localized web applications that require standardized API communication, cross-browser DOM event management, or robust SSR data state serialization.
|
package/ai-doc.txt
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
This is the basic functional library (@dxtmisha/functional-basic). It contains framework-agnostic algorithms, utilities, and classes.
|
|
2
|
-
|
|
3
|
-
ATTENTION FOR VUE ENVIRONMENT:
|
|
4
|
-
If you are developing in Vue, ALWAYS look for the required functionality (composables, reactive wrappers) inside the `@dxtmisha/functional` library FIRST.
|
|
5
|
-
And ONLY if there is no reactive or Vue-specific analog there, you may use the functionality directly from this library (@dxtmisha/functional-basic).
|
|
6
|
-
|
|
7
|
-
=============================================================================
|
|
8
|
-
CLASS STRUCTURE & CODING STANDARDS (RULES FOR AI)
|
|
9
|
-
=============================================================================
|
|
10
|
-
|
|
11
|
-
To maintain consistency and high industrial quality across the dxt-ui codebase, all TypeScript classes inside `@dxtmisha/functional-basic` must strictly adhere to the following rules regarding structure, member ordering, and styles.
|
|
12
|
-
|
|
13
|
-
1. ORDER OF MEMBERS WITHIN A CLASS
|
|
14
|
-
Members in every class MUST be ordered in the following sequence:
|
|
15
|
-
|
|
16
|
-
A. Class Properties / Member Variables:
|
|
17
|
-
- Placed at the very top of the class body.
|
|
18
|
-
- Ordered by visibility: Public first, then Protected, and Private last.
|
|
19
|
-
- Within each visibility level, group by logical connection or alphabetically.
|
|
20
|
-
- Initialize default values directly on declaration when possible.
|
|
21
|
-
|
|
22
|
-
B. Constructor:
|
|
23
|
-
- Placed immediately after all property declarations.
|
|
24
|
-
- Parameter properties (e.g., `protected url: string`) are allowed to simplify declaration.
|
|
25
|
-
|
|
26
|
-
C. Public Methods:
|
|
27
|
-
- Placed after the constructor.
|
|
28
|
-
- Grouped logically:
|
|
29
|
-
1. Getters, checkers, and status-check methods (e.g., `is*`, `get*`).
|
|
30
|
-
2. Setters and configuration methods (e.g., `set*`).
|
|
31
|
-
3. Core executors and action methods (e.g., `request()`, `fetch()`, `show()`).
|
|
32
|
-
|
|
33
|
-
D. Protected Methods:
|
|
34
|
-
- Placed after all public methods.
|
|
35
|
-
- Contain internal utility and helper logic accessible to subclasses.
|
|
36
|
-
|
|
37
|
-
E. Private Methods:
|
|
38
|
-
- Placed at the very end of the class.
|
|
39
|
-
- Strict encapsulation of internal logic.
|
|
40
|
-
|
|
41
|
-
2. CODING & STYLE CONVENTIONS
|
|
42
|
-
- Naming:
|
|
43
|
-
* Classes: PascalCase (e.g., `LoadingInstance`).
|
|
44
|
-
* Methods & Properties: camelCase (e.g., `registrationEvent`, `registrationList`).
|
|
45
|
-
* Constants inside files: UPPER_SNAKE_CASE (e.g., `LOADING_EVENT_NAME`).
|
|
46
|
-
- TypeScript Safety:
|
|
47
|
-
* Never use `any`. Use generic parameters or `unknown` if the type is dynamic/undefined.
|
|
48
|
-
* Explicitly declare return types for ALL public, protected, and private methods (including `void`).
|
|
49
|
-
* Use interfaces/types to define structural contracts for complex inputs and outputs.
|
|
50
|
-
- SSR Isolation (Server-Side Rendering):
|
|
51
|
-
* The library must be fully isomorphic and safe for SSR.
|
|
52
|
-
* Avoid storing request-specific state in global/static class properties directly.
|
|
53
|
-
* Use `ServerStorage.get('key', () => new Instance())` for request-isolated singletons.
|
|
54
|
-
* Use `isDomRuntime()` checks before accessing browser-only APIs like `window`, `document`, or `location`.
|