@vesperjs/vue 0.3.0 → 0.3.2
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/dist/index.d.mts +18 -7
- package/dist/index.mjs +4 -3
- package/package.json +20 -20
package/dist/index.d.mts
CHANGED
|
@@ -73,26 +73,37 @@ declare const useMutationApi: <T = unknown, E = any>(url: string, {
|
|
|
73
73
|
pending: boolean;
|
|
74
74
|
}>;
|
|
75
75
|
//#endregion
|
|
76
|
-
//#region src/composables/backend/use-
|
|
77
|
-
interface
|
|
76
|
+
//#region src/composables/backend/use-api-error.d.ts
|
|
77
|
+
interface UseApiErrorOptions {
|
|
78
78
|
flash: Ref<Flash>;
|
|
79
|
-
caller?:
|
|
79
|
+
caller?: UseApiErrorCallerType;
|
|
80
80
|
}
|
|
81
|
-
interface
|
|
81
|
+
interface UseApiErrorCallerType {
|
|
82
82
|
externalErrors?: Ref<ErrorMessages<string>>;
|
|
83
83
|
clearAccount?: () => void;
|
|
84
84
|
}
|
|
85
|
+
declare const useApiError: <BER extends object = BackendErrorResource>({
|
|
86
|
+
flash,
|
|
87
|
+
caller
|
|
88
|
+
}: UseApiErrorOptions) => {
|
|
89
|
+
backendErrorInfo: Ref<BackendErrorInfo<BER>, BER>;
|
|
90
|
+
setError: (error: FetchError<ErrorsResource<ErrorMessages<string>> | BER>, options?: {
|
|
91
|
+
off?: boolean;
|
|
92
|
+
}) => void;
|
|
93
|
+
reload: () => void;
|
|
94
|
+
};
|
|
85
95
|
declare const useAlert: <BER extends object = BackendErrorResource>({
|
|
86
96
|
flash,
|
|
87
97
|
caller
|
|
88
|
-
}:
|
|
98
|
+
}: UseApiErrorOptions) => {
|
|
89
99
|
backendErrorInfo: Ref<BackendErrorInfo<BER>, BER>;
|
|
90
100
|
setError: (error: FetchError<ErrorsResource<ErrorMessages<string>> | BER>, options?: {
|
|
91
101
|
off?: boolean;
|
|
92
102
|
}) => void;
|
|
93
103
|
reload: () => void;
|
|
94
104
|
};
|
|
95
|
-
type
|
|
105
|
+
type UseApiErrorType = ReturnType<typeof useApiError>;
|
|
106
|
+
type UseAlertType = UseApiErrorType;
|
|
96
107
|
//#endregion
|
|
97
108
|
//#region src/composables/ui/dom/use-element.d.ts
|
|
98
109
|
declare const useElement: <EL extends Element, P extends string>(el: EL | undefined | null, {
|
|
@@ -137,4 +148,4 @@ declare const i18n: _$vue_i18n0.I18n<{
|
|
|
137
148
|
};
|
|
138
149
|
}, {}, {}, string, false>;
|
|
139
150
|
//#endregion
|
|
140
|
-
export { type BackendErrorInfo, type BackendErrorResource, type ErrorMessages, type ErrorsResource, type Flash, type UseAlertType, type UseFlashType, type UseNanoRouteType, i18n, useAlert, useApiConstants, useDate, useElement, useEntity, useExternalErrors, useFlash, useLocale, useMutationApi, useNanoRoute, useOFetch, useQueryApi };
|
|
151
|
+
export { type BackendErrorInfo, type BackendErrorResource, type ErrorMessages, type ErrorsResource, type Flash, type UseAlertType, type UseApiErrorType, type UseFlashType, type UseNanoRouteType, i18n, useAlert, useApiConstants, useApiError, useDate, useElement, useEntity, useExternalErrors, useFlash, useLocale, useMutationApi, useNanoRoute, useOFetch, useQueryApi };
|
package/dist/index.mjs
CHANGED
|
@@ -143,8 +143,8 @@ const useMutationApi = async function(url, { method, body = {}, token = null, on
|
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
145
|
//#endregion
|
|
146
|
-
//#region src/composables/backend/use-
|
|
147
|
-
const
|
|
146
|
+
//#region src/composables/backend/use-api-error.ts
|
|
147
|
+
const useApiError = function({ flash, caller }) {
|
|
148
148
|
const { backendErrorInfo, clearBackendErrorInfo } = useBackendErrorInfo();
|
|
149
149
|
const setError = function(error, options) {
|
|
150
150
|
const off = options?.off ?? false;
|
|
@@ -186,6 +186,7 @@ const useAlert = function({ flash, caller }) {
|
|
|
186
186
|
reload
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
|
+
const useAlert = useApiError;
|
|
189
190
|
//#endregion
|
|
190
191
|
//#region src/composables/ui/dom/use-element.ts
|
|
191
192
|
const useElement = function(el, { property }) {
|
|
@@ -211,4 +212,4 @@ const useNanoRoute = function(router) {
|
|
|
211
212
|
};
|
|
212
213
|
};
|
|
213
214
|
//#endregion
|
|
214
|
-
export { i18n, useAlert, useApiConstants, useDate, useElement, useEntity, useExternalErrors, useFlash, useLocale, useMutationApi, useNanoRoute, useOFetch, useQueryApi };
|
|
215
|
+
export { i18n, useAlert, useApiConstants, useApiError, useDate, useElement, useEntity, useExternalErrors, useFlash, useLocale, useMutationApi, useNanoRoute, useOFetch, useQueryApi };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesperjs/vue",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"vue.js"
|
|
6
6
|
],
|
|
@@ -20,33 +20,33 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@formkit/tempo": "^1.0.0",
|
|
23
|
-
"@nanostores/persistent": "^1.3.
|
|
23
|
+
"@nanostores/persistent": "^1.3.4",
|
|
24
24
|
"@nanostores/router": "^1.0.0",
|
|
25
|
-
"@vesperjs/shared": "0.3.
|
|
26
|
-
"nanostores": "^1.
|
|
25
|
+
"@vesperjs/shared": "0.3.2",
|
|
26
|
+
"nanostores": "^1.3.0",
|
|
27
27
|
"ofetch": "^1.5.1",
|
|
28
|
-
"undici": "^8.0
|
|
29
|
-
"vue-i18n": "^11.
|
|
28
|
+
"undici": "^8.1.0",
|
|
29
|
+
"vue-i18n": "^11.4.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@eslint/js": "^10.0.1",
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
34
|
-
"@typescript-eslint/parser": "^8.
|
|
35
|
-
"@typescript-eslint/project-service": "^8.
|
|
36
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
37
|
-
"@typescript-eslint/utils": "^8.
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
35
|
+
"@typescript-eslint/project-service": "^8.59.0",
|
|
36
|
+
"@typescript-eslint/typescript-estree": "^8.59.0",
|
|
37
|
+
"@typescript-eslint/utils": "^8.59.0",
|
|
38
38
|
"@vue/eslint-config-typescript": "^14.7.0",
|
|
39
|
-
"eslint": "^10.2.
|
|
40
|
-
"eslint-plugin-vue": "^10.
|
|
41
|
-
"oxfmt": "^0.
|
|
42
|
-
"tsdown": "^0.21.
|
|
43
|
-
"typescript": "^6.0.
|
|
39
|
+
"eslint": "^10.2.1",
|
|
40
|
+
"eslint-plugin-vue": "^10.9.0",
|
|
41
|
+
"oxfmt": "^0.46.0",
|
|
42
|
+
"tsdown": "^0.21.10",
|
|
43
|
+
"typescript": "^6.0.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@vue/reactivity": "^3.5.
|
|
47
|
-
"@vue/runtime-core": "^3.5.
|
|
48
|
-
"@vue/runtime-dom": "^3.5.
|
|
49
|
-
"vue": "^3.5.
|
|
46
|
+
"@vue/reactivity": "^3.5.33 || ^3.6.0-beta.10",
|
|
47
|
+
"@vue/runtime-core": "^3.5.33 || ^3.6.0-beta.10",
|
|
48
|
+
"@vue/runtime-dom": "^3.5.33 || ^3.6.0-beta.10",
|
|
49
|
+
"vue": "^3.5.33 || ^3.6.0-beta.10"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsdown --dts",
|