@dxtmisha/functional 1.15.7 → 1.15.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/CHANGELOG.md +7 -0
- package/ai-description.md +6 -6
- package/ai-mcp.json +12 -12
- package/ai-types.md +125 -38
- package/dist/library.js +6 -6
- package/dist/types/listTypes.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.15.8] - 2026-08-05
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **ListRecord**: Refactored `ListRecord<Item extends ListDataBasic>` type definition to `Item[] | Record<string, Item>` for enhanced flexibility with custom item objects and record structures.
|
|
9
|
+
- **package.json**: Expanded package `files` distribution list to include `ai-prompts` and `ai-mcp.json` context definitions.
|
|
10
|
+
- **AI Documentation**: Updated JSDoc prompt rules, added MCP resource definitions (`ai-mcp.json`), and updated package metadata (`ai-description.md`, `ai-types.md`).
|
|
11
|
+
|
|
5
12
|
## [1.15.7] - 2026-08-05
|
|
6
13
|
|
|
7
14
|
### Changed
|
package/ai-description.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
A reactive utility and component architecture library for Vue 3 providing high-level abstract base classes, state management composables, and localized formatting helpers. It standardizes reactive API orchestration, browser storage binding, DOM visibility tracking, internationalization, and design component construction across client and server-rendered environments. Key capabilities are grouped into API and network composables for managing asynchronous HTTP requests, mutation workflows, SSR prefetching, response contract validation, error mappings, and list orchestration; design component base classes for standardized component rendering, dynamic class and style computation, prop change tracking, slot management, and element exposure; localization and formatting utilities for reactive handling of dates, numbers, currency, unit conversions, country flags, dynamic translations, and language-dependent computed properties; persistent storage composables synchronizing state with cookies, web storage, URL query or hash parameters, and cross-tab messaging; list and search helpers for managing reactive data filtering, selection state, text highlighting, debouncing, and router-bound navigation lists; and DOM system utilities for IntersectionObserver lazy visibility tracking, reactive page metadata management, global loading states, scrollbar measurements, and singleton dependency injection. Study ai-types.md when implementing abstract component constructors, defining API validation contracts or error schemas, typing complex list structures and search options, configuring singleton execution scopes, or managing reactive Vue prop and subcomponent bindings. This library integrates natively into Vue 3 and Vue Router applications through a unified global plugin that configures shared API, routing, localization, and metadata services.
|
|
2
2
|
## Mandatory Rules
|
|
3
|
-
Read the corresponding file
|
|
4
|
-
- 'node_modules/@dxtmisha/functional/ai-prompts/api-reference.md':
|
|
5
|
-
- 'node_modules/@dxtmisha/functional/ai-prompts/localization-seo.md': Geographic context,
|
|
6
|
-
- 'node_modules/@dxtmisha/functional/ai-prompts/reactivity-lists.md': Async reactivity
|
|
7
|
-
- 'node_modules/@dxtmisha/functional/ai-prompts/storage-state.md': Reactive composables for
|
|
3
|
+
Read the corresponding file ONLY when working on a task related to (even if not working directly with this package):
|
|
4
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/api-reference.md': Reactive singleton scope initialization and REST API management patterns
|
|
5
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/localization-seo.md': Geographic context, locale-aware formatting, reactive translations, document metadata, and scrollbar width measurement
|
|
6
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/reactivity-lists.md': Async reactivity composables, reactive list models, search filtering, and DOM observer utilities
|
|
7
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/storage-state.md': Reactive composables for browser storage, cookies, cross-tab synchronization, and URL hash state
|
package/ai-mcp.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"uri": "@dxtmisha/functional/ai-types.md",
|
|
4
|
-
"name": "Vue Functional
|
|
4
|
+
"name": "Vue Functional Types (@dxtmisha/functional)",
|
|
5
5
|
"mimeType": "text/markdown",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Type definitions and interface declarations for Vue 3 composables, reactive API abstractions, i18n helpers, design constructors, and utility state managers."
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
"uri": "@dxtmisha/functional/ai-description.md",
|
|
10
|
-
"name": "Vue
|
|
10
|
+
"name": "Vue Utility Architecture (@dxtmisha/functional)",
|
|
11
11
|
"mimeType": "text/markdown",
|
|
12
|
-
"description": "
|
|
12
|
+
"description": "Architectural guidelines and utility reference for Vue 3 applications, covering reactive state management, API orchestration, component base classes, localization, and storage synchronization."
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"uri": "@dxtmisha/functional/ai-prompts/api-reference.md",
|
|
16
|
-
"name": "API Reference",
|
|
16
|
+
"name": "API Reference (@dxtmisha/functional)",
|
|
17
17
|
"mimeType": "text/markdown",
|
|
18
|
-
"description": "
|
|
18
|
+
"description": "Provides guidelines and usage patterns for REST API management and reactive scope-isolated singletons in @dxtmisha/functional."
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"uri": "@dxtmisha/functional/ai-prompts/localization-seo.md",
|
|
22
|
-
"name": "Localization
|
|
22
|
+
"name": "Localization SEO Utilities (@dxtmisha/functional)",
|
|
23
23
|
"mimeType": "text/markdown",
|
|
24
|
-
"description": "
|
|
24
|
+
"description": "Provides reactive utilities and helper functions for locale-aware formatting, translation primitives, geographic context, and dynamic HTML document metadata management."
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"uri": "@dxtmisha/functional/ai-prompts/reactivity-lists.md",
|
|
28
|
-
"name": "Reactivity
|
|
28
|
+
"name": "Reactivity List Utilities (@dxtmisha/functional)",
|
|
29
29
|
"mimeType": "text/markdown",
|
|
30
|
-
"description": "Comprehensive
|
|
30
|
+
"description": "Comprehensive API reference for async reactivity composables, reactive list structures, debounced multi-field search helpers, and lifecycle-managed DOM observers."
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"uri": "@dxtmisha/functional/ai-prompts/storage-state.md",
|
|
34
|
-
"name": "
|
|
34
|
+
"name": "Browser State Composables (@dxtmisha/functional)",
|
|
35
35
|
"mimeType": "text/markdown",
|
|
36
|
-
"description": "
|
|
36
|
+
"description": "Reactive composable wrappers for persistent and synchronized browser state management, including localStorage, sessionStorage, cookies, BroadcastChannel, and URL hash fragments."
|
|
37
37
|
}
|
|
38
38
|
]
|
package/ai-types.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
All these methods are in the @dxtmisha/functional library.
|
|
2
2
|
|
|
3
|
-
import { ComputedRef, Ref, ShallowRef, ToRefs, VNode,
|
|
4
|
-
import {
|
|
3
|
+
import { ComputedRef, Ref, ShallowRef, ToRefs, VNode, VNodeArrayChildren, ComputedGetter, DebuggerOptions, Plugin, PropType } from 'vue';
|
|
4
|
+
import { Datetime, GeoDate, GeoFirstDay, GeoHours, NumberOrStringOrDate, ElementOrString, ElementOrWindow, EventItem, EventListenerDetail, EventOptions, GeoFlag, GeoFlagItem, GeoFlagNational, ItemValue, NumberOrString, GeoItemFull, GeoUnit, ApiInstance, ApiData, ApiDataValidation, ApiErrorStorageList, ApiErrorItem, ApiFetch, FormattersListColumns, FormattersOptionsList, SearchColumns, SearchFormatList, FormattersListProp, FormattersReturn, MetaRobots, Meta, SearchItem, SearchOptions, TranslateInstance, TranslateList, ApiConfig, ErrorCenterCauseList, ErrorCenterHandlerCallback, ErrorCenterHandlerList, IconsConfig, TranslateConfig, ItemList, ApiDefaultValue, ApiMethodItem, Undefined, NumberOrStringOrBoolean, SearchListValue } from '@dxtmisha/functional-basic';
|
|
5
5
|
import { InputSocialIcons } from '@dxtmisha/media';
|
|
6
|
-
import {
|
|
7
|
-
export
|
|
6
|
+
import { RouteLocationRaw, Router, _RouterClassic } from 'vue-router';
|
|
7
|
+
export type RefType<T> = ComputedRef<T> | Ref<T>;
|
|
8
|
+
export type RefUndefined<T> = RefType<T | undefined>;
|
|
9
|
+
export type RefOrNormal<T> = RefType<T> | T;
|
|
10
|
+
export type RefOrNormalOrFunction<T> = RefOrNormal<T> | (() => RefOrNormal<T>);
|
|
11
|
+
export type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
|
|
12
|
+
export type RawSlots = {
|
|
13
|
+
[name: string]: unknown;
|
|
14
|
+
$stable?: boolean;
|
|
15
|
+
};
|
|
8
16
|
export type ApiOptions = ApiMethodItem | RefOrNormal<ApiFetch>;
|
|
9
17
|
export type ApiManagementValue = ApiDefaultValue | ApiDefaultValue[];
|
|
10
18
|
export type ApiManagementGet<Return extends ApiManagementValue, Type extends ApiManagementValue = Return> = {
|
|
@@ -120,15 +128,6 @@ export type ListSelectedItem = NumberOrStringOrBoolean;
|
|
|
120
128
|
export type ListSelectedList = ListSelectedItem | ListSelectedItem[];
|
|
121
129
|
export type ListName = string | number | undefined;
|
|
122
130
|
export type ListNames = ListName[];
|
|
123
|
-
export type RefType<T> = ComputedRef<T> | Ref<T>;
|
|
124
|
-
export type RefUndefined<T> = RefType<T | undefined>;
|
|
125
|
-
export type RefOrNormal<T> = RefType<T> | T;
|
|
126
|
-
export type RefOrNormalOrFunction<T> = RefOrNormal<T> | (() => RefOrNormal<T>);
|
|
127
|
-
export type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
|
|
128
|
-
export type RawSlots = {
|
|
129
|
-
[name: string]: unknown;
|
|
130
|
-
$stable?: boolean;
|
|
131
|
-
};
|
|
132
131
|
export type SearchListValueRef<T extends SearchItem> = RefOrNormal<SearchListValue<T>>;
|
|
133
132
|
export type SearchListInput<T extends SearchItem> = SearchListValueRef<T> | (() => SearchListValueRef<T>);
|
|
134
133
|
export type SearchColumnsRef<T extends SearchItem, K extends SearchColumns<T>> = RefOrNormal<K>;
|
|
@@ -160,6 +159,7 @@ export declare class DesignComponents<COMP extends ConstrComponent, P extends Co
|
|
|
160
159
|
renderAdd<K extends keyof COMP, PK extends keyof P>(item: any[], name: K & string, props?: P[PK] & ConstrItem | ConstrItem, children?: RawChildren | RawSlots, index?: PK & string | string): this;
|
|
161
160
|
}
|
|
162
161
|
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> {
|
|
162
|
+
constructor(name: string, props: Readonly<P>, options?: ConstrOptions<COMP, EMITS, P> | undefined);
|
|
163
163
|
getName(): string;
|
|
164
164
|
getDesign(): string;
|
|
165
165
|
getSubClass(name: string | string[]): string;
|
|
@@ -203,13 +203,6 @@ export declare class GeoFlagRef {
|
|
|
203
203
|
getNational(codes?: RefOrNormal<string[] | undefined>): ComputedRef<GeoFlagNational[]>;
|
|
204
204
|
getNationalLanguage(codes?: RefOrNormal<string[] | undefined>): ComputedRef<GeoFlagNational[]>;
|
|
205
205
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Reactive class for managing the formatting of numbers and dates.
|
|
208
|
-
*
|
|
209
|
-
* @remarks
|
|
210
|
-
* Avoid using this reactive class if reactive updates are not required.
|
|
211
|
-
* For non-reactive formatting, use the standard `GeoIntl` class from `@dxtmisha/functional-basic`.
|
|
212
|
-
*/
|
|
213
206
|
export declare class GeoIntlRef {
|
|
214
207
|
constructor(code?: RefOrNormal<string>);
|
|
215
208
|
display(value?: RefOrNormal<string>, typeOptions?: Intl.DisplayNamesOptions['type'] | Intl.DisplayNamesOptions): ComputedRef<string>;
|
|
@@ -328,13 +321,34 @@ export declare class ScrollbarWidthRef {
|
|
|
328
321
|
}
|
|
329
322
|
/**
|
|
330
323
|
* Asynchronous reactive composable for API requests with built-in SSR support.
|
|
324
|
+
* Wraps `useApiRef` and immediately calls `initSsr()` to ensure data is pre-fetched on the server side.
|
|
325
|
+
* Use this composable ONLY if you need the request to be executed on the server side during SSR.
|
|
326
|
+
* For all other cases, use `useApiRef`.
|
|
331
327
|
*
|
|
332
328
|
* @example
|
|
333
329
|
* ```typescript
|
|
334
330
|
* import { Schema as S } from '@effect/schema'
|
|
335
331
|
* import { useApiAsyncRef } from '@dxtmisha/functional'
|
|
332
|
+
*
|
|
336
333
|
* const userSchema = S.Struct({ id: S.Number, name: S.String })
|
|
337
|
-
*
|
|
334
|
+
*
|
|
335
|
+
* const { data, loading, errorItem, isResponseContractValid } = useApiAsyncRef(
|
|
336
|
+
* '/users/1',
|
|
337
|
+
* { method: 'GET' },
|
|
338
|
+
* true,
|
|
339
|
+
* undefined,
|
|
340
|
+
* undefined,
|
|
341
|
+
* (data) => {
|
|
342
|
+
* try {
|
|
343
|
+
* return { status: 'success', data: S.decodeUnknownSync(userSchema)(data) }
|
|
344
|
+
* } catch (e) {
|
|
345
|
+
* return { status: 'error', errors: e }
|
|
346
|
+
* }
|
|
347
|
+
* },
|
|
348
|
+
* [
|
|
349
|
+
* { status: 404, message: 'User not found' }
|
|
350
|
+
* ]
|
|
351
|
+
* )
|
|
338
352
|
* ```
|
|
339
353
|
*/
|
|
340
354
|
export declare function useApiAsyncRef<R, T = R>(path?: RefOrNormal<string | undefined>, options?: ApiOptions, reactivity?: boolean, conditions?: RefType<boolean>, transformation?: (data: T, isResponseContractValid?: ApiDataValidation) => ApiData<R>, validateResponseContract?: (data: T) => ApiDataValidation, errorContract?: ApiErrorStorageList, unmounted?: boolean, apiInstance?: ApiInstance): UseApiRef<R>;
|
|
@@ -350,6 +364,12 @@ export declare function useApiGet<T, Request extends ApiFetch['request'] = ApiFe
|
|
|
350
364
|
loading: Ref<boolean, boolean>;
|
|
351
365
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
352
366
|
};
|
|
367
|
+
/**
|
|
368
|
+
* Asynchronous reactive composable for API management requests with built-in SSR support.
|
|
369
|
+
* Wraps `useApiManagementRef` and immediately calls `initSsr()` to ensure data is pre-fetched on the server side.
|
|
370
|
+
* Use this composable ONLY if you need the request to be executed on the server side during SSR.
|
|
371
|
+
* For all other cases, use `useApiManagementRef`.
|
|
372
|
+
*/
|
|
353
373
|
export declare function useApiManagementAsyncRef<Return extends ApiManagementValue, FormattersOptions extends FormattersOptionsList, Post extends Record<string, any>, Put extends Record<string, any>, Delete extends Record<string, any>, Type extends ApiManagementValue = Return, Item extends ArrayToItem<Return> = ArrayToItem<Return>, ItemFormatters extends FormattersListColumns<Item, FormattersOptions>[number] = FormattersListColumns<Item, FormattersOptions>[number], Columns extends SearchColumns<ItemFormatters> = []>(propsGet: ApiManagementGet<Return, Type>, formattersOptions?: FormattersOptions, searchOptions?: ApiManagementSearch<Item, Columns>, postRequest?: ApiManagementRequest<Post>, putRequest?: ApiManagementRequest<Put>, deleteRequest?: ApiManagementRequest<Delete>, action?: () => Promise<void> | void, apiInstance?: ApiInstance): {
|
|
354
374
|
isValid: ComputedRef<boolean>;
|
|
355
375
|
isResponseContractValid: ComputedRef<boolean>;
|
|
@@ -378,24 +398,35 @@ export declare function useApiManagementAsyncRef<Return extends ApiManagementVal
|
|
|
378
398
|
};
|
|
379
399
|
/**
|
|
380
400
|
* A powerful composable for comprehensive API request orchestration.
|
|
401
|
+
* It centrally manages data loading (GET), list formatting, client-side searching,
|
|
402
|
+
* and mutations (POST, PUT, DELETE) through a single reactive interface.
|
|
381
403
|
*
|
|
382
|
-
* @note
|
|
383
|
-
*
|
|
404
|
+
* @note This hook is recommended to be used in tandem with `executeUse` for centralized state management.
|
|
405
|
+
* By wrapping `useApiManagementRef` in `executeUseProvide` or `executeUseGlobal`, you can ensure
|
|
406
|
+
* a single source of truth across the component tree or the entire application.
|
|
384
407
|
*
|
|
385
408
|
* @remarks
|
|
386
409
|
* Data formatting guidelines for `formattersOptions`:
|
|
387
|
-
* - Recommended for formatting: Numbers that represent values, dates, currency, units, and statuses.
|
|
410
|
+
* - Recommended for formatting: Numbers that represent values (prices, counts), dates, currency, units, and statuses.
|
|
388
411
|
* - Not recommended for formatting: Technical identifiers such as ID, UUID, account numbers, types, or internal codes.
|
|
389
412
|
*
|
|
390
413
|
* @example
|
|
391
|
-
* ```typescript
|
|
392
414
|
* const products = useApiManagementRef(
|
|
415
|
+
* {
|
|
416
|
+
* path: '/api/v1/products',
|
|
417
|
+
* skeleton: () => Array(5).fill({ id: 0, name: 'Loading...', price: 0 })
|
|
418
|
+
* },
|
|
419
|
+
* {
|
|
420
|
+
* price: (v) => `${v} USD`,
|
|
421
|
+
* created_at: (v) => new Date(v).toLocaleDateString()
|
|
422
|
+
* },
|
|
423
|
+
* {
|
|
424
|
+
* columns: ['name', 'category']
|
|
425
|
+
* },
|
|
393
426
|
* { path: '/api/v1/products' },
|
|
394
|
-
* {
|
|
395
|
-
* {
|
|
396
|
-
* { path: '/api/v1/products' }
|
|
427
|
+
* { path: (data) => `/api/v1/products/${data.id}` },
|
|
428
|
+
* { path: (data) => `/api/v1/products/${data.id}` }
|
|
397
429
|
* );
|
|
398
|
-
* ```
|
|
399
430
|
*/
|
|
400
431
|
export declare function useApiManagementRef<Return extends ApiManagementValue, FormattersOptions extends FormattersOptionsList, Post extends Record<string, any>, Put extends Record<string, any>, Delete extends Record<string, any>, Type extends ApiManagementValue = Return, Item extends ArrayToItem<Return> = ArrayToItem<Return>, ItemFormatters extends FormattersListColumns<Item, FormattersOptions>[number] = FormattersListColumns<Item, FormattersOptions>[number], Columns extends SearchColumns<ItemFormatters> = []>(propsGet: ApiManagementGet<Return, Type>, formattersOptions?: FormattersOptions, searchOptions?: ApiManagementSearch<Item, Columns>, postRequest?: ApiManagementRequest<Post>, putRequest?: ApiManagementRequest<Put>, deleteRequest?: ApiManagementRequest<Delete>, action?: () => Promise<void> | void, apiInstance?: ApiInstance): {
|
|
401
432
|
isValid: ComputedRef<boolean>;
|
|
@@ -457,12 +488,35 @@ export interface UseApiRef<R> {
|
|
|
457
488
|
}
|
|
458
489
|
/**
|
|
459
490
|
* Main reactive composable for working with API requests in Vue.
|
|
491
|
+
* Automatically handles SSR, reactivity, caching, error storage, data validation, and transformation.
|
|
460
492
|
*
|
|
461
493
|
* @example
|
|
462
494
|
* ```typescript
|
|
463
495
|
* import { Schema as S } from '@effect/schema'
|
|
464
496
|
* import { useApiRef } from '@dxtmisha/functional'
|
|
465
|
-
*
|
|
497
|
+
*
|
|
498
|
+
* const userSchema = S.Struct({ id: S.Number, name: S.String })
|
|
499
|
+
*
|
|
500
|
+
* const { data, loading, errorItem, isResponseContractValid } = useApiRef(
|
|
501
|
+
* '/users/1',
|
|
502
|
+
* { method: 'GET' },
|
|
503
|
+
* true,
|
|
504
|
+
* undefined,
|
|
505
|
+
* (data) => ({ ...data, isTransformed: true }),
|
|
506
|
+
* (data) => {
|
|
507
|
+
* try {
|
|
508
|
+
* return { status: 'success', data: S.decodeUnknownSync(userSchema)(data) }
|
|
509
|
+
* } catch (e) {
|
|
510
|
+
* return { status: 'error', errors: e }
|
|
511
|
+
* }
|
|
512
|
+
* },
|
|
513
|
+
* [
|
|
514
|
+
* {
|
|
515
|
+
* status: 404,
|
|
516
|
+
* message: 'User not found'
|
|
517
|
+
* }
|
|
518
|
+
* ]
|
|
519
|
+
* )
|
|
466
520
|
* ```
|
|
467
521
|
*/
|
|
468
522
|
export declare function useApiRef<R, T = R>(path?: RefOrNormal<string | undefined>, options?: ApiOptions, reactivity?: boolean, conditions?: RefType<boolean>, transformation?: (data: T, isResponseContractValid?: ApiDataValidation) => ApiData<R>, validateResponseContract?: (data: T) => ApiDataValidation, errorContract?: ApiErrorStorageList, unmounted?: boolean, apiInstance?: ApiInstance): UseApiRef<R>;
|
|
@@ -597,7 +651,9 @@ export declare function useSearchValueRef<T extends SearchItem, K extends Search
|
|
|
597
651
|
export declare function useSessionRef<T>(name: string, defaultValue?: T | (() => T)): Ref<T | undefined>;
|
|
598
652
|
export declare function useStorageRef<T>(name: string, defaultValue?: T | (() => T), cache?: number): Ref<T | undefined>;
|
|
599
653
|
/**
|
|
600
|
-
* Getting translated text by array of keys or
|
|
654
|
+
* Getting the translated text by an array of keys or a string with a key.
|
|
655
|
+
* Returns a `ShallowRef` that automatically updates when the global language changes.
|
|
656
|
+
* Use `as const` for arrays to ensure proper TypeScript key inference.
|
|
601
657
|
*
|
|
602
658
|
* @example
|
|
603
659
|
* ```typescript
|
|
@@ -608,6 +664,7 @@ export declare function useStorageRef<T>(name: string, defaultValue?: T | (() =>
|
|
|
608
664
|
export declare function useTranslateRef<T extends (string | string[])[]>(names: T, translateInstance?: TranslateInstance): ShallowRef<TranslateList<T>>;
|
|
609
665
|
export declare const t: <T extends string[]>(names: T) => ShallowRef<TranslateList<T>>;
|
|
610
666
|
export declare const uiMakeFlags: () => void;
|
|
667
|
+
export * from '@dxtmisha/functional-basic';
|
|
611
668
|
export declare function computedAsync<R>(getter: (() => Promise<R>) | (() => R) | R, initialState?: (() => R) | R, ignore?: R, debugOptions?: DebuggerOptions): ComputedRef<R | undefined>;
|
|
612
669
|
export declare function computedByLanguage<T, R extends (T | undefined) = T | undefined>(getter: ComputedGetter<R>, getterNone?: R | (() => R), conditions?: () => boolean, debugOptions?: DebuggerOptions): ComputedRef<R>;
|
|
613
670
|
export declare function computedEternity<T>(getter: () => Promise<T> | T, initialState?: (() => T) | T): Ref<T, T>;
|
|
@@ -624,14 +681,21 @@ export interface FunctionalPluginOptions {
|
|
|
624
681
|
errorCallbacks?: ErrorCenterHandlerCallback[];
|
|
625
682
|
}
|
|
626
683
|
/**
|
|
627
|
-
* Vue plugin for initializing global functional services
|
|
684
|
+
* Vue plugin for initializing and configuring global functional services
|
|
685
|
+
* (Api, Translate, Icons, Meta).
|
|
628
686
|
*
|
|
629
687
|
* @example
|
|
630
688
|
* ```typescript
|
|
631
689
|
* import { createApp } from 'vue'
|
|
632
690
|
* import { dxtFunctionalPlugin } from '@dxtmisha/functional'
|
|
691
|
+
* import router from './router'
|
|
692
|
+
*
|
|
633
693
|
* const app = createApp(App)
|
|
634
|
-
* app.use(dxtFunctionalPlugin, {
|
|
694
|
+
* app.use(dxtFunctionalPlugin, {
|
|
695
|
+
* api: { url: 'https://api.example.com' },
|
|
696
|
+
* metaSuffix: ' | My App',
|
|
697
|
+
* router
|
|
698
|
+
* })
|
|
635
699
|
* ```
|
|
636
700
|
*/
|
|
637
701
|
export declare const dxtFunctionalPlugin: Plugin;
|
|
@@ -646,16 +710,28 @@ export type ExecuteUseReturn<R> = Readonly<R & {
|
|
|
646
710
|
}>;
|
|
647
711
|
/**
|
|
648
712
|
* Creates a managed singleton that encapsulates initialization logic and access mode.
|
|
713
|
+
* Supports initialization strategies: 'global', 'provide', 'local'.
|
|
649
714
|
*
|
|
650
715
|
* @remarks
|
|
651
|
-
* Use this function for API services,
|
|
716
|
+
* Use this function for API services, shared reactive states, and singleton resource optimizations.
|
|
652
717
|
*
|
|
653
718
|
* @example
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
719
|
+
* export const useUserApi = executeUseGlobal(() => {
|
|
720
|
+
* return useApiGet('/api/user');
|
|
721
|
+
* });
|
|
722
|
+
*
|
|
723
|
+
* export const useFeatureState = executeUseProvide(() => {
|
|
724
|
+
* const items = [];
|
|
725
|
+
* const addItem = (item) => items.push(item);
|
|
726
|
+
* return { items, addItem };
|
|
727
|
+
* });
|
|
657
728
|
*/
|
|
658
729
|
export declare function executeUse<R, O extends any[], RI extends ExecuteUseReturn<R> = ExecuteUseReturn<R>>(callback: (...args: O) => R, type?: ExecuteUseType): ((...args: O) => RI) | (() => RI);
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Creates a global singleton.
|
|
733
|
+
* @remarks See {@link executeUse} for more details.
|
|
734
|
+
*/
|
|
659
735
|
export declare function executeUseGlobal<R>(callback: () => R): (() => Readonly<R & {
|
|
660
736
|
init(): Readonly<R>;
|
|
661
737
|
destroyExecute?(): void;
|
|
@@ -663,6 +739,11 @@ export declare function executeUseGlobal<R>(callback: () => R): (() => Readonly<
|
|
|
663
739
|
init(): Readonly<R>;
|
|
664
740
|
destroyExecute?(): void;
|
|
665
741
|
}>);
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Creates a component-scoped singleton.
|
|
745
|
+
* @remarks Best for sharing state within a component sub-tree. See {@link executeUse} for more details.
|
|
746
|
+
*/
|
|
666
747
|
export declare function executeUseProvide<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<R & {
|
|
667
748
|
init(): Readonly<R>;
|
|
668
749
|
destroyExecute?(): void;
|
|
@@ -670,6 +751,11 @@ export declare function executeUseProvide<R, O extends any[]>(callback: (...args
|
|
|
670
751
|
init(): Readonly<R>;
|
|
671
752
|
destroyExecute?(): void;
|
|
672
753
|
}>);
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Creates a local singleton.
|
|
757
|
+
* @remarks Best for internal state preservation within a closure. See {@link executeUse} for more details.
|
|
758
|
+
*/
|
|
673
759
|
export declare function executeUseLocal<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<R & {
|
|
674
760
|
init(): Readonly<R>;
|
|
675
761
|
destroyExecute?(): void;
|
|
@@ -677,6 +763,7 @@ export declare function executeUseLocal<R, O extends any[]>(callback: (...args:
|
|
|
677
763
|
init(): Readonly<R>;
|
|
678
764
|
destroyExecute?(): void;
|
|
679
765
|
}>);
|
|
766
|
+
|
|
680
767
|
export declare function executeUseGlobalInit(): void;
|
|
681
768
|
export declare function getInject<T>(name: string): T | undefined;
|
|
682
769
|
export declare const getOptions: (options?: ApiOptions) => RefOrNormal<ApiFetch>;
|
package/dist/library.js
CHANGED
|
@@ -3,7 +3,7 @@ import { computed as F, customRef as oe, effectScope as se, getCurrentInstance a
|
|
|
3
3
|
import { MediaSocial as be } from "@dxtmisha/media";
|
|
4
4
|
export * from "@dxtmisha/functional-basic";
|
|
5
5
|
//#endregion
|
|
6
|
-
//#region \0@oxc-project+runtime@0.
|
|
6
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
|
|
7
7
|
function B(e) {
|
|
8
8
|
"@babel/helpers - typeof";
|
|
9
9
|
return B = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
@@ -13,7 +13,7 @@ function B(e) {
|
|
|
13
13
|
}, B(e);
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
-
//#region \0@oxc-project+runtime@0.
|
|
16
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
|
|
17
17
|
function xe(e, t) {
|
|
18
18
|
if (B(e) != "object" || !e) return e;
|
|
19
19
|
var n = e[Symbol.toPrimitive];
|
|
@@ -25,13 +25,13 @@ function xe(e, t) {
|
|
|
25
25
|
return (t === "string" ? String : Number)(e);
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region \0@oxc-project+runtime@0.
|
|
28
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
|
|
29
29
|
function Se(e) {
|
|
30
30
|
var t = xe(e, "string");
|
|
31
31
|
return B(t) == "symbol" ? t : t + "";
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
//#region \0@oxc-project+runtime@0.
|
|
34
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
|
|
35
35
|
function V(e, t, n) {
|
|
36
36
|
return (t = Se(t)) in e ? Object.defineProperty(e, t, {
|
|
37
37
|
value: n,
|
|
@@ -582,10 +582,10 @@ var Me = class {
|
|
|
582
582
|
return !!e && this.mapItems.value.findIndex((t) => M(t.index, e)) !== -1;
|
|
583
583
|
})), V(this, "isSelectedMin", F(() => {
|
|
584
584
|
let e = Number(H(this.min) || 0);
|
|
585
|
-
return e > 0
|
|
585
|
+
return e > 0 && this.selectedListInGroup.value.length >= e;
|
|
586
586
|
})), V(this, "isSelectedMax", F(() => {
|
|
587
587
|
let e = Number(H(this.max) || 9999999);
|
|
588
|
-
return e > 0
|
|
588
|
+
return e > 0 && this.selectedListInGroup.value.length >= e;
|
|
589
589
|
})), V(this, "selectedList", F(() => {
|
|
590
590
|
let e = this.getSelected();
|
|
591
591
|
return e && this.isSelected.value ? this.mapItems.value.filter((t) => M(t.index, e)) : [];
|
|
@@ -28,7 +28,7 @@ export type ListList<Item extends ListDataBasic = ListDataBasic> = ListDataItem<
|
|
|
28
28
|
* List or record structure for list data/
|
|
29
29
|
* Структура списка или записи для данных списка
|
|
30
30
|
*/
|
|
31
|
-
export type ListRecord<Item extends ListDataBasic = ListDataBasic> =
|
|
31
|
+
export type ListRecord<Item extends ListDataBasic = ListDataBasic> = Item[] | Record<string, Item>;
|
|
32
32
|
/**
|
|
33
33
|
* Extended list item with additional state properties/
|
|
34
34
|
* Расширенный элемент списка с дополнительными свойствами состояния
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/functional",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A comprehensive library of utilities, base classes, and Vue 3 composables for reactive web development — API orchestration, state singletons (executeUse), storage sync, i18n, formatters, and component design. Extends @dxtmisha/functional-basic.",
|
|
7
7
|
"keywords": [
|