@vesperjs/shared 0.9.7 → 0.9.9
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 +8 -12
- package/dist/index.mjs +12 -14
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref, WritableComputedRef } from "@vue/reactivity";
|
|
2
|
-
import
|
|
2
|
+
import Bowser from "bowser";
|
|
3
3
|
|
|
4
4
|
//#region src/types/error/backend-error-info.d.ts
|
|
5
5
|
interface BackendErrorInfo<BER extends object> {
|
|
@@ -41,16 +41,6 @@ declare const useExternalErrors: <P extends string>(flash: Ref<Flash>) => {
|
|
|
41
41
|
isSuccess: () => boolean;
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region src/composables/user-agent/use-browser-info.d.ts
|
|
45
|
-
declare const useBrowserInfo: () => {
|
|
46
|
-
browserInfo: Parser.Parser;
|
|
47
|
-
};
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/composables/user-agent/use-user-agent.d.ts
|
|
50
|
-
declare const useUserAgent: () => {
|
|
51
|
-
userAgent: Parser.ParsedResult;
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
44
|
//#region src/composables/util/use-date.d.ts
|
|
55
45
|
declare const useDate: (fmtDate?: string, locale?: string) => {
|
|
56
46
|
isValidDate: (value: string) => boolean;
|
|
@@ -78,4 +68,10 @@ declare const useFlash: () => {
|
|
|
78
68
|
clearFlash: () => void;
|
|
79
69
|
};
|
|
80
70
|
//#endregion
|
|
81
|
-
|
|
71
|
+
//#region src/composables/use-user-agent.d.ts
|
|
72
|
+
declare const useUserAgent: () => {
|
|
73
|
+
userAgent: Bowser.Parser.ParsedResult;
|
|
74
|
+
browserInfo: Bowser.Parser.Parser;
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { type BackendErrorInfo, type BackendErrorResource, type ErrorMessages, type ErrorsResource, type Flash, useBackendErrorInfo, useDate, useEntity, useExternalErrors, useFlash, useUserAgent };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, ref } from "@vue/reactivity";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { parse } from "@formkit/tempo";
|
|
3
|
+
import Bowser from "bowser";
|
|
4
4
|
//#region src/composables/backend/error/use-backend-error-info.ts
|
|
5
5
|
const useBackendErrorInfo = function() {
|
|
6
6
|
const backendErrorInfo = ref({});
|
|
@@ -40,21 +40,11 @@ const useExternalErrors = function(flash) {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
43
|
-
//#region src/composables/user-agent/use-browser-info.ts
|
|
44
|
-
const useBrowserInfo = function() {
|
|
45
|
-
return { browserInfo: getParser(globalThis.navigator.userAgent) };
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/composables/user-agent/use-user-agent.ts
|
|
49
|
-
const useUserAgent = function() {
|
|
50
|
-
return { userAgent: parse(globalThis.navigator.userAgent) };
|
|
51
|
-
};
|
|
52
|
-
//#endregion
|
|
53
43
|
//#region src/composables/util/use-date.ts
|
|
54
44
|
const useDate = function(fmtDate = "YYYY/MM/DD", locale) {
|
|
55
45
|
const isValidDate = (value) => {
|
|
56
46
|
try {
|
|
57
|
-
const date = value ? parse
|
|
47
|
+
const date = value ? parse(value, fmtDate, locale) : null;
|
|
58
48
|
return date instanceof Date && !isNaN(date.getTime());
|
|
59
49
|
} catch {
|
|
60
50
|
return false;
|
|
@@ -91,4 +81,12 @@ const useFlash = function() {
|
|
|
91
81
|
};
|
|
92
82
|
};
|
|
93
83
|
//#endregion
|
|
94
|
-
|
|
84
|
+
//#region src/composables/use-user-agent.ts
|
|
85
|
+
const useUserAgent = function() {
|
|
86
|
+
return {
|
|
87
|
+
userAgent: Bowser.parse(globalThis.navigator.userAgent),
|
|
88
|
+
browserInfo: Bowser.getParser(globalThis.navigator.userAgent)
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
export { useBackendErrorInfo, useDate, useEntity, useExternalErrors, useFlash, useUserAgent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesperjs/shared",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"Nuxt",
|
|
6
6
|
"vue.js"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsdown --dts",
|
|
43
|
-
"build:check": "tsc--noEmit",
|
|
43
|
+
"build:check": "tsc --noEmit",
|
|
44
44
|
"lint": "eslint --fix './src/**/*.{js,ts}'",
|
|
45
45
|
"fmt": "oxfmt",
|
|
46
46
|
"fmt:check": "oxfmt --check"
|