@aerogel/core 0.1.1-next.9bd06e629f34098543a54bdb87e8996767876d42 → 0.1.1-next.a8a712e051e6729532e787aab3e4573464412909
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/aerogel-core.d.ts +129 -76
- package/dist/aerogel-core.js +1274 -1187
- package/dist/aerogel-core.js.map +1 -1
- package/package.json +2 -1
- package/src/components/AppLayout.vue +1 -1
- package/src/components/AppOverlays.vue +1 -1
- package/src/components/contracts/Button.ts +1 -1
- package/src/components/contracts/Modal.ts +2 -0
- package/src/components/contracts/Toast.ts +1 -1
- package/src/components/headless/HeadlessInputInput.vue +13 -5
- package/src/components/headless/HeadlessModal.vue +3 -12
- package/src/components/headless/HeadlessModalContent.vue +1 -1
- package/src/components/ui/AdvancedOptions.vue +4 -13
- package/src/components/ui/Button.vue +1 -0
- package/src/components/ui/Details.vue +33 -0
- package/src/components/ui/Input.vue +12 -4
- package/src/components/ui/LoadingModal.vue +1 -2
- package/src/components/ui/Modal.vue +32 -13
- package/src/components/ui/ProgressBar.vue +16 -2
- package/src/components/ui/SettingsModal.vue +1 -1
- package/src/components/ui/Toast.vue +1 -0
- package/src/components/ui/index.ts +1 -0
- package/src/errors/Errors.ts +4 -0
- package/src/forms/FormController.ts +4 -0
- package/src/index.css +10 -0
- package/src/services/App.state.ts +1 -0
- package/src/services/App.ts +4 -0
- package/src/services/index.ts +5 -0
- package/src/ui/UI.ts +2 -2
- package/src/ui/index.ts +1 -11
- package/src/ui/modals.ts +36 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/time.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aerogel/core",
|
|
3
|
-
"version": "0.1.1-next.
|
|
3
|
+
"version": "0.1.1-next.a8a712e051e6729532e787aab3e4573464412909",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"dompurify": "^3.2.4",
|
|
37
37
|
"eruda": "^3.4.1",
|
|
38
|
+
"eruda-indexeddb": "^0.1.1",
|
|
38
39
|
"marked": "^15.0.7",
|
|
39
40
|
"pinia": "^2.1.6",
|
|
40
41
|
"reka-ui": "^2.2.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="flex min-h-full flex-col text-base leading-tight font-normal
|
|
2
|
+
<div class="text-primary-text flex min-h-full flex-col text-base leading-tight font-normal antialiased">
|
|
3
3
|
<slot v-if="$errors.hasStartupErrors" name="startup-crash">
|
|
4
4
|
<component :is="$ui.requireComponent('startup-crash')" />
|
|
5
5
|
</slot>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PrimitiveProps } from 'reka-ui';
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
|
|
4
|
-
export type ButtonVariant = 'default' | 'secondary' | 'danger' | 'ghost' | 'outline' | 'link';
|
|
4
|
+
export type ButtonVariant = 'default' | 'secondary' | 'danger' | 'warning' | 'ghost' | 'outline' | 'link';
|
|
5
5
|
export type ButtonSize = 'default' | 'small' | 'large' | 'icon';
|
|
6
6
|
export interface ButtonProps extends PrimitiveProps {
|
|
7
7
|
class?: HTMLAttributes['class'];
|
|
@@ -19,6 +19,7 @@ import { computed, inject, useTemplateRef, watchEffect } from 'vue';
|
|
|
19
19
|
|
|
20
20
|
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
21
21
|
import { onFormFocus } from '@aerogel/core/utils/composition/forms';
|
|
22
|
+
import { LOCAL_TIMEZONE_OFFSET } from '@aerogel/core/utils';
|
|
22
23
|
import type FormController from '@aerogel/core/forms/FormController';
|
|
23
24
|
import type { FormFieldValue } from '@aerogel/core/forms/FormController';
|
|
24
25
|
import type { InputExpose } from '@aerogel/core/components/contracts/Input';
|
|
@@ -39,7 +40,7 @@ const renderedType = computed(() => {
|
|
|
39
40
|
return ['text', 'email', 'number', 'tel', 'url'].includes(fieldType) ? fieldType : 'text';
|
|
40
41
|
});
|
|
41
42
|
const checked = computed(() => {
|
|
42
|
-
if (
|
|
43
|
+
if (renderedType.value !== 'checkbox') {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -59,11 +60,15 @@ function getValue(): FormFieldValue | null {
|
|
|
59
60
|
return null;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
switch (
|
|
63
|
+
switch (renderedType.value) {
|
|
63
64
|
case 'checkbox':
|
|
64
65
|
return $input.value.checked;
|
|
65
66
|
case 'date':
|
|
66
|
-
|
|
67
|
+
case 'time':
|
|
68
|
+
case 'datetime-local':
|
|
69
|
+
return new Date(Math.round($input.value.valueAsNumber / 60000) * 60000 + LOCAL_TIMEZONE_OFFSET);
|
|
70
|
+
case 'number':
|
|
71
|
+
return $input.value.valueAsNumber;
|
|
67
72
|
default:
|
|
68
73
|
return $input.value.value;
|
|
69
74
|
}
|
|
@@ -75,8 +80,11 @@ watchEffect(() => {
|
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
if (
|
|
79
|
-
|
|
83
|
+
if (['date', 'time', 'datetime-local'].includes(renderedType.value) && value.value instanceof Date) {
|
|
84
|
+
const roundedValue = Math.round(value.value.getTime() / 60000) * 60000;
|
|
85
|
+
|
|
86
|
+
$input.value.valueAsNumber = roundedValue - LOCAL_TIMEZONE_OFFSET;
|
|
87
|
+
input.update(new Date(roundedValue));
|
|
80
88
|
|
|
81
89
|
return;
|
|
82
90
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<DialogRoot :ref="forwardRef" open @update:open="persistent || close()">
|
|
2
|
+
<DialogRoot :ref="forwardRef" open @update:open="persistent || $event || close()">
|
|
3
3
|
<DialogPortal>
|
|
4
4
|
<slot :close />
|
|
5
5
|
</DialogPortal>
|
|
@@ -7,18 +7,17 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script setup lang="ts" generic="T = void">
|
|
10
|
-
import { after } from '@noeldemartin/utils';
|
|
11
10
|
import { DialogPortal, DialogRoot, useForwardExpose } from 'reka-ui';
|
|
12
11
|
import { provide, ref } from 'vue';
|
|
13
|
-
import { useModal } from '@noeldemartin/vue-modals';
|
|
14
12
|
import type { DialogContent } from 'reka-ui';
|
|
15
13
|
import type { Nullable } from '@noeldemartin/utils';
|
|
16
14
|
|
|
15
|
+
import { useModal } from '@aerogel/core/ui/modals';
|
|
17
16
|
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
18
17
|
import type { ModalExpose, ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
19
18
|
|
|
20
19
|
const $content = ref<Nullable<InstanceType<typeof DialogContent>>>(null);
|
|
21
|
-
const
|
|
20
|
+
const { close } = useModal<T>();
|
|
22
21
|
|
|
23
22
|
defineProps<ModalProps>();
|
|
24
23
|
defineSlots<ModalSlots<T>>();
|
|
@@ -27,12 +26,4 @@ defineExpose<AcceptRefs<ModalExpose>>({ $content });
|
|
|
27
26
|
const { forwardRef } = useForwardExpose();
|
|
28
27
|
|
|
29
28
|
provide('$modalContentRef', $content);
|
|
30
|
-
|
|
31
|
-
async function close(result?: T) {
|
|
32
|
-
modal.close(result);
|
|
33
|
-
|
|
34
|
-
await after(1000);
|
|
35
|
-
|
|
36
|
-
modal.remove();
|
|
37
|
-
}
|
|
38
29
|
</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { useTemplateRef, watchEffect } from 'vue';
|
|
11
11
|
import { DialogContent } from 'reka-ui';
|
|
12
|
-
import { ModalComponent, useModal } from '@noeldemartin/vue-modals';
|
|
13
12
|
import type { Ref } from 'vue';
|
|
14
13
|
|
|
14
|
+
import { ModalComponent, useModal } from '@aerogel/core/ui/modals';
|
|
15
15
|
import { injectOrFail } from '@aerogel/core/utils/vue';
|
|
16
16
|
import type { ModalContentInstance } from '@aerogel/core/components/contracts/Modal';
|
|
17
17
|
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
>
|
|
6
|
-
<IconCheveronRight class="size-6 transition-transform group-open:rotate-90" />
|
|
7
|
-
<span>{{ $td('ui.advancedOptions', 'Advanced options') }}</span>
|
|
8
|
-
</summary>
|
|
9
|
-
|
|
10
|
-
<div class="pt-2 pl-4">
|
|
11
|
-
<slot />
|
|
12
|
-
</div>
|
|
13
|
-
</details>
|
|
2
|
+
<Details :label="$td('ui.advancedOptions', 'Advanced options')">
|
|
3
|
+
<slot />
|
|
4
|
+
</Details>
|
|
14
5
|
</template>
|
|
15
6
|
|
|
16
7
|
<script setup lang="ts">
|
|
17
|
-
import
|
|
8
|
+
import Details from './Details.vue';
|
|
18
9
|
</script>
|
|
@@ -25,6 +25,7 @@ const renderedClasses = computed(() => variantClasses<Variants<Pick<ButtonProps,
|
|
|
25
25
|
default: 'bg-primary-600 text-white focus-visible:outline-primary-600',
|
|
26
26
|
secondary: 'bg-background text-gray-900 ring-gray-300',
|
|
27
27
|
danger: 'bg-red-600 text-white focus-visible:outline-red-600',
|
|
28
|
+
warning: 'bg-yellow-600 text-white focus-visible:outline-yellow-600',
|
|
28
29
|
ghost: 'bg-transparent',
|
|
29
30
|
outline: 'bg-transparent text-primary-600 ring-primary-600',
|
|
30
31
|
link: 'text-links',
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<details class="group">
|
|
3
|
+
<summary :class="renderedSummaryClasses">
|
|
4
|
+
<IconCheveronRight class="size-6 transition-transform group-open:rotate-90" />
|
|
5
|
+
<slot name="label">
|
|
6
|
+
<span>{{ label ?? $td('ui.details', 'Details') }}</span>
|
|
7
|
+
</slot>
|
|
8
|
+
</summary>
|
|
9
|
+
|
|
10
|
+
<div :class="renderedContentClasses">
|
|
11
|
+
<slot />
|
|
12
|
+
</div>
|
|
13
|
+
</details>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
18
|
+
import { classes } from '@aerogel/core/utils';
|
|
19
|
+
import { type HTMLAttributes, computed } from 'vue';
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
label = undefined,
|
|
23
|
+
contentClass,
|
|
24
|
+
summaryClass,
|
|
25
|
+
} = defineProps<{ label?: string; contentClass?: HTMLAttributes['class']; summaryClass?: HTMLAttributes['class'] }>();
|
|
26
|
+
const renderedContentClasses = computed(() => classes('pt-2 pl-4', contentClass));
|
|
27
|
+
const renderedSummaryClasses = computed(() =>
|
|
28
|
+
classes(
|
|
29
|
+
'-ml-2 flex w-[max-content] items-center rounded-lg py-2 pr-3 pl-1 max-w-full',
|
|
30
|
+
'hover:bg-gray-100 focus-visible:outline focus-visible:outline-gray-700',
|
|
31
|
+
summaryClass,
|
|
32
|
+
));
|
|
33
|
+
</script>
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
<IconExclamationSolid class="size-5 text-red-500" />
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
|
-
<HeadlessInputDescription class="
|
|
17
|
-
<HeadlessInputError class="
|
|
16
|
+
<HeadlessInputDescription :class="renderedDescriptionClasses" />
|
|
17
|
+
<HeadlessInputError :class="renderedErrorClasses" />
|
|
18
18
|
</HeadlessInput>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
@@ -35,13 +35,21 @@ import type { InputEmits, InputProps } from '@aerogel/core/components/contracts/
|
|
|
35
35
|
|
|
36
36
|
defineOptions({ inheritAttrs: false });
|
|
37
37
|
defineEmits<InputEmits>();
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
|
|
39
|
+
const { label, inputClass, wrapperClass, descriptionClass, errorClass, ...props } = defineProps<
|
|
40
|
+
InputProps & {
|
|
41
|
+
inputClass?: HTMLAttributes['class'];
|
|
42
|
+
wrapperClass?: HTMLAttributes['class'];
|
|
43
|
+
descriptionClass?: HTMLAttributes['class'];
|
|
44
|
+
errorClass?: HTMLAttributes['class'];
|
|
45
|
+
}
|
|
40
46
|
>();
|
|
41
47
|
const $input = useTemplateRef('$inputRef');
|
|
42
48
|
const [inputAttrs, rootClasses] = useInputAttrs();
|
|
43
49
|
const renderedWrapperClasses = computed(() =>
|
|
44
50
|
classes('relative rounded-md shadow-2xs', { 'mt-1': label }, wrapperClass));
|
|
51
|
+
const renderedDescriptionClasses = computed(() => classes('mt-2 text-sm text-gray-600', descriptionClass));
|
|
52
|
+
const renderedErrorClasses = computed(() => classes('mt-2 text-sm text-red-600', errorClass));
|
|
45
53
|
const renderedInputClasses = computed(() =>
|
|
46
54
|
classes(
|
|
47
55
|
// eslint-disable-next-line vue/max-len
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Modal
|
|
3
3
|
persistent
|
|
4
|
-
class="flex"
|
|
5
4
|
wrapper-class="w-auto"
|
|
6
5
|
:title="renderedTitle"
|
|
7
6
|
:title-hidden
|
|
8
|
-
:class="{ 'flex-col-reverse': showProgress, 'items-center justify-center gap-2': !showProgress }"
|
|
7
|
+
:class="{ 'flex-col-reverse': showProgress, 'flex-row items-center justify-center gap-2': !showProgress }"
|
|
9
8
|
>
|
|
10
9
|
<ProgressBar
|
|
11
10
|
v-if="showProgress"
|
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
'animate-[fade-in_var(--tw-duration)_ease-in-out]': !hasRenderedModals,
|
|
13
13
|
'bg-black/30': firstVisibleModal?.id === id || (!firstVisibleModal && modals[0]?.id === id),
|
|
14
14
|
'opacity-0': !firstVisibleModal,
|
|
15
|
+
hidden: renderFullscreen,
|
|
15
16
|
}"
|
|
16
17
|
/>
|
|
17
18
|
<HeadlessModalContent v-bind="contentProps" :class="renderedWrapperClass">
|
|
18
|
-
<div
|
|
19
|
+
<div
|
|
20
|
+
v-if="!persistent && !closeHidden"
|
|
21
|
+
class="absolute top-0 right-0 pt-3.5 pr-2.5"
|
|
22
|
+
:class="{ 'hidden sm:block': !renderFullscreen }"
|
|
23
|
+
>
|
|
19
24
|
<button
|
|
20
25
|
type="button"
|
|
21
26
|
class="clickable z-10 rounded-full p-2.5 text-gray-400 hover:text-gray-500"
|
|
@@ -58,8 +63,6 @@ import IconClose from '~icons/zondicons/close';
|
|
|
58
63
|
|
|
59
64
|
import { useForwardExpose } from 'reka-ui';
|
|
60
65
|
import { computed, onMounted } from 'vue';
|
|
61
|
-
import { injectModal, modals, useModal } from '@noeldemartin/vue-modals';
|
|
62
|
-
import type { ModalController } from '@noeldemartin/vue-modals';
|
|
63
66
|
import type { ComponentPublicInstance, HTMLAttributes, Ref } from 'vue';
|
|
64
67
|
import { type Nullable, after } from '@noeldemartin/utils';
|
|
65
68
|
|
|
@@ -69,8 +72,11 @@ import HeadlessModalContent from '@aerogel/core/components/headless/HeadlessModa
|
|
|
69
72
|
import HeadlessModalDescription from '@aerogel/core/components/headless/HeadlessModalDescription.vue';
|
|
70
73
|
import HeadlessModalOverlay from '@aerogel/core/components/headless/HeadlessModalOverlay.vue';
|
|
71
74
|
import HeadlessModalTitle from '@aerogel/core/components/headless/HeadlessModalTitle.vue';
|
|
75
|
+
import UI from '@aerogel/core/ui/UI';
|
|
72
76
|
import { classes } from '@aerogel/core/utils/classes';
|
|
73
77
|
import { reactiveSet } from '@aerogel/core/utils';
|
|
78
|
+
import { injectModal, modals, useModal } from '@aerogel/core/ui/modals';
|
|
79
|
+
import type { ModalController } from '@aerogel/core/ui/modals';
|
|
74
80
|
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
75
81
|
import type { ModalExpose, ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
76
82
|
|
|
@@ -88,6 +94,8 @@ const {
|
|
|
88
94
|
description,
|
|
89
95
|
persistent,
|
|
90
96
|
closeHidden,
|
|
97
|
+
fullscreen,
|
|
98
|
+
fullscreenOnMobile,
|
|
91
99
|
...props
|
|
92
100
|
} = defineProps<
|
|
93
101
|
ModalProps & {
|
|
@@ -113,18 +121,29 @@ const firstVisibleModal = computed(() => modals.value.find((modal) => modal.visi
|
|
|
113
121
|
const hasRenderedModals = computed(() => modals.value.some((modal) => renderedModals.has(modal)));
|
|
114
122
|
const contentProps = computed(() => (description ? {} : { 'aria-describedby': undefined }));
|
|
115
123
|
const renderedContentClass = computed(() =>
|
|
116
|
-
classes(
|
|
124
|
+
classes(
|
|
125
|
+
'overflow-auto px-4 pb-4 flex flex-col flex-1',
|
|
126
|
+
{ 'pt-4': !title || titleHidden, 'max-h-[90vh]': !renderFullscreen.value },
|
|
127
|
+
contentClass,
|
|
128
|
+
));
|
|
129
|
+
const renderFullscreen = computed(() => fullscreen || (fullscreenOnMobile && UI.mobile));
|
|
117
130
|
const renderedWrapperClass = computed(() =>
|
|
118
131
|
classes(
|
|
119
|
-
'isolate fixed
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
'isolate fixed z-50 flex flex-col overflow-hidden bg-white text-left duration-300',
|
|
133
|
+
renderFullscreen.value
|
|
134
|
+
? [
|
|
135
|
+
'inset-0 transition-[transform,translate] will-change-[transform,translate]',
|
|
136
|
+
renderedModals.has(modal.value) || 'animate-[slide-in_var(--tw-duration)_ease-in-out]',
|
|
137
|
+
inForeground.value ? 'translate-y-0' : 'translate-y-full',
|
|
138
|
+
]
|
|
139
|
+
: [
|
|
140
|
+
'top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full',
|
|
141
|
+
'max-w-[calc(100%-2rem)] rounded-lg shadow-xl sm:max-w-lg',
|
|
142
|
+
'transition-[scale,opacity] will-change-[scale,opacity]',
|
|
143
|
+
renderedModals.has(modal.value) ||
|
|
144
|
+
'animate-[fade-in_var(--tw-duration)_ease-in-out,grow_var(--tw-duration)_ease-in-out]',
|
|
145
|
+
inForeground.value ? 'scale-100 opacity-100' : 'scale-50 opacity-0',
|
|
146
|
+
],
|
|
128
147
|
wrapperClass,
|
|
129
148
|
));
|
|
130
149
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="mt-1 h-2 w-full overflow-hidden rounded-full bg-gray-200">
|
|
2
|
+
<div class="relative mt-1 h-2 w-full overflow-hidden rounded-full bg-gray-200">
|
|
3
3
|
<div :class="filledClasses" :style="`transform:translateX(-${(1 - renderedProgress) * 100}%)`" />
|
|
4
|
+
<div
|
|
5
|
+
v-if="overflowWidthPercentage"
|
|
6
|
+
:class="overflowClasses"
|
|
7
|
+
:style="{ width: `${overflowWidthPercentage}%` }"
|
|
8
|
+
/>
|
|
4
9
|
<span class="sr-only">
|
|
5
10
|
{{
|
|
6
11
|
$td('ui.progress', '{progress}% complete', {
|
|
@@ -18,8 +23,9 @@ import { classes } from '@aerogel/core/utils/classes';
|
|
|
18
23
|
import type Job from '@aerogel/core/jobs/Job';
|
|
19
24
|
import type { Falsifiable } from '@aerogel/core/utils';
|
|
20
25
|
|
|
21
|
-
const { filledClass, progress, job } = defineProps<{
|
|
26
|
+
const { filledClass, overflowClass, progress, job } = defineProps<{
|
|
22
27
|
filledClass?: string;
|
|
28
|
+
overflowClass?: string;
|
|
23
29
|
progress?: number;
|
|
24
30
|
job?: Falsifiable<Job>;
|
|
25
31
|
}>();
|
|
@@ -28,6 +34,12 @@ let cleanup: Falsifiable<Function>;
|
|
|
28
34
|
const jobProgress = ref(0);
|
|
29
35
|
const filledClasses = computed(() =>
|
|
30
36
|
classes('size-full transition-transform duration-500 rounded-r-full ease-linear bg-primary-600', filledClass));
|
|
37
|
+
const overflowClasses = computed(() =>
|
|
38
|
+
classes(
|
|
39
|
+
'absolute inset-y-0 right-0 size-full rounded-r-full',
|
|
40
|
+
'bg-primary-900 transition-[width] duration-500 ease-linear',
|
|
41
|
+
overflowClass,
|
|
42
|
+
));
|
|
31
43
|
const renderedProgress = computed(() => {
|
|
32
44
|
if (typeof progress === 'number') {
|
|
33
45
|
return progress;
|
|
@@ -35,6 +47,8 @@ const renderedProgress = computed(() => {
|
|
|
35
47
|
|
|
36
48
|
return jobProgress.value;
|
|
37
49
|
});
|
|
50
|
+
const overflowWidthPercentage = computed(() =>
|
|
51
|
+
renderedProgress.value > 1 ? 100 * ((renderedProgress.value - 1) / renderedProgress.value) : null);
|
|
38
52
|
|
|
39
53
|
watch(
|
|
40
54
|
() => job,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Modal :title="$td('settings.title', 'Settings')">
|
|
2
|
+
<Modal :title="$td('settings.title', 'Settings')" :fullscreen-on-mobile="$app.settingsFullscreenOnMobile">
|
|
3
3
|
<component :is="setting.component" v-for="(setting, key) in settings" :key />
|
|
4
4
|
</Modal>
|
|
5
5
|
</template>
|
|
@@ -3,6 +3,7 @@ export { default as AlertModal } from './AlertModal.vue';
|
|
|
3
3
|
export { default as Button } from './Button.vue';
|
|
4
4
|
export { default as Checkbox } from './Checkbox.vue';
|
|
5
5
|
export { default as ConfirmModal } from './ConfirmModal.vue';
|
|
6
|
+
export { default as Details } from './Details.vue';
|
|
6
7
|
export { default as DropdownMenu } from './DropdownMenu.vue';
|
|
7
8
|
export { default as DropdownMenuOption } from './DropdownMenuOption.vue';
|
|
8
9
|
export { default as DropdownMenuOptions } from './DropdownMenuOptions.vue';
|
package/src/errors/Errors.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSError, facade, isDevelopment, isObject, isTesting, objectWithoutEmpty, toString } from '@noeldemartin/utils';
|
|
2
2
|
import { watchEffect } from 'vue';
|
|
3
3
|
import type Eruda from 'eruda';
|
|
4
|
+
import type ErudaIndexedDB from 'eruda-indexeddb';
|
|
4
5
|
|
|
5
6
|
import App from '@aerogel/core/services/App';
|
|
6
7
|
import ServiceBootError from '@aerogel/core/errors/ServiceBootError';
|
|
@@ -16,6 +17,7 @@ export class ErrorsService extends Service {
|
|
|
16
17
|
public forceReporting: boolean = false;
|
|
17
18
|
private enabled: boolean = true;
|
|
18
19
|
private eruda: typeof Eruda | null = null;
|
|
20
|
+
private erudaPlugins: [typeof ErudaIndexedDB] | null = null;
|
|
19
21
|
|
|
20
22
|
public enable(): void {
|
|
21
23
|
this.enabled = true;
|
|
@@ -131,8 +133,10 @@ export class ErrorsService extends Service {
|
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
this.eruda ??= (await import('eruda')).default;
|
|
136
|
+
this.erudaPlugins ??= [(await import('eruda-indexeddb')).default];
|
|
134
137
|
|
|
135
138
|
this.eruda.init();
|
|
139
|
+
this.erudaPlugins.forEach((plugin) => this.eruda?.add(plugin));
|
|
136
140
|
});
|
|
137
141
|
}
|
|
138
142
|
|
|
@@ -112,6 +112,10 @@ export default class FormController<Fields extends FormFieldDefinitions = FormFi
|
|
|
112
112
|
return this._fields[field]?.rules?.split('|') ?? [];
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
public setFieldErrors<T extends keyof Fields>(field: T, errors: string[] | null): void {
|
|
116
|
+
this._errors[field] = errors;
|
|
117
|
+
}
|
|
118
|
+
|
|
115
119
|
public getFieldType<T extends keyof Fields>(field: T): FormFieldType | null {
|
|
116
120
|
return this._fields[field]?.type ?? null;
|
|
117
121
|
}
|
package/src/index.css
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
--color-primary-950: color-mix(in oklab, var(--color-primary-600) 50%, black);
|
|
21
21
|
|
|
22
22
|
--color-background: oklch(1 0 0);
|
|
23
|
+
--color-primary-text: var(--color-gray-900);
|
|
23
24
|
--color-links: var(--color-primary);
|
|
24
25
|
|
|
25
26
|
--breakpoint-content: var(--breakpoint-md);
|
|
@@ -66,6 +67,15 @@ button[data-markdown-action] {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
@keyframes slide-in {
|
|
71
|
+
0% {
|
|
72
|
+
transform: translateY(100%);
|
|
73
|
+
}
|
|
74
|
+
100% {
|
|
75
|
+
transform: translateY(0);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
@keyframes grow {
|
|
70
80
|
0% {
|
|
71
81
|
scale: 0;
|
package/src/services/App.ts
CHANGED
|
@@ -30,6 +30,10 @@ export class AppService extends Service {
|
|
|
30
30
|
this.settings.push(markRaw(setting));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
public setSettingsFullscreenOnMobile(fullscreenOnMobile: boolean): void {
|
|
34
|
+
this.settingsFullscreenOnMobile = fullscreenOnMobile;
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
public async whenReady<T>(callback: () => T): Promise<T> {
|
|
34
38
|
const result = await this.ready.then(callback);
|
|
35
39
|
|
package/src/services/index.ts
CHANGED
|
@@ -56,6 +56,10 @@ export default definePlugin({
|
|
|
56
56
|
app.use(getPiniaStore());
|
|
57
57
|
options.settings?.forEach((setting) => App.addSetting(setting));
|
|
58
58
|
|
|
59
|
+
if (options.settingsFullscreenOnMobile !== undefined) {
|
|
60
|
+
App.setSettingsFullscreenOnMobile(options.settingsFullscreenOnMobile);
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
await bootServices(app, services);
|
|
60
64
|
},
|
|
61
65
|
});
|
|
@@ -64,6 +68,7 @@ declare module '@aerogel/core/bootstrap/options' {
|
|
|
64
68
|
export interface AerogelOptions {
|
|
65
69
|
services?: Record<string, Service>;
|
|
66
70
|
settings?: AppSetting[];
|
|
71
|
+
settingsFullscreenOnMobile?: boolean;
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
|
package/src/ui/UI.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { after, facade, fail, isDevelopment, uuid } from '@noeldemartin/utils';
|
|
2
2
|
import { markRaw, unref } from 'vue';
|
|
3
|
-
import { closeModal, createModal, modals, showModal } from '@noeldemartin/vue-modals';
|
|
4
3
|
import type { Constructor } from '@noeldemartin/utils';
|
|
5
4
|
import type { Component, ComputedOptions, MethodOptions } from 'vue';
|
|
6
|
-
import type { GetModalProps, GetModalResponse } from '@noeldemartin/vue-modals';
|
|
7
5
|
|
|
8
6
|
import Events from '@aerogel/core/services/Events';
|
|
7
|
+
import { closeModal, createModal, modals, showModal } from '@aerogel/core/ui/modals';
|
|
8
|
+
import type { GetModalProps, GetModalResponse } from '@aerogel/core/ui/modals';
|
|
9
9
|
import type { AcceptRefs } from '@aerogel/core/utils';
|
|
10
10
|
import type { AlertModalExpose, AlertModalProps } from '@aerogel/core/components/contracts/AlertModal';
|
|
11
11
|
import type { ButtonVariant } from '@aerogel/core/components/contracts/Button';
|
package/src/ui/index.ts
CHANGED
|
@@ -14,20 +14,10 @@ import type { Component } from 'vue';
|
|
|
14
14
|
|
|
15
15
|
const services = { $ui: UI };
|
|
16
16
|
|
|
17
|
+
export * from './modals';
|
|
17
18
|
export * from './UI';
|
|
18
19
|
export * from './utils';
|
|
19
20
|
export { default as UI } from './UI';
|
|
20
|
-
export {
|
|
21
|
-
useModal,
|
|
22
|
-
createModal,
|
|
23
|
-
showModal,
|
|
24
|
-
closeModal,
|
|
25
|
-
modals,
|
|
26
|
-
ModalComponent,
|
|
27
|
-
ModalsPortal,
|
|
28
|
-
type GetModalProps,
|
|
29
|
-
type GetModalResponse,
|
|
30
|
-
} from '@noeldemartin/vue-modals';
|
|
31
21
|
|
|
32
22
|
export type UIServices = typeof services;
|
|
33
23
|
|
package/src/ui/modals.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { after } from '@noeldemartin/utils';
|
|
2
|
+
import { injectModal, useModal as useModalBase } from '@noeldemartin/vue-modals';
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
createModal,
|
|
6
|
+
showModal,
|
|
7
|
+
injectModal,
|
|
8
|
+
closeModal,
|
|
9
|
+
modals,
|
|
10
|
+
ModalComponent,
|
|
11
|
+
ModalsPortal,
|
|
12
|
+
type GetModalProps,
|
|
13
|
+
type GetModalResponse,
|
|
14
|
+
type ModalController,
|
|
15
|
+
} from '@noeldemartin/vue-modals';
|
|
16
|
+
|
|
17
|
+
const instances = new WeakSet();
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
20
|
+
export function useModal<T = never>() {
|
|
21
|
+
const instance = injectModal<T>();
|
|
22
|
+
const { close, remove, ...modal } = useModalBase<T>(instances.has(instance) ? {} : { removeOnClose: false });
|
|
23
|
+
|
|
24
|
+
instances.add(instance);
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
...modal,
|
|
28
|
+
async close(result?: T) {
|
|
29
|
+
close(result);
|
|
30
|
+
|
|
31
|
+
await after(1000);
|
|
32
|
+
|
|
33
|
+
remove();
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
package/src/utils/index.ts
CHANGED