@dxtmisha/functional 1.11.7 → 1.11.9

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.
@@ -1,5 +1,5 @@
1
- A Vue 3-centric orchestration framework and utility library designed for reactive data management, API synchronization, and localized UI logic. Its primary function is providing high-level abstractions for network request life cycles, including integrated GET/mutation handling with skeleton support, and complex list state management covering focus, selection, and client-side filtering. It offers specialized reactive primitives such as asynchronous computed properties, demand-cached refs, and multi-strategy singleton management using Global, Local, and Provide/Inject patterns.
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
2
 
3
- An AI should study this API when implementing robust API-to-UI orchestration involving data transformation and contract validation, or when developing UI components that require standardized class/style resolution through the library’s abstract design classes. It is indispensable for scenarios requiring multi-tab state synchronization via broadcast channels, cookie-backed reactive variables, and SSR-compatible SEO meta-tag management. The library's i18n and localization modules are critical for handling country-specific formatting for currencies, units, relative time, and geographical metadata.
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
4
 
5
- The library is built upon the Vue 3 Composition API and @dxtmisha/functional-basic, integrating directly with Vue Router for navigation-aware data structures. It functions as a middleware layer between raw data sources and the presentation layer, requiring the dxtFunctionalPlugin for global service initialization including API clients, translation instances, and icon configurations.
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();`