@globalbrain/sefirot 3.47.1 → 3.49.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.
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import IconCheckCircleFill from '@iconify-icons/ph/check-circle-fill'
|
|
3
|
+
import IconCircle from '@iconify-icons/ph/circle-bold'
|
|
4
|
+
import IconCircleDashed from '@iconify-icons/ph/circle-dashed-bold'
|
|
5
|
+
import IconCircleNotch from '@iconify-icons/ph/circle-notch-bold'
|
|
6
|
+
import IconXCircle from '@iconify-icons/ph/x-circle-bold'
|
|
7
|
+
import { computed } from 'vue'
|
|
8
|
+
import SIcon from './SIcon.vue'
|
|
9
|
+
|
|
10
|
+
export type Size = 'nano' | 'mini' | 'small' | 'medium' | 'large' | 'jumbo'
|
|
11
|
+
export type State = 'pending' | 'ready' | 'queued' | 'running' | 'completed' | 'failed'
|
|
12
|
+
export type Mode = 'colored' | 'monochrome'
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<{
|
|
15
|
+
size?: Size
|
|
16
|
+
state: State
|
|
17
|
+
mode?: Mode
|
|
18
|
+
}>(), {
|
|
19
|
+
size: 'medium',
|
|
20
|
+
mode: 'colored'
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const classes = computed(() => [
|
|
24
|
+
props.size,
|
|
25
|
+
props.state,
|
|
26
|
+
props.mode
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
const stateIconDict = {
|
|
30
|
+
pending: IconCircle,
|
|
31
|
+
ready: IconCircle,
|
|
32
|
+
queued: IconCircleDashed,
|
|
33
|
+
running: IconCircleNotch,
|
|
34
|
+
completed: IconCheckCircleFill,
|
|
35
|
+
failed: IconXCircle
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div class="SIndicator" :class="classes">
|
|
41
|
+
<SIcon class="icon" :icon="stateIconDict[state]" />
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<style scoped lang="postcss">
|
|
46
|
+
@keyframes indicator-blink {
|
|
47
|
+
0% { opacity: 1; }
|
|
48
|
+
50% { opacity: 0.5; }
|
|
49
|
+
100% { opacity: 1; }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@keyframes indicator-spin {
|
|
53
|
+
0% { transform: rotate(0deg); }
|
|
54
|
+
100% { transform: rotate(360deg); }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.icon {
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.SIndicator.nano { width: 20px; height: 20px; }
|
|
63
|
+
.SIndicator.mini { width: 24px; height: 24px; }
|
|
64
|
+
.SIndicator.small { width: 28px; height: 28px; }
|
|
65
|
+
.SIndicator.medium { width: 32px; height: 32px; }
|
|
66
|
+
.SIndicator.large { width: 40px; height: 40px; }
|
|
67
|
+
.SIndicator.jumbo { width: 48px; height: 48px; }
|
|
68
|
+
|
|
69
|
+
.SIndicator.queued {
|
|
70
|
+
animation: indicator-blink 1.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.SIndicator.running {
|
|
74
|
+
animation: indicator-spin 1.5s linear infinite;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.SIndicator.colored {
|
|
78
|
+
&.pending { color: var(--c-fg-gray-1); }
|
|
79
|
+
&.ready { color: var(--c-fg-info-1); }
|
|
80
|
+
&.queued { color: var(--c-fg-info-1); }
|
|
81
|
+
&.running { color: var(--c-fg-info-1); }
|
|
82
|
+
&.completed { color: var(--c-fg-success-1); }
|
|
83
|
+
&.failed { color: var(--c-fg-danger-1); }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.SIndicator.monochrome {
|
|
87
|
+
color: var(--c-fg-gray-1);
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -8,7 +8,7 @@ import SInputSegments from './SInputSegments.vue'
|
|
|
8
8
|
export type Size = 'mini' | 'small' | 'medium'
|
|
9
9
|
export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
10
10
|
|
|
11
|
-
const props = defineProps<{
|
|
11
|
+
const props = withDefaults(defineProps<{
|
|
12
12
|
size?: Size
|
|
13
13
|
name?: string
|
|
14
14
|
label?: string
|
|
@@ -21,6 +21,7 @@ const props = defineProps<{
|
|
|
21
21
|
placeholder?: string
|
|
22
22
|
disabled?: boolean
|
|
23
23
|
rows?: number | 'fill'
|
|
24
|
+
autoResize?: boolean | number
|
|
24
25
|
value?: string | null
|
|
25
26
|
modelValue?: string | null
|
|
26
27
|
hideError?: boolean
|
|
@@ -28,7 +29,10 @@ const props = defineProps<{
|
|
|
28
29
|
preview?: (value: string | null) => string
|
|
29
30
|
previewLabel?: string
|
|
30
31
|
writeLabel?: string
|
|
31
|
-
}>()
|
|
32
|
+
}>(), {
|
|
33
|
+
size: 'small',
|
|
34
|
+
rows: 3
|
|
35
|
+
})
|
|
32
36
|
|
|
33
37
|
const emit = defineEmits<{
|
|
34
38
|
(e: 'update:model-value', value: string | null): void
|
|
@@ -36,6 +40,12 @@ const emit = defineEmits<{
|
|
|
36
40
|
(e: 'blur', value: string | null): void
|
|
37
41
|
}>()
|
|
38
42
|
|
|
43
|
+
const sizePaddingYDict = {
|
|
44
|
+
mini: 12,
|
|
45
|
+
small: 14,
|
|
46
|
+
medium: 22
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
const _value = computed(() => {
|
|
40
50
|
return props.modelValue !== undefined
|
|
41
51
|
? props.modelValue
|
|
@@ -43,11 +53,26 @@ const _value = computed(() => {
|
|
|
43
53
|
})
|
|
44
54
|
|
|
45
55
|
const classes = computed(() => [
|
|
46
|
-
props.size
|
|
56
|
+
props.size,
|
|
47
57
|
{ disabled: props.disabled },
|
|
48
58
|
{ fill: props.rows === 'fill' }
|
|
49
59
|
])
|
|
50
60
|
|
|
61
|
+
const style = computed(() => {
|
|
62
|
+
if (!props.autoResize) {
|
|
63
|
+
return undefined
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const rows = props.rows === 'fill' ? 3 : props.rows
|
|
67
|
+
const padding = sizePaddingYDict[props.size]
|
|
68
|
+
const fontSize = 24
|
|
69
|
+
|
|
70
|
+
const minHeight = `min-height: ${rows * fontSize + padding}px;`
|
|
71
|
+
const maxHeight = props.autoResize === true ? '' : `max-height: calc(${props.autoResize}lh + ${padding}px);`
|
|
72
|
+
|
|
73
|
+
return `field-sizing:content;${minHeight}${maxHeight}`
|
|
74
|
+
})
|
|
75
|
+
|
|
51
76
|
function emitInput(e: Event): void {
|
|
52
77
|
const v = (e.target as HTMLInputElement).value || null
|
|
53
78
|
emit('update:model-value', v)
|
|
@@ -95,8 +120,9 @@ const isPreview = ref(false)
|
|
|
95
120
|
v-show="!isPreview"
|
|
96
121
|
:id="name"
|
|
97
122
|
class="input"
|
|
123
|
+
:style="style"
|
|
98
124
|
:placeholder="placeholder"
|
|
99
|
-
:rows="rows
|
|
125
|
+
:rows="rows === 'fill' ? 3 : rows"
|
|
100
126
|
:disabled="disabled"
|
|
101
127
|
:value="_value ?? undefined"
|
|
102
128
|
@input="emitInput"
|
|
@@ -172,7 +198,7 @@ const isPreview = ref(false)
|
|
|
172
198
|
.prose {
|
|
173
199
|
padding: 6px 10px;
|
|
174
200
|
width: 100%;
|
|
175
|
-
min-height:
|
|
201
|
+
min-height: 30px;
|
|
176
202
|
line-height: 20px;
|
|
177
203
|
font-size: var(--input-font-size, var(--input-mini-font-size));
|
|
178
204
|
}
|
|
@@ -183,7 +209,7 @@ const isPreview = ref(false)
|
|
|
183
209
|
.prose {
|
|
184
210
|
padding: 7px 12px;
|
|
185
211
|
width: 100%;
|
|
186
|
-
min-height:
|
|
212
|
+
min-height: 38px;
|
|
187
213
|
line-height: 24px;
|
|
188
214
|
font-size: var(--input-font-size, var(--input-small-font-size));
|
|
189
215
|
}
|
|
@@ -194,7 +220,7 @@ const isPreview = ref(false)
|
|
|
194
220
|
.prose {
|
|
195
221
|
padding: 11px 16px;
|
|
196
222
|
width: 100%;
|
|
197
|
-
min-height:
|
|
223
|
+
min-height: 46px;
|
|
198
224
|
line-height: 24px;
|
|
199
225
|
font-size: var(--input-font-size, var(--input-medium-font-size));
|
|
200
226
|
}
|
|
@@ -204,12 +230,6 @@ const isPreview = ref(false)
|
|
|
204
230
|
display: flex;
|
|
205
231
|
flex-direction: column;
|
|
206
232
|
flex-grow: 1;
|
|
207
|
-
height: 100%;
|
|
208
|
-
|
|
209
|
-
.input,
|
|
210
|
-
.prose {
|
|
211
|
-
height: 100%;
|
|
212
|
-
}
|
|
213
233
|
}
|
|
214
234
|
|
|
215
235
|
.SInputTextarea.disabled {
|
package/lib/composables/Error.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapted from
|
|
3
|
-
* @see https://github.com/vuejs/core/blob/
|
|
4
|
-
* @see https://github.com/vuejs/core/blob/
|
|
3
|
+
* @see https://github.com/vuejs/core/blob/8d606c44ece5a9940ede05513f844f698d082589/packages/runtime-core/src/component.ts
|
|
4
|
+
* @see https://github.com/vuejs/core/blob/cdb1d1795d21591659e2560e201ee4fbf1ea4aca/packages/runtime-core/src/warning.ts
|
|
5
5
|
* @see https://github.com/getsentry/sentry-javascript/blob/2cfb0ef3fa5c40f90c317267a4d10b969994d021/packages/vue/src/errorhandler.ts
|
|
6
|
+
* @see https://github.com/vercel/ai/blob/d544886d4f61440bacd6e44c86144bfac7c98282/packages/provider-utils/src/get-error-message.ts#L12
|
|
6
7
|
*
|
|
7
8
|
* Original licenses:
|
|
8
9
|
*
|
|
@@ -11,6 +12,9 @@
|
|
|
11
12
|
*
|
|
12
13
|
* (c) 2019 Sentry (https://sentry.io) and individual contributors
|
|
13
14
|
* @license MIT
|
|
15
|
+
*
|
|
16
|
+
* (c) 2023 Vercel, Inc.
|
|
17
|
+
* @license Apache-2.0
|
|
14
18
|
*/
|
|
15
19
|
|
|
16
20
|
import * as Sentry from '@sentry/browser'
|
|
@@ -136,6 +140,12 @@ function formatProps(props: Record<string, unknown>): string {
|
|
|
136
140
|
.join(' ')
|
|
137
141
|
}
|
|
138
142
|
|
|
143
|
+
const ignoreErrors = [
|
|
144
|
+
/Network Error/,
|
|
145
|
+
/Non-Error (?:exception|promise rejection) captured/,
|
|
146
|
+
/ResizeObserver loop/
|
|
147
|
+
]
|
|
148
|
+
|
|
139
149
|
export function useErrorHandler({
|
|
140
150
|
dsn,
|
|
141
151
|
environment,
|
|
@@ -147,6 +157,14 @@ export function useErrorHandler({
|
|
|
147
157
|
}) {
|
|
148
158
|
const error = useError()
|
|
149
159
|
|
|
160
|
+
function set(value: any) {
|
|
161
|
+
const message = getErrorMessage(value)
|
|
162
|
+
if (ignoreErrors.some((ignore) => ignore.test(message))) {
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
error.set(value)
|
|
166
|
+
}
|
|
167
|
+
|
|
150
168
|
const enabled = !!dsn && import.meta.env.PROD
|
|
151
169
|
|
|
152
170
|
// No need to manually report these errors as they are automatically
|
|
@@ -154,22 +172,15 @@ export function useErrorHandler({
|
|
|
154
172
|
// onMounted because it's not available outside component lifecycle.
|
|
155
173
|
if (typeof document !== 'undefined') {
|
|
156
174
|
addEventListener('error', (event) => {
|
|
157
|
-
|
|
175
|
+
set(event.error)
|
|
158
176
|
})
|
|
159
177
|
addEventListener('unhandledrejection', (event) => {
|
|
160
|
-
|
|
178
|
+
set(event.reason)
|
|
161
179
|
})
|
|
162
180
|
}
|
|
163
181
|
|
|
164
182
|
if (enabled) {
|
|
165
|
-
Sentry.init({
|
|
166
|
-
dsn,
|
|
167
|
-
environment,
|
|
168
|
-
ignoreErrors: [
|
|
169
|
-
'ResizeObserver loop limit exceeded',
|
|
170
|
-
'ResizeObserver loop completed with undelivered notifications'
|
|
171
|
-
]
|
|
172
|
-
})
|
|
183
|
+
Sentry.init({ dsn, environment, ignoreErrors })
|
|
173
184
|
}
|
|
174
185
|
|
|
175
186
|
return function errorHandler(
|
|
@@ -177,7 +188,7 @@ export function useErrorHandler({
|
|
|
177
188
|
instance: ComponentPublicInstance | null = null,
|
|
178
189
|
info: string = ''
|
|
179
190
|
) {
|
|
180
|
-
|
|
191
|
+
set(e)
|
|
181
192
|
|
|
182
193
|
if (enabled) {
|
|
183
194
|
pauseTracking()
|
|
@@ -211,3 +222,19 @@ export function useErrorHandler({
|
|
|
211
222
|
}
|
|
212
223
|
}
|
|
213
224
|
}
|
|
225
|
+
|
|
226
|
+
function getErrorMessage(error: unknown | undefined) {
|
|
227
|
+
if (error == null) {
|
|
228
|
+
return 'unknown error'
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (typeof error === 'string') {
|
|
232
|
+
return error
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (error instanceof Error) {
|
|
236
|
+
return error.message
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return JSON.stringify(error)
|
|
240
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isString } from '../../support/Utils'
|
|
2
2
|
|
|
3
3
|
/* eslint-disable-next-line no-control-regex */
|
|
4
|
-
const regExp = /^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|[\x01-\x09\x0B\x0C\x0E-\x7F])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21-\x5A\x53-\x7F]|\\[\x01-\x09\x0B\x0C\x0E-\x7F])+)\])$/i
|
|
4
|
+
const regExp = /^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|[\x01-\x09\x0B\x0C\x0E-\x7F])*")@(?:(?:[a-z0-9](?:[a-z0-9-_]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21-\x5A\x53-\x7F]|\\[\x01-\x09\x0B\x0C\x0E-\x7F])+)\])$/i
|
|
5
5
|
|
|
6
6
|
export function email(value: unknown): boolean {
|
|
7
7
|
if (!isString(value)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.49.0",
|
|
4
4
|
"packageManager": "pnpm@9.1.1",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@vuelidate/validators": "^2.0.4",
|
|
53
53
|
"@vueuse/core": "^10.9.0",
|
|
54
54
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
55
|
+
"dayjs": "^1.11.11",
|
|
55
56
|
"fuse.js": "^7.0.0",
|
|
56
57
|
"lodash-es": "^4.17.21",
|
|
57
58
|
"markdown-it": "^14.1.0",
|
|
@@ -70,7 +71,6 @@
|
|
|
70
71
|
"@tinyhttp/cookie": "^2.1.0",
|
|
71
72
|
"@types/file-saver": "^2.0.7",
|
|
72
73
|
"@types/qs": "^6.9.15",
|
|
73
|
-
"dayjs": "^1.11.11",
|
|
74
74
|
"file-saver": "^2.0.5",
|
|
75
75
|
"ofetch": "^1.3.4",
|
|
76
76
|
"qs": "^6.12.1"
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"@vuelidate/validators": "^2.0.4",
|
|
96
96
|
"@vueuse/core": "^10.9.0",
|
|
97
97
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
98
|
+
"dayjs": "^1.11.11",
|
|
98
99
|
"eslint": "^8.57.0",
|
|
99
100
|
"fuse.js": "^7.0.0",
|
|
100
101
|
"happy-dom": "^14.10.2",
|