@aerogel/core 0.0.0-next.bb9dcdbb118a15d146d3a1c4cf861ca2f4f1eebd → 0.0.0-next.c29ffcd25bffdbed37ecce3aac1ba14cde3e9d39
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.cjs.js +1 -1
- package/dist/aerogel-core.cjs.js.map +1 -1
- package/dist/aerogel-core.d.ts +47 -8
- package/dist/aerogel-core.esm.js +1 -1
- package/dist/aerogel-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/lib/AGProgressBar.vue +22 -7
- package/src/components/modals/AGConfirmModal.ts +2 -1
- package/src/components/modals/AGConfirmModal.vue +1 -1
- package/src/jobs/listeners.ts +1 -1
- package/src/services/App.state.ts +6 -1
- package/src/ui/UI.ts +5 -2
- package/src/utils/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aerogel/core",
|
|
3
3
|
"description": "The Lightest Solid",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.c29ffcd25bffdbed37ecce3aac1ba14cde3e9d39",
|
|
5
5
|
"main": "dist/aerogel-core.cjs.js",
|
|
6
6
|
"module": "dist/aerogel-core.esm.js",
|
|
7
7
|
"types": "dist/aerogel-core.d.ts",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="mt-1 h-2 w-full min-w-[min(400px,80vw)] overflow-hidden rounded-full bg-gray-200">
|
|
3
|
-
<div :class="barClasses" :style="`transform:translateX(-${(1 -
|
|
3
|
+
<div :class="barClasses" :style="`transform:translateX(-${(1 - renderedProgress) * 100}%)`" />
|
|
4
4
|
<span class="sr-only">
|
|
5
5
|
{{
|
|
6
6
|
$td('ui.progress', '{progress}% complete', {
|
|
7
|
-
progress:
|
|
7
|
+
progress: renderedProgress * 100,
|
|
8
8
|
})
|
|
9
9
|
}}
|
|
10
10
|
</span>
|
|
@@ -12,19 +12,34 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
-
import { computed } from 'vue';
|
|
15
|
+
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { numberProp, objectProp, stringProp } from '@/utils/vue';
|
|
18
|
+
import type { Job } from '@/jobs';
|
|
18
19
|
|
|
19
20
|
const props = defineProps({
|
|
20
|
-
progress:
|
|
21
|
-
|
|
21
|
+
progress: numberProp(),
|
|
22
|
+
barClass: stringProp(''),
|
|
23
|
+
job: objectProp<Job>(),
|
|
22
24
|
});
|
|
25
|
+
|
|
26
|
+
let cleanup: Function | undefined;
|
|
27
|
+
const jobProgress = ref(0);
|
|
23
28
|
const barClasses = computed(() => {
|
|
24
|
-
const classes = props.
|
|
29
|
+
const classes = props.barClass ?? '';
|
|
25
30
|
|
|
26
31
|
return `h-full w-full transition-transform duration-500 ease-linear ${
|
|
27
32
|
classes.includes('bg-') ? classes : `${classes} bg-gray-700`
|
|
28
33
|
}`;
|
|
29
34
|
});
|
|
35
|
+
const renderedProgress = computed(() => {
|
|
36
|
+
if (typeof props.progress === 'number') {
|
|
37
|
+
return props.progress;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return jobProgress.value;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
onMounted(() => (cleanup = props.job?.listeners.add({ onUpdated: (progress) => (jobProgress.value = progress) })));
|
|
44
|
+
onUnmounted(() => cleanup?.());
|
|
30
45
|
</script>
|
|
@@ -3,7 +3,7 @@ import type { ExtractPropTypes } from 'vue';
|
|
|
3
3
|
import type { ObjectWithout, Pretty, SubPartial } from '@noeldemartin/utils';
|
|
4
4
|
|
|
5
5
|
import { Colors } from '@/components/constants';
|
|
6
|
-
import { enumProp, objectProp, requiredStringProp, stringProp } from '@/utils';
|
|
6
|
+
import { booleanProp, enumProp, objectProp, requiredStringProp, stringProp } from '@/utils';
|
|
7
7
|
import { translateWithDefault } from '@/lang';
|
|
8
8
|
import type { AcceptRefs } from '@/utils';
|
|
9
9
|
import type { ConfirmCheckboxes } from '@/ui';
|
|
@@ -17,6 +17,7 @@ export const confirmModalProps = {
|
|
|
17
17
|
cancelColor: enumProp(Colors, Colors.Clear),
|
|
18
18
|
checkboxes: objectProp<ConfirmCheckboxes>(),
|
|
19
19
|
actions: objectProp<Record<string, () => unknown>>(),
|
|
20
|
+
required: booleanProp(false),
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export type AGConfirmModalProps = Pretty<
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<AGButton :color="acceptColor" @click="close(true)">
|
|
7
7
|
{{ renderedAcceptText }}
|
|
8
8
|
</AGButton>
|
|
9
|
-
<AGButton :color="cancelColor" @click="close()">
|
|
9
|
+
<AGButton v-if="!required" :color="cancelColor" @click="close()">
|
|
10
10
|
{{ renderedCancelText }}
|
|
11
11
|
</AGButton>
|
|
12
12
|
</div>
|
package/src/jobs/listeners.ts
CHANGED
|
@@ -16,18 +16,23 @@ export default defineServiceState({
|
|
|
16
16
|
},
|
|
17
17
|
computed: {
|
|
18
18
|
development: (state) => state.environment === 'development',
|
|
19
|
+
staging: (state) => state.environment === 'staging',
|
|
19
20
|
testing: (state) => state.environment === 'test' || state.environment === 'testing',
|
|
20
21
|
versionName(state): string {
|
|
21
22
|
if (this.development) {
|
|
22
23
|
return 'dev.' + Aerogel.sourceHash.toString().substring(0, 7);
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
if (this.staging) {
|
|
27
|
+
return 'staging.' + Aerogel.sourceHash.toString().substring(0, 7);
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
return `v${state.version}`;
|
|
26
31
|
},
|
|
27
32
|
versionUrl(state): string {
|
|
28
33
|
return (
|
|
29
34
|
state.sourceUrl +
|
|
30
|
-
(this.development ? `/tree/${Aerogel.sourceHash}` : `/releases/tag/${this.versionName}`)
|
|
35
|
+
(this.development || this.staging ? `/tree/${Aerogel.sourceHash}` : `/releases/tag/${this.versionName}`)
|
|
31
36
|
);
|
|
32
37
|
},
|
|
33
38
|
},
|
package/src/ui/UI.ts
CHANGED
|
@@ -44,6 +44,7 @@ export type ConfirmOptions = AcceptRefs<{
|
|
|
44
44
|
cancelText?: string;
|
|
45
45
|
cancelColor?: Color;
|
|
46
46
|
actions?: Record<string, () => unknown>;
|
|
47
|
+
required?: boolean;
|
|
47
48
|
}>;
|
|
48
49
|
|
|
49
50
|
export type LoadingOptions = AcceptRefs<{
|
|
@@ -114,15 +115,17 @@ export class UIService extends Service {
|
|
|
114
115
|
const getProperties = (): AGConfirmModalProps => {
|
|
115
116
|
if (typeof messageOrOptions !== 'string') {
|
|
116
117
|
return {
|
|
117
|
-
message: messageOrTitle,
|
|
118
118
|
...(messageOrOptions ?? {}),
|
|
119
|
+
message: messageOrTitle,
|
|
120
|
+
required: !!messageOrOptions?.required,
|
|
119
121
|
};
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
return {
|
|
125
|
+
...(options ?? {}),
|
|
123
126
|
title: messageOrTitle,
|
|
124
127
|
message: messageOrOptions,
|
|
125
|
-
|
|
128
|
+
required: !!options?.required,
|
|
126
129
|
};
|
|
127
130
|
};
|
|
128
131
|
const properties = getProperties();
|
package/src/utils/index.ts
CHANGED