@dxtmisha/functional 1.11.6 → 1.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/ai-description.txt +5 -0
  3. package/ai-doc.ru.txt +34 -0
  4. package/ai-doc.txt +34 -0
  5. package/ai-types.txt +629 -452
  6. package/dist/classes/design/DesignAbstract.d.ts +61 -0
  7. package/dist/classes/design/DesignAsyncAbstract.d.ts +28 -0
  8. package/dist/classes/design/DesignChanged.d.ts +42 -0
  9. package/dist/classes/design/DesignComp.d.ts +4 -0
  10. package/dist/classes/design/DesignComponents.d.ts +81 -0
  11. package/dist/classes/design/DesignConstructorAbstract.d.ts +150 -0
  12. package/dist/classes/ref/DatetimeRef.d.ts +123 -0
  13. package/dist/classes/ref/EffectScopeGlobal.d.ts +22 -0
  14. package/dist/classes/ref/EventRef.d.ts +22 -0
  15. package/dist/classes/ref/GeoFlagRef.d.ts +51 -0
  16. package/dist/classes/ref/GeoIntlRef.d.ts +213 -0
  17. package/dist/classes/ref/GeoRef.d.ts +58 -0
  18. package/dist/classes/ref/ListDataRef.d.ts +359 -0
  19. package/dist/classes/ref/RouterItemRef.d.ts +61 -0
  20. package/dist/classes/ref/ScrollbarWidthRef.d.ts +22 -0
  21. package/dist/composables/ref/useApiAsyncRef.d.ts +18 -0
  22. package/dist/composables/ref/useApiDelete.d.ts +20 -0
  23. package/dist/composables/ref/useApiGet.d.ts +20 -0
  24. package/dist/composables/ref/useApiManagementAsyncRef.d.ts +49 -0
  25. package/dist/composables/ref/useApiManagementRef.d.ts +155 -0
  26. package/dist/composables/ref/useApiPost.d.ts +20 -0
  27. package/dist/composables/ref/useApiPut.d.ts +20 -0
  28. package/dist/composables/ref/useApiRef.d.ts +106 -0
  29. package/dist/composables/ref/useApiRequest.d.ts +28 -0
  30. package/dist/composables/ref/useBroadcastValueRef.d.ts +11 -0
  31. package/dist/composables/ref/useCookieRef.d.ts +11 -0
  32. package/dist/composables/ref/useFormattersRef.d.ts +21 -0
  33. package/dist/composables/ref/useGeoIntlRef.d.ts +7 -0
  34. package/dist/composables/ref/useHashRef.d.ts +9 -0
  35. package/dist/composables/ref/useLazyItemByMarginRef.d.ts +22 -0
  36. package/dist/composables/ref/useLazyRef.d.ts +42 -0
  37. package/dist/composables/ref/useLoadingRef.d.ts +7 -0
  38. package/dist/composables/ref/useMeta.d.ts +223 -0
  39. package/dist/composables/ref/useRouterList.d.ts +28 -0
  40. package/dist/composables/ref/useSearchRef.d.ts +36 -0
  41. package/dist/composables/ref/useSearchValueRef.d.ts +19 -0
  42. package/dist/composables/ref/useSessionRef.d.ts +9 -0
  43. package/dist/composables/ref/useStorageRef.d.ts +10 -0
  44. package/dist/composables/ref/useTranslateRef.d.ts +40 -0
  45. package/dist/flags.d.ts +1 -0
  46. package/dist/functions/basic.d.ts +1 -0
  47. package/dist/functions/computedAsync.d.ts +13 -0
  48. package/dist/functions/computedByLanguage.d.ts +15 -0
  49. package/dist/functions/computedEternity.d.ts +15 -0
  50. package/dist/functions/dxtFunctionalPlugin.d.ts +61 -0
  51. package/dist/functions/executeUse.d.ts +216 -0
  52. package/dist/functions/getInject.d.ts +7 -0
  53. package/dist/functions/getOptions.d.ts +10 -0
  54. package/dist/functions/ref/getBindRef.d.ts +13 -0
  55. package/dist/functions/ref/getRef.d.ts +8 -0
  56. package/dist/functions/ref/render.d.ts +13 -0
  57. package/dist/functions/ref/setRef.d.ts +9 -0
  58. package/dist/functions/ref/toRefItem.d.ts +9 -0
  59. package/dist/functions/render/getBind.d.ts +14 -0
  60. package/dist/functions/render/getClassName.d.ts +8 -0
  61. package/dist/functions/render/getIndexForRender.d.ts +10 -0
  62. package/dist/functions/toBind.d.ts +10 -0
  63. package/dist/functions/toBinds.d.ts +9 -0
  64. package/dist/library.d.ts +62 -2803
  65. package/dist/library.js +105 -71
  66. package/dist/types/apiTypes.d.ts +66 -0
  67. package/dist/types/constructorTypes.d.ts +126 -0
  68. package/dist/types/listTypes.d.ts +63 -0
  69. package/dist/types/refTypes.d.ts +36 -0
  70. package/dist/types/searchTypes.d.ts +6 -0
  71. package/package.json +9 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,79 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.11.6] - 2026-05-01
6
+
7
+ ### Added
8
+ - **useApiAsyncRef**: Introduced `useApiAsyncRef` for asynchronous API initialization within Vue async setup components.
9
+ - **useApiRef**: Added support for synchronous cache recovery via `recovery()`.
10
+ - **useApiRef**: Added support for server prefetching via `initSsr()` and Vue's `onServerPrefetch`.
11
+ - **getInject**: Moved utility to `@dxtmisha/functional` for wider availability and easier dependency injection.
12
+
13
+ ### Changed / Improved
14
+ - **useApiRef**: Enhanced with response contract validation and improved initialization logic.
15
+ - **useApiRef**: Optimized internals with new helpers like `isConditions` and `getApiFetch`.
16
+ - **SSR & Hydration**: Improved hydration stability by ensuring API data is available immediately upon client mount, preventing flickering and mismatches.
17
+
18
+ ## [1.1.5] - 2026-04-26
19
+
20
+ ### Added
21
+ - **Api**: Added `setOrigin()` and `getOrigin()` methods for managing the protocol and domain of the base URL.
22
+ - **Api**: Added `setConfig()` method for bulk configuration of API settings.
23
+ - **Api**: Added support for `endResetLimit` in `ApiFetch` to control recursive retries via `setEnd`.
24
+ - **Api**: Added support for jittered retry delays to prevent request thundering herds.
25
+ - **ServerStorage**: Added `remove()` method for deleting items from storage.
26
+ - **ServerStorage**: Added `setErrorStatus()` method to toggle visibility of context-missing errors.
27
+
28
+ ## [1.1.4] - 2026-04-25
29
+
30
+ ### Added
31
+ - **Meta**: Added `htmlTitle()` method to `Meta`, `MetaStatic`, and `MetaManager` classes for generating HTML-safe title strings.
32
+
33
+ ### Changed / Improved
34
+ - **MetaManager**: The `toHtml()` method now excludes the `<title>` tag, allowing for more flexible title management via `htmlTitle()`.
35
+ - **Package**: Added `CHANGELOG.md` to the list of files included in the package distribution.
36
+
37
+ ## [1.1.3] - 2026-04-24
38
+
39
+ ### Added
40
+ - **ResumableTimer**: Added a new class for managing timers with pause and resume functionality.
41
+ - **ApiDataReturn**: Implemented a class for standardizing API responses with support for descriptions and texts.
42
+ - **MetaStatic**: Added a class for managing static meta-data.
43
+ - **Datetime**: Added functionality for working with dates and times.
44
+ - **Translate**: Implemented a localization and translation system.
45
+ - **GeoInstance**: Added an instance for advanced geolocation data handling.
46
+ - **ApiHydration**: Added support for API data hydration for SSR.
47
+ - **StorageCallback**: Added a callback mechanism for tracking storage changes.
48
+ - **New Functions**:
49
+ - `getCurrentTime` — returns the current time.
50
+ - `getArrayHighlightMatch` — searches for and highlights matches in arrays.
51
+
52
+ ### Changed / Improved
53
+ - **Refactoring**: Major refactoring of the `functional-basic` package to improve architecture.
54
+ - **SSR**: Adapted the API and related modules for full Server-Side Rendering support.
55
+ - **API**:
56
+ - Improved the core `Api` class.
57
+ - Refined `ApiCache` and caching systems.
58
+ - **Cookie**:
59
+ - Completely redesigned the Cookie handling mechanics, including `CookieBlock` and `CookieStorage`.
60
+ - Added `getListenerRaw` support to `CookieStorage.init()` for initializing from raw cookie strings (essential for SSR).
61
+ - Extracted cookie parsing and formatting logic into protected `parse()` and `format()` methods.
62
+ - Expanded `CookieOptions` to support modern attributes: `path`, `domain`, `secure`, `httpOnly`, and `partitioned` (CHIPS).
63
+ - Updated `setListener` signature to include the fully formatted cookie string as a third parameter, facilitating easier SSR header management.
64
+ - **Function Optimization**:
65
+ - `getSearchExp` and `getSeparatingSearchExp` — refined search mechanisms.
66
+ - `getRequestString` — improved query string generation.
67
+ - `addTagHighlightMatch` — optimized tag highlighting.
68
+ - `applyTemplate` — expanded template support.
69
+ - `forEach`, `frame`, `blobToBase64`, `getElementId` — technical improvements and optimization.
70
+
71
+ ### Fixed
72
+ - **Testing**: Fixed and updated all unit tests (`vitest`) for stability and coverage.
73
+ - **Geo**: Fixed logic errors in geolocation functions and their tests.
74
+ - Fixed type definition errors and minor bugs in core functions.
75
+
76
+ ### Documentation
77
+ - **JSDoc**: Completed a full revision and standardization of JSDoc comments for all classes and functions.
78
+ - **ServerStorage**: Added detailed descriptions of methods and operating principles.
79
+ - Updated `ApiDataReturn` documentation.
@@ -0,0 +1,5 @@
1
+ This library provides a reactive framework for Vue 3 application development, focusing on structured UI component construction, complex data management, and orchestrated API interactions. Its core purpose is to standardize component architecture through abstract base classes like DesignConstructorAbstract and to provide reactive, high-level wrappers for localized formatting (GeoIntlRef), date manipulation (DatetimeRef), and state persistence (useStorageRef, useCookieRef, useBroadcastValueRef).
2
+
3
+ An AI should study this library when implementing a design system requiring standardized class-based component logic or when building data-intensive interfaces that need integrated searching, filtering, and CRUD operations via useApiManagementRef. It is indispensable for scenarios involving multi-tab state synchronization, SEO management (useMeta), and reactive internationalization (useTranslateRef) where DOM synchronization must be automated.
4
+
5
+ The library integrates directly with Vue 3 and vue-router, acting as a reactive middleware layer over @dxtmisha/functional-basic. It utilizes a singleton management pattern (executeUse) for global service orchestration and relies heavily on Ref and ComputedRef to maintain its internal state machine and lifecycle hooks.
package/ai-doc.ru.txt ADDED
@@ -0,0 +1,34 @@
1
+ Это главная функциональная библиотека для среды Vue (@dxtmisha/functional). Здесь собраны утилиты, composables и реактивные классы, заточенные под Vue.
2
+
3
+ ПРАВИЛА ИСПОЛЬЗОВАНИЯ:
4
+ 1. При разработке на Vue всегда отдавайте приоритет этой библиотеке для работы с логикой и composables, а не `@dxtmisha/functional-basic`.
5
+ 2. Библиотека оборачивает базовую нереактивную логику в систему реактивности Vue. Если нужная функция или класс есть здесь, они имеют абсолютный приоритет.
6
+ 3. Импортируйте утилиты из `@dxtmisha/functional` для реактивного поведения UI, composables и управления состоянием.
7
+
8
+ РАБОТА С API И СОСТОЯНИЕМ (useApi / executeUse):
9
+ Для работы с сетевыми запросами в библиотеке предусмотрен набор хуков: `useApiGet`, `useApiPost`, `useApiPut`, `useApiDelete`, `useApiRequest`, `useApiRef`, `useApiAsyncRef`, `useApiManagementRef`, `useApiManagementAsyncRef`.
10
+ Строго соблюдайте следующие правила их применения:
11
+
12
+ 1. НЕ ВЫЗЫВАЙТЕ эти хуки напрямую в компонентах (SFC).
13
+ 2. Выносите всю настройку и вызовы `useApi*` в ОТДЕЛЬНЫЕ ФАЙЛЫ (сервисы / хранилища).
14
+ 3. Оборачивайте настройку API в фабрику `executeUse` (а именно: `executeUseGlobal`, `executeUseProvide` или `executeUseLocal` из `src/functions/executeUse.ts`). Это гарантирует создание синглтонов (одна точка доступа) и предотвращает создание дубликатов запросов и хранилищ состояния.
15
+ 4. Выполняйте любую дополнительную обработку запросов (например: маппинг данных, подготовка структуры для отображения скелетона перед загрузкой формы) в этом же файле, внутри коллбэка `executeUse`, а наружу возвращайте уже полностью готовый набор данных и методов.
16
+ *Пример правильного использования:*
17
+ ```ts
18
+ import { executeUseGlobal } from '@dxtmisha/functional';
19
+ import { useApiManagementRef } from '@dxtmisha/functional';
20
+
21
+ export const useUserManagement = executeUseGlobal(() => {
22
+ return useApiManagementRef(
23
+ { path: '/api/users' }, // GET setup
24
+ { date: (v) => new Date(v).toLocaleString() }, // Formatters
25
+ { columns: ['name', 'email'] }, // Search
26
+ { path: '/api/users' }, // POST
27
+ { path: (o) => `/api/users/${o.id}` }, // PUT
28
+ { path: (o) => `/api/users/${o.id}` } // DELETE
29
+ );
30
+ // Здесь же можно добавить логику подготовки скелетонов, форматирования и т.д.
31
+ // и затем вернуть расширенный объект
32
+ });
33
+ ```
34
+ 5. В самом Vue-компоненте просто импортируйте и вызывайте созданный синглтон-хук: `const { list, loading, sendPost } = useUserManagement();`
package/ai-doc.txt ADDED
@@ -0,0 +1,34 @@
1
+ This is the main functional library for the Vue environment (@dxtmisha/functional). It contains Vue-specific utilities, composables, and reactive classes.
2
+
3
+ USAGE RULES:
4
+ 1. When developing in Vue, always use this library for functionality, logic, and composables instead of `@dxtmisha/functional-basic` whenever possible.
5
+ 2. It wraps basic non-reactive logic into Vue's reactivity system. If the required function or composable exists here, it has absolute priority.
6
+ 3. Import utilities from `@dxtmisha/functional` for reactive UI behavior, composables, and state management.
7
+
8
+ WORKING WITH API AND STATE (useApi / executeUse):
9
+ A set of composables is provided for network requests: `useApiGet`, `useApiPost`, `useApiPut`, `useApiDelete`, `useApiRequest`, `useApiRef`, `useApiAsyncRef`, `useApiManagementRef`, `useApiManagementAsyncRef`.
10
+ Strictly follow these rules for their application:
11
+
12
+ 1. DO NOT call these composables directly in the Vue components (SFC).
13
+ 2. Move all API configurations and `useApi*` calls into SEPARATE FILES (services/stores).
14
+ 3. Wrap the API configurations inside the `executeUse` factory (specifically: `executeUseGlobal`, `executeUseProvide`, or `executeUseLocal` from `src/functions/executeUse.ts`). This guarantees the creation of managed singletons (single access point) and prevents duplicated requests and reactive states.
15
+ 4. Perform any additional request processing (e.g., data mapping, preparing structures for skeletons before loading a form) in the same file, inside the `executeUse` callback, and return a fully prepared set of data and methods.
16
+ *Example of correct usage:*
17
+ ```ts
18
+ import { executeUseGlobal } from '@dxtmisha/functional';
19
+ import { useApiManagementRef } from '@dxtmisha/functional';
20
+
21
+ export const useUserManagement = executeUseGlobal(() => {
22
+ return useApiManagementRef(
23
+ { path: '/api/users' }, // GET setup
24
+ { date: (v) => new Date(v).toLocaleString() }, // Formatters
25
+ { columns: ['name', 'email'] }, // Search
26
+ { path: '/api/users' }, // POST
27
+ { path: (o) => `/api/users/${o.id}` }, // PUT
28
+ { path: (o) => `/api/users/${o.id}` } // DELETE
29
+ );
30
+ // Logic for skeletons, additional formatting, etc., should be added here,
31
+ // and then return the extended object.
32
+ });
33
+ ```
34
+ 5. Within the Vue component itself, simply import and call your custom singleton composable: `const { list, loading, sendPost } = useUserManagement();`