@dxtmisha/functional-basic 1.2.8 → 1.3.3
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.txt +12 -3
- package/ai-doc.ru.txt +50 -1
- package/ai-doc.txt +50 -1
- package/ai-types.txt +326 -470
- package/dist/library.js +74 -61
- package/dist/src/classes/GeoFlag.d.ts +7 -0
- package/dist/src/functions/getKey.d.ts +1 -1
- package/dist/src/functions/getLength.d.ts +10 -0
- package/dist/src/functions/isTab.d.ts +8 -0
- package/dist/src/library.d.ts +2 -0
- package/dist/src/types/geoTypes.d.ts +2 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.1] - 2026-05-25
|
|
6
|
+
|
|
7
|
+
### Changed / Improved
|
|
8
|
+
- **Maintenance**: Incremented version to `1.3.1` to align with monorepo release updates.
|
|
9
|
+
|
|
10
|
+
## [1.3.0] - 2026-05-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **`getLength`**: Introduced a new `getLength` utility function to determine the length/size of strings, arrays, Maps, Sets, and objects reactively and safely, accompanied by complete bilingual JSDocs.
|
|
14
|
+
- **Tests**: Created a comprehensive unit test suite (`getLength.test.ts`) to validate length computation across all supported data types.
|
|
15
|
+
|
|
16
|
+
### Changed / Improved
|
|
17
|
+
- **Build System**: Added `ui-priority: 100` attribute to `package.json` to facilitate prioritized build sorting of foundational libraries.
|
|
18
|
+
|
|
19
|
+
## [1.2.11] - 2026-05-25
|
|
20
|
+
|
|
21
|
+
### Changed / Improved
|
|
22
|
+
- **Tests**: Configured the vitest runner command to execute with `NODE_OPTIONS="--no-webstorage"` in `package.json` to prevent environment-related web storage warnings.
|
|
23
|
+
|
|
24
|
+
## [1.2.10] - 2026-05-24
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **isTab**: Introduced `isTab` utility function to reliably detect Tab key presses across different browser environments by checking `key`, `code`, and `keyCode`.
|
|
28
|
+
- **isTab**: Added comprehensive unit tests in `src/functions/__tests__/isTab.test.ts` to verify tab-detection behavior under multiple key configurations.
|
|
29
|
+
|
|
30
|
+
### Changed / Improved
|
|
31
|
+
- **isInput**: Refactored `isInput` helper to correctly return `false` for elements with `readonly` or `disabled` attributes.
|
|
32
|
+
- **getKey**: Updated return type of `getKey` helper function to return `string | number | undefined` instead of forcing a strict `string`.
|
|
33
|
+
- **ErrorCenter**: Enhanced `ErrorCenterCauseItem` type inside `errorCenter.ts` with generic parameter support (`ErrorCenterCauseItem<D = any>`) to support strictly-typed structures for error cause detail records.
|
|
34
|
+
- **Maintenance**: Excluded auto-generated AI description files from package assets, standardized type outputs and version bumped to `1.2.10`.
|
|
35
|
+
|
|
5
36
|
## [1.2.5] - 2026-05-17
|
|
6
37
|
|
|
7
38
|
### Changed / Improved
|
package/ai-description.txt
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
Core Purpose
|
|
2
|
+
A comprehensive, framework-agnostic utility library designed to simplify common frontend development tasks, including HTTP API communication (with caching and SSR hydration), state management (cookies, local/session storage), internationalization (Geo, Datetime, Translation), and DOM/Event management.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
Usage Scenarios
|
|
5
|
+
Study this library when you need:
|
|
6
|
+
1. Robust API Integration: Standardized fetching, request cancellation (AbortController), automated error handling/retry logic, and response caching.
|
|
7
|
+
2. SSR Data Synchronization: Managing data consistency between server and client via hydration scripts.
|
|
8
|
+
3. Feature-Rich State Persistence: Handling cookies (with SameSite/Secure options) and browser storage (with TTL/caching capabilities).
|
|
9
|
+
4. Complex DOM/UI Logic: Managing event listeners with lifecycle auto-cleanup, scrollbar width calculations, and global loading state management.
|
|
10
|
+
5. Localization/I18n: Handling currency, date formatting, and translation file loading dynamically.
|
|
11
|
+
6. Search Functionality: Implementing client-side search with regex matching and highlight formatting for list data.
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
Integration Context
|
|
14
|
+
This library acts as a foundational "glue" layer. It is built using native Web APIs (Fetch, BroadcastChannel, ResizeObserver, Intl) and is intended to be initialized globally. It provides abstract classes that can be extended or injected to fit various architectures (e.g., SSR frameworks like Nuxt or Next.js, or standard SPA setups). It centralizes configuration for API paths, translation endpoints, and geo-data, serving as a unified utility core for the application.
|
package/ai-doc.ru.txt
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
Esto базовая функциональная библиотека (@dxtmisha/functional-basic). Здесь собраны алгоритмы, утилиты и классы, независимые от фреймворка.
|
|
2
2
|
|
|
3
3
|
ВНИМАНИЕ ДЛЯ СРЕДЫ VUE:
|
|
4
4
|
Если вы разрабатываете под Vue, СНАЧАЛА всегда ищите нужный функционал (composables, реактивные классы) в библиотеке `@dxtmisha/functional`.
|
|
5
5
|
И ТОЛЬКО если там нет нужного реактивного/специфичного для Vue аналога, используйте функционал напрямую из этой библиотеки (@dxtmisha/functional-basic).
|
|
6
|
+
|
|
7
|
+
=============================================================================
|
|
8
|
+
СТРУКТУРА КЛАССОВ И СТАНДАРТЫ КОДА (ПРАВИЛА ДЛЯ AI)
|
|
9
|
+
=============================================================================
|
|
10
|
+
|
|
11
|
+
Для обеспечения согласованности и высокого промышленного качества кодовой базы dxt-ui, все классы TypeScript внутри `@dxtmisha/functional-basic` должны строго следовать следующим правилам относительно структуры, порядка членов и стилей.
|
|
12
|
+
|
|
13
|
+
1. ПОРЯДОК ЧЛЕНОВ ВНУТРИ КЛАССА
|
|
14
|
+
Члены каждого класса ДОЛЖНЫ быть упорядочены в следующей последовательности:
|
|
15
|
+
|
|
16
|
+
А. Свойства класса / Переменные-члены:
|
|
17
|
+
- Располагаются в самом верху тела класса.
|
|
18
|
+
- Сортируются по видимости: сначала Public, затем Protected и в конце Private.
|
|
19
|
+
- Внутри каждого уровня видимости группируются по смыслу или по алфавиту.
|
|
20
|
+
- Инициализируйте значения по умолчанию прямо при объявлении, если это возможно.
|
|
21
|
+
|
|
22
|
+
Б. Конструктор:
|
|
23
|
+
- Располагается сразу после объявлений всех свойств.
|
|
24
|
+
- Разрешено объявление свойств через параметры конструктора (например, `protected url: string`) для упрощения кода.
|
|
25
|
+
|
|
26
|
+
В. Публичные методы (Public Methods):
|
|
27
|
+
- Располагаются после конструктора.
|
|
28
|
+
- Группируются логически:
|
|
29
|
+
1. Геттеры, методы проверки состояния и статуса (например, `is*`, `get*`).
|
|
30
|
+
2. Сеттеры и методы конфигурации (например, `set*`).
|
|
31
|
+
3. Основные методы выполнения и экшены (например, `request()`, `fetch()`, `show()`).
|
|
32
|
+
|
|
33
|
+
Г. Защищенные методы (Protected Methods):
|
|
34
|
+
- Располагаются после всех публичных методов.
|
|
35
|
+
- Содержат внутреннюю вспомогательную логику, доступную для наследников класса.
|
|
36
|
+
|
|
37
|
+
Д. Приватные методы (Private Methods):
|
|
38
|
+
- Располагаются в самом конце класса.
|
|
39
|
+
- Строгая инкапсуляция внутренней логики.
|
|
40
|
+
|
|
41
|
+
2. СТИЛЬ И СОГЛАШЕНИЯ ПО НАПИСАНИЮ КОДА
|
|
42
|
+
- Именование:
|
|
43
|
+
* Классы: PascalCase (например, `LoadingInstance`).
|
|
44
|
+
* Методы и свойства: camelCase (например, `registrationEvent`, `registrationList`).
|
|
45
|
+
* Константы внутри файлов: UPPER_SNAKE_CASE (например, `LOADING_EVENT_NAME`).
|
|
46
|
+
- Безопасность TypeScript:
|
|
47
|
+
* Никогда не используйте тип `any`. Используйте дженерики или `unknown`, если тип динамический/неопределенный.
|
|
48
|
+
* Явно указывайте возвращаемые типы для ВСЕХ публичных, защищенных и приватных методов (включая `void`).
|
|
49
|
+
* Используйте интерфейсы/типы для определения структурных контрактов сложных входящих и исходящих данных.
|
|
50
|
+
- SSR Изоляция (Server-Side Rendering):
|
|
51
|
+
* Библиотека должна быть полностью изоморфной и безопасной для SSR.
|
|
52
|
+
* Избегайте прямого хранения специфичного для запроса состояния в глобальных/статических свойствах классов.
|
|
53
|
+
* Используйте `ServerStorage.get('key', () => new Instance())` для синглтонов, изолированных в рамках запроса.
|
|
54
|
+
* Используйте проверку `isDomRuntime()` перед обращением к браузерным API, таким как `window`, `document` или `location`.
|
package/ai-doc.txt
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
This is the basic functional library (@dxtmisha/functional-basic). It contains framework-agnostic algorithms, utilities, and classes.
|
|
2
2
|
|
|
3
|
-
ATTENTION FOR VUE
|
|
3
|
+
ATTENTION FOR VUE ENVIRONMENT:
|
|
4
4
|
If you are developing in Vue, ALWAYS look for the required functionality (composables, reactive wrappers) inside the `@dxtmisha/functional` library FIRST.
|
|
5
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`.
|