@dxtmisha/functional 1.15.5 → 1.15.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 +11 -0
- package/ai-description.md +7 -29
- package/ai-doc.md +5 -39
- package/ai-mcp.json +38 -0
- package/ai-prompts/api-reference.md +25 -0
- package/ai-prompts/localization-seo.md +29 -0
- package/ai-prompts/reactivity-lists.md +34 -0
- package/ai-prompts/storage-state.md +27 -0
- package/ai-types.md +180 -385
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.15.7] - 2026-08-05
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **AI Documentation**: Modularized package documentation and generated `ai-mcp.json` resource definitions alongside updated `ai-description.md` and `ai-types.md`.
|
|
9
|
+
|
|
10
|
+
## [1.15.6] - 2026-07-28
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- **GeoIntlRef & useGeoIntlRef**: Added JSDoc `@remarks` guidelines recommending the use of standard non-reactive `GeoIntl` from `@dxtmisha/functional-basic` when reactivity is not required.
|
|
14
|
+
- **Documentation**: Updated AI documentation context (`ai-description.md`, `ai-types.md`) and package type definitions.
|
|
15
|
+
|
|
5
16
|
## [1.15.5] - 2026-07-25
|
|
6
17
|
|
|
7
18
|
### Added
|
package/ai-description.md
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Singleton State & Execution Control: executeUse, executeUseGlobal, executeUseProvide, executeUseLocal, executeUseGlobalInit. These encapsulate factory initialization into global, component-tree inject/provide, or closure-local singletons.
|
|
10
|
-
|
|
11
|
-
Localization & Formatting Classes and Composables: DatetimeRef, GeoFlagRef, GeoIntlRef, GeoRef, GeoUnitRef, useGeoIntlRef, useGeoUnitRef, useFormattersRef, useTranslateRef, t. These offer reactive locale-aware date/time formatting, unit conversion, flag retrieval, and multi-key translation refs.
|
|
12
|
-
|
|
13
|
-
Data Structures & UI Management: ListDataRef, useRouterList, useSearchRef, useSearchValueRef, useLazyRef, useLazyItemByMarginRef, ScrollbarWidthRef, EventRef, EffectScopeGlobal. These provide reactive list data mapping, search query debounce and highlighting, lazy-loading via IntersectionObserver, scrollbar width tracking, and global effect scopes.
|
|
14
|
-
|
|
15
|
-
State Persistence & Browser Composables: useBroadcastValueRef, useCookieRef, useHashRef, useQueryRef, useSessionRef, useStorageRef, useMeta. These control cross-tab communication, cookies, URL query/hash reactive synchronization, session/local storage, and reactive HTML document metadata.
|
|
16
|
-
|
|
17
|
-
Utility Functions & Plugin: computedAsync, computedByLanguage, computedEternity, getBind, getBindRef, render, toBind, toBinds, dxtFunctionalPlugin.
|
|
18
|
-
|
|
19
|
-
3. TRIGGERS FOR STUDYING AI-TYPES.MD
|
|
20
|
-
Reading ai-types.md is mandatory under any of the following conditions, keywords, or implementation tasks:
|
|
21
|
-
- Extending or sub-classing DesignConstructorAbstract, DesignAbstract, DesignAsyncAbstract, or DesignComponents.
|
|
22
|
-
- Configuring API integrations requiring complex typing, specifically ApiManagementGet, ApiManagementSearch, ApiManagementRequest, or ApiOptions.
|
|
23
|
-
- Utilizing component metadata and binding types, such as ConstrBind, ConstrClasses, ConstrStyles, ConstrOptions, ConstrSetup, ConstrComponentMod, or ConstrProps.
|
|
24
|
-
- Constructing managed singletons using executeUse, executeUseGlobal, executeUseProvide, or executeUseLocal.
|
|
25
|
-
- Typing complex list inputs, search items, and reactive parameters using ListList, ListDataItem, ListDataFull, RefOrNormal, RefType, or RefOrNormalOrFunction.
|
|
26
|
-
- Implementing contract validation functions (validateResponseContract, validateRequestContract) or error contracts (ApiErrorStorageList) with schema validation libraries.
|
|
27
|
-
|
|
28
|
-
4. INTEGRATION CONTEXT
|
|
29
|
-
Initializes as a Vue 3 plugin via dxtFunctionalPlugin. Connects directly with Vue 3 reactivity and rendering APIs (ref, computed, VNode, provide/inject). Wraps base functional logic from @dxtmisha/functional-basic, integrates with vue-router via RouterItemRef, links to @dxtmisha/media for social icons, and supports runtime schema validation (such as @effect/schema) inside API payload contracts.
|
|
1
|
+
This library is a reactive utility and component architecture framework for Vue 3 that standardizes design system component construction, locale-aware data formatting, browser storage state, and API request lifecycle orchestration. It provides abstract component models for computing styles, classes, slots, and properties, alongside wrappers for reactive state synchronization and dynamic component rendering. Design System Architecture components abstractly encapsulate Vue component structures, automating class and style generation, property change detection, slot bindings, and dynamic component rendering. API and Network Management modules manage asynchronous HTTP request lifecycles, server-side prefetching, CRUD mutations, response contract validation, error handling, and unified client-side search or formatting pipelines. Localization and Formatting utilities deliver reactive interfaces for internationalized formatting of dates, currencies, numbers, measurement units, country flag metadata, and dynamic translation lists. Storage and State controls wrap browser local storage, session storage, cookies, broadcast channels, and URL query or hash parameters into reactive references. List and Search utilities provide reactive controllers for hierarchical list filtering, multi-item selection tracking, focus navigation, and debounced text searches. DOM and Lifecycle controls manage intersection observers for lazy loading, document head metadata, scrollbar dimensions, global loading state tracking, and reactive event listeners. Injection and Singleton utilities support managed lifecycle topologies across application, component-subtree, or closure scopes. Studying ai-types.md is mandatory when implementing custom component constructors extending base design abstract classes, defining request or response validation contracts, configuring complex API management options, typing list data inputs and selection states, setting up functional plugin options, or establishing singleton execution topologies. The library integrates directly with Vue 3 reactivity and SSR runtime paradigms, Vue Router navigation mechanisms, and core functional utility packages.
|
|
2
|
+
## Mandatory Rules
|
|
3
|
+
Read the corresponding file if your task relates to:
|
|
4
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/api-reference.md': Scope factory initialization, reactive singletons, and REST API management patterns
|
|
5
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/localization-seo.md': Geographic context, internationalization formatting, translation utilities, HTML metadata management, and scrollbar measurement
|
|
6
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/reactivity-lists.md': Async reactivity helpers, list management, search filtering, and DOM event observers
|
|
7
|
+
- 'node_modules/@dxtmisha/functional/ai-prompts/storage-state.md': Reactive composables for persistent browser storage, cookies, broadcast messaging, and URL hashes
|
package/ai-doc.md
CHANGED
|
@@ -1,42 +1,8 @@
|
|
|
1
1
|
# @dxtmisha/functional Reference
|
|
2
|
-
Vue 3 reactive utilities built on `@dxtmisha/functional-basic`. See `ai-types.md` for full signatures.
|
|
3
|
-
|
|
4
|
-
## Usage Rules & Strategies
|
|
5
|
-
- **Priority**: Always use this package over `@dxtmisha/functional-basic` in Vue.
|
|
6
|
-
- **API/State Singletons**: **NEVER** call `useApi*` / `executeUse*` hooks directly in Vue components. Wrap them in `executeUseGlobal` (startup), `executeUseLocal` (lazy, session scope), or `executeUseProvide` (scoped tree) inside external service files. Components only import and call the resulting hook.
|
|
7
|
-
|
|
8
|
-
```typescript
|
|
9
|
-
import { executeUseLocal, useApiManagementRef, useStorageRef, useSessionRef, useCookieRef, useBroadcastValueRef, useHashRef, GeoRef, useGeoIntlRef, useTranslateRef, useMeta, ScrollbarWidthRef, computedAsync, computedEternity, ListDataRef, useSearchRef, EventRef, useLazyRef } from '@dxtmisha/functional';
|
|
10
|
-
|
|
11
|
-
// 1. API Management
|
|
12
|
-
export const useUsers = executeUseLocal(() => useApiManagementRef(
|
|
13
|
-
{ path: '/api/users' }, { date: (v) => new Date(v).toLocaleString() }, { columns: ['name'] },
|
|
14
|
-
{ path: '/api/users' }, { path: (o) => `/api/users/${o.id}` }, { path: (o) => `/api/users/${o.id}` }
|
|
15
|
-
));
|
|
16
|
-
|
|
17
|
-
// 2. Storage & State
|
|
18
|
-
const theme = useStorageRef<'light' | 'dark'>('theme', 'light');
|
|
19
|
-
const step = useSessionRef<number>('step', 1);
|
|
20
|
-
const token = useCookieRef<string>('auth', '', { secure: true });
|
|
21
|
-
const sync = useBroadcastValueRef<string>('ch', 'idle');
|
|
22
|
-
const page = useHashRef<string>('page', 'home');
|
|
23
2
|
|
|
24
|
-
|
|
25
|
-
const country = GeoRef.getCountry(); const intl = useGeoIntlRef(); intl.currency(150, 'EUR');
|
|
26
|
-
const t = useTranslateRef(['global.save']);
|
|
27
|
-
|
|
28
|
-
// 4. SEO & Layout
|
|
29
|
-
useMeta().setTitle('Page'); const scrollW = new ScrollbarWidthRef().width;
|
|
30
|
-
|
|
31
|
-
// 5. Reactivity Helpers
|
|
32
|
-
const asyncData = computedAsync(async () => fetch(), 'loading...');
|
|
33
|
-
const cached = computedEternity(async () => fetch(), 'loading...');
|
|
34
|
-
|
|
35
|
-
// 6. Lists & Search
|
|
36
|
-
const list = new ListDataRef(items, selectedId); list.isSelected;
|
|
37
|
-
const { listSearch } = useSearchRef(items, ['label'], ref('query'));
|
|
3
|
+
Vue 3 reactive utilities built on `@dxtmisha/functional-basic`. See `ai-types.md` for full signatures.
|
|
38
4
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
5
|
+
## Core Architectural Rules & Strategies
|
|
6
|
+
- **Priority**: Always use `@dxtmisha/functional` reactive composables instead of low-level `@dxtmisha/functional-basic` primitives in Vue 3 applications.
|
|
7
|
+
- **API & State Singletons**: **NEVER** call `useApi*` / `executeUse*` hooks directly in Vue components (`<script setup>`). Wrap them in `executeUseGlobal` (startup), `executeUseLocal` (lazy, session scope), or `executeUseProvide` (scoped tree) inside external service files. Components only import and call the resulting hook.
|
|
8
|
+
- **Purity & Atomicity**: Keep Vue components minimal. Extract all reactive state management, network orchestration, and side effects into external composables.
|
package/ai-mcp.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"uri": "@dxtmisha/functional/ai-types.md",
|
|
4
|
+
"name": "Vue Functional Reference",
|
|
5
|
+
"mimeType": "text/markdown",
|
|
6
|
+
"description": "TypeScript type definitions and composable API specifications for Vue application state management, data formatting, localization, and API request handling."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"uri": "@dxtmisha/functional/ai-description.md",
|
|
10
|
+
"name": "Vue Framework Architecture",
|
|
11
|
+
"mimeType": "text/markdown",
|
|
12
|
+
"description": "Comprehensive architectural conventions and guidelines for a Vue 3 reactive utility framework, covering component construction, API lifecycle management, localization, and persistent state controls."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"uri": "@dxtmisha/functional/ai-prompts/api-reference.md",
|
|
16
|
+
"name": "API Reference",
|
|
17
|
+
"mimeType": "text/markdown",
|
|
18
|
+
"description": "Defines architectural patterns and usage guidelines for REST API management and scope-isolated reactive singletons within @dxtmisha/functional. Details scope factory initialization alongside reactive CRUD operations with client-side caching and contract validation."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"uri": "@dxtmisha/functional/ai-prompts/localization-seo.md",
|
|
22
|
+
"name": "Localization and SEO",
|
|
23
|
+
"mimeType": "text/markdown",
|
|
24
|
+
"description": "Covers locale-aware formatting, multi-key translations, geographic context management, and reactive HTML document metadata handling for SEO optimization."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"uri": "@dxtmisha/functional/ai-prompts/reactivity-lists.md",
|
|
28
|
+
"name": "Reactivity and Lists",
|
|
29
|
+
"mimeType": "text/markdown",
|
|
30
|
+
"description": "Comprehensive guide to advanced asynchronous reactivity composables, list data models, multi-field search filtering, and DOM observer utilities."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"uri": "@dxtmisha/functional/ai-prompts/storage-state.md",
|
|
34
|
+
"name": "Reactive Browser State",
|
|
35
|
+
"mimeType": "text/markdown",
|
|
36
|
+
"description": "API reference and usage examples for reactive composables managing persistent browser state and cross-tab synchronization. Covers localStorage, sessionStorage, cookies, BroadcastChannel, and URL hash state."
|
|
37
|
+
}
|
|
38
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# API Management & Reactive Singletons
|
|
2
|
+
|
|
3
|
+
Guidance and usage patterns for REST API management and scope-isolated singleton factories in `@dxtmisha/functional`.
|
|
4
|
+
|
|
5
|
+
## 1. Scope Factory Initialization (`executeUse*`)
|
|
6
|
+
- **`executeUseGlobal`**: Initializes a global singleton instance at application startup (shared across the entire application).
|
|
7
|
+
- **`executeUseLocal`**: Lazily creates a session-scoped or closure-local instance upon first invocation.
|
|
8
|
+
- **`executeUseProvide`**: Scope-bound singleton bound to a specific component subtree via Vue `provide` / `inject`.
|
|
9
|
+
|
|
10
|
+
## 2. API Management (`useApiManagementRef`)
|
|
11
|
+
Handles REST CRUD operations with built-in reactivity, client-side caching, filtering, and contract validation.
|
|
12
|
+
|
|
13
|
+
### Example
|
|
14
|
+
```typescript
|
|
15
|
+
import { executeUseLocal, useApiManagementRef } from '@dxtmisha/functional';
|
|
16
|
+
|
|
17
|
+
export const useUsers = executeUseLocal(() => useApiManagementRef(
|
|
18
|
+
{ path: '/api/users' },
|
|
19
|
+
{ date: (v: string) => new Date(v).toLocaleString() },
|
|
20
|
+
{ columns: ['name', 'email'] },
|
|
21
|
+
{ path: '/api/users' },
|
|
22
|
+
{ path: (o) => `/api/users/${o.id}` },
|
|
23
|
+
{ path: (o) => `/api/users/${o.id}` }
|
|
24
|
+
));
|
|
25
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Localization, Geo & SEO Management
|
|
2
|
+
|
|
3
|
+
Locale-aware formatting, translation primitives, and reactive HTML document metadata handling.
|
|
4
|
+
|
|
5
|
+
## Available Utilities
|
|
6
|
+
- **`GeoRef`**: Access country information and geographic context (`GeoRef.getCountry()`).
|
|
7
|
+
- **`useGeoIntlRef()`**: Reactive internationalization helper for currency, numbers, and dates.
|
|
8
|
+
- **`useTranslateRef(keys)`**: Multi-key reactive translation resolver.
|
|
9
|
+
- **`useMeta()`**: Reactive manager for HTML document title, meta tags, and open graph social tags.
|
|
10
|
+
- **`ScrollbarWidthRef`**: Helper to measure dynamic scrollbar width for fixed overlay calculations.
|
|
11
|
+
|
|
12
|
+
### Example
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
GeoRef,
|
|
16
|
+
useGeoIntlRef,
|
|
17
|
+
useTranslateRef,
|
|
18
|
+
useMeta,
|
|
19
|
+
ScrollbarWidthRef
|
|
20
|
+
} from '@dxtmisha/functional';
|
|
21
|
+
|
|
22
|
+
const country = GeoRef.getCountry();
|
|
23
|
+
const intl = useGeoIntlRef();
|
|
24
|
+
intl.currency(150, 'EUR');
|
|
25
|
+
|
|
26
|
+
const t = useTranslateRef(['global.save']);
|
|
27
|
+
useMeta().setTitle('User Dashboard');
|
|
28
|
+
const scrollW = new ScrollbarWidthRef().width;
|
|
29
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Reactivity Helpers, Lists & DOM Utilities
|
|
2
|
+
|
|
3
|
+
Advanced async reactivity, list data models, search filters, and DOM observers.
|
|
4
|
+
|
|
5
|
+
## Available Composables & Classes
|
|
6
|
+
- **`computedAsync(evaluator, defaultVal)`**: Asynchronous computed reference for promise resolution.
|
|
7
|
+
- **`computedEternity(evaluator, defaultVal)`**: Cached asynchronous computed ref that preserves state across re-evaluations.
|
|
8
|
+
- **`ListDataRef(items, selectedId)`**: Reactive list structure supporting selection state management.
|
|
9
|
+
- **`useSearchRef(items, fields, queryRef)`**: Debounced multi-field search and highlighting composable.
|
|
10
|
+
- **`EventRef(target, element, event, callback)`**: Managed DOM event listener with automatic lifecycle cleanup.
|
|
11
|
+
- **`useLazyRef()`**: IntersectionObserver helper for lazy rendering and dynamic element loading.
|
|
12
|
+
|
|
13
|
+
### Example
|
|
14
|
+
```typescript
|
|
15
|
+
import { ref } from 'vue';
|
|
16
|
+
import {
|
|
17
|
+
computedAsync,
|
|
18
|
+
computedEternity,
|
|
19
|
+
ListDataRef,
|
|
20
|
+
useSearchRef,
|
|
21
|
+
EventRef,
|
|
22
|
+
useLazyRef
|
|
23
|
+
} from '@dxtmisha/functional';
|
|
24
|
+
|
|
25
|
+
const asyncData = computedAsync(async () => fetch('/api/data').then(r => r.json()), 'loading...');
|
|
26
|
+
const cachedData = computedEternity(async () => fetch('/api/cached').then(r => r.json()), 'loading...');
|
|
27
|
+
|
|
28
|
+
const list = new ListDataRef(items, selectedId);
|
|
29
|
+
const query = ref('');
|
|
30
|
+
const { listSearch } = useSearchRef(items, ['name', 'description'], query);
|
|
31
|
+
|
|
32
|
+
const listener = new EventRef(window, window, 'keydown', (e) => console.log(e.key));
|
|
33
|
+
const lazy = useLazyRef();
|
|
34
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Reactive Storage & Browser State
|
|
2
|
+
|
|
3
|
+
Composable wrappers for persistent and synchronized browser state management.
|
|
4
|
+
|
|
5
|
+
## Available Composables
|
|
6
|
+
- **`useStorageRef<T>(key, defaultVal)`**: Reactive `localStorage` wrapper with cross-tab synchronization.
|
|
7
|
+
- **`useSessionRef<T>(key, defaultVal)`**: Reactive `sessionStorage` wrapper for session-scoped data.
|
|
8
|
+
- **`useCookieRef<T>(key, defaultVal, options)`**: SSR-safe reactive cookie state wrapper.
|
|
9
|
+
- **`useBroadcastValueRef<T>(channel, defaultVal)`**: Reactive cross-tab broadcast messaging using `BroadcastChannel`.
|
|
10
|
+
- **`useHashRef<T>(key, defaultVal)`**: Reactive synchronization with URL hash fragments.
|
|
11
|
+
|
|
12
|
+
### Example
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
useStorageRef,
|
|
16
|
+
useSessionRef,
|
|
17
|
+
useCookieRef,
|
|
18
|
+
useBroadcastValueRef,
|
|
19
|
+
useHashRef
|
|
20
|
+
} from '@dxtmisha/functional';
|
|
21
|
+
|
|
22
|
+
const theme = useStorageRef<'light' | 'dark'>('theme', 'light');
|
|
23
|
+
const step = useSessionRef<number>('step', 1);
|
|
24
|
+
const token = useCookieRef<string>('auth', '', { secure: true });
|
|
25
|
+
const sync = useBroadcastValueRef<string>('ch', 'idle');
|
|
26
|
+
const page = useHashRef<string>('page', 'home');
|
|
27
|
+
```
|
package/ai-types.md
CHANGED
|
@@ -1,20 +1,138 @@
|
|
|
1
1
|
1) All these methods are in the @dxtmisha/functional library.
|
|
2
|
-
2) Everything that is exported can be used.
|
|
3
|
-
3) Use what is in this library if it exists; do not use other libraries if there is an analogue here. Do not create new ones if an analogue already exists here.
|
|
4
|
-
|
|
5
|
-
The following is the content of "exports" from package.json:
|
|
6
|
-
{
|
|
7
|
-
".": {
|
|
8
|
-
"import": "./dist/library.js",
|
|
9
|
-
"types": "./dist/library.d.ts"
|
|
10
|
-
},
|
|
11
|
-
"./flags": {
|
|
12
|
-
"import": "./dist/flags.js",
|
|
13
|
-
"types": "./dist/flags.d.ts"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
2
|
|
|
3
|
+
import { ComputedRef, Ref, ShallowRef, ToRefs, VNode, DebuggerOptions, ComputedGetter, PropType, VNodeArrayChildren, Plugin } from 'vue';
|
|
4
|
+
import { RouteLocationRaw, Router, _RouterClassic } from 'vue-router';
|
|
5
|
+
import { InputSocialIcons } from '@dxtmisha/media';
|
|
6
|
+
import { Datetime, GeoDate, GeoFirstDay, GeoHours, NumberOrStringOrDate, ElementOrString, ElementOrWindow, EventItem, EventListenerDetail, EventOptions, GeoFlag, GeoFlagItem, GeoFlagNational, ItemValue, NumberOrString, GeoItemFull, GeoUnit, ApiInstance, ApiData, ApiDataValidation, ApiErrorStorageList, ApiFetch, ArrayToItem, FormattersListColumns, FormattersOptionsList, SearchColumns, SearchFormatList, ApiErrorItem, FormattersListProp, FormattersReturn, MetaRobots, Meta, SearchItem, SearchOptions, TranslateInstance, TranslateList, ApiConfig, ErrorCenterCauseList, ErrorCenterHandlerCallback, ErrorCenterHandlerList, IconsConfig, TranslateConfig, Undefined, NumberOrStringOrBoolean, ApiDefaultValue, SearchListValue, ItemList, ApiMethodItem } from '@dxtmisha/functional-basic';
|
|
17
7
|
export * from '@dxtmisha/functional-basic';
|
|
8
|
+
export type ApiOptions = ApiMethodItem | RefOrNormal<ApiFetch>;
|
|
9
|
+
export type ApiManagementValue = ApiDefaultValue | ApiDefaultValue[];
|
|
10
|
+
export type ApiManagementGet<Return extends ApiManagementValue, Type extends ApiManagementValue = Return> = {
|
|
11
|
+
path?: RefOrNormal<string | undefined>;
|
|
12
|
+
options?: ApiOptions;
|
|
13
|
+
reactivity?: boolean;
|
|
14
|
+
conditions?: RefType<boolean>;
|
|
15
|
+
transformation?: (data: Type, isResponseContractValid?: ApiDataValidation) => ApiData<Return>;
|
|
16
|
+
validateResponseContract?: (data: Type) => ApiDataValidation;
|
|
17
|
+
errorContract?: ApiErrorStorageList;
|
|
18
|
+
typeData?: ((data: Return) => boolean) | any;
|
|
19
|
+
unmounted?: boolean;
|
|
20
|
+
skeleton?: () => Return;
|
|
21
|
+
};
|
|
22
|
+
export type ApiManagementSearch<T extends SearchItem, K extends SearchColumns<T>> = {
|
|
23
|
+
columns: K;
|
|
24
|
+
value?: Ref<string>;
|
|
25
|
+
options?: SearchOptions;
|
|
26
|
+
};
|
|
27
|
+
export type ApiManagementRequest<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> = {
|
|
28
|
+
path?: RefOrNormal<string | undefined>;
|
|
29
|
+
action?: (data: Return | undefined) => Promise<void> | void;
|
|
30
|
+
transformation?: (data: T) => Return;
|
|
31
|
+
validateRequestContract?: (data: Request) => ApiDataValidation & Return;
|
|
32
|
+
validateResponseContract?: (data: T) => ApiDataValidation & Return;
|
|
33
|
+
errorContract?: ApiErrorStorageList;
|
|
34
|
+
toData?: boolean;
|
|
35
|
+
options?: ApiOptions;
|
|
36
|
+
};
|
|
37
|
+
export type ConstrItem = Record<string, any>;
|
|
38
|
+
export type ConstrValue<T = any> = {
|
|
39
|
+
value?: T;
|
|
40
|
+
};
|
|
41
|
+
export type ConstrComponent = Record<string, any>;
|
|
42
|
+
export type ConstrComponentMod<P extends ConstrItem> = ConstrItem | {
|
|
43
|
+
[K in keyof P]?: RefOrNormal<P[K]>;
|
|
44
|
+
};
|
|
45
|
+
export type ConstrExpose<E extends Element, EXPOSE extends ConstrItem> = EXPOSE & {
|
|
46
|
+
elementHtml?: ComputedRef<E | undefined>;
|
|
47
|
+
};
|
|
48
|
+
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
49
|
+
export type ConstrEmitItem<T extends ConstrItem> = T[keyof T];
|
|
50
|
+
export type ConstrEmit<T extends ConstrItem = ConstrItem> = UnionToIntersection<ConstrEmitItem<{
|
|
51
|
+
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
52
|
+
}>>;
|
|
53
|
+
export type ConstrClassObject = Record<string, boolean | undefined>;
|
|
54
|
+
export type ConstrClass = string | (string | ConstrClass | Undefined)[] | ConstrClassObject;
|
|
55
|
+
export type ConstrClassList = Record<string, ConstrClass>;
|
|
56
|
+
export type ConstrClasses = {
|
|
57
|
+
main: ConstrClass;
|
|
58
|
+
} & ConstrClassList;
|
|
59
|
+
export type ConstrStylesItem = string | null;
|
|
60
|
+
export type ConstrStyles = Record<string, ConstrStylesItem> | ConstrStyles[];
|
|
61
|
+
export type ConstrOptions<COMP extends ConstrComponent, EMITS extends ConstrItem, P extends ConstrItem> = {
|
|
62
|
+
components?: COMP;
|
|
63
|
+
compMod?: ConstrComponentMod<P>;
|
|
64
|
+
emits?: ConstrEmit<EMITS>;
|
|
65
|
+
classes?: RefType<ConstrClasses>;
|
|
66
|
+
styles?: RefType<ConstrStyles>;
|
|
67
|
+
};
|
|
68
|
+
export type ConstrSetup<E extends Element, CLASSES extends ConstrClasses, SETUP extends ConstrItem> = {
|
|
69
|
+
name: string;
|
|
70
|
+
element: Ref<E | undefined>;
|
|
71
|
+
classes: RefType<CLASSES>;
|
|
72
|
+
styles: RefType<ConstrStyles>;
|
|
73
|
+
} & SETUP;
|
|
74
|
+
export type ConstrRegistration = {
|
|
75
|
+
flag?: boolean;
|
|
76
|
+
translate?: Record<string, string>;
|
|
77
|
+
};
|
|
78
|
+
export type ConstrBind<T> = T & Record<string, any> & {
|
|
79
|
+
key?: string;
|
|
80
|
+
class?: ConstrClass;
|
|
81
|
+
style?: ConstrStyles;
|
|
82
|
+
};
|
|
83
|
+
export type ConstrPropItemOptions<T = any> = {
|
|
84
|
+
type?: PropType<T>;
|
|
85
|
+
required?: boolean;
|
|
86
|
+
default?: any;
|
|
87
|
+
validator?(value: any, props: any): boolean;
|
|
88
|
+
};
|
|
89
|
+
export type ConstrPropItem<T = any> = ConstrPropItemOptions<T> | PropType<T>;
|
|
90
|
+
export type ConstrProps<P = Record<string, any>> = {
|
|
91
|
+
[K in keyof P]: ConstrPropItem<P[K]>;
|
|
92
|
+
};
|
|
93
|
+
export type ConstrHrefProps = {
|
|
94
|
+
href?: string;
|
|
95
|
+
};
|
|
96
|
+
export type ListType = 'item' | 'space' | 'line' | 'subtitle' | 'html' | 'menu' | 'menu-group' | 'group';
|
|
97
|
+
export type ListDataBasic = {
|
|
98
|
+
label?: NumberOrString;
|
|
99
|
+
value?: any;
|
|
100
|
+
search?: string;
|
|
101
|
+
};
|
|
102
|
+
export type ListDataItem<Item extends ListDataBasic = ListDataBasic> = ConstrBind<Item & {
|
|
103
|
+
parent?: string;
|
|
104
|
+
type: ListType;
|
|
105
|
+
index: string;
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
export type ListList<Item extends ListDataBasic = ListDataBasic> = ListDataItem<Item>[];
|
|
109
|
+
export type ListRecord<Item extends ListDataBasic = ListDataBasic> = ListList<Item> | Record<string, any>;
|
|
110
|
+
export type ListDataFullItem<Item extends ListDataBasic = ListDataBasic> = ListDataItem<Item> & {
|
|
111
|
+
focus: boolean;
|
|
112
|
+
highlight?: string;
|
|
113
|
+
selected: boolean;
|
|
114
|
+
disabled?: boolean;
|
|
115
|
+
};
|
|
116
|
+
export type ListDataFull<Item extends ListDataBasic = ListDataBasic> = ListDataFullItem<Item>[];
|
|
117
|
+
export type ListListInputItem<Item extends ListDataBasic = ListDataBasic> = ConstrBind<Item>;
|
|
118
|
+
export type ListListInput<Item extends ListDataBasic = ListDataBasic> = ListListInputItem<Item>[] | string[] | Record<string, ListListInputItem<Item>> | Record<string, string>;
|
|
119
|
+
export type ListSelectedItem = NumberOrStringOrBoolean;
|
|
120
|
+
export type ListSelectedList = ListSelectedItem | ListSelectedItem[];
|
|
121
|
+
export type ListName = string | number | undefined;
|
|
122
|
+
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
|
+
export type SearchListValueRef<T extends SearchItem> = RefOrNormal<SearchListValue<T>>;
|
|
133
|
+
export type SearchListInput<T extends SearchItem> = SearchListValueRef<T> | (() => SearchListValueRef<T>);
|
|
134
|
+
export type SearchColumnsRef<T extends SearchItem, K extends SearchColumns<T>> = RefOrNormal<K>;
|
|
135
|
+
export type SearchColumnsInput<T extends SearchItem, K extends SearchColumns<T>> = SearchColumnsRef<T, K> | (() => SearchColumnsRef<T, K>);
|
|
18
136
|
export declare abstract class DesignAbstract<T extends Record<string, any>, C extends Record<string, any>> {
|
|
19
137
|
constructor(props: T, callback?: ((event: C) => void) | undefined, changed?: string[]);
|
|
20
138
|
make(compelled?: boolean): this;
|
|
@@ -30,7 +148,8 @@ export declare class DesignChanged<T extends Record<string, any>> {
|
|
|
30
148
|
isChanged(): boolean;
|
|
31
149
|
update(): void;
|
|
32
150
|
}
|
|
33
|
-
export declare class DesignComp<COMP extends ConstrComponent, P extends ConstrItem> extends DesignComponents<COMP, P> {
|
|
151
|
+
export declare class DesignComp<COMP extends ConstrComponent, P extends ConstrItem> extends DesignComponents<COMP, P> {
|
|
152
|
+
}
|
|
34
153
|
export declare class DesignComponents<COMP extends ConstrComponent, P extends ConstrItem> {
|
|
35
154
|
constructor(components?: COMP, modification?: ConstrComponentMod<P> | undefined);
|
|
36
155
|
is<K extends keyof COMP>(name: K): name is K;
|
|
@@ -84,6 +203,13 @@ export declare class GeoFlagRef {
|
|
|
84
203
|
getNational(codes?: RefOrNormal<string[] | undefined>): ComputedRef<GeoFlagNational[]>;
|
|
85
204
|
getNationalLanguage(codes?: RefOrNormal<string[] | undefined>): ComputedRef<GeoFlagNational[]>;
|
|
86
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
|
+
*/
|
|
87
213
|
export declare class GeoIntlRef {
|
|
88
214
|
constructor(code?: RefOrNormal<string>);
|
|
89
215
|
display(value?: RefOrNormal<string>, typeOptions?: Intl.DisplayNamesOptions['type'] | Intl.DisplayNamesOptions): ComputedRef<string>;
|
|
@@ -202,60 +328,24 @@ export declare class ScrollbarWidthRef {
|
|
|
202
328
|
}
|
|
203
329
|
/**
|
|
204
330
|
* Asynchronous reactive composable for API requests with built-in SSR support.
|
|
205
|
-
* Wraps `useApiRef` and immediately calls `initSsr()` to ensure data is pre-fetched on the server side.
|
|
206
|
-
* Use this composable ONLY if you need the request to be executed on the server side during SSR.
|
|
207
|
-
* For all other cases, use `useApiRef`.
|
|
208
331
|
*
|
|
209
332
|
* @example
|
|
210
333
|
* ```typescript
|
|
211
334
|
* import { Schema as S } from '@effect/schema'
|
|
212
335
|
* import { useApiAsyncRef } from '@dxtmisha/functional'
|
|
213
|
-
*
|
|
214
336
|
* const userSchema = S.Struct({ id: S.Number, name: S.String })
|
|
215
|
-
*
|
|
216
|
-
* // Data will be pre-fetched on the server during SSR (onServerPrefetch)
|
|
217
|
-
* const { data, loading, errorItem, isResponseContractValid } = useApiAsyncRef(
|
|
218
|
-
* '/users/1',
|
|
219
|
-
* { method: 'GET' },
|
|
220
|
-
* true, // reactivity
|
|
221
|
-
* undefined, // conditions
|
|
222
|
-
* undefined, // transformation
|
|
223
|
-
* (data) => { // validateResponseContract
|
|
224
|
-
* try {
|
|
225
|
-
* return { status: 'success', data: S.decodeUnknownSync(userSchema)(data) }
|
|
226
|
-
* } catch (e) {
|
|
227
|
-
* return { status: 'error', errors: e }
|
|
228
|
-
* }
|
|
229
|
-
* },
|
|
230
|
-
* [ // errorContract
|
|
231
|
-
* { status: 404, message: 'User not found' }
|
|
232
|
-
* ]
|
|
233
|
-
* )
|
|
337
|
+
* const { data, loading, errorItem } = useApiAsyncRef('/users/1')
|
|
234
338
|
* ```
|
|
235
|
-
*
|
|
236
|
-
* @param path path to request (can be a Ref or Getter)
|
|
237
|
-
* @param options data for the request (headers, method, etc.)
|
|
238
|
-
* @param reactivity should reactivity be enabled (automatically re-fetch on deps change)
|
|
239
|
-
* @param conditions conditions for executing the request (request will wait until true)
|
|
240
|
-
* @param transformation transforms the received response data
|
|
241
|
-
* @param validateResponseContract function to validate response data contract. Used to ensure that the API
|
|
242
|
-
* response matches the expected structure. Highly recommended to use with `@effect/schema`.
|
|
243
|
-
* It should return `ApiDataValidation` containing a `status` ('success' or 'error')
|
|
244
|
-
* and the parsed data or errors.
|
|
245
|
-
* @param errorContract array of expected error contracts for the request (`ApiErrorStorageList`).
|
|
246
|
-
* Highly recommended to add if there is information about possible request errors. Allows you to predefine
|
|
247
|
-
* possible errors (by code, status, or custom validation). If an error occurs matching one of these contracts,
|
|
248
|
-
* it will be automatically processed and made available via the `errorItem` computed property.
|
|
249
|
-
* @param unmounted whether to stop the request and clear data from cache when component is unmounted
|
|
250
|
-
* @param apiInstance Api instance (defaults to global Api instance)
|
|
251
339
|
*/
|
|
252
340
|
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>;
|
|
253
|
-
export interface UseApiDeleteSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
341
|
+
export interface UseApiDeleteSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
342
|
+
}
|
|
254
343
|
export declare function useApiDelete<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiDeleteSetup<T, Request, Return>): {
|
|
255
344
|
loading: Ref<boolean, boolean>;
|
|
256
345
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
257
346
|
};
|
|
258
|
-
export interface UseApiGetSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
347
|
+
export interface UseApiGetSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
348
|
+
}
|
|
259
349
|
export declare function useApiGet<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiGetSetup<T, Request, Return>): {
|
|
260
350
|
loading: Ref<boolean, boolean>;
|
|
261
351
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
@@ -288,63 +378,24 @@ export declare function useApiManagementAsyncRef<Return extends ApiManagementVal
|
|
|
288
378
|
};
|
|
289
379
|
/**
|
|
290
380
|
* A powerful composable for comprehensive API request orchestration.
|
|
291
|
-
* It centrally manages data loading (GET), list formatting, client-side searching,
|
|
292
|
-
* and mutations (POST, PUT, DELETE) through a single reactive interface.
|
|
293
|
-
*
|
|
294
|
-
* @template Return type of data returned by the API
|
|
295
|
-
* @template FormattersOptions optional formatting rules
|
|
296
|
-
* @template Post data type for POST creation request
|
|
297
|
-
* @template Put data type for PUT update request
|
|
298
|
-
* @template Delete data type for DELETE removal request
|
|
299
|
-
* @template Type original data type (before transformation)
|
|
300
|
-
* @template Item type of a single item in the data list
|
|
301
|
-
* @template ItemFormatters item type after formatters are applied
|
|
302
|
-
* @template Columns search columns derived from formatting
|
|
303
381
|
*
|
|
304
|
-
* @
|
|
305
|
-
*
|
|
306
|
-
* @param searchOptions optional client-side search settings
|
|
307
|
-
* @param postRequest optional POST mutation settings
|
|
308
|
-
* @param putRequest optional PUT mutation settings
|
|
309
|
-
* @param deleteRequest optional DELETE mutation settings
|
|
310
|
-
* @param action common callback executed after any successful mutation
|
|
311
|
-
* @param apiInstance API instance for requests (defaults to Api.getItem())
|
|
312
|
-
*
|
|
313
|
-
* @returns reactive API management interface
|
|
314
|
-
*
|
|
315
|
-
* @note This hook is recommended to be used in tandem with `executeUse` for centralized state management.
|
|
316
|
-
* By wrapping `useApiManagementRef` in `executeUseProvide` or `executeUseGlobal`, you can ensure
|
|
317
|
-
* a single source of truth across the component tree or the entire application.
|
|
382
|
+
* @note
|
|
383
|
+
* This hook is recommended to be used in tandem with `executeUse` for centralized state management.
|
|
318
384
|
*
|
|
319
385
|
* @remarks
|
|
320
386
|
* Data formatting guidelines for `formattersOptions`:
|
|
321
|
-
* -
|
|
322
|
-
* -
|
|
387
|
+
* - Recommended for formatting: Numbers that represent values, dates, currency, units, and statuses.
|
|
388
|
+
* - Not recommended for formatting: Technical identifiers such as ID, UUID, account numbers, types, or internal codes.
|
|
323
389
|
*
|
|
324
390
|
* @example
|
|
325
|
-
*
|
|
391
|
+
* ```typescript
|
|
326
392
|
* const products = useApiManagementRef(
|
|
327
|
-
* {
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
* }
|
|
331
|
-
* {
|
|
332
|
-
* // Formatters for display
|
|
333
|
-
* price: (v) => `${v} USD`,
|
|
334
|
-
* created_at: (v) => new Date(v).toLocaleDateString()
|
|
335
|
-
* },
|
|
336
|
-
* {
|
|
337
|
-
* // Client-side search setup
|
|
338
|
-
* columns: ['name', 'category']
|
|
339
|
-
* },
|
|
340
|
-
* { path: '/api/v1/products' }, // POST (create)
|
|
341
|
-
* { path: (data) => `/api/v1/products/${data.id}` }, // PUT (update)
|
|
342
|
-
* { path: (data) => `/api/v1/products/${data.id}` } // DELETE (remove)
|
|
393
|
+
* { path: '/api/v1/products' },
|
|
394
|
+
* { price: (v) => `${v} USD` },
|
|
395
|
+
* { columns: ['name', 'category'] },
|
|
396
|
+
* { path: '/api/v1/products' }
|
|
343
397
|
* );
|
|
344
|
-
*
|
|
345
|
-
* // Accessing data:
|
|
346
|
-
* // products.list.value -> processed, formatted, and searched list
|
|
347
|
-
* // products.sendPost({ name: 'New Product', price: 100 }) -> execute mutation
|
|
398
|
+
* ```
|
|
348
399
|
*/
|
|
349
400
|
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): {
|
|
350
401
|
isValid: ComputedRef<boolean>;
|
|
@@ -372,12 +423,14 @@ export declare function useApiManagementRef<Return extends ApiManagementValue, F
|
|
|
372
423
|
sendPut: (request?: ApiFetch["request"]) => Promise<ApiData<Put> | undefined>;
|
|
373
424
|
sendDelete: (request?: ApiFetch["request"]) => Promise<ApiData<Delete> | undefined>;
|
|
374
425
|
};
|
|
375
|
-
export interface UseApiPostSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
426
|
+
export interface UseApiPostSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
427
|
+
}
|
|
376
428
|
export declare function useApiPost<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiPostSetup<T, Request, Return>): {
|
|
377
429
|
loading: Ref<boolean, boolean>;
|
|
378
430
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
379
431
|
};
|
|
380
|
-
export interface UseApiPutSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
432
|
+
export interface UseApiPutSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
433
|
+
}
|
|
381
434
|
export declare function useApiPut<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiPutSetup<T, Request, Return>): {
|
|
382
435
|
loading: Ref<boolean, boolean>;
|
|
383
436
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
@@ -404,53 +457,13 @@ export interface UseApiRef<R> {
|
|
|
404
457
|
}
|
|
405
458
|
/**
|
|
406
459
|
* Main reactive composable for working with API requests in Vue.
|
|
407
|
-
* Automatically handles SSR, reactivity, caching, error storage, data validation, and transformation.
|
|
408
460
|
*
|
|
409
461
|
* @example
|
|
410
462
|
* ```typescript
|
|
411
463
|
* import { Schema as S } from '@effect/schema'
|
|
412
464
|
* import { useApiRef } from '@dxtmisha/functional'
|
|
413
|
-
*
|
|
414
|
-
* // Define a schema using @effect/schema
|
|
415
|
-
* const userSchema = S.Struct({ id: S.Number, name: S.String })
|
|
416
|
-
*
|
|
417
|
-
* const { data, loading, errorItem, isResponseContractValid } = useApiRef(
|
|
418
|
-
* '/users/1',
|
|
419
|
-
* { method: 'GET' },
|
|
420
|
-
* true, // reactivity
|
|
421
|
-
* undefined, // conditions
|
|
422
|
-
* (data) => ({ ...data, isTransformed: true }), // transformation
|
|
423
|
-
* (data) => { // validateResponseContract
|
|
424
|
-
* try {
|
|
425
|
-
* return { status: 'success', data: S.decodeUnknownSync(userSchema)(data) }
|
|
426
|
-
* } catch (e) {
|
|
427
|
-
* return { status: 'error', errors: e }
|
|
428
|
-
* }
|
|
429
|
-
* },
|
|
430
|
-
* [ // errorContract (ApiErrorStorageList)
|
|
431
|
-
* {
|
|
432
|
-
* status: 404,
|
|
433
|
-
* message: 'User not found'
|
|
434
|
-
* }
|
|
435
|
-
* ]
|
|
436
|
-
* )
|
|
465
|
+
* const { data, loading } = useApiRef('/users/1')
|
|
437
466
|
* ```
|
|
438
|
-
*
|
|
439
|
-
* @param path path to request (can be a Ref or Getter)
|
|
440
|
-
* @param options data for the request (headers, method, etc.)
|
|
441
|
-
* @param reactivity should reactivity be enabled (automatically re-fetch on deps change)
|
|
442
|
-
* @param conditions conditions for executing the request (request will wait until true)
|
|
443
|
-
* @param transformation transforms the received response data
|
|
444
|
-
* @param validateResponseContract function to validate response data contract. Used to ensure that the API
|
|
445
|
-
* response matches the expected structure. Highly recommended to use with `@effect/schema`.
|
|
446
|
-
* It should return `ApiDataValidation` containing a `status` ('success' or 'error')
|
|
447
|
-
* and the parsed data or errors.
|
|
448
|
-
* @param errorContract array of expected error contracts for the request (`ApiErrorStorageList`).
|
|
449
|
-
* Highly recommended to add if there is information about possible request errors. Allows you to predefine
|
|
450
|
-
* possible errors (by code, status, or custom validation). If an error occurs matching one of these contracts,
|
|
451
|
-
* it will be automatically processed and made available via the `errorItem` computed property.
|
|
452
|
-
* @param unmounted whether to stop the request and clear data from cache when component is unmounted
|
|
453
|
-
* @param apiInstance Api instance (defaults to global Api instance)
|
|
454
467
|
*/
|
|
455
468
|
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>;
|
|
456
469
|
export declare const setApiRefGlobalConditions: (conditions: RefType<any>) => void;
|
|
@@ -470,12 +483,20 @@ export declare function useApiRequest<T, Request extends ApiFetch['request'] = A
|
|
|
470
483
|
loading: Ref<boolean, boolean>;
|
|
471
484
|
send(request?: Request): Promise<Return | undefined>;
|
|
472
485
|
};
|
|
473
|
-
|
|
486
|
+
type BroadcastValueItem<T> = T | string | undefined;
|
|
487
|
+
export declare function useBroadcastValueRef<T>(name: string, defaultValue?: T | string | (() => (T | string))): Ref<BroadcastValueItem<T>>;
|
|
474
488
|
export declare function useCookieRef<T>(name: string, defaultValue?: T | string | (() => (T | string)), options?: CookieOptions): Ref<T | string | undefined>;
|
|
475
489
|
export declare function useFormattersRef<Options extends FormattersOptionsList = FormattersOptionsList, List extends FormattersListProp = FormattersListProp>(list: RefType<List | undefined>, options: Options): {
|
|
476
490
|
listFormat: ComputedRef<FormattersReturn<List, Options>>;
|
|
477
491
|
length: ComputedRef<number>;
|
|
478
492
|
};
|
|
493
|
+
/**
|
|
494
|
+
* Returns a class object for working with data formatting.
|
|
495
|
+
*
|
|
496
|
+
* @remarks
|
|
497
|
+
* Avoid using this reactive composable if reactive updates are not required.
|
|
498
|
+
* For non-reactive formatting, use the standard `GeoIntl` class from `@dxtmisha/functional-basic`.
|
|
499
|
+
*/
|
|
479
500
|
export declare function useGeoIntlRef(): GeoIntlRef;
|
|
480
501
|
export declare function useGeoUnitRef(): GeoUnitRef;
|
|
481
502
|
export declare function useHashRef<T>(name: string, defaultValue?: T | (() => T)): ShallowRef<T>;
|
|
@@ -551,7 +572,7 @@ export declare const useMeta: () => Readonly<{
|
|
|
551
572
|
setSuffix: (suffix: string) => void;
|
|
552
573
|
}>;
|
|
553
574
|
destroyExecute?(): void;
|
|
554
|
-
}
|
|
575
|
+
}>;
|
|
555
576
|
export declare function useQueryRef<T>(name: string, defaultValue?: T | (() => T)): ShallowRef<T>;
|
|
556
577
|
export declare const useRouterList: <T extends ListDataBasic>(list: RefType<ConstrBind<T>[] | undefined>, selected?: Ref<string> | string, hasTo?: boolean) => {
|
|
557
578
|
item: ComputedRef<T | undefined>;
|
|
@@ -576,30 +597,15 @@ export declare function useSearchValueRef<T extends SearchItem, K extends Search
|
|
|
576
597
|
export declare function useSessionRef<T>(name: string, defaultValue?: T | (() => T)): Ref<T | undefined>;
|
|
577
598
|
export declare function useStorageRef<T>(name: string, defaultValue?: T | (() => T), cache?: number): Ref<T | undefined>;
|
|
578
599
|
/**
|
|
579
|
-
* Getting
|
|
580
|
-
*
|
|
581
|
-
* It returns a `ShallowRef` that automatically updates when the global language changes.
|
|
582
|
-
* Use `as const` for arrays to ensure proper TypeScript key inference.
|
|
600
|
+
* Getting translated text by array of keys or key string.
|
|
583
601
|
*
|
|
584
|
-
*
|
|
602
|
+
* @example
|
|
585
603
|
* ```typescript
|
|
586
|
-
* // 1. Using the main composable
|
|
587
604
|
* const translations = useTranslateRef(['home.title', 'home.description'] as const);
|
|
588
|
-
*
|
|
589
|
-
* // 2. Using the shorthand 't'
|
|
590
605
|
* const labels = t(['button.save', 'button.cancel'] as const);
|
|
591
606
|
* ```
|
|
592
|
-
*
|
|
593
|
-
* @param names a string or an array with keys
|
|
594
|
-
* @param translateInstance a translate instance
|
|
595
607
|
*/
|
|
596
608
|
export declare function useTranslateRef<T extends (string | string[])[]>(names: T, translateInstance?: TranslateInstance): ShallowRef<TranslateList<T>>;
|
|
597
|
-
/**
|
|
598
|
-
* Shorthand for useTranslateRef.
|
|
599
|
-
* Use `as const` for arrays to ensure proper TypeScript key inference.
|
|
600
|
-
*
|
|
601
|
-
* @param names a string or an array with keys
|
|
602
|
-
*/
|
|
603
609
|
export declare const t: <T extends string[]>(names: T) => ShallowRef<TranslateList<T>>;
|
|
604
610
|
export declare const uiMakeFlags: () => void;
|
|
605
611
|
export declare function computedAsync<R>(getter: (() => Promise<R>) | (() => R) | R, initialState?: (() => R) | R, ignore?: R, debugOptions?: DebuggerOptions): ComputedRef<R | undefined>;
|
|
@@ -618,21 +624,14 @@ export interface FunctionalPluginOptions {
|
|
|
618
624
|
errorCallbacks?: ErrorCenterHandlerCallback[];
|
|
619
625
|
}
|
|
620
626
|
/**
|
|
621
|
-
* Vue plugin for initializing
|
|
622
|
-
* (Api, Translate, Icons, Meta).
|
|
627
|
+
* Vue plugin for initializing global functional services.
|
|
623
628
|
*
|
|
624
629
|
* @example
|
|
625
630
|
* ```typescript
|
|
626
631
|
* import { createApp } from 'vue'
|
|
627
632
|
* import { dxtFunctionalPlugin } from '@dxtmisha/functional'
|
|
628
|
-
* import router from './router'
|
|
629
|
-
*
|
|
630
633
|
* const app = createApp(App)
|
|
631
|
-
* app.use(dxtFunctionalPlugin, {
|
|
632
|
-
* api: { url: 'https://api.example.com' },
|
|
633
|
-
* metaSuffix: ' | My App',
|
|
634
|
-
* router
|
|
635
|
-
* })
|
|
634
|
+
* app.use(dxtFunctionalPlugin, { api: { url: 'https://api.example.com' } })
|
|
636
635
|
* ```
|
|
637
636
|
*/
|
|
638
637
|
export declare const dxtFunctionalPlugin: Plugin;
|
|
@@ -648,73 +647,15 @@ export type ExecuteUseReturn<R> = Readonly<R & {
|
|
|
648
647
|
/**
|
|
649
648
|
* Creates a managed singleton that encapsulates initialization logic and access mode.
|
|
650
649
|
*
|
|
651
|
-
* It supports three initialization strategies:
|
|
652
|
-
* - `global`: A single instance for the entire application.
|
|
653
|
-
* - `provide`: Shared via provide/inject in the component tree (standard for Vue 3).
|
|
654
|
-
* - `local`: A single instance within the closure of the returned function.
|
|
655
|
-
*
|
|
656
|
-
* @template R return type of the factory function
|
|
657
|
-
* @template O argument types for the factory function
|
|
658
|
-
* @template RI instance type with management methods
|
|
659
|
-
*
|
|
660
|
-
* @param callback initialization function
|
|
661
|
-
* @param type initialization strategy (defaults to provide)
|
|
662
|
-
*
|
|
663
|
-
* @returns {function} accessor function for the singleton
|
|
664
|
-
*
|
|
665
650
|
* @remarks
|
|
666
|
-
* Use this function
|
|
667
|
-
* - **API Services:** Always wrap API clients to ensure a single connection point and unified state.
|
|
668
|
-
* - **Resource Optimization:** For functions where creating multiple instances is undesirable (e.g., heavy objects, event buses).
|
|
669
|
-
* - **Shared State:** To share reactive state within a component tree using the `provide` strategy.
|
|
670
|
-
* - **External SDKs:** Initializing third-party libraries (analytics, maps, charts) that should be singletons.
|
|
671
|
-
*
|
|
672
|
-
* @example
|
|
673
|
-
* // 1. Global API singleton (useApiGet)
|
|
674
|
-
* export const useUserApi = executeUseGlobal(() => {
|
|
675
|
-
* return useApiGet('/api/user');
|
|
676
|
-
* });
|
|
677
|
-
*
|
|
678
|
-
* @example
|
|
679
|
-
* // 2. Shared Reactive State
|
|
680
|
-
* export const useFeatureState = executeUseProvide(() => {
|
|
681
|
-
* // Reactive logic here
|
|
682
|
-
* const items = [];
|
|
683
|
-
* const addItem = (item) => items.push(item);
|
|
684
|
-
* return { items, addItem };
|
|
685
|
-
* });
|
|
686
|
-
*
|
|
687
|
-
* @example
|
|
688
|
-
* // 3. Local Caching
|
|
689
|
-
* export const useHeavyResource = executeUseLocal((config) => {
|
|
690
|
-
* return new HeavyResource(config);
|
|
691
|
-
* });
|
|
651
|
+
* Use this function for API services, resource optimization, shared state, or external SDKs.
|
|
692
652
|
*
|
|
693
653
|
* @example
|
|
694
|
-
*
|
|
695
|
-
* export const
|
|
696
|
-
*
|
|
697
|
-
* { path: '/api/users' }, // GET setup
|
|
698
|
-
* { date: (v) => new Date(v).toLocaleString() }, // Formatters
|
|
699
|
-
* { columns: ['name', 'email'] }, // Search
|
|
700
|
-
* { path: '/api/users' }, // POST (create)
|
|
701
|
-
* { path: (o) => `/api/users/${o.id}` }, // PUT (update)
|
|
702
|
-
* { path: (o) => `/api/users/${o.id}` } // DELETE (remove)
|
|
703
|
-
* );
|
|
704
|
-
* });
|
|
705
|
-
*
|
|
706
|
-
* // Usage in component:
|
|
707
|
-
* // const { list, loading, sendPost, sendDelete } = useUserManagement();
|
|
654
|
+
* ```typescript
|
|
655
|
+
* export const useUserApi = executeUseGlobal(() => useApiGet('/api/user'));
|
|
656
|
+
* ```
|
|
708
657
|
*/
|
|
709
658
|
export declare function executeUse<R, O extends any[], RI extends ExecuteUseReturn<R> = ExecuteUseReturn<R>>(callback: (...args: O) => R, type?: ExecuteUseType): ((...args: O) => RI) | (() => RI);
|
|
710
|
-
/**
|
|
711
|
-
* Creates a global singleton.
|
|
712
|
-
*
|
|
713
|
-
* @remarks
|
|
714
|
-
* See {@link executeUse} for more details.
|
|
715
|
-
*
|
|
716
|
-
* @param callback Initialization function
|
|
717
|
-
*/
|
|
718
659
|
export declare function executeUseGlobal<R>(callback: () => R): (() => Readonly<R & {
|
|
719
660
|
init(): Readonly<R>;
|
|
720
661
|
destroyExecute?(): void;
|
|
@@ -722,15 +663,6 @@ export declare function executeUseGlobal<R>(callback: () => R): (() => Readonly<
|
|
|
722
663
|
init(): Readonly<R>;
|
|
723
664
|
destroyExecute?(): void;
|
|
724
665
|
}>);
|
|
725
|
-
/**
|
|
726
|
-
* Creates a component-scoped singleton.
|
|
727
|
-
*
|
|
728
|
-
* @remarks
|
|
729
|
-
* Best for sharing state within a component sub-tree.
|
|
730
|
-
* See {@link executeUse} for more details.
|
|
731
|
-
*
|
|
732
|
-
* @param callback Initialization function
|
|
733
|
-
*/
|
|
734
666
|
export declare function executeUseProvide<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<R & {
|
|
735
667
|
init(): Readonly<R>;
|
|
736
668
|
destroyExecute?(): void;
|
|
@@ -738,15 +670,6 @@ export declare function executeUseProvide<R, O extends any[]>(callback: (...args
|
|
|
738
670
|
init(): Readonly<R>;
|
|
739
671
|
destroyExecute?(): void;
|
|
740
672
|
}>);
|
|
741
|
-
/**
|
|
742
|
-
* Creates a local singleton.
|
|
743
|
-
*
|
|
744
|
-
* @remarks
|
|
745
|
-
* Best for internal state preservation within a closure.
|
|
746
|
-
* See {@link executeUse} for more details.
|
|
747
|
-
*
|
|
748
|
-
* @param callback Initialization function
|
|
749
|
-
*/
|
|
750
673
|
export declare function executeUseLocal<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<R & {
|
|
751
674
|
init(): Readonly<R>;
|
|
752
675
|
destroyExecute?(): void;
|
|
@@ -768,132 +691,4 @@ export declare function getBind<T, R extends ItemList>(value: T | R | undefined
|
|
|
768
691
|
export declare function getClassName<T extends ItemList>(props?: T): string | undefined;
|
|
769
692
|
export declare function getIndexForRender<T extends ItemList>(name: string | any, props?: T, index?: string): string | undefined;
|
|
770
693
|
export declare function toBind<R extends ItemList = ItemList>(extra: ItemList, value: ItemList): ConstrBind<R>;
|
|
771
|
-
export declare function toBinds<R extends ItemList = ItemList>(...values: (ItemList | undefined)[]): ConstrBind<R>;
|
|
772
|
-
export type ApiOptions = ApiMethodItem | RefOrNormal<ApiFetch>;
|
|
773
|
-
export type ApiManagementValue = ApiDefaultValue | ApiDefaultValue[];
|
|
774
|
-
export type ApiManagementGet<Return extends ApiManagementValue, Type extends ApiManagementValue = Return> = {
|
|
775
|
-
path?: RefOrNormal<string | undefined>;
|
|
776
|
-
options?: ApiOptions;
|
|
777
|
-
reactivity?: boolean;
|
|
778
|
-
conditions?: RefType<boolean>;
|
|
779
|
-
transformation?: (data: Type, isResponseContractValid?: ApiDataValidation) => ApiData<Return>;
|
|
780
|
-
validateResponseContract?: (data: Type) => ApiDataValidation;
|
|
781
|
-
errorContract?: ApiErrorStorageList;
|
|
782
|
-
typeData?: ((data: Return) => boolean) | any;
|
|
783
|
-
unmounted?: boolean;
|
|
784
|
-
skeleton?: () => Return;
|
|
785
|
-
};
|
|
786
|
-
export type ApiManagementSearch<T extends SearchItem, K extends SearchColumns<T>> = {
|
|
787
|
-
columns: K;
|
|
788
|
-
value?: Ref<string>;
|
|
789
|
-
options?: SearchOptions;
|
|
790
|
-
};
|
|
791
|
-
export type ApiManagementRequest<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> = {
|
|
792
|
-
path?: RefOrNormal<string | undefined>;
|
|
793
|
-
action?: (data: Return | undefined) => Promise<void> | void;
|
|
794
|
-
transformation?: (data: T) => Return;
|
|
795
|
-
validateRequestContract?: (data: Request) => ApiDataValidation & Return;
|
|
796
|
-
validateResponseContract?: (data: T) => ApiDataValidation & Return;
|
|
797
|
-
errorContract?: ApiErrorStorageList;
|
|
798
|
-
toData?: boolean;
|
|
799
|
-
options?: ApiOptions;
|
|
800
|
-
};
|
|
801
|
-
export type ConstrItem = Record<string, any>;
|
|
802
|
-
export type ConstrValue<T = any> = {
|
|
803
|
-
value?: T;
|
|
804
|
-
};
|
|
805
|
-
export type ConstrComponent = Record<string, any>;
|
|
806
|
-
export type ConstrComponentMod<P extends ConstrItem> = ConstrItem | {
|
|
807
|
-
[K in keyof P]?: RefOrNormal<P[K]>;
|
|
808
|
-
};
|
|
809
|
-
export type ConstrExpose<E extends Element, EXPOSE extends ConstrItem> = EXPOSE & {
|
|
810
|
-
elementHtml?: ComputedRef<E | undefined>;
|
|
811
|
-
};
|
|
812
|
-
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
813
|
-
export type ConstrEmitItem<T extends ConstrItem> = T[keyof T];
|
|
814
|
-
export type ConstrEmit<T extends ConstrItem = ConstrItem> = UnionToIntersection<ConstrEmitItem<{
|
|
815
|
-
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
816
|
-
}>>;
|
|
817
|
-
export type ConstrClassObject = Record<string, boolean | undefined>;
|
|
818
|
-
export type ConstrClass = string | (string | ConstrClass | Undefined)[] | ConstrClassObject;
|
|
819
|
-
export type ConstrClassList = Record<string, ConstrClass>;
|
|
820
|
-
export type ConstrClasses = {
|
|
821
|
-
main: ConstrClass;
|
|
822
|
-
} & ConstrClassList;
|
|
823
|
-
export type ConstrStylesItem = string | null;
|
|
824
|
-
export type ConstrStyles = Record<string, ConstrStylesItem> | ConstrStyles[];
|
|
825
|
-
export type ConstrOptions<COMP extends ConstrComponent, EMITS extends ConstrItem, P extends ConstrItem> = {
|
|
826
|
-
components?: COMP;
|
|
827
|
-
compMod?: ConstrComponentMod<P>;
|
|
828
|
-
emits?: ConstrEmit<EMITS>;
|
|
829
|
-
classes?: RefType<ConstrClasses>;
|
|
830
|
-
styles?: RefType<ConstrStyles>;
|
|
831
|
-
};
|
|
832
|
-
export type ConstrSetup<E extends Element, CLASSES extends ConstrClasses, SETUP extends ConstrItem> = {
|
|
833
|
-
name: string;
|
|
834
|
-
element: Ref<E | undefined>;
|
|
835
|
-
classes: RefType<CLASSES>;
|
|
836
|
-
styles: RefType<ConstrStyles>;
|
|
837
|
-
} & SETUP;
|
|
838
|
-
export type ConstrRegistration = {
|
|
839
|
-
flag?: boolean;
|
|
840
|
-
translate?: Record<string, string>;
|
|
841
|
-
};
|
|
842
|
-
export type ConstrBind<T> = T & Record<string, any> & {
|
|
843
|
-
key?: string;
|
|
844
|
-
class?: ConstrClass;
|
|
845
|
-
style?: ConstrStyles;
|
|
846
|
-
};
|
|
847
|
-
export type ConstrPropItemOptions<T = any> = {
|
|
848
|
-
type?: PropType<T>;
|
|
849
|
-
required?: boolean;
|
|
850
|
-
default?: any;
|
|
851
|
-
validator?(value: any, props: any): boolean;
|
|
852
|
-
};
|
|
853
|
-
export type ConstrPropItem<T = any> = ConstrPropItemOptions<T> | PropType<T>;
|
|
854
|
-
export type ConstrProps<P = Record<string, any>> = {
|
|
855
|
-
[K in keyof P]: ConstrPropItem<P[K]>;
|
|
856
|
-
};
|
|
857
|
-
export type ConstrHrefProps = {
|
|
858
|
-
href?: string;
|
|
859
|
-
};
|
|
860
|
-
export type ListType = 'item' | 'space' | 'line' | 'subtitle' | 'html' | 'menu' | 'menu-group' | 'group';
|
|
861
|
-
export type ListDataBasic = {
|
|
862
|
-
label?: NumberOrString;
|
|
863
|
-
value?: any;
|
|
864
|
-
search?: string;
|
|
865
|
-
};
|
|
866
|
-
export type ListDataItem<Item extends ListDataBasic = ListDataBasic> = ConstrBind<Item & {
|
|
867
|
-
parent?: string;
|
|
868
|
-
type: ListType;
|
|
869
|
-
index: string;
|
|
870
|
-
disabled?: boolean;
|
|
871
|
-
}>;
|
|
872
|
-
export type ListList<Item extends ListDataBasic = ListDataBasic> = ListDataItem<Item>[];
|
|
873
|
-
export type ListRecord<Item extends ListDataBasic = ListDataBasic> = ListList<Item> | Record<string, any>;
|
|
874
|
-
export type ListDataFullItem<Item extends ListDataBasic = ListDataBasic> = ListDataItem<Item> & {
|
|
875
|
-
focus: boolean;
|
|
876
|
-
highlight?: string;
|
|
877
|
-
selected: boolean;
|
|
878
|
-
disabled?: boolean;
|
|
879
|
-
};
|
|
880
|
-
export type ListDataFull<Item extends ListDataBasic = ListDataBasic> = ListDataFullItem<Item>[];
|
|
881
|
-
export type ListListInputItem<Item extends ListDataBasic = ListDataBasic> = ConstrBind<Item>;
|
|
882
|
-
export type ListListInput<Item extends ListDataBasic = ListDataBasic> = ListListInputItem<Item>[] | string[] | Record<string, ListListInputItem<Item>> | Record<string, string>;
|
|
883
|
-
export type ListSelectedItem = NumberOrStringOrBoolean;
|
|
884
|
-
export type ListSelectedList = ListSelectedItem | ListSelectedItem[];
|
|
885
|
-
export type ListName = string | number | undefined;
|
|
886
|
-
export type ListNames = ListName[];
|
|
887
|
-
export type RefType<T> = ComputedRef<T> | Ref<T>;
|
|
888
|
-
export type RefUndefined<T> = RefType<T | undefined>;
|
|
889
|
-
export type RefOrNormal<T> = RefType<T> | T;
|
|
890
|
-
export type RefOrNormalOrFunction<T> = RefOrNormal<T> | (() => RefOrNormal<T>);
|
|
891
|
-
export type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
|
|
892
|
-
export type RawSlots = {
|
|
893
|
-
[name: string]: unknown;
|
|
894
|
-
$stable?: boolean;
|
|
895
|
-
};
|
|
896
|
-
export type SearchListValueRef<T extends SearchItem> = RefOrNormal<SearchListValue<T>>;
|
|
897
|
-
export type SearchListInput<T extends SearchItem> = SearchListValueRef<T> | (() => SearchListValueRef<T>);
|
|
898
|
-
export type SearchColumnsRef<T extends SearchItem, K extends SearchColumns<T>> = RefOrNormal<K>;
|
|
899
|
-
export type SearchColumnsInput<T extends SearchItem, K extends SearchColumns<T>> = SearchColumnsRef<T, K> | (() => SearchColumnsRef<T, K>);
|
|
694
|
+
export declare function toBinds<R extends ItemList = ItemList>(...values: (ItemList | undefined)[]): ConstrBind<R>;
|
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.7",
|
|
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": [
|
|
@@ -70,9 +70,11 @@
|
|
|
70
70
|
"publish-to-npm": "npm publish --access public"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
|
+
"ai-prompts",
|
|
73
74
|
"dist",
|
|
74
75
|
"ai-description.md",
|
|
75
76
|
"ai-doc.md",
|
|
77
|
+
"ai-mcp.json",
|
|
76
78
|
"ai-types.md",
|
|
77
79
|
"CHANGELOG.md",
|
|
78
80
|
"LICENSE",
|