@dxtmisha/functional 1.11.7 → 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.
- package/ai-description.txt +3 -3
- package/ai-doc.ru.txt +34 -0
- package/ai-doc.txt +34 -0
- package/ai-types.txt +613 -474
- package/dist/library.js +4 -4
- package/package.json +3 -1
package/ai-description.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
|
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();`
|