@dxtmisha/functional 1.13.4 → 1.13.7

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 CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.13.7] - 2026-06-19
6
+
7
+ ### Added
8
+ - **GeoRef**: Added static reactive `getLocation()`, `getLocationCountry()`, and `getLocationLanguage()` methods returning isolated `ComputedRef<string>` representations of location components.
9
+
10
+ ### Fixed
11
+ - **Tests**: Adjusted test assertions in `GeoRef.test.ts` for `'en-VN'` to expect country `'VN'` and standard `'en-VN'` under the country-first matching priority.
12
+
13
+ ## [1.13.5] - 2026-06-17
14
+
15
+
16
+ ### Changed / Improved
17
+ - **GeoRef**: Refactored static getters (`getCountry`, `getLanguage`, `getStandard`, `getFirstDay`) to use request-isolated computed references via `ServerStorage.get`. This isolates their reactive state per request, resolving potential cross-request state pollution during SSR.
18
+
5
19
  ## [1.13.4] - 2026-06-17
6
20
 
7
21
  ### Added
@@ -0,0 +1,18 @@
1
+ Core Purpose: A high-level reactive framework for Vue 3 that abstracts complex state, API orchestration, and UI design patterns. It provides a standardized layer for API management (including SSR support), data formatting, list manipulation, and design component architecture.
2
+
3
+ Key Expositions:
4
+ 1. API Management: `useApiRef` (standard reactive fetch), `useApiManagementRef` (orchestrates GET/POST/PUT/DELETE with search/formatting), and SSR-specific versions (`useApiAsyncRef`, `useApiManagementAsyncRef`).
5
+ 2. Design System Components: `DesignConstructorAbstract` and `DesignComponents` for building reactive, theme-aware components; `DesignChanged` for tracking property mutations.
6
+ 3. Geo/Intl Utilities: `GeoIntlRef` (localized formatting for numbers, dates, currency, size), `GeoRef` (locale/country state management), and `GeoFlagRef`.
7
+ 4. Reactive Ref Utilities: `ListDataRef` (complex list management, grouping, selection, navigation), `EventRef` (reactive event listeners), and various composables for `localStorage`/`sessionStorage`/`cookies`.
8
+ 5. Functional Helpers: `executeUse` (singleton management: global/provide/local), `computedAsync`/`computedEternity` (advanced reactivity wrappers).
9
+
10
+ Triggers for Studying ai-types.md:
11
+ - When implementing or consuming API requests with `useApi...` hooks to understand data contracts and error handling.
12
+ - When configuring `executeUse` strategies (global vs provide) for service injection.
13
+ - When defining component properties or structures using `Constr...` types (e.g., `ConstrBind`, `ConstrOptions`).
14
+ - When managing complex lists or search logic requiring `ListDataRef` or `Search...` types.
15
+ - When creating custom design classes inheriting from `DesignConstructorAbstract`.
16
+
17
+ Integration Context:
18
+ This library serves as a middleware layer between raw API responses/browser APIs and Vue components. It is designed to work with `@dxtmisha/functional-basic` (the core utility provider) and relies on Vue's reactivity system. It is meant to be registered as a plugin (`dxtFunctionalPlugin`) to provide global configurations for API clients, translation services, and routing.
package/ai-doc.md ADDED
@@ -0,0 +1,226 @@
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();`
35
+
36
+ CHOOSING THE executeUse STRATEGY:
37
+ 1. `executeUseLocal` (PREFERRED):
38
+ - When to use: For most API requests and services.
39
+ - Key Features: Works "lazily" (lazy initialization) — initializes only when first called. The instance persists until the end of the session. This prevents overloading the application start with unnecessary requests.
40
+ 2. `executeUseGlobal`:
41
+ - When to use: When data or a service must be loaded/initialized IMMEDIATELY at application start (e.g., critical settings, SDKs).
42
+ - Key Features: Creates a single instance for the entire application. All global singletons are forcibly initialized via `executeUseGlobalInit()`.
43
+ 3. `executeUseProvide`:
44
+ - When to use: For state shared between a parent and a group of child components (e.g., tabs, complex forms with sub-components).
45
+ - Key Features: Uses provide/inject. The first component in the tree that calls the hook becomes the "provider", others become consumers.
46
+
47
+ =============================================================================
48
+ DEVELOPER GUIDE: USING `@dxtmisha/functional` AS A LIBRARY
49
+ =============================================================================
50
+
51
+ This section contains instructions and code guidelines for AI models on how to import and use the Vue-specific reactive classes, composables, and utility functions provided by this library in Vue 3 / Nuxt applications.
52
+
53
+ ---
54
+
55
+ ### 1. Reactive Storage & State Composables
56
+
57
+ These composables bind browser storages reactively to Vue `Ref` objects, keeping them in sync.
58
+
59
+ #### `useStorageRef` (localStorage)
60
+ Reactively binds a key from `localStorage`.
61
+ ```typescript
62
+ import { useStorageRef } from '@dxtmisha/functional';
63
+
64
+ // Bind to key with optional initial default value
65
+ const theme = useStorageRef<'light' | 'dark'>('theme_key', 'light');
66
+
67
+ // Setting the value triggers an immediate update to localStorage reactively
68
+ theme.value = 'dark';
69
+ ```
70
+
71
+ #### `useSessionRef` (sessionStorage) & `useCookieRef` (Cookies)
72
+ ```typescript
73
+ import { useSessionRef, useCookieRef } from '@dxtmisha/functional';
74
+
75
+ // sessionStorage
76
+ const step = useSessionRef<number>('form_step', 1);
77
+
78
+ // CookieStorage
79
+ const token = useCookieRef<string>('auth_token', '', { secure: true });
80
+ ```
81
+
82
+ #### `useBroadcastValueRef` (Cross-Tab Synchronization)
83
+ Synchronizes a state value reactively across multiple browser tabs under the same origin.
84
+ ```typescript
85
+ import { useBroadcastValueRef } from '@dxtmisha/functional';
86
+
87
+ // Synchronizes the value of the ref across tabs using BroadcastChannel
88
+ const syncState = useBroadcastValueRef<string>('active_channel', 'idle');
89
+ ```
90
+
91
+ #### `useHashRef` (URL Hash)
92
+ Reactively binds Vue state to the URL hash parameters.
93
+ ```typescript
94
+ import { useHashRef } from '@dxtmisha/functional';
95
+
96
+ const hashPage = useHashRef<string>('page', 'home');
97
+ ```
98
+
99
+ ---
100
+
101
+ ### 2. Reactive Geolocation & Internationalization (`GeoRef`, `GeoIntlRef`, `GeoFlagRef`, `useTranslateRef`)
102
+
103
+ Provides reactive integrations for internationalization APIs.
104
+
105
+ #### `GeoRef` & `GeoIntlRef`
106
+ ```typescript
107
+ import { GeoRef, useGeoIntlRef } from '@dxtmisha/functional';
108
+
109
+ // Reactive tracking of user location details
110
+ const currentCountry = GeoRef.getCountry(); // ComputedRef<string>
111
+
112
+ // Reactive i18n formatter hook
113
+ const intl = useGeoIntlRef();
114
+ const formattedPrice = intl.currency(150, 'EUR'); // ComputedRef<string>
115
+ ```
116
+
117
+ #### `useTranslateRef`
118
+ Reactively loads and gets translation tokens.
119
+ ```typescript
120
+ import { useTranslateRef } from '@dxtmisha/functional';
121
+
122
+ const translations = useTranslateRef(['global.save', 'global.cancel']);
123
+ // returns: ShallowRef<Record<string, string>> containing loaded translations
124
+ ```
125
+
126
+ ---
127
+
128
+ ### 3. SEO & Layout Utilities
129
+
130
+ #### `useMeta`
131
+ Manages page metadata reactively. Calling setters will update document headers and tags reactively.
132
+ ```typescript
133
+ import { useMeta } from '@dxtmisha/functional';
134
+
135
+ const metaManager = useMeta();
136
+ metaManager.setTitle('My Product Page');
137
+ metaManager.setDescription('Product details and configurations.');
138
+ ```
139
+
140
+ #### `ScrollbarWidthRef`
141
+ Tracks the scrollbar width reactively to solve layout shift issues.
142
+ ```typescript
143
+ import { ScrollbarWidthRef } from '@dxtmisha/functional';
144
+
145
+ const scrollbar = new ScrollbarWidthRef();
146
+ const width = scrollbar.width; // Ref<number>
147
+ const hasScroll = scrollbar.is; // ComputedRef<boolean>
148
+ ```
149
+
150
+ ---
151
+
152
+ ### 4. Advanced Reactivity Helpers
153
+
154
+ #### `computedAsync`
155
+ Creates a computed property that resolves its value asynchronously. Useful for async tasks inside computed getters.
156
+ ```typescript
157
+ import { computedAsync } from '@dxtmisha/functional';
158
+
159
+ // Performs asynchronous data lookup and reactively returns the result
160
+ const asyncData = computedAsync(async () => {
161
+ return await fetchSomeData(activeId.value);
162
+ }, 'initial_loading_value');
163
+ ```
164
+
165
+ #### `computedEternity`
166
+ Computes an asynchronous value once and caches it indefinitely unless manually refreshed.
167
+ ```typescript
168
+ import { computedEternity } from '@dxtmisha/functional';
169
+
170
+ const cachedData = computedEternity(async () => {
171
+ return await fetchStaticData();
172
+ }, 'loading_state');
173
+ ```
174
+
175
+ ---
176
+
177
+ ### 5. List & Search Orchestration
178
+
179
+ #### `ListDataRef`
180
+ A powerful reactive state orchestrator for managing lists, groups, items, pagination, highlight paths, and selections.
181
+ ```typescript
182
+ import { ListDataRef } from '@dxtmisha/functional';
183
+
184
+ const items = ref([
185
+ { value: 'id1', label: 'First Option' },
186
+ { value: 'id2', label: 'Second Option' },
187
+ ]);
188
+ const selectedId = ref('id1');
189
+
190
+ const listData = new ListDataRef(items, selectedId);
191
+ const isSelected = listData.isSelected; // ComputedRef<boolean>
192
+ const nextItem = listData.getSelectedNext(); // returns next select item
193
+ ```
194
+
195
+ #### `useSearchRef`
196
+ Combines a source list, target fields, search query, and options to reactively search a list with built-in delay and highlight support.
197
+ ```typescript
198
+ import { useSearchRef } from '@dxtmisha/functional';
199
+
200
+ const query = ref('second');
201
+ const { listSearch, loading, length } = useSearchRef(items, ['label'], query);
202
+ ```
203
+
204
+ ---
205
+
206
+ ### 6. DOM & Lazy Rendering
207
+
208
+ #### `EventRef`
209
+ Reactive wrapper for DOM events. Starts and stops event binding cleanly inside Vue component lifecycles (runs setup and teardown hooks automatically).
210
+ ```typescript
211
+ import { EventRef } from '@dxtmisha/functional';
212
+
213
+ // Listens reactively; auto-starts on setup and auto-stops on unmounted
214
+ const keyListener = new EventRef(window, window, 'keydown', (event) => {
215
+ console.log('Key pressed', event.key);
216
+ });
217
+ ```
218
+
219
+ #### `useLazyRef`
220
+ Reactive manager utilizing `IntersectionObserver` to defer rendering of off-screen components.
221
+ ```typescript
222
+ import { useLazyRef } from '@dxtmisha/functional';
223
+
224
+ const lazyManager = useLazyRef();
225
+ const isVisible = lazyManager.addLazyItem(elementRef); // ShallowRef<boolean>
226
+ ```
@@ -16,10 +16,6 @@ The following is the content of "exports" from package.json:
16
16
 
17
17
  // File: src/classes/design/DesignAbstract.d.ts
18
18
  export declare abstract class DesignAbstract<T extends Record<string, any>, C extends Record<string, any>> {
19
- protected readonly props: T;
20
- protected readonly callback?: ((event: C) => void) | undefined;
21
- protected readonly event: C;
22
- protected readonly changed: DesignChanged<T>;
23
19
  constructor(props: T, callback?: ((event: C) => void) | undefined, changed?: string[]);
24
20
  make(compelled?: boolean): this;
25
21
  makeCallback(compelled?: boolean): void;
@@ -35,8 +31,6 @@ export declare abstract class DesignAsyncAbstract<T extends Record<string, any>,
35
31
 
36
32
  // File: src/classes/design/DesignChanged.d.ts
37
33
  export declare class DesignChanged<T extends Record<string, any>> {
38
- protected readonly props: T;
39
- protected readonly watch: string[];
40
34
  constructor(props: T, watch?: string[]);
41
35
  is(name: string | string[]): boolean;
42
36
  isChanged(): boolean;
@@ -49,9 +43,6 @@ export declare class DesignComp<COMP extends ConstrComponent, P extends ConstrIt
49
43
 
50
44
  // File: src/classes/design/DesignComponents.d.ts
51
45
  export declare class DesignComponents<COMP extends ConstrComponent, P extends ConstrItem> {
52
- protected readonly components: COMP;
53
- protected readonly modification?: ConstrComponentMod<P> | undefined;
54
- protected caching: Record<string, ComputedRef<any>>;
55
46
  constructor(components?: COMP, modification?: ConstrComponentMod<P> | undefined);
56
47
  is<K extends keyof COMP>(name: K): name is K;
57
48
  get<K extends keyof COMP>(name: K): COMP[K];
@@ -63,20 +54,6 @@ export declare class DesignComponents<COMP extends ConstrComponent, P extends Co
63
54
 
64
55
  // File: src/classes/design/DesignConstructorAbstract.d.ts
65
56
  export declare abstract class DesignConstructorAbstract<E extends Element, COMP extends ConstrComponent, EMITS extends ConstrItem, EXPOSE extends ConstrItem, SLOTS extends ConstrItem, CLASSES extends ConstrClasses, P extends ConstrItem> {
66
- protected readonly props: Readonly<P>;
67
- protected readonly options?: ConstrOptions<COMP, EMITS, P> | undefined;
68
- protected readonly name: string[];
69
- protected readonly element: Ref<E | undefined, E | undefined>;
70
- protected readonly refs: ToRefs<P>;
71
- protected readonly components: DesignComponents<COMP, P>;
72
- protected readonly emits?: ConstrEmit<EMITS>;
73
- protected readonly classes?: ComputedRef<CLASSES>;
74
- protected classesSub?: ComputedRef<Partial<CLASSES>>;
75
- protected readonly styles?: ComputedRef<ConstrStyles>;
76
- protected stylesSub?: ComputedRef<ConstrStyles>;
77
- protected attrs?: ConstrItem;
78
- protected slots?: SLOTS;
79
- protected dataExpose?: EXPOSE;
80
57
  protected constructor(name: string, props: Readonly<P>, options?: ConstrOptions<COMP, EMITS, P> | undefined);
81
58
  protected init(): this;
82
59
  getName(): string;
@@ -91,24 +68,10 @@ export declare abstract class DesignConstructorAbstract<E extends Element, COMP
91
68
  protected abstract initClasses(): Partial<CLASSES>;
92
69
  protected abstract initStyles(): ConstrStyles;
93
70
  protected abstract initRender(): VNode | (VNode | any)[] | undefined;
94
- protected initSlot<K extends keyof SLOTS>(name: K, children?: any[], props?: ConstrItem): VNode | undefined;
95
- protected toClass(classes?: ConstrClass): ConstrClassObject;
96
- protected toClassName<T extends ConstrItem>(classes?: ConstrItem): T;
97
71
  }
98
72
 
99
73
  // File: src/classes/ref/DatetimeRef.d.ts
100
74
  export declare class DatetimeRef {
101
- protected item: Ref<NumberOrStringOrDate>;
102
- protected type: Ref<GeoDate>;
103
- protected code: Ref<string>;
104
- protected date: Ref<Date>;
105
- protected datetime: Datetime;
106
- protected year: Ref<number, number>;
107
- protected month: Ref<number, number>;
108
- protected day: Ref<number, number>;
109
- protected hour: Ref<number, number>;
110
- protected minute: Ref<number, number>;
111
- protected second: Ref<number, number>;
112
75
  constructor(date: RefOrNormal<NumberOrStringOrDate>, type?: RefOrNormal<GeoDate>, code?: RefOrNormal<string>);
113
76
  getItem(): Ref<NumberOrStringOrDate>;
114
77
  getDate(): Ref<Date>;
@@ -138,7 +101,6 @@ export declare class EventRef<E extends ElementOrWindow, O extends Event, D exte
138
101
 
139
102
  // File: src/classes/ref/GeoFlagRef.d.ts
140
103
  export declare class GeoFlagRef {
141
- protected flag: ComputedRef<GeoFlag>;
142
104
  constructor(code?: RefOrNormal<string | undefined>);
143
105
  getCode(): string;
144
106
  get(code?: RefOrNormal<string>): ComputedRef<GeoFlagItem | undefined>;
@@ -181,25 +143,15 @@ export declare class GeoRef {
181
143
  static getLanguage(): ComputedRef<string>;
182
144
  static getStandard(): ComputedRef<string>;
183
145
  static getFirstDay(): ComputedRef<string>;
146
+ static getLocation(): ComputedRef<string>;
147
+ static getLocationCountry(): ComputedRef<string>;
148
+ static getLocationLanguage(): ComputedRef<string>;
184
149
  static set(code: string): void;
185
150
  static setValueDefault(code?: string | (() => string)): void;
186
151
  }
187
152
 
188
153
  // File: src/classes/ref/ListDataRef.d.ts
189
154
  export declare class ListDataRef {
190
- protected readonly list: RefOrNormal<ListListInput | undefined>;
191
- protected readonly focus?: RefType<ListSelectedItem | undefined> | undefined;
192
- protected readonly highlight?: RefType<string | undefined> | undefined;
193
- protected readonly highlightLengthStart?: RefType<number | undefined> | undefined;
194
- protected readonly filterMode?: RefType<boolean | undefined> | undefined;
195
- protected readonly selected?: RefType<ListSelectedList | undefined> | undefined;
196
- protected readonly keyValue?: RefType<string | undefined> | undefined;
197
- protected readonly keyLabel?: RefType<string | undefined> | undefined;
198
- protected readonly lite?: RefType<number | undefined> | undefined;
199
- protected readonly min: RefOrNormal<number | string | undefined>;
200
- protected readonly max: RefOrNormal<number | string | undefined>;
201
- protected readonly parent?: string | undefined;
202
- protected subList: Record<any, ListDataRef>;
203
155
  constructor(list: RefOrNormal<ListListInput | undefined>, focus?: RefType<ListSelectedItem | undefined> | undefined, highlight?: RefType<string | undefined> | undefined, highlightLengthStart?: RefType<number | undefined> | undefined, filterMode?: RefType<boolean | undefined> | undefined, selected?: RefType<ListSelectedList | undefined> | undefined, keyValue?: RefType<string | undefined> | undefined, keyLabel?: RefType<string | undefined> | undefined, lite?: RefType<number | undefined> | undefined, min?: RefOrNormal<number | string | undefined>, max?: RefOrNormal<number | string | undefined>, parent?: string | undefined);
204
156
  readonly data: ComputedRef<ListList>;
205
157
  readonly liteData: ComputedRef<ListList>;
@@ -415,23 +367,71 @@ export declare const useLazyItemByMarginRef: (element: RefType<HTMLElement | und
415
367
 
416
368
  // File: src/composables/ref/useLazyRef.d.ts
417
369
  export type LazyItem = { status: ShallowRef<boolean>; ratio: ShallowRef<number>; entry: ShallowRef<IntersectionObserverEntry | undefined>; stopWatch: () => void; };
418
- export type LazyList = Record<string, LazyItem>;
419
- export declare const useLazyRef: (options?: IntersectionObserverInit) => { intersectionObserver: IntersectionObserver | undefined; getItem(element: HTMLElement): LazyItem; addLazyItem(element: Ref<HTMLElement | undefined>): ShallowRef<boolean, boolean>; removeLazyItem: (element?: HTMLElement) => void; disconnectLazy: () => void | undefined; };
370
+ export declare const useLazyRef: (options?: IntersectionObserverInit) => {
371
+ intersectionObserver: IntersectionObserver | undefined;
372
+ getItem(element: HTMLElement): LazyItem;
373
+ addLazyItem(element: Ref<HTMLElement | undefined>): ShallowRef<boolean, boolean>;
374
+ removeLazyItem: (element?: HTMLElement) => void;
375
+ disconnectLazy: () => void | undefined;
376
+ };
420
377
 
421
378
  // File: src/composables/ref/useLoadingRef.d.ts
422
379
  export declare function useLoadingRef(): ShallowRef<boolean, boolean>;
423
380
 
424
381
  // File: src/composables/ref/useMeta.d.ts
425
- export declare const useMeta: () => Readonly<{ meta: typeof MetaStatic; title: Ref<string, string>; keyword: Ref<string, string>; description: Ref<string, string>; author: Ref<string, string>; image: Ref<string, string>; canonical: Ref<string, string>; robots: Ref<MetaRobots, MetaRobots>; siteName: Ref<string, string>; getHtmlMeta: () => string; sync: () => void; update: () => void; updateSsr: () => void; setTitle: (value: string) => void; setKeywords: (value: string) => void; setDescription: (value: string) => void; setAuthor: (value: string) => void; setImage: (value: string) => void; setCanonical: (value: string) => void; setRobots: (value: MetaRobots) => void; setSiteName: (value: string) => void; setSuffix: (suffix: string) => typeof MetaStatic; } & { init(): Readonly<any>; destroyExecute?(): void; }>;
382
+ export declare const useMeta: () => Readonly<{
383
+ meta: typeof MetaStatic;
384
+ title: Ref<string, string>;
385
+ keyword: Ref<string, string>;
386
+ description: Ref<string, string>;
387
+ author: Ref<string, string>;
388
+ image: Ref<string, string>;
389
+ canonical: Ref<string, string>;
390
+ robots: Ref<MetaRobots, MetaRobots>;
391
+ siteName: Ref<string, string>;
392
+ getHtmlMeta: () => string;
393
+ sync: () => void;
394
+ update: () => void;
395
+ updateSsr: () => void;
396
+ setTitle: (value: string) => void;
397
+ setKeywords: (value: string) => void;
398
+ setDescription: (value: string) => void;
399
+ setAuthor: (value: string) => void;
400
+ setImage: (value: string) => void;
401
+ setCanonical: (value: string) => void;
402
+ setRobots: (value: MetaRobots) => void;
403
+ setSiteName: (value: string) => void;
404
+ setSuffix: (suffix: string) => typeof MetaStatic;
405
+ } & {
406
+ init(): any;
407
+ destroyExecute?(): void;
408
+ }>;
426
409
 
427
410
  // File: src/composables/ref/useRouterList.d.ts
428
- export declare const useRouterList: <T extends ListDataBasic>(list: RefType<ConstrBind<T>[] | undefined>, selected?: Ref<string> | string, hasTo?: boolean) => { item: ComputedRef<T | undefined>; selected: Ref<string, string>; label: ComputedRef<NumberOrString>; list: ComputedRef<ConstrBind<T>[]>; to: (name?: string) => void; toMain(): void; };
411
+ export declare const useRouterList: <T extends ListDataBasic>(list: RefType<ConstrBind<T>[] | undefined>, selected?: Ref<string> | string, hasTo?: boolean) => {
412
+ item: ComputedRef<T | undefined>;
413
+ selected: Ref<string, string>;
414
+ label: ComputedRef<NumberOrString>;
415
+ list: ComputedRef<ConstrBind<T>[]>;
416
+ to: (name?: string) => void;
417
+ toMain(): void;
418
+ };
429
419
 
430
420
  // File: src/composables/ref/useSearchRef.d.ts
431
- export declare function useSearchRef<T extends SearchItem, K extends SearchColumns<T>>(list: SearchListInput<T>, columns: K, value?: Ref<string>, options?: SearchOptions): { isSearch: ComputedRef<boolean>; search: Ref<string, string>; loading: Ref<boolean, boolean>; listSearch: ComputedRef<SearchFormatList<T, K>>; length: ComputedRef<number>; };
421
+ export declare function useSearchRef<T extends SearchItem, K extends SearchColumns<T>>(list: SearchListInput<T>, columns: K, value?: Ref<string>, options?: SearchOptions): {
422
+ isSearch: ComputedRef<boolean>;
423
+ search: Ref<string, string>;
424
+ loading: Ref<boolean, boolean>;
425
+ listSearch: ComputedRef<SearchFormatList<T, K>>;
426
+ length: ComputedRef<number>;
427
+ };
432
428
 
433
429
  // File: src/composables/ref/useSearchValueRef.d.ts
434
- export declare function useSearchValueRef<T extends SearchItem, K extends SearchColumns<T>>(item: SearchList<T, K>, value?: Ref<string>): { search: Ref<string, string>; searchDelay: Ref<string, string>; loading: Ref<boolean, boolean>; };
430
+ export declare function useSearchValueRef<T extends SearchItem, K extends SearchColumns<T>>(item: SearchList<T, K>, value?: Ref<string>): {
431
+ search: Ref<string, string>;
432
+ searchDelay: Ref<string, string>;
433
+ loading: Ref<boolean, boolean>;
434
+ };
435
435
 
436
436
  // File: src/composables/ref/useSessionRef.d.ts
437
437
  export declare function useSessionRef<T>(name: string, defaultValue?: T | (() => T)): Ref<T | undefined>;
@@ -459,16 +459,25 @@ export declare function computedByLanguage<T, R extends (T | undefined) = T | un
459
459
  export declare function computedEternity<T>(getter: () => Promise<T> | T, initialState?: (() => T) | T): Ref<T, T>;
460
460
 
461
461
  // File: src/functions/dxtFunctionalPlugin.d.ts
462
- export interface FunctionalPluginOptions { api?: ApiConfig; translate?: TranslateConfig; location?: string | (() => string); metaSuffix?: string; icons?: IconsConfig; router?: Router; errorCauses?: ErrorCenterCauseList; errorHandlers?: ErrorCenterHandlerList; }
462
+ export interface FunctionalPluginOptions {
463
+ api?: ApiConfig;
464
+ translate?: TranslateConfig;
465
+ location?: string | (() => string);
466
+ metaSuffix?: string;
467
+ icons?: IconsConfig;
468
+ router?: Router;
469
+ errorCauses?: ErrorCenterCauseList;
470
+ errorHandlers?: ErrorCenterHandlerList;
471
+ }
463
472
  export declare const dxtFunctionalPlugin: Plugin;
464
473
 
465
474
  // File: src/functions/executeUse.d.ts
466
475
  export declare enum ExecuteUseType { global = "global", provide = "provide", local = "local" }
467
476
  export type ExecuteUseReturn<R> = Readonly<R & { init(): Readonly<R>; destroyExecute?(): void; }>;
468
477
  export declare function executeUse<R, O extends any[], RI extends ExecuteUseReturn<R> = ExecuteUseReturn<R>>(callback: (...args: O) => R, type?: ExecuteUseType): ((...args: O) => RI) | (() => RI);
469
- export declare function executeUseGlobal<R>(callback: () => R): (() => Readonly<any>) | (() => Readonly<any>);
470
- export declare function executeUseProvide<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<any>) | (() => Readonly<any>);
471
- export declare function executeUseLocal<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<any>) | (() => Readonly<any>);
478
+ export declare function executeUseGlobal<R>(callback: () => R): any;
479
+ export declare function executeUseProvide<R, O extends any[]>(callback: (...args: O) => R): any;
480
+ export declare function executeUseLocal<R, O extends any[]>(callback: (...args: O) => R): any;
472
481
  export declare function executeUseGlobalInit(): void;
473
482
 
474
483
  // File: src/functions/getInject.d.ts
@@ -513,12 +522,98 @@ export declare function toBind<R extends ItemList = ItemList>(extra: ItemList, v
513
522
  // File: src/functions/toBinds.d.ts
514
523
  export declare function toBinds<R extends ItemList = ItemList>(...values: (ItemList | undefined)[]): ConstrBind<R>;
515
524
 
525
+ // File: src/library.d.ts
526
+ export * from './classes/design/DesignAbstract';
527
+ export * from './classes/design/DesignAsyncAbstract';
528
+ export * from './classes/design/DesignChanged';
529
+ export * from './classes/design/DesignComp';
530
+ export * from './classes/design/DesignComponents';
531
+ export * from './classes/design/DesignConstructorAbstract';
532
+ export * from './classes/ref/DatetimeRef';
533
+ export * from './classes/ref/EffectScopeGlobal';
534
+ export * from './classes/ref/EventRef';
535
+ export * from './classes/ref/GeoFlagRef';
536
+ export * from './classes/ref/GeoIntlRef';
537
+ export * from './classes/ref/GeoRef';
538
+ export * from './classes/ref/ListDataRef';
539
+ export * from './classes/ref/RouterItemRef';
540
+ export * from './classes/ref/ScrollbarWidthRef';
541
+ export * from './composables/ref/useApiAsyncRef';
542
+ export * from './composables/ref/useApiDelete';
543
+ export * from './composables/ref/useApiGet';
544
+ export * from './composables/ref/useApiManagementAsyncRef';
545
+ export * from './composables/ref/useApiManagementRef';
546
+ export * from './composables/ref/useApiPost';
547
+ export * from './composables/ref/useApiPut';
548
+ export * from './composables/ref/useApiRef';
549
+ export * from './composables/ref/useApiRequest';
550
+ export * from './composables/ref/useBroadcastValueRef';
551
+ export * from './composables/ref/useCookieRef';
552
+ export * from './composables/ref/useFormattersRef';
553
+ export * from './composables/ref/useGeoIntlRef';
554
+ export * from './composables/ref/useHashRef';
555
+ export * from './composables/ref/useLazyItemByMarginRef';
556
+ export * from './composables/ref/useLazyRef';
557
+ export * from './composables/ref/useLoadingRef';
558
+ export * from './composables/ref/useMeta';
559
+ export * from './composables/ref/useRouterList';
560
+ export * from './composables/ref/useSearchRef';
561
+ export * from './composables/ref/useSearchValueRef';
562
+ export * from './composables/ref/useSessionRef';
563
+ export * from './composables/ref/useStorageRef';
564
+ export * from './composables/ref/useTranslateRef';
565
+ export * from './functions/basic';
566
+ export * from './functions/computedAsync';
567
+ export * from './functions/computedByLanguage';
568
+ export * from './functions/computedEternity';
569
+ export * from './functions/dxtFunctionalPlugin';
570
+ export * from './functions/executeUse';
571
+ export * from './functions/getInject';
572
+ export * from './functions/getOptions';
573
+ export * from './functions/ref/executeFunctionRef';
574
+ export * from './functions/ref/getApiErrorRef';
575
+ export * from './functions/ref/getBindRef';
576
+ export * from './functions/ref/getRef';
577
+ export * from './functions/ref/render';
578
+ export * from './functions/ref/setRef';
579
+ export * from './functions/ref/toRefItem';
580
+ export * from './functions/render/getBind';
581
+ export * from './functions/render/getClassName';
582
+ export * from './functions/render/getIndexForRender';
583
+ export * from './functions/toBind';
584
+ export * from './functions/toBinds';
585
+ export * from './types/apiTypes';
586
+ export * from './types/constructorTypes';
587
+ export * from './types/listTypes';
588
+ export * from './types/refTypes';
589
+ export * from './types/searchTypes';
590
+
516
591
  // File: src/types/apiTypes.d.ts
517
592
  export type ApiOptions = ApiMethodItem | RefOrNormal<ApiFetch>;
518
593
  export type ApiManagementValue = ApiDefaultValue | ApiDefaultValue[];
519
- export type ApiManagementGet<Return extends ApiManagementValue, Type extends ApiManagementValue = Return> = { path?: RefOrNormal<string | undefined>; options?: ApiOptions; reactivity?: boolean; conditions?: RefType<boolean>; transformation?: (data: Type, isResponseContractValid?: ApiDataValidation) => ApiData<Return>; validateResponseContract?: (data: Type) => ApiDataValidation; errorContract?: ApiErrorStorageList; typeData?: ((data: Return) => boolean) | any; unmounted?: boolean; skeleton?: () => Return; };
594
+ export type ApiManagementGet<Return extends ApiManagementValue, Type extends ApiManagementValue = Return> = {
595
+ path?: RefOrNormal<string | undefined>;
596
+ options?: ApiOptions;
597
+ reactivity?: boolean;
598
+ conditions?: RefType<boolean>;
599
+ transformation?: (data: Type, isResponseContractValid?: ApiDataValidation) => ApiData<Return>;
600
+ validateResponseContract?: (data: Type) => ApiDataValidation;
601
+ errorContract?: ApiErrorStorageList;
602
+ typeData?: ((data: Return) => boolean) | any;
603
+ unmounted?: boolean;
604
+ skeleton?: () => Return;
605
+ };
520
606
  export type ApiManagementSearch<T extends SearchItem, K extends SearchColumns<T>> = { columns: K; value?: Ref<string>; options?: SearchOptions; };
521
- export type ApiManagementRequest<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> = { path?: RefOrNormal<string | undefined>; action?: (data: Return | undefined) => Promise<void> | void; transformation?: (data: T) => Return; validateRequestContract?: (data: Request) => ApiDataValidation & Return; validateResponseContract?: (data: T) => ApiDataValidation & Return; errorContract?: ApiErrorStorageList; toData?: boolean; options?: ApiOptions; };
607
+ export type ApiManagementRequest<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> = {
608
+ path?: RefOrNormal<string | undefined>;
609
+ action?: (data: Return | undefined) => Promise<void> | void;
610
+ transformation?: (data: T) => Return;
611
+ validateRequestContract?: (data: Request) => ApiDataValidation & Return;
612
+ validateResponseContract?: (data: T) => ApiDataValidation & Return;
613
+ errorContract?: ApiErrorStorageList;
614
+ toData?: boolean;
615
+ options?: ApiOptions;
616
+ };
522
617
 
523
618
  // File: src/types/constructorTypes.d.ts
524
619
  export type ConstrItem = Record<string, any>;
@@ -535,8 +630,19 @@ export type ConstrClassList = Record<string, ConstrClass>;
535
630
  export type ConstrClasses = { main: ConstrClass; } & ConstrClassList;
536
631
  export type ConstrStylesItem = string | null;
537
632
  export type ConstrStyles = Record<string, ConstrStylesItem> | ConstrStyles[];
538
- export type ConstrOptions<COMP extends ConstrComponent, EMITS extends ConstrItem, P extends ConstrItem> = { components?: COMP; compMod?: ConstrComponentMod<P>; emits?: ConstrEmit<EMITS>; classes?: RefType<ConstrClasses>; styles?: RefType<ConstrStyles>; };
539
- export type ConstrSetup<E extends Element, CLASSES extends ConstrClasses, SETUP extends ConstrItem> = { name: string; element: Ref<E | undefined>; classes: RefType<CLASSES>; styles: RefType<ConstrStyles>; } & SETUP;
633
+ export type ConstrOptions<COMP extends ConstrComponent, EMITS extends ConstrItem, P extends ConstrItem> = {
634
+ components?: COMP;
635
+ compMod?: ConstrComponentMod<P>;
636
+ emits?: ConstrEmit<EMITS>;
637
+ classes?: RefType<ConstrClasses>;
638
+ styles?: RefType<ConstrStyles>;
639
+ };
640
+ export type ConstrSetup<E extends Element, CLASSES extends ConstrClasses, SETUP extends ConstrItem> = {
641
+ name: string;
642
+ element: Ref<E | undefined>;
643
+ classes: RefType<CLASSES>;
644
+ styles: RefType<ConstrStyles>;
645
+ } & SETUP;
540
646
  export type ConstrRegistration = { flag?: boolean; translate?: Record<string, string>; };
541
647
  export type ConstrBind<T> = T & Record<string, any> & { key?: string; class?: ConstrClass; style?: ConstrStyles; };
542
648
  export type ConstrPropItemOptions<T = any> = { type?: PropType<T>; required?: boolean; default?: any; validator?(value: any, props: any): boolean; };
package/dist/library.js CHANGED
@@ -352,21 +352,30 @@ var Oe = class {
352
352
  getNational(e) {
353
353
  return I(() => this.flag.value.getNational(U(e)));
354
354
  }
355
- }, J, Y = class {
355
+ }, J = class {
356
356
  static get() {
357
357
  return y.get("__ui:geo-ref__", () => z(u.getItem()));
358
358
  }
359
359
  static getCountry() {
360
- return this.country;
360
+ return y.get("__ui:geo-ref-country__", () => I(() => this.get().value.country));
361
361
  }
362
362
  static getLanguage() {
363
- return this.language;
363
+ return y.get("__ui:geo-ref-language__", () => I(() => this.get().value.language));
364
364
  }
365
365
  static getStandard() {
366
- return this.standard;
366
+ return y.get("__ui:geo-ref-standard__", () => I(() => this.get().value.standard));
367
367
  }
368
368
  static getFirstDay() {
369
- return this.firstDay;
369
+ return y.get("__ui:geo-ref-first-day__", () => I(() => this.get().value.firstDay));
370
+ }
371
+ static getLocation() {
372
+ return y.get("__ui:geo-ref-location__", () => I(() => this.get().value.location));
373
+ }
374
+ static getLocationCountry() {
375
+ return y.get("__ui:geo-ref-location-country__", () => I(() => this.get().value.locationCountry));
376
+ }
377
+ static getLocationLanguage() {
378
+ return y.get("__ui:geo-ref-location-language__", () => I(() => this.get().value.locationLanguage));
370
379
  }
371
380
  static set(e) {
372
381
  u.set(e, !0), this.get().value = u.getItem();
@@ -374,15 +383,11 @@ var Oe = class {
374
383
  static setValueDefault(e) {
375
384
  u.setValueDefault(e), this.get().value = u.getItem();
376
385
  }
377
- };
378
- J = Y, H(Y, "country", I(() => J.get().value.country)), H(Y, "language", I(() => J.get().value.language)), H(Y, "standard", I(() => J.get().value.standard)), H(Y, "firstDay", I(() => J.get().value.firstDay));
379
- //#endregion
380
- //#region src/classes/ref/GeoIntlRef.ts
381
- var je = class {
386
+ }, je = class {
382
387
  constructor(e) {
383
388
  H(this, "location", void 0), H(this, "intl", void 0), this.location = K(e), this.intl = I(() => {
384
389
  var e;
385
- return new f((e = this.location.value) == null ? Y.getLanguage().value : e);
390
+ return new f((e = this.location.value) == null ? J.getLanguage().value : e);
386
391
  });
387
392
  }
388
393
  display(e, t) {
@@ -659,7 +664,7 @@ var je = class {
659
664
  value: e
660
665
  };
661
666
  }
662
- }, Ne = "__ui:router-item-ref__", X = class {
667
+ }, Ne = "__ui:router-item-ref__", Y = class {
663
668
  static get() {
664
669
  return y.get(Ne);
665
670
  }
@@ -709,9 +714,9 @@ function Fe(e) {
709
714
  }
710
715
  //#endregion
711
716
  //#region src/functions/getOptions.ts
712
- var Ie = (e) => typeof e == "string" ? { method: e } : e || {}, Z;
713
- function Le(n, r, i = !0, a, o, s, c, l = !0, u = e.getItem()) {
714
- let d = R(), f = K(Ie(r)), p = R(!1), m = R(!1), h = R(), g, _ = !0, v, y = () => {
717
+ var X = (e) => typeof e == "string" ? { method: e } : e || {}, Z;
718
+ function Ie(n, r, i = !0, a, o, s, c, l = !0, u = e.getItem()) {
719
+ let d = R(), f = K(X(r)), p = R(!1), m = R(!1), h = R(), g, _ = !0, v, y = () => {
715
720
  let e = U(n);
716
721
  return !!((!a || a.value) && e);
717
722
  }, b = () => ({
@@ -793,19 +798,19 @@ function Le(n, r, i = !0, a, o, s, c, l = !0, u = e.getItem()) {
793
798
  abort: () => g == null ? void 0 : g.abort()
794
799
  };
795
800
  }
796
- var Re = (e) => {
801
+ var Le = (e) => {
797
802
  Z || (Z = e);
798
803
  };
799
804
  //#endregion
800
805
  //#region src/composables/ref/useApiAsyncRef.ts
801
- function ze(t, n, r = !0, i, a, o, s, c = !0, l = e.getItem()) {
802
- let u = Le(t, n, r, i, a, o, s, c, l);
806
+ function Re(t, n, r = !0, i, a, o, s, c = !0, l = e.getItem()) {
807
+ let u = Ie(t, n, r, i, a, o, s, c, l);
803
808
  return u.initSsr(), u;
804
809
  }
805
810
  //#endregion
806
811
  //#region src/composables/ref/useApiRequest.ts
807
812
  function Q({ path: r, method: i = n.post, action: a, transformation: o, validateRequestContract: s, validateResponseContract: c, errorContract: l, toData: u = !0, options: d, apiInstance: f = e.getItem() }) {
808
- let p = R(!1), m = K(Ie(d));
813
+ let p = R(!1), m = K(X(d));
809
814
  return l && t.add(l, U(r), i), {
810
815
  loading: p,
811
816
  async send(e) {
@@ -840,7 +845,7 @@ function Q({ path: r, method: i = n.post, action: a, transformation: o, validate
840
845
  }
841
846
  //#endregion
842
847
  //#region src/composables/ref/useApiDelete.ts
843
- function Be(e) {
848
+ function ze(e) {
844
849
  return Q({
845
850
  ...e,
846
851
  method: n.delete
@@ -848,7 +853,7 @@ function Be(e) {
848
853
  }
849
854
  //#endregion
850
855
  //#region src/composables/ref/useApiGet.ts
851
- function Ve(e) {
856
+ function Be(e) {
852
857
  return Q({
853
858
  ...e,
854
859
  method: n.get
@@ -856,7 +861,7 @@ function Ve(e) {
856
861
  }
857
862
  //#endregion
858
863
  //#region src/composables/ref/useApiPost.ts
859
- function He(e) {
864
+ function Ve(e) {
860
865
  return Q({
861
866
  ...e,
862
867
  method: n.post
@@ -864,7 +869,7 @@ function He(e) {
864
869
  }
865
870
  //#endregion
866
871
  //#region src/composables/ref/useApiPut.ts
867
- function Ue(e) {
872
+ function He(e) {
868
873
  return Q({
869
874
  ...e,
870
875
  method: n.put
@@ -872,7 +877,7 @@ function Ue(e) {
872
877
  }
873
878
  //#endregion
874
879
  //#region src/composables/ref/useFormattersRef.ts
875
- function We(e, t) {
880
+ function Ue(e, t) {
876
881
  let n = new l(t);
877
882
  return {
878
883
  listFormat: I(() => n.setList(e.value).to()),
@@ -881,7 +886,7 @@ function We(e, t) {
881
886
  }
882
887
  //#endregion
883
888
  //#region src/composables/ref/useSearchValueRef.ts
884
- function Ge(e, t) {
889
+ function We(e, t) {
885
890
  let n = t == null ? R("") : t, r = R(n.value), i = R(!1), a;
886
891
  return B(n, (t, o, s) => {
887
892
  let c = e.getOptions().getDelay();
@@ -898,8 +903,8 @@ function Ge(e, t) {
898
903
  }
899
904
  //#endregion
900
905
  //#region src/composables/ref/useSearchRef.ts
901
- function Ke(e, t, n, r) {
902
- let i = new v(void 0, t, void 0, r), { search: a, searchDelay: o, loading: s } = Ge(i, n), c = () => U(x(e)) || [], l = I(() => i.setValue(o.value).getItem().isSearch()), u = I(() => i.setList(c()).setValue(o.value).to());
906
+ function Ge(e, t, n, r) {
907
+ let i = new v(void 0, t, void 0, r), { search: a, searchDelay: o, loading: s } = We(i, n), c = () => U(x(e)) || [], l = I(() => i.setValue(o.value).getItem().isSearch()), u = I(() => i.setList(c()).setValue(o.value).to());
903
908
  return {
904
909
  isSearch: l,
905
910
  search: a,
@@ -910,9 +915,9 @@ function Ke(e, t, n, r) {
910
915
  }
911
916
  //#endregion
912
917
  //#region src/composables/ref/useApiManagementRef.ts
913
- function qe(e, t, n, r, i, a, o, s) {
914
- let { path: c, options: l, reactivity: u, conditions: d, transformation: f, validateResponseContract: p, errorContract: m, typeData: h, unmounted: g, skeleton: _ } = e, v, y, b, x, C, w = Le(c, l, u, d, f, p, m, g, s), T = I(() => h === void 0 ? !0 : w.isStarting() ? !1 : A(h) ? h(w.data.value) : w.data.value instanceof h), E = I(() => w.isStarting() && _ ? _() : w.data.value);
915
- if (t && (v = We(E, t)), n && (y = Ke(I(() => {
918
+ function Ke(e, t, n, r, i, a, o, s) {
919
+ let { path: c, options: l, reactivity: u, conditions: d, transformation: f, validateResponseContract: p, errorContract: m, typeData: h, unmounted: g, skeleton: _ } = e, v, y, b, x, C, w = Ie(c, l, u, d, f, p, m, g, s), T = I(() => h === void 0 ? !0 : w.isStarting() ? !1 : A(h) ? h(w.data.value) : w.data.value instanceof h), E = I(() => w.isStarting() && _ ? _() : w.data.value);
920
+ if (t && (v = Ue(E, t)), n && (y = Ge(I(() => {
916
921
  var e;
917
922
  let t = (e = v == null ? void 0 : v.listFormat.value) == null ? w.data.value : e;
918
923
  if (Array.isArray(t)) return t;
@@ -922,15 +927,15 @@ function qe(e, t, n, r, i, a, o, s) {
922
927
  }, t = (t) => async (n) => {
923
928
  A(t) && await S(t(n)), e(n);
924
929
  };
925
- r && (b = He({
930
+ r && (b = Ve({
926
931
  ...r,
927
932
  action: t(r.action),
928
933
  apiInstance: s
929
- })), i && (x = Ue({
934
+ })), i && (x = He({
930
935
  ...i,
931
936
  action: t(i.action),
932
937
  apiInstance: s
933
- })), a && (C = Be({
938
+ })), a && (C = ze({
934
939
  ...a,
935
940
  action: t(a.action),
936
941
  apiInstance: s
@@ -976,15 +981,15 @@ function qe(e, t, n, r, i, a, o, s) {
976
981
  }
977
982
  //#endregion
978
983
  //#region src/composables/ref/useApiManagementAsyncRef.ts
979
- function Je(e, t, n, r, i, a, o, s) {
980
- let c = qe(e, t, n, r, i, a, o, s);
984
+ function qe(e, t, n, r, i, a, o, s) {
985
+ let c = Ke(e, t, n, r, i, a, o, s);
981
986
  return c.initSsr(), c;
982
987
  }
983
988
  //#endregion
984
989
  //#region src/composables/ref/useBroadcastValueRef.ts
985
- var Ye = () => y.get("__ui:broadcast-value-ref__", () => ({}));
986
- function Xe(e, t) {
987
- let n = `broadcast--${e}`, i = Ye();
990
+ var Je = () => y.get("__ui:broadcast-value-ref__", () => ({}));
991
+ function Ye(e, t) {
992
+ let n = `broadcast--${e}`, i = Je();
988
993
  if (n in i) return i[n];
989
994
  let a = R(x(t));
990
995
  if (k()) {
@@ -999,11 +1004,11 @@ function Xe(e, t) {
999
1004
  }
1000
1005
  //#endregion
1001
1006
  //#region src/composables/ref/useCookieRef.ts
1002
- var Ze = () => y.get("__ui:cookie-ref__", () => ({}));
1003
- function Qe(e, t, n) {
1004
- let r = Ze();
1007
+ var Xe = () => y.get("__ui:cookie-ref__", () => ({}));
1008
+ function Ze(e, t, n) {
1009
+ let r = Xe();
1005
1010
  if (e in r) return r[e];
1006
- let a = new i(e), o = Xe(`__cookie:${e}`, a.get(t, n));
1011
+ let a = new i(e), o = Ye(`__cookie:${e}`, a.get(t, n));
1007
1012
  return q.run(() => {
1008
1013
  B(o, (e) => {
1009
1014
  a.set(e, n);
@@ -1012,14 +1017,14 @@ function Qe(e, t, n) {
1012
1017
  }
1013
1018
  //#endregion
1014
1019
  //#region src/composables/ref/useGeoIntlRef.ts
1015
- function $e() {
1020
+ function Qe() {
1016
1021
  return new je();
1017
1022
  }
1018
1023
  //#endregion
1019
1024
  //#region src/composables/ref/useHashRef.ts
1020
- var et = () => y.get("__ui:hash-ref__", () => ({}));
1021
- function tt(e, t) {
1022
- let n = et();
1025
+ var $e = () => y.get("__ui:hash-ref__", () => ({}));
1026
+ function et(e, t) {
1027
+ let n = $e();
1023
1028
  if (e in n) return n[e];
1024
1029
  let r = z(p.get(e, t));
1025
1030
  return k() && (q.run(() => {
@@ -1030,7 +1035,7 @@ function tt(e, t) {
1030
1035
  }
1031
1036
  //#endregion
1032
1037
  //#region src/composables/ref/useLazyRef.ts
1033
- var nt = (e = { rootMargin: "128px 0px" }) => {
1038
+ var tt = (e = { rootMargin: "128px 0px" }) => {
1034
1039
  let t = {}, n = k() && "IntersectionObserver" in window ? new IntersectionObserver((e) => {
1035
1040
  e.forEach((e) => {
1036
1041
  let n = T(e.target);
@@ -1074,16 +1079,16 @@ var nt = (e = { rootMargin: "128px 0px" }) => {
1074
1079
  removeLazyItem: r,
1075
1080
  disconnectLazy: () => n == null ? void 0 : n.disconnect()
1076
1081
  };
1077
- }, rt = () => y.get("__ui:lazy-item-by-margin-ref__", () => []), it = (e) => {
1078
- let t = rt(), n = t.find((t) => t.rootMargin === e);
1082
+ }, nt = () => y.get("__ui:lazy-item-by-margin-ref__", () => []), rt = (e) => {
1083
+ let t = nt(), n = t.find((t) => t.rootMargin === e);
1079
1084
  if (n) return n.item;
1080
- let r = nt({ rootMargin: e });
1085
+ let r = tt({ rootMargin: e });
1081
1086
  return t.push({
1082
1087
  rootMargin: e,
1083
1088
  item: r
1084
1089
  }), r;
1085
- }, at = (e, t) => {
1086
- let n = it(t);
1090
+ }, it = (e, t) => {
1091
+ let n = rt(t);
1087
1092
  return {
1088
1093
  lazyItemStatus: n.addLazyItem(e),
1089
1094
  get lazyItem() {
@@ -1093,7 +1098,7 @@ var nt = (e = { rootMargin: "128px 0px" }) => {
1093
1098
  };
1094
1099
  //#endregion
1095
1100
  //#region src/composables/ref/useLoadingRef.ts
1096
- function ot() {
1101
+ function at() {
1097
1102
  let e = z(h.is());
1098
1103
  return k() && h.registrationEvent(({ detail: t }) => {
1099
1104
  e.value = t.loading;
@@ -1101,11 +1106,11 @@ function ot() {
1101
1106
  }
1102
1107
  //#endregion
1103
1108
  //#region src/functions/executeUse.ts
1104
- var st = /* @__PURE__ */ function(e) {
1109
+ var ot = /* @__PURE__ */ function(e) {
1105
1110
  return e.global = "global", e.provide = "provide", e.local = "local", e;
1106
- }({}), ct = 1, lt = ee(1e5, 999999), ut = () => `__execute_use${lt}::${ct++}`, dt = () => y.get("__ui:execute-use-global__", () => []);
1111
+ }({}), st = 1, ct = ee(1e5, 999999), lt = () => `__execute_use${ct}::${st++}`, ut = () => y.get("__ui:execute-use-global__", () => []);
1107
1112
  function $(e, t = "provide") {
1108
- let n = ut(), r, i = (t) => {
1113
+ let n = lt(), r, i = (t) => {
1109
1114
  let n = Object.freeze(e(...t));
1110
1115
  return {
1111
1116
  ...n,
@@ -1127,23 +1132,23 @@ function $(e, t = "provide") {
1127
1132
  }, s = (...e) => t === "provide" ? ce(n, void 0) || a(e) : (r || q.run(() => {
1128
1133
  r = o(e);
1129
1134
  }), r);
1130
- return t === "global" && dt().push(s), s;
1135
+ return t === "global" && ut().push(s), s;
1131
1136
  }
1132
- function ft(e) {
1137
+ function dt(e) {
1133
1138
  return $(e, "global");
1134
1139
  }
1135
- function pt(e) {
1140
+ function ft(e) {
1136
1141
  return $(e, "provide");
1137
1142
  }
1138
- function mt(e) {
1143
+ function pt(e) {
1139
1144
  return $(e, "local");
1140
1145
  }
1141
- function ht() {
1142
- dt().forEach((e) => e());
1146
+ function mt() {
1147
+ ut().forEach((e) => e());
1143
1148
  }
1144
1149
  //#endregion
1145
1150
  //#region src/composables/ref/useMeta.ts
1146
- var gt = mt(() => {
1151
+ var ht = pt(() => {
1147
1152
  let e = g, t = R(e.getTitle()), n = R(e.getKeywords()), r = R(e.getDescription()), i = R(e.getImage()), a = R(e.getCanonical()), o = R(e.getRobots()), s = R(e.getAuthor()), c = R(e.getSiteName()), l = () => e.html(), u = (e) => {
1148
1153
  t.value = e, x();
1149
1154
  }, d = (e) => {
@@ -1200,13 +1205,13 @@ var gt = mt(() => {
1200
1205
  setSiteName: v,
1201
1206
  setSuffix: (t) => e.setSuffix(t)
1202
1207
  };
1203
- }), _t = () => gt(), vt = (e, t, n = !0) => {
1208
+ }), gt = () => ht(), _t = (e, t, n = !0) => {
1204
1209
  var r;
1205
1210
  let i = L(t) ? t : R(t || ((r = e.value) == null || (r = r[0]) == null ? void 0 : r.value) || ""), a = () => o(i.value), o = (t) => {
1206
1211
  var n;
1207
1212
  return (n = e.value) == null ? void 0 : n.find((e) => e.value === t);
1208
1213
  }, s = (e) => {
1209
- e && e !== i.value && o(e) && (i.value = e, X.push({ name: e }));
1214
+ e && e !== i.value && o(e) && (i.value = e, Y.push({ name: e }));
1210
1215
  };
1211
1216
  return {
1212
1217
  item: I(() => a()),
@@ -1225,9 +1230,9 @@ var gt = mt(() => {
1225
1230
  s((t = e.value) == null || (t = t[0]) == null ? void 0 : t.value);
1226
1231
  }
1227
1232
  };
1228
- }, yt = () => y.get("__ui:session-ref__", () => ({}));
1229
- function bt(e, t) {
1230
- let n = yt();
1233
+ }, vt = () => y.get("__ui:session-ref__", () => ({}));
1234
+ function yt(e, t) {
1235
+ let n = vt();
1231
1236
  if (e in n) return n[e];
1232
1237
  let r = new a(e, !0), i = R(r.get(t));
1233
1238
  return q.run(() => {
@@ -1236,9 +1241,9 @@ function bt(e, t) {
1236
1241
  }
1237
1242
  //#endregion
1238
1243
  //#region src/composables/ref/useStorageRef.ts
1239
- var xt = () => y.get("__ui:storage-ref__", () => ({}));
1240
- function St(e, t, n) {
1241
- let r = xt();
1244
+ var bt = () => y.get("__ui:storage-ref__", () => ({}));
1245
+ function xt(e, t, n) {
1246
+ let r = bt();
1242
1247
  if (e in r) return r[e];
1243
1248
  let i = new a(e), o = R(i.get(t, n));
1244
1249
  return q.run(() => {
@@ -1249,12 +1254,12 @@ function St(e, t, n) {
1249
1254
  }
1250
1255
  //#endregion
1251
1256
  //#region src/composables/ref/useTranslateRef.ts
1252
- function Ct(e, t = b.getItem()) {
1257
+ function St(e, t = b.getItem()) {
1253
1258
  let n = z(t.getListSync(e, !0)), r = async () => {
1254
1259
  n.value = { ...await t.getList(e) };
1255
1260
  };
1256
1261
  if (k()) {
1257
- B(Y.getLanguage(), r);
1262
+ B(J.getLanguage(), r);
1258
1263
  for (let e in n.value) if (n.value[e] === e || n.value[e] === " ") {
1259
1264
  r().then();
1260
1265
  break;
@@ -1262,10 +1267,10 @@ function Ct(e, t = b.getItem()) {
1262
1267
  }
1263
1268
  return n;
1264
1269
  }
1265
- var wt = (e) => Ct(e);
1270
+ var Ct = (e) => St(e);
1266
1271
  //#endregion
1267
1272
  //#region src/functions/computedAsync.ts
1268
- function Tt(e, t, n, r) {
1273
+ function wt(e, t, n, r) {
1269
1274
  let i = z(x(t)), a = !0, o = async () => {
1270
1275
  let t = await S(e);
1271
1276
  t !== n && (i.value = t);
@@ -1276,9 +1281,9 @@ function Tt(e, t, n, r) {
1276
1281
  }
1277
1282
  //#endregion
1278
1283
  //#region src/functions/computedByLanguage.ts
1279
- function Et(e, t = () => void 0, n, r) {
1284
+ function Tt(e, t = () => void 0, n, r) {
1280
1285
  return I(() => {
1281
- if (Y.get().value && (n === void 0 || n())) {
1286
+ if (J.get().value && (n === void 0 || n())) {
1282
1287
  let t = e();
1283
1288
  if (t !== void 0) return t;
1284
1289
  }
@@ -1287,7 +1292,7 @@ function Et(e, t = () => void 0, n, r) {
1287
1292
  }
1288
1293
  //#endregion
1289
1294
  //#region src/functions/computedEternity.ts
1290
- function Dt(e, t) {
1295
+ function Et(e, t) {
1291
1296
  return re((n, r) => {
1292
1297
  let i = z(x(t)), a = !1, o = async () => {
1293
1298
  i.value = await S(e), r();
@@ -1308,17 +1313,17 @@ function Dt(e, t) {
1308
1313
  }
1309
1314
  //#endregion
1310
1315
  //#region src/functions/dxtFunctionalPlugin.ts
1311
- var Ot = { install(t, n = {}) {
1312
- if (n.api && e.setConfig(n.api), n.translate && b.setConfig(n.translate), n.location && Y.setValueDefault(n.location), n.icons && m.setConfig(n.icons), n.metaSuffix && _t().setSuffix(n.metaSuffix), n.router) X.set(n.router);
1316
+ var Dt = { install(t, n = {}) {
1317
+ if (n.api && e.setConfig(n.api), n.translate && b.setConfig(n.translate), n.location && J.setValueDefault(n.location), n.icons && m.setConfig(n.icons), n.metaSuffix && gt().setSuffix(n.metaSuffix), n.router) Y.set(n.router);
1313
1318
  else {
1314
1319
  let e = t.config.globalProperties.$router;
1315
- e && X.set(e);
1320
+ e && Y.set(e);
1316
1321
  }
1317
- n.errorCauses && s.addList(n.errorCauses), n.errorHandlers && s.addHandlerList(n.errorHandlers), ht();
1322
+ n.errorCauses && s.addList(n.errorCauses), n.errorHandlers && s.addHandlerList(n.errorHandlers), mt();
1318
1323
  } };
1319
1324
  //#endregion
1320
1325
  //#region src/functions/getInject.ts
1321
- function kt(e) {
1326
+ function Ot(e) {
1322
1327
  if (se()) {
1323
1328
  let t = ce(e);
1324
1329
  if (t) return t;
@@ -1326,24 +1331,24 @@ function kt(e) {
1326
1331
  }
1327
1332
  //#endregion
1328
1333
  //#region src/functions/ref/executeFunctionRef.ts
1329
- function At(e) {
1334
+ function kt(e) {
1330
1335
  return U(x(e));
1331
1336
  }
1332
1337
  //#endregion
1333
1338
  //#region src/functions/render/getBind.ts
1334
- function jt(e, t = {}, n = "value", r = !1) {
1339
+ function At(e, t = {}, n = "value", r = !1) {
1335
1340
  let i = typeof t == "string", a = i ? t : n, o = i ? {} : t;
1336
1341
  return e ? e && M(e) && (a in e || r) ? W(o, e) : W(o, { [a]: e }) : i ? {} : { ...o };
1337
1342
  }
1338
1343
  //#endregion
1339
1344
  //#region src/functions/ref/getBindRef.ts
1340
- function Mt(e, t = {}, n = "value") {
1341
- return I(() => jt(U(e), U(t), n));
1345
+ function jt(e, t = {}, n = "value") {
1346
+ return I(() => At(U(e), U(t), n));
1342
1347
  }
1343
1348
  //#endregion
1344
1349
  //#region src/functions/ref/setRef.ts
1345
- function Nt(e, t) {
1350
+ function Mt(e, t) {
1346
1351
  e.value !== t && (e.value = t);
1347
1352
  }
1348
1353
  //#endregion
1349
- export { Oe as DatetimeRef, be as DesignAbstract, xe as DesignAsyncAbstract, ye as DesignChanged, Ee as DesignComp, G as DesignComponents, De as DesignConstructorAbstract, q as EffectScopeGlobal, ke as EventRef, st as ExecuteUseType, Ae as GeoFlagRef, je as GeoIntlRef, Y as GeoRef, Me as ListDataRef, X as RouterItemRef, Pe as ScrollbarWidthRef, Tt as computedAsync, Et as computedByLanguage, Dt as computedEternity, Ot as dxtFunctionalPlugin, At as executeFunctionRef, $ as executeUse, ft as executeUseGlobal, ht as executeUseGlobalInit, mt as executeUseLocal, pt as executeUseProvide, Fe as getApiErrorRef, jt as getBind, Mt as getBindRef, Se as getClassName, Ce as getIndexForRender, kt as getInject, Ie as getOptions, U as getRef, we as render, Re as setApiRefGlobalConditions, Nt as setRef, wt as t, W as toBind, Te as toBinds, K as toRefItem, ze as useApiAsyncRef, Be as useApiDelete, Ve as useApiGet, Je as useApiManagementAsyncRef, qe as useApiManagementRef, He as useApiPost, Ue as useApiPut, Le as useApiRef, Q as useApiRequest, Xe as useBroadcastValueRef, Qe as useCookieRef, We as useFormattersRef, $e as useGeoIntlRef, tt as useHashRef, at as useLazyItemByMarginRef, nt as useLazyRef, ot as useLoadingRef, _t as useMeta, vt as useRouterList, Ke as useSearchRef, Ge as useSearchValueRef, bt as useSessionRef, St as useStorageRef, Ct as useTranslateRef };
1354
+ export { Oe as DatetimeRef, be as DesignAbstract, xe as DesignAsyncAbstract, ye as DesignChanged, Ee as DesignComp, G as DesignComponents, De as DesignConstructorAbstract, q as EffectScopeGlobal, ke as EventRef, ot as ExecuteUseType, Ae as GeoFlagRef, je as GeoIntlRef, J as GeoRef, Me as ListDataRef, Y as RouterItemRef, Pe as ScrollbarWidthRef, wt as computedAsync, Tt as computedByLanguage, Et as computedEternity, Dt as dxtFunctionalPlugin, kt as executeFunctionRef, $ as executeUse, dt as executeUseGlobal, mt as executeUseGlobalInit, pt as executeUseLocal, ft as executeUseProvide, Fe as getApiErrorRef, At as getBind, jt as getBindRef, Se as getClassName, Ce as getIndexForRender, Ot as getInject, X as getOptions, U as getRef, we as render, Le as setApiRefGlobalConditions, Mt as setRef, Ct as t, W as toBind, Te as toBinds, K as toRefItem, Re as useApiAsyncRef, ze as useApiDelete, Be as useApiGet, qe as useApiManagementAsyncRef, Ke as useApiManagementRef, Ve as useApiPost, He as useApiPut, Ie as useApiRef, Q as useApiRequest, Ye as useBroadcastValueRef, Ze as useCookieRef, Ue as useFormattersRef, Qe as useGeoIntlRef, et as useHashRef, it as useLazyItemByMarginRef, tt as useLazyRef, at as useLoadingRef, gt as useMeta, _t as useRouterList, Ge as useSearchRef, We as useSearchValueRef, yt as useSessionRef, xt as useStorageRef, St as useTranslateRef };
@@ -6,10 +6,6 @@ import { GeoItemFull } from '@dxtmisha/functional-basic';
6
6
  * Реактивный класс для работы с географическими данными.
7
7
  */
8
8
  export declare class GeoRef {
9
- private static readonly country;
10
- private static readonly language;
11
- private static readonly standard;
12
- private static readonly firstDay;
13
9
  /**
14
10
  * Information about the current country.
15
11
  *
@@ -47,6 +43,27 @@ export declare class GeoRef {
47
43
  * реактивная строка, представляющая первый день недели
48
44
  */
49
45
  static getFirstDay(): ComputedRef<string>;
46
+ /**
47
+ * Current location string.
48
+ *
49
+ * Текущее местоположение.
50
+ * @returns reactive string with the current location/ реактивная строка с текущим местоположением
51
+ */
52
+ static getLocation(): ComputedRef<string>;
53
+ /**
54
+ * Current country code from the location.
55
+ *
56
+ * Текущий код страны из местоположения.
57
+ * @returns reactive string with the current country code from location/ реактивная строка с кодом текущей страны из местоположения
58
+ */
59
+ static getLocationCountry(): ComputedRef<string>;
60
+ /**
61
+ * Current language code from the location.
62
+ *
63
+ * Текущий код языка из местоположения.
64
+ * @returns reactive string with the current language code from location/ реактивная строка с кодом текущего языка из местоположения
65
+ */
66
+ static getLocationLanguage(): ComputedRef<string>;
50
67
  /**
51
68
  * Changes the data by the full code.
52
69
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/functional",
3
3
  "private": false,
4
- "version": "1.13.4",
4
+ "version": "1.13.7",
5
5
  "type": "module",
6
6
  "description": "A comprehensive library of utilities, base classes, and Vue 3 composables for reactive web development. Extends @dxtmisha/functional-basic with Composition API.",
7
7
  "keywords": [
@@ -46,10 +46,9 @@
46
46
  },
47
47
  "files": [
48
48
  "dist",
49
- "ai-description.txt",
50
- "ai-doc.ru.txt",
51
- "ai-doc.txt",
52
- "ai-types.txt",
49
+ "ai-description.md",
50
+ "ai-doc.md",
51
+ "ai-types.md",
53
52
  "CHANGELOG.md",
54
53
  "LICENSE",
55
54
  "package.json",
@@ -1,18 +0,0 @@
1
- This library is a collection of Vue 3-based utility classes and composables designed for building complex, reactive, and SSR-ready interfaces. It provides a standardized framework for API management, component state, geographic/localization data, and dynamic rendering.
2
-
3
- 1. Core Purpose:
4
- An infrastructure-level toolkit for Vue 3 that abstracts asynchronous data fetching, state management, and UI rendering logic. It provides structured classes and composables to handle API lifecycle (GET/POST/PUT/DELETE), reactive data transformations, internationalization (Intl), and component orchestration.
5
-
6
- 2. Usage Scenarios:
7
- - API Orchestration: When building complex forms, data tables, or dashboards requiring integrated state, validation (via @effect/schema compatibility), and SSR support. Use `useApiManagementRef` for unified CRUD handling or `useApiRef` for individual requests.
8
- - Reactive Data Management: When you need synchronized data across browser tabs (`useBroadcastValueRef`) or persistence across reloads (`useStorageRef`, `useCookieRef`).
9
- - Localization & Formatting: When the application needs to dynamically handle geographic data, currency formatting, file sizes, or date manipulation via `GeoIntlRef` and `useGeoIntlRef`.
10
- - Component Design System: When building modular UI components that require consistent prop-to-style/class mapping (`DesignConstructorAbstract`, `DesignComponents`).
11
- - Lifecycle & DOM Utilities: When implementing lazy loading (`useLazyRef`) or global state management using `executeUse` for singletons.
12
-
13
- 3. Integration Context:
14
- - Vue 3 Core: Heavily leverages `Ref`, `ComputedRef`, and `provide/inject`.
15
- - Data Fetching: Acts as a high-level wrapper over an underlying `functional-basic` library.
16
- - Routing: Integrates with `vue-router` via `RouterItemRef` and `useRouterList`.
17
- - SSR: Provides specific `Async` variants (e.g., `useApiAsyncRef`) for server-side pre-fetching.
18
- - Schema Validation: Designed to work with `@effect/schema` for robust API contract validation.
package/ai-doc.ru.txt DELETED
@@ -1,45 +0,0 @@
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();`
35
-
36
- ВЫБОР СТРАТЕГИИ executeUse:
37
- 1. `executeUseLocal` (ПРЕДПОЧТИТЕЛЬНО):
38
- - Когда использовать: Для большинства API-запросов и сервисов.
39
- - Особенности: Работает «лениво» (lazy) — инициализируется только в момент первого вызова. Экземпляр сохраняется до конца сессии. Это позволяет не перегружать старт приложения лишними запросами.
40
- 2. `executeUseGlobal`:
41
- - Когда использовать: Когда данные или сервис должны быть загружены/инициализированы СРАЗУ при старте приложения (например: критические настройки, SDK).
42
- - Особенности: Создает один экземпляр на всё приложение. Все глобальные синглтоны инициализируются принудительно через `executeUseGlobalInit()`.
43
- 3. `executeUseProvide`:
44
- - Когда использовать: Для состояния, разделяемого между родителем и группой дочерних компонентов (например: табы, сложные формы с подкомпонентами).
45
- - Особенности: Использует provide/inject. Первый компонент в дереве, вызвавший хук, становится «провайдером», остальные — потребителями.
package/ai-doc.txt DELETED
@@ -1,45 +0,0 @@
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();`
35
-
36
- CHOOSING THE executeUse STRATEGY:
37
- 1. `executeUseLocal` (PREFERRED):
38
- - When to use: For most API requests and services.
39
- - Key Features: Works "lazily" (lazy initialization) — initializes only when first called. The instance persists until the end of the session. This prevents overloading the application start with unnecessary requests.
40
- 2. `executeUseGlobal`:
41
- - When to use: When data or a service must be loaded/initialized IMMEDIATELY at application start (e.g., critical settings, SDKs).
42
- - Key Features: Creates a single instance for the entire application. All global singletons are forcibly initialized via `executeUseGlobalInit()`.
43
- 3. `executeUseProvide`:
44
- - When to use: For state shared between a parent and a group of child components (e.g., tabs, complex forms with sub-components).
45
- - Key Features: Uses provide/inject. The first component in the tree that calls the hook becomes the "provider", others become consumers.