@aerogel/core 0.1.1-next.a33efa4fd6560f7df50d8a64a9e9e2a2f62e79bb → 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 +18 -7
- package/dist/aerogel-core.js +1000 -961
- package/dist/aerogel-core.js.map +1 -1
- package/package.json +2 -1
- package/src/components/AppLayout.vue +1 -1
- package/src/components/contracts/Modal.ts +1 -1
- package/src/components/ui/Details.vue +19 -6
- package/src/components/ui/Input.vue +12 -4
- package/src/components/ui/LoadingModal.vue +1 -2
- package/src/components/ui/Modal.vue +8 -4
- package/src/components/ui/ProgressBar.vue +16 -2
- package/src/components/ui/SettingsModal.vue +1 -1
- package/src/errors/Errors.ts +4 -0
- package/src/index.css +1 -0
- package/src/services/App.state.ts +1 -0
- package/src/services/App.ts +4 -0
- package/src/services/index.ts +5 -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>
|
|
@@ -6,7 +6,7 @@ export type ModalContentInstance = Nullable<InstanceType<typeof DialogContent>>;
|
|
|
6
6
|
export interface ModalProps {
|
|
7
7
|
persistent?: boolean;
|
|
8
8
|
fullscreen?: boolean;
|
|
9
|
-
|
|
9
|
+
fullscreenOnMobile?: boolean;
|
|
10
10
|
title?: string;
|
|
11
11
|
titleHidden?: boolean;
|
|
12
12
|
description?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<details class="group">
|
|
3
|
-
<summary
|
|
4
|
-
class="-ml-2 flex w-[max-content] items-center rounded-lg py-2 pr-3 pl-1 hover:bg-gray-100 focus-visible:outline focus-visible:outline-gray-700"
|
|
5
|
-
>
|
|
3
|
+
<summary :class="renderedSummaryClasses">
|
|
6
4
|
<IconCheveronRight class="size-6 transition-transform group-open:rotate-90" />
|
|
7
|
-
<
|
|
5
|
+
<slot name="label">
|
|
6
|
+
<span>{{ label ?? $td('ui.details', 'Details') }}</span>
|
|
7
|
+
</slot>
|
|
8
8
|
</summary>
|
|
9
9
|
|
|
10
|
-
<div class="
|
|
10
|
+
<div :class="renderedContentClasses">
|
|
11
11
|
<slot />
|
|
12
12
|
</div>
|
|
13
13
|
</details>
|
|
@@ -15,6 +15,19 @@
|
|
|
15
15
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
18
|
+
import { classes } from '@aerogel/core/utils';
|
|
19
|
+
import { type HTMLAttributes, computed } from 'vue';
|
|
18
20
|
|
|
19
|
-
|
|
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
|
+
));
|
|
20
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"
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
}"
|
|
17
17
|
/>
|
|
18
18
|
<HeadlessModalContent v-bind="contentProps" :class="renderedWrapperClass">
|
|
19
|
-
<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
|
+
>
|
|
20
24
|
<button
|
|
21
25
|
type="button"
|
|
22
26
|
class="clickable z-10 rounded-full p-2.5 text-gray-400 hover:text-gray-500"
|
|
@@ -91,7 +95,7 @@ const {
|
|
|
91
95
|
persistent,
|
|
92
96
|
closeHidden,
|
|
93
97
|
fullscreen,
|
|
94
|
-
|
|
98
|
+
fullscreenOnMobile,
|
|
95
99
|
...props
|
|
96
100
|
} = defineProps<
|
|
97
101
|
ModalProps & {
|
|
@@ -118,11 +122,11 @@ const hasRenderedModals = computed(() => modals.value.some((modal) => renderedMo
|
|
|
118
122
|
const contentProps = computed(() => (description ? {} : { 'aria-describedby': undefined }));
|
|
119
123
|
const renderedContentClass = computed(() =>
|
|
120
124
|
classes(
|
|
121
|
-
'overflow-auto px-4 pb-4',
|
|
125
|
+
'overflow-auto px-4 pb-4 flex flex-col flex-1',
|
|
122
126
|
{ 'pt-4': !title || titleHidden, 'max-h-[90vh]': !renderFullscreen.value },
|
|
123
127
|
contentClass,
|
|
124
128
|
));
|
|
125
|
-
const renderFullscreen = computed(() => fullscreen || (
|
|
129
|
+
const renderFullscreen = computed(() => fullscreen || (fullscreenOnMobile && UI.mobile));
|
|
126
130
|
const renderedWrapperClass = computed(() =>
|
|
127
131
|
classes(
|
|
128
132
|
'isolate fixed z-50 flex flex-col overflow-hidden bg-white text-left duration-300',
|
|
@@ -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>
|
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
|
|
package/src/index.css
CHANGED
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
|
|