@globalbrain/sefirot 4.12.0 → 4.13.0
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/lib/components/STooltip.vue +1 -1
- package/lib/composables/Lang.ts +3 -3
- package/lib/http/Http.ts +12 -12
- package/lib/support/Utils.ts +1 -1
- package/package.json +22 -22
|
@@ -87,7 +87,7 @@ const cleanups = [
|
|
|
87
87
|
setTimeout(() => { ignore.value = false })
|
|
88
88
|
}
|
|
89
89
|
}),
|
|
90
|
-
onClickOutside(root, hide, { ignore: [content] }),
|
|
90
|
+
onClickOutside(root, hide, { ignore: [content], controls: false }),
|
|
91
91
|
() => timeoutId.value != null && window.clearTimeout(timeoutId.value)
|
|
92
92
|
]
|
|
93
93
|
|
package/lib/composables/Lang.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type InjectionKey, getCurrentInstance, inject } from 'vue'
|
|
2
2
|
|
|
3
3
|
export type Lang = 'en' | 'ja'
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export interface HasLang {
|
|
|
15
15
|
lang: Lang
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export const SefirotLangKey = 'sefirot-lang-key'
|
|
18
|
+
export const SefirotLangKey: InjectionKey<Lang> = Symbol.for('sefirot-lang-key')
|
|
19
19
|
|
|
20
20
|
export function useSetupLang(): (user?: HasLang | null) => void {
|
|
21
21
|
const browserLang = useBrowserLang()
|
|
@@ -26,7 +26,7 @@ export function useSetupLang(): (user?: HasLang | null) => void {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function provideLang(lang: Lang) {
|
|
29
|
-
provide(SefirotLangKey, lang)
|
|
29
|
+
getCurrentInstance()?.appContext.app.provide(SefirotLangKey, lang)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function useLang(): Lang {
|
package/lib/http/Http.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { parse as parseContentDisposition } from '@tinyhttp/content-disposition'
|
|
|
2
2
|
import { parse as parseCookie } from '@tinyhttp/cookie'
|
|
3
3
|
import FileSaver from 'file-saver'
|
|
4
4
|
import { FetchError, type FetchOptions, type FetchRequest, type FetchResponse, ofetch } from 'ofetch'
|
|
5
|
-
import { stringify } from 'qs'
|
|
5
|
+
import { type IStringifyOptions, stringify } from 'qs'
|
|
6
6
|
import { type Lang } from '../composables/Lang'
|
|
7
7
|
import { isBlob, isError, isFormData, isRequest, isResponse, isString } from '../support/Utils'
|
|
8
8
|
|
|
@@ -20,6 +20,7 @@ export interface HttpOptions {
|
|
|
20
20
|
lang?: Lang
|
|
21
21
|
payloadKey?: string
|
|
22
22
|
headers?: () => Awaitable<Record<string, string>>
|
|
23
|
+
stringifyOptions?: IStringifyOptions
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export class Http {
|
|
@@ -29,6 +30,7 @@ export class Http {
|
|
|
29
30
|
private static lang: Lang | undefined = undefined
|
|
30
31
|
private static payloadKey = '__payload__'
|
|
31
32
|
private static headers: () => Awaitable<Record<string, string>> = async () => ({})
|
|
33
|
+
private static stringifyOptions: IStringifyOptions = {}
|
|
32
34
|
|
|
33
35
|
static config(options: HttpOptions): void {
|
|
34
36
|
if (options.baseUrl) {
|
|
@@ -49,6 +51,9 @@ export class Http {
|
|
|
49
51
|
if (options.headers) {
|
|
50
52
|
Http.headers = options.headers
|
|
51
53
|
}
|
|
54
|
+
if (options.stringifyOptions) {
|
|
55
|
+
Http.stringifyOptions = options.stringifyOptions
|
|
56
|
+
}
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
private async ensureXsrfToken(): Promise<string | undefined> {
|
|
@@ -69,7 +74,8 @@ export class Http {
|
|
|
69
74
|
private async buildRequest(url: string, _options: FetchOptions = {}): Promise<[string, FetchOptions]> {
|
|
70
75
|
const { method, params, query, ...options } = _options
|
|
71
76
|
const xsrfToken = ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method || '') && (await this.ensureXsrfToken())
|
|
72
|
-
|
|
77
|
+
|
|
78
|
+
const queryString = stringify({ ...params, ...query }, { encodeValuesOnly: true, ...Http.stringifyOptions })
|
|
73
79
|
|
|
74
80
|
return [
|
|
75
81
|
`${url}${queryString ? `?${queryString}` : ''}`,
|
|
@@ -195,16 +201,10 @@ export class Http {
|
|
|
195
201
|
export function isFetchError(e: unknown): e is FetchError {
|
|
196
202
|
return (
|
|
197
203
|
e instanceof FetchError
|
|
198
|
-
|| (isError(e)
|
|
199
|
-
&& (
|
|
200
|
-
&& ((e
|
|
201
|
-
|
|
202
|
-
`[${
|
|
203
|
-
((e as FetchError).request as Request | undefined)?.method || (e as FetchError).options?.method || 'GET'
|
|
204
|
-
}] ${JSON.stringify(
|
|
205
|
-
((e as FetchError).request as Request | undefined)?.url || String((e as FetchError).request) || '/'
|
|
206
|
-
)}: `
|
|
207
|
-
))
|
|
204
|
+
|| (isError<FetchError>(e)
|
|
205
|
+
&& (e.response === undefined || isResponse(e.response))
|
|
206
|
+
&& ((isString(e.request) && e.message.startsWith(`[${e.options?.method || 'GET'}] ${JSON.stringify(e.request || '/')}: `))
|
|
207
|
+
|| (isRequest(e.request) && e.message.startsWith(`[${e.request.method}] ${JSON.stringify(e.request.url)}: `))))
|
|
208
208
|
)
|
|
209
209
|
}
|
|
210
210
|
|
package/lib/support/Utils.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function isDate(value: unknown): value is Date {
|
|
|
16
16
|
return _isDate(value)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function isError(value: unknown): value is
|
|
19
|
+
export function isError<T extends Error = Error>(value: unknown): value is T {
|
|
20
20
|
return _isError(value)
|
|
21
21
|
}
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.13.0",
|
|
5
5
|
"packageManager": "pnpm@9.15.3",
|
|
6
6
|
"description": "Vue Components for Global Brain Design System.",
|
|
7
7
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
@@ -51,32 +51,32 @@
|
|
|
51
51
|
"@vue/reactivity": "^3.5.13",
|
|
52
52
|
"@vuelidate/core": "^2.0.3",
|
|
53
53
|
"@vuelidate/validators": "^2.0.4",
|
|
54
|
-
"@vueuse/core": "^12.
|
|
54
|
+
"@vueuse/core": "^12.7.0",
|
|
55
55
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
56
56
|
"dayjs": "^1.11.13",
|
|
57
|
-
"fuse.js": "^7.
|
|
57
|
+
"fuse.js": "^7.1.0",
|
|
58
58
|
"lodash-es": "^4.17.21",
|
|
59
59
|
"markdown-it": "^14.1.0",
|
|
60
60
|
"normalize.css": "^8.0.1",
|
|
61
|
-
"pinia": "^
|
|
62
|
-
"postcss": "^8.
|
|
61
|
+
"pinia": "^3.0.1",
|
|
62
|
+
"postcss": "^8.5.3",
|
|
63
63
|
"postcss-nested": "^7.0.2",
|
|
64
64
|
"v-calendar": "3.0.1",
|
|
65
65
|
"vue": "^3.5.13",
|
|
66
66
|
"vue-router": "^4.5.0"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@sentry/browser": "^
|
|
69
|
+
"@sentry/browser": "^9.2.0",
|
|
70
70
|
"@tanstack/vue-virtual": "3.0.0-beta.62",
|
|
71
71
|
"@tinyhttp/content-disposition": "^2.2.2",
|
|
72
72
|
"@tinyhttp/cookie": "^2.1.1",
|
|
73
73
|
"@types/file-saver": "^2.0.7",
|
|
74
|
-
"@types/qs": "^6.9.
|
|
74
|
+
"@types/qs": "^6.9.18",
|
|
75
75
|
"file-saver": "^2.0.5",
|
|
76
76
|
"magic-string": "^0.30.17",
|
|
77
77
|
"ofetch": "^1.4.1",
|
|
78
|
-
"qs": "^6.
|
|
79
|
-
"unplugin-icons": "^22.
|
|
78
|
+
"qs": "^6.14.0",
|
|
79
|
+
"unplugin-icons": "^22.1.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@globalbrain/eslint-config": "^1.7.1",
|
|
@@ -87,35 +87,35 @@
|
|
|
87
87
|
"@types/body-scroll-lock": "^3.1.2",
|
|
88
88
|
"@types/lodash-es": "^4.17.12",
|
|
89
89
|
"@types/markdown-it": "^14.1.2",
|
|
90
|
-
"@types/node": "^22.
|
|
90
|
+
"@types/node": "^22.13.5",
|
|
91
91
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
92
|
-
"@vitest/coverage-v8": "
|
|
92
|
+
"@vitest/coverage-v8": "^3.0.7",
|
|
93
93
|
"@vue/reactivity": "^3.5.13",
|
|
94
94
|
"@vue/test-utils": "^2.4.6",
|
|
95
95
|
"@vuelidate/core": "^2.0.3",
|
|
96
96
|
"@vuelidate/validators": "^2.0.4",
|
|
97
|
-
"@vueuse/core": "^12.
|
|
97
|
+
"@vueuse/core": "^12.7.0",
|
|
98
98
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
99
99
|
"dayjs": "^1.11.13",
|
|
100
100
|
"eslint": "8.57.0",
|
|
101
|
-
"fuse.js": "^7.
|
|
102
|
-
"happy-dom": "^
|
|
101
|
+
"fuse.js": "^7.1.0",
|
|
102
|
+
"happy-dom": "^17.1.8",
|
|
103
103
|
"histoire": "0.16.5",
|
|
104
104
|
"lodash-es": "^4.17.21",
|
|
105
105
|
"markdown-it": "^14.1.0",
|
|
106
106
|
"normalize.css": "^8.0.1",
|
|
107
|
-
"pinia": "^
|
|
108
|
-
"postcss": "^8.
|
|
107
|
+
"pinia": "^3.0.1",
|
|
108
|
+
"postcss": "^8.5.3",
|
|
109
109
|
"postcss-nested": "^7.0.2",
|
|
110
110
|
"punycode": "^2.3.1",
|
|
111
|
-
"release-it": "^18.1.
|
|
112
|
-
"typescript": "~5.
|
|
111
|
+
"release-it": "^18.1.2",
|
|
112
|
+
"typescript": "~5.7.3",
|
|
113
113
|
"v-calendar": "3.0.1",
|
|
114
|
-
"vite": "^6.0
|
|
115
|
-
"vitepress": "
|
|
116
|
-
"vitest": "
|
|
114
|
+
"vite": "^6.2.0",
|
|
115
|
+
"vitepress": ">=2.0.0-alpha.3",
|
|
116
|
+
"vitest": "^3.0.7",
|
|
117
117
|
"vue": "^3.5.13",
|
|
118
118
|
"vue-router": "^4.5.0",
|
|
119
|
-
"vue-tsc": "^2.2.
|
|
119
|
+
"vue-tsc": "^2.2.4"
|
|
120
120
|
}
|
|
121
121
|
}
|