@antcde/vue-utils 0.2.0 → 0.2.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/README.md +4 -1
- package/dist/index.js +116 -1327
- package/dist/types/index.d.ts +1 -1
- package/dist/types/useAntColorMode.d.ts +1 -1
- package/dist/types/useAntI18n.d.ts +3 -3
- package/dist/types/useCommsClient.d.ts +2 -3
- package/dist/types/useCommsHost.d.ts +1 -1
- package/dist/types/utils.d.ts +38 -0
- package/package.json +5 -5
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { useAntColorMode, type UseAntColorModeOptions, type UseAntColorModeRetur
|
|
|
2
2
|
export { useAntI18n, type UseAntI18nReturn } from './useAntI18n';
|
|
3
3
|
export { type UseCommsClient, useCommsClient } from './useCommsClient';
|
|
4
4
|
export { type CommsHostArgs, type UseCommsHost, useCommsHost } from './useCommsHost';
|
|
5
|
-
export { type AnyUseApiReturn, type CommsToolbar,
|
|
5
|
+
export { type AnyUseApiReturn, type CommsToolbar, useApi, type UseApiReturn, useCommsInjection, useSignal, useSingleton, } from './utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseCommsClient } from './useCommsClient';
|
|
2
1
|
import { BasicColorSchema, UseColorModeOptions, UseColorModeReturn } from '@vueuse/core';
|
|
2
|
+
import { UseCommsClient } from './useCommsClient';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
|
|
5
5
|
export type UseAntColorModeOptions = UseColorModeOptions<BasicColorSchema>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Composer, UseI18nOptions } from 'vue-i18n';
|
|
2
2
|
import { UseCommsClient } from './useCommsClient';
|
|
3
3
|
|
|
4
|
-
export type UseAntI18nReturn
|
|
4
|
+
export type UseAntI18nReturn = Composer;
|
|
5
5
|
/**
|
|
6
6
|
* Listens to the changing locale received from comms and translations will automatically refresh due to internal watcher.
|
|
7
7
|
* @param comms
|
|
8
8
|
* @param options
|
|
9
9
|
*/
|
|
10
|
-
export declare function useAntI18n
|
|
10
|
+
export declare function useAntI18n(comms: UseCommsClient, options?: UseI18nOptions): UseAntI18nReturn;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { AntConnect, Client, Context,
|
|
1
|
+
import { AntConnect, Client, Context, Signal } from '@antcde/connect-ts';
|
|
2
2
|
import { ObservableInput } from 'rxjs';
|
|
3
3
|
import { CommsToolbar } from './utils';
|
|
4
4
|
import { Ref } from 'vue';
|
|
5
5
|
|
|
6
|
-
export interface UseCommsClient extends Omit<Client, 'context' | 'toolbar' | 'appState'
|
|
6
|
+
export interface UseCommsClient extends Omit<Client, 'context' | 'toolbar' | 'appState'> {
|
|
7
7
|
context: Ref<Context>;
|
|
8
8
|
toolbar: CommsToolbar;
|
|
9
9
|
appState: Ref<string>;
|
|
10
|
-
locales: Ref<LocaleData>;
|
|
11
10
|
}
|
|
12
11
|
type KeyboardShortcutsHook = (signal: Signal) => ObservableInput<Signal>;
|
|
13
12
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AntConnect, License, Notepad, Notification, ProjectShort, SignalReceiver, SignalSender, Task, User } from '@antcde/connect-ts';
|
|
2
|
+
import { CommsToolbar } from './utils';
|
|
2
3
|
import { SubscriptionLike } from 'rxjs';
|
|
3
4
|
import { Ref } from 'vue';
|
|
4
|
-
import { CommsToolbar } from './utils';
|
|
5
5
|
|
|
6
6
|
type Nullable<T> = NonNullable<T> | null | undefined;
|
|
7
7
|
export interface CommsHostArgs {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Signal, ToolbarItem } from '@antcde/connect-ts';
|
|
2
|
+
import { UseAsyncStateOptions, UseAsyncStateReturn } from '@vueuse/core';
|
|
3
|
+
import { DeepReadonly, FunctionPlugin, Ref, UnwrapRef, WatchStopHandle } from 'vue';
|
|
4
|
+
import { UseCommsClient } from './useCommsClient';
|
|
5
|
+
|
|
6
|
+
type RefObject<T> = {
|
|
7
|
+
[K in keyof T]: T[K];
|
|
8
|
+
};
|
|
9
|
+
export declare function unrefObject<T extends object>(obj: RefObject<T>): UnwrapRef<T>;
|
|
10
|
+
export interface CommsToolbar {
|
|
11
|
+
title: Ref<string | undefined>;
|
|
12
|
+
searchEnabled: Ref<boolean>;
|
|
13
|
+
search: Ref<string>;
|
|
14
|
+
menu: Ref<ToolbarItem[]>;
|
|
15
|
+
isLoading: Ref<boolean>;
|
|
16
|
+
}
|
|
17
|
+
interface UseCommsFactoryResult {
|
|
18
|
+
provideComms: FunctionPlugin;
|
|
19
|
+
injectComms: () => UseCommsClient;
|
|
20
|
+
}
|
|
21
|
+
export declare function useCommsInjection(name?: string): UseCommsFactoryResult;
|
|
22
|
+
export declare function useSingleton<T extends object>(name: string, factory: () => T, dispose?: (value: T) => void): [provide: FunctionPlugin, inject: () => T];
|
|
23
|
+
export declare function useApi<Data, Params extends any[] = [], Shallow extends boolean = true>(promise: Promise<Data> | ((...args: Params) => Promise<Data>), initialState: Data, options?: UseAsyncStateOptions<Shallow, Data>): UseApiReturn<Data, Params, Shallow>;
|
|
24
|
+
export interface UseApiReturn<Data, Params extends any[], Shallow extends boolean> extends Omit<UseAsyncStateReturn<Data, Params, Shallow>, 'execute'> {
|
|
25
|
+
execute: (...args: Params) => Promise<Data>;
|
|
26
|
+
executeDelayed: (delay: number, ...args: Params) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A shorthand that implies all the generics to be any
|
|
30
|
+
*/
|
|
31
|
+
export type AnyUseApiReturn = UseApiReturn<any, any, any>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the last emitted signal
|
|
34
|
+
*
|
|
35
|
+
* @param comms
|
|
36
|
+
*/
|
|
37
|
+
export declare function useSignal(comms: UseCommsClient): [DeepReadonly<Ref<Signal | undefined>>, WatchStopHandle];
|
|
38
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antcde/vue-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"description": "Helper to use ANT Comms in Vue 3",
|
|
6
6
|
"author": "CollaborAll",
|
|
7
7
|
"repository": {
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@vueuse/core": "^12.0.0",
|
|
30
30
|
"vue": "^3.5.10",
|
|
31
|
-
"vue-i18n": "^
|
|
31
|
+
"vue-i18n": "^10.0.1",
|
|
32
|
+
"rxjs": "^7.0.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"@antcde/connect-ts": "0.2.0"
|
|
35
|
+
"@antcde/connect-ts": "0.4.9"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@vitejs/plugin-vue": "^5.0.3",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"vue-tsc": "^1.8.27"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "vite build",
|
|
46
|
+
"build": "pnpm clean && vite build",
|
|
47
47
|
"type-check": "vue-tsc --noEmit",
|
|
48
48
|
"clean": "pnpm dlx rimraf dist"
|
|
49
49
|
}
|