@aerogel/core 0.0.0-next.c29ffcd25bffdbed37ecce3aac1ba14cde3e9d39 → 0.0.0-next.c3236837f7f8fc319a4a56022accb32757b3db89
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.css +1 -0
- package/dist/aerogel-core.d.ts +2061 -1962
- package/dist/aerogel-core.js +3669 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +32 -37
- package/src/bootstrap/bootstrap.test.ts +4 -7
- package/src/bootstrap/index.ts +14 -15
- package/src/bootstrap/options.ts +1 -1
- package/src/components/AppLayout.vue +14 -0
- package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
- package/src/components/AppOverlays.vue +9 -0
- package/src/components/AppToasts.vue +16 -0
- package/src/components/contracts/AlertModal.ts +19 -0
- package/src/components/contracts/Button.ts +16 -0
- package/src/components/contracts/ConfirmModal.ts +48 -0
- package/src/components/contracts/DropdownMenu.ts +25 -0
- package/src/components/contracts/ErrorReportModal.ts +33 -0
- package/src/components/contracts/Input.ts +26 -0
- package/src/components/contracts/LoadingModal.ts +26 -0
- package/src/components/contracts/Modal.ts +21 -0
- package/src/components/contracts/PromptModal.ts +34 -0
- package/src/components/contracts/Select.ts +45 -0
- package/src/components/contracts/Toast.ts +15 -0
- package/src/components/contracts/index.ts +11 -0
- package/src/components/headless/HeadlessButton.vue +51 -0
- package/src/components/headless/HeadlessInput.vue +59 -0
- package/src/components/headless/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +7 -8
- package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
- package/src/components/headless/HeadlessInputInput.vue +86 -0
- package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
- package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +10 -13
- package/src/components/headless/HeadlessModal.vue +57 -0
- package/src/components/headless/HeadlessModalContent.vue +30 -0
- package/src/components/headless/HeadlessModalDescription.vue +12 -0
- package/src/components/headless/HeadlessModalOverlay.vue +12 -0
- package/src/components/headless/HeadlessModalTitle.vue +12 -0
- package/src/components/headless/HeadlessSelect.vue +120 -0
- package/src/components/headless/{forms/AGHeadlessSelectError.vue → HeadlessSelectError.vue} +5 -6
- package/src/components/headless/HeadlessSelectLabel.vue +25 -0
- package/src/components/headless/HeadlessSelectOption.vue +34 -0
- package/src/components/headless/HeadlessSelectOptions.vue +42 -0
- package/src/components/headless/HeadlessSelectTrigger.vue +22 -0
- package/src/components/headless/HeadlessSelectValue.vue +18 -0
- package/src/components/headless/HeadlessSwitch.vue +96 -0
- package/src/components/headless/HeadlessToast.vue +18 -0
- package/src/components/headless/HeadlessToastAction.vue +13 -0
- package/src/components/headless/index.ts +20 -3
- package/src/components/index.ts +6 -11
- package/src/components/ui/AdvancedOptions.vue +18 -0
- package/src/components/ui/AlertModal.vue +17 -0
- package/src/components/ui/Button.vue +115 -0
- package/src/components/ui/Checkbox.vue +56 -0
- package/src/components/ui/ConfirmModal.vue +50 -0
- package/src/components/ui/DropdownMenu.vue +32 -0
- package/src/components/ui/DropdownMenuOption.vue +22 -0
- package/src/components/ui/DropdownMenuOptions.vue +44 -0
- package/src/components/ui/EditableContent.vue +82 -0
- package/src/components/ui/ErrorLogs.vue +19 -0
- package/src/components/ui/ErrorLogsModal.vue +48 -0
- package/src/components/ui/ErrorMessage.vue +15 -0
- package/src/components/ui/ErrorReportModal.vue +73 -0
- package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +34 -27
- package/src/components/ui/ErrorReportModalTitle.vue +24 -0
- package/src/components/{forms/AGForm.vue → ui/Form.vue} +4 -5
- package/src/components/ui/Input.vue +56 -0
- package/src/components/ui/Link.vue +12 -0
- package/src/components/ui/LoadingModal.vue +34 -0
- package/src/components/ui/Markdown.vue +97 -0
- package/src/components/ui/Modal.vue +131 -0
- package/src/components/{modals/AGModalContext.vue → ui/ModalContext.vue} +8 -9
- package/src/components/ui/ProgressBar.vue +51 -0
- package/src/components/ui/PromptModal.vue +38 -0
- package/src/components/ui/Select.vue +27 -0
- package/src/components/ui/SelectLabel.vue +21 -0
- package/src/components/ui/SelectOption.vue +29 -0
- package/src/components/ui/SelectOptions.vue +35 -0
- package/src/components/ui/SelectTrigger.vue +29 -0
- package/src/components/ui/Setting.vue +31 -0
- package/src/components/ui/SettingsModal.vue +15 -0
- package/src/components/{lib/AGStartupCrash.vue → ui/StartupCrash.vue} +8 -8
- package/src/components/ui/Switch.vue +11 -0
- package/src/components/ui/TextArea.vue +56 -0
- package/src/components/ui/Toast.vue +46 -0
- package/src/components/ui/index.ts +35 -0
- package/src/directives/index.ts +9 -5
- package/src/directives/measure.ts +12 -6
- package/src/errors/Errors.state.ts +1 -1
- package/src/errors/Errors.ts +29 -27
- package/src/errors/index.ts +15 -8
- package/src/errors/settings/Debug.vue +32 -0
- package/src/errors/settings/index.ts +10 -0
- package/src/errors/utils.ts +1 -1
- package/src/forms/{Form.test.ts → FormController.test.ts} +32 -8
- package/src/forms/{Form.ts → FormController.ts} +46 -38
- package/src/forms/index.ts +2 -3
- package/src/forms/utils.ts +35 -35
- package/src/index.css +75 -0
- package/src/jobs/Job.ts +2 -2
- package/src/lang/DefaultLangProvider.ts +7 -4
- package/src/lang/Lang.state.ts +1 -1
- package/src/lang/Lang.ts +1 -1
- package/src/lang/index.ts +12 -6
- package/src/lang/settings/Language.vue +48 -0
- package/src/lang/settings/index.ts +10 -0
- package/src/plugins/Plugin.ts +1 -1
- package/src/plugins/index.ts +10 -7
- package/src/services/App.state.ts +15 -4
- package/src/services/App.ts +12 -4
- package/src/services/Cache.ts +1 -1
- package/src/services/Events.test.ts +8 -8
- package/src/services/Events.ts +4 -10
- package/src/services/Service.ts +21 -21
- package/src/services/Storage.ts +3 -3
- package/src/services/index.ts +10 -6
- package/src/services/utils.ts +2 -2
- package/src/testing/index.ts +8 -3
- package/src/testing/setup.ts +3 -19
- package/src/ui/UI.state.ts +8 -13
- package/src/ui/UI.ts +143 -114
- package/src/ui/index.ts +27 -28
- package/src/utils/classes.ts +41 -0
- package/src/utils/composition/events.ts +4 -6
- package/src/utils/composition/forms.ts +20 -4
- package/src/utils/composition/state.ts +11 -2
- package/src/utils/index.ts +3 -1
- package/src/utils/markdown.ts +37 -5
- package/src/utils/types.ts +3 -0
- package/src/utils/vue.ts +31 -137
- package/dist/aerogel-core.cjs.js +0 -2
- package/dist/aerogel-core.cjs.js.map +0 -1
- package/dist/aerogel-core.esm.js +0 -2
- package/dist/aerogel-core.esm.js.map +0 -1
- package/histoire.config.ts +0 -7
- package/noeldemartin.config.js +0 -5
- package/postcss.config.js +0 -6
- package/src/assets/histoire.css +0 -3
- package/src/components/AGAppLayout.vue +0 -16
- package/src/components/AGAppOverlays.vue +0 -41
- package/src/components/AGAppSnackbars.vue +0 -13
- package/src/components/composition.ts +0 -23
- package/src/components/constants.ts +0 -8
- package/src/components/forms/AGButton.vue +0 -44
- package/src/components/forms/AGCheckbox.vue +0 -41
- package/src/components/forms/AGInput.vue +0 -40
- package/src/components/forms/AGSelect.story.vue +0 -46
- package/src/components/forms/AGSelect.vue +0 -60
- package/src/components/forms/index.ts +0 -5
- package/src/components/headless/forms/AGHeadlessButton.ts +0 -3
- package/src/components/headless/forms/AGHeadlessButton.vue +0 -62
- package/src/components/headless/forms/AGHeadlessInput.ts +0 -34
- package/src/components/headless/forms/AGHeadlessInput.vue +0 -70
- package/src/components/headless/forms/AGHeadlessInputInput.vue +0 -84
- package/src/components/headless/forms/AGHeadlessSelect.ts +0 -42
- package/src/components/headless/forms/AGHeadlessSelect.vue +0 -77
- package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectOption.ts +0 -4
- package/src/components/headless/forms/AGHeadlessSelectOption.vue +0 -39
- package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
- package/src/components/headless/forms/composition.ts +0 -10
- package/src/components/headless/forms/index.ts +0 -18
- package/src/components/headless/modals/AGHeadlessModal.ts +0 -36
- package/src/components/headless/modals/AGHeadlessModal.vue +0 -92
- package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -32
- package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -23
- package/src/components/headless/modals/index.ts +0 -4
- package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
- package/src/components/headless/snackbars/index.ts +0 -40
- package/src/components/interfaces.ts +0 -24
- package/src/components/lib/AGErrorMessage.vue +0 -16
- package/src/components/lib/AGLink.vue +0 -9
- package/src/components/lib/AGMarkdown.vue +0 -54
- package/src/components/lib/AGMeasured.vue +0 -16
- package/src/components/lib/AGProgressBar.vue +0 -45
- package/src/components/lib/index.ts +0 -6
- package/src/components/modals/AGAlertModal.ts +0 -18
- package/src/components/modals/AGAlertModal.vue +0 -14
- package/src/components/modals/AGConfirmModal.ts +0 -42
- package/src/components/modals/AGConfirmModal.vue +0 -26
- package/src/components/modals/AGErrorReportModal.ts +0 -49
- package/src/components/modals/AGErrorReportModal.vue +0 -54
- package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
- package/src/components/modals/AGLoadingModal.ts +0 -29
- package/src/components/modals/AGLoadingModal.vue +0 -15
- package/src/components/modals/AGModal.ts +0 -11
- package/src/components/modals/AGModal.vue +0 -39
- package/src/components/modals/AGModalContext.ts +0 -8
- package/src/components/modals/AGModalTitle.vue +0 -9
- package/src/components/modals/AGPromptModal.ts +0 -41
- package/src/components/modals/AGPromptModal.vue +0 -34
- package/src/components/modals/index.ts +0 -17
- package/src/components/snackbars/AGSnackbar.vue +0 -36
- package/src/components/snackbars/index.ts +0 -3
- package/src/components/utils.ts +0 -10
- package/src/directives/initial-focus.ts +0 -11
- package/src/forms/composition.ts +0 -6
- package/src/main.histoire.ts +0 -1
- package/src/utils/tailwindcss.test.ts +0 -26
- package/src/utils/tailwindcss.ts +0 -7
- package/tailwind.config.js +0 -4
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -17
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithout, Pretty, SubPartial } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { Colors } from '@/components/constants';
|
|
6
|
-
import { booleanProp, enumProp, objectProp, requiredStringProp, stringProp } from '@/utils';
|
|
7
|
-
import { translateWithDefault } from '@/lang';
|
|
8
|
-
import type { AcceptRefs } from '@/utils';
|
|
9
|
-
import type { ConfirmCheckboxes } from '@/ui';
|
|
10
|
-
|
|
11
|
-
export const confirmModalProps = {
|
|
12
|
-
title: stringProp(),
|
|
13
|
-
message: requiredStringProp(),
|
|
14
|
-
acceptText: stringProp(),
|
|
15
|
-
acceptColor: enumProp(Colors, Colors.Primary),
|
|
16
|
-
cancelText: stringProp(),
|
|
17
|
-
cancelColor: enumProp(Colors, Colors.Clear),
|
|
18
|
-
checkboxes: objectProp<ConfirmCheckboxes>(),
|
|
19
|
-
actions: objectProp<Record<string, () => unknown>>(),
|
|
20
|
-
required: booleanProp(false),
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type AGConfirmModalProps = Pretty<
|
|
24
|
-
AcceptRefs<
|
|
25
|
-
SubPartial<
|
|
26
|
-
ObjectWithout<ExtractPropTypes<typeof confirmModalProps>, null | undefined>,
|
|
27
|
-
'acceptColor' | 'cancelColor'
|
|
28
|
-
>
|
|
29
|
-
>
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
export function useConfirmModalProps(): typeof confirmModalProps {
|
|
33
|
-
return confirmModalProps;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
37
|
-
export function useConfirmModal(props: ExtractPropTypes<typeof confirmModalProps>) {
|
|
38
|
-
const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));
|
|
39
|
-
const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));
|
|
40
|
-
|
|
41
|
-
return { renderedAcceptText, renderedCancelText };
|
|
42
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal v-slot="{ close }: IAGModalDefaultSlotProps" :cancellable="false" :title="title">
|
|
3
|
-
<AGMarkdown :text="message" :actions="actions" />
|
|
4
|
-
|
|
5
|
-
<div class="mt-2 flex flex-row-reverse gap-2">
|
|
6
|
-
<AGButton :color="acceptColor" @click="close(true)">
|
|
7
|
-
{{ renderedAcceptText }}
|
|
8
|
-
</AGButton>
|
|
9
|
-
<AGButton v-if="!required" :color="cancelColor" @click="close()">
|
|
10
|
-
{{ renderedCancelText }}
|
|
11
|
-
</AGButton>
|
|
12
|
-
</div>
|
|
13
|
-
</AGModal>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import AGModal from './AGModal.vue';
|
|
18
|
-
import { useConfirmModal, useConfirmModalProps } from './AGConfirmModal';
|
|
19
|
-
import type { IAGModalDefaultSlotProps } from './AGModal';
|
|
20
|
-
|
|
21
|
-
import AGButton from '../forms/AGButton.vue';
|
|
22
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
23
|
-
|
|
24
|
-
const props = defineProps(useConfirmModalProps());
|
|
25
|
-
const { renderedAcceptText, renderedCancelText } = useConfirmModal(props);
|
|
26
|
-
</script>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { computed, ref } from 'vue';
|
|
2
|
-
import type { Component, ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithout, Pretty } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { requiredArrayProp } from '@/utils/vue';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
import type { AcceptRefs } from '@/utils/vue';
|
|
8
|
-
import type { ErrorReport } from '@/errors';
|
|
9
|
-
|
|
10
|
-
export interface IAGErrorReportModalButtonsDefaultSlotProps {
|
|
11
|
-
id: string;
|
|
12
|
-
description: string;
|
|
13
|
-
iconComponent: Component;
|
|
14
|
-
url?: string;
|
|
15
|
-
handler?(): void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const errorReportModalProps = {
|
|
19
|
-
reports: requiredArrayProp<ErrorReport>(),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type AGErrorReportModalProps = Pretty<
|
|
23
|
-
AcceptRefs<ObjectWithout<ExtractPropTypes<typeof errorReportModalProps>, null | undefined>>
|
|
24
|
-
>;
|
|
25
|
-
|
|
26
|
-
export function useErrorReportModalProps(): typeof errorReportModalProps {
|
|
27
|
-
return errorReportModalProps;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
31
|
-
export function useErrorReportModal(props: ExtractPropTypes<typeof errorReportModalProps>) {
|
|
32
|
-
const activeReportIndex = ref(0);
|
|
33
|
-
const report = computed(() => props.reports[activeReportIndex.value] as ErrorReport);
|
|
34
|
-
const details = computed(
|
|
35
|
-
() =>
|
|
36
|
-
report.value.details?.trim() ||
|
|
37
|
-
translateWithDefault('errors.detailsEmpty', 'This error is missing a stacktrace.'),
|
|
38
|
-
);
|
|
39
|
-
const previousReportText = translateWithDefault('errors.previousReport', 'Show previous report');
|
|
40
|
-
const nextReportText = translateWithDefault('errors.nextReport', 'Show next report');
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
activeReportIndex,
|
|
44
|
-
details,
|
|
45
|
-
nextReportText,
|
|
46
|
-
previousReportText,
|
|
47
|
-
report,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal>
|
|
3
|
-
<div>
|
|
4
|
-
<h2 class="flex items-center justify-between text-lg font-medium">
|
|
5
|
-
<div class="flex items-center">
|
|
6
|
-
<AGErrorReportModalTitle
|
|
7
|
-
:report="report"
|
|
8
|
-
:current-report="activeReportIndex + 1"
|
|
9
|
-
:total-reports="reports.length"
|
|
10
|
-
/>
|
|
11
|
-
<template v-if="reports.length > 1">
|
|
12
|
-
<AGButton
|
|
13
|
-
color="clear"
|
|
14
|
-
:disabled="activeReportIndex === 0"
|
|
15
|
-
:title="previousReportText"
|
|
16
|
-
:aria-label="previousReportText"
|
|
17
|
-
@click="activeReportIndex--"
|
|
18
|
-
>
|
|
19
|
-
<IconCheveronLeft aria-hidden="true" class="h-4 w-4" />
|
|
20
|
-
</AGButton>
|
|
21
|
-
<AGButton
|
|
22
|
-
color="clear"
|
|
23
|
-
:disabled="activeReportIndex === reports.length - 1"
|
|
24
|
-
:title="nextReportText"
|
|
25
|
-
:aria-label="nextReportText"
|
|
26
|
-
@click="activeReportIndex++"
|
|
27
|
-
>
|
|
28
|
-
<IconCheveronRight aria-hidden="true" class="h-4 w-4" />
|
|
29
|
-
</AGButton>
|
|
30
|
-
</template>
|
|
31
|
-
</div>
|
|
32
|
-
<AGErrorReportModalButtons :report="report" />
|
|
33
|
-
</h2>
|
|
34
|
-
<AGMarkdown v-if="report.description" :text="report.description" class="mt-2" />
|
|
35
|
-
</div>
|
|
36
|
-
<pre class="h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900" v-text="details" />
|
|
37
|
-
</AGModal>
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<script setup lang="ts">
|
|
41
|
-
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
42
|
-
import IconCheveronLeft from '~icons/zondicons/cheveron-left';
|
|
43
|
-
|
|
44
|
-
import { useErrorReportModal, useErrorReportModalProps } from './AGErrorReportModal';
|
|
45
|
-
|
|
46
|
-
import AGButton from '../forms/AGButton.vue';
|
|
47
|
-
import AGErrorReportModalButtons from './AGErrorReportModalButtons.vue';
|
|
48
|
-
import AGErrorReportModalTitle from './AGErrorReportModalTitle.vue';
|
|
49
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
50
|
-
import AGModal from './AGModal.vue';
|
|
51
|
-
|
|
52
|
-
const props = defineProps(useErrorReportModalProps());
|
|
53
|
-
const { activeReportIndex, details, nextReportText, previousReportText, report } = useErrorReportModal(props);
|
|
54
|
-
</script>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGMarkdown :text="text" inline />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import { computed } from 'vue';
|
|
7
|
-
|
|
8
|
-
import { numberProp, requiredObjectProp } from '@/utils/vue';
|
|
9
|
-
import type { ErrorReport } from '@/errors';
|
|
10
|
-
|
|
11
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
report: requiredObjectProp<ErrorReport>(),
|
|
15
|
-
currentReport: numberProp(),
|
|
16
|
-
totalReports: numberProp(),
|
|
17
|
-
});
|
|
18
|
-
const text = computed(() => {
|
|
19
|
-
if (!props.totalReports || props.totalReports <= 1) {
|
|
20
|
-
return props.report.title;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return `${props.report.title} (${props.currentReport}/${props.totalReports})`;
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithout } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { numberProp, stringProp } from '@/utils';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
import type { AcceptRefs } from '@/utils';
|
|
8
|
-
|
|
9
|
-
export const loadingModalProps = {
|
|
10
|
-
title: stringProp(),
|
|
11
|
-
message: stringProp(),
|
|
12
|
-
progress: numberProp(),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type AGLoadingModalProps = AcceptRefs<
|
|
16
|
-
ObjectWithout<ExtractPropTypes<typeof loadingModalProps>, null | undefined>
|
|
17
|
-
>;
|
|
18
|
-
|
|
19
|
-
export function useLoadingModalProps(): typeof loadingModalProps {
|
|
20
|
-
return loadingModalProps;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
24
|
-
export function useLoadingModal(props: ExtractPropTypes<typeof loadingModalProps>) {
|
|
25
|
-
const renderedMessage = computed(() => props.message ?? translateWithDefault('ui.loading', 'Loading...'));
|
|
26
|
-
const showProgress = computed(() => typeof props.progress === 'number');
|
|
27
|
-
|
|
28
|
-
return { renderedMessage, showProgress };
|
|
29
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal :cancellable="false">
|
|
3
|
-
<AGMarkdown :text="renderedMessage" />
|
|
4
|
-
</AGModal>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import AGModal from './AGModal.vue';
|
|
9
|
-
import { useLoadingModal, useLoadingModalProps } from './AGLoadingModal';
|
|
10
|
-
|
|
11
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
12
|
-
|
|
13
|
-
const props = defineProps(useLoadingModalProps());
|
|
14
|
-
const { renderedMessage } = useLoadingModal(props);
|
|
15
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGHeadlessModal
|
|
3
|
-
ref="$modal"
|
|
4
|
-
v-slot="{ close }: IAGHeadlessModalDefaultSlotProps"
|
|
5
|
-
v-bind="props"
|
|
6
|
-
class="relative z-50"
|
|
7
|
-
>
|
|
8
|
-
<div class="fixed inset-0 flex items-center justify-center p-8">
|
|
9
|
-
<AGHeadlessModalPanel class="flex max-h-full max-w-full flex-col overflow-hidden bg-white p-4">
|
|
10
|
-
<AGHeadlessModalTitle v-if="title" class="mb-2 text-lg font-semibold">
|
|
11
|
-
<AGMarkdown :text="title" inline />
|
|
12
|
-
</AGHeadlessModalTitle>
|
|
13
|
-
<div class="flex max-h-full flex-col overflow-auto" v-bind="$attrs">
|
|
14
|
-
<slot :close="close" />
|
|
15
|
-
</div>
|
|
16
|
-
</AGHeadlessModalPanel>
|
|
17
|
-
</div>
|
|
18
|
-
</AGHeadlessModal>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { ref } from 'vue';
|
|
23
|
-
|
|
24
|
-
import { useModalExpose, useModalProps } from '@/components/headless/modals/AGHeadlessModal';
|
|
25
|
-
import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from '@/components/headless/modals/AGHeadlessModal';
|
|
26
|
-
|
|
27
|
-
import type { IAGModal } from './AGModal';
|
|
28
|
-
|
|
29
|
-
import AGHeadlessModal from '../headless/modals/AGHeadlessModal.vue';
|
|
30
|
-
import AGHeadlessModalPanel from '../headless/modals/AGHeadlessModalPanel.vue';
|
|
31
|
-
import AGHeadlessModalTitle from '../headless/modals/AGHeadlessModalTitle.vue';
|
|
32
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
33
|
-
|
|
34
|
-
const props = defineProps(useModalProps());
|
|
35
|
-
const $modal = ref<IAGHeadlessModal>();
|
|
36
|
-
|
|
37
|
-
defineOptions({ inheritAttrs: false });
|
|
38
|
-
defineExpose<IAGModal>(useModalExpose($modal));
|
|
39
|
-
</script>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithout, Pretty, SubPartial } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { Colors } from '@/components/constants';
|
|
6
|
-
import { enumProp, requiredStringProp, stringProp } from '@/utils';
|
|
7
|
-
import { translateWithDefault } from '@/lang';
|
|
8
|
-
import type { AcceptRefs } from '@/utils';
|
|
9
|
-
|
|
10
|
-
export const promptModalProps = {
|
|
11
|
-
title: stringProp(),
|
|
12
|
-
message: requiredStringProp(),
|
|
13
|
-
label: stringProp(),
|
|
14
|
-
defaultValue: stringProp(),
|
|
15
|
-
placeholder: stringProp(),
|
|
16
|
-
acceptText: stringProp(),
|
|
17
|
-
acceptColor: enumProp(Colors, Colors.Primary),
|
|
18
|
-
cancelText: stringProp(),
|
|
19
|
-
cancelColor: enumProp(Colors, Colors.Clear),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type AGPromptModalProps = Pretty<
|
|
23
|
-
AcceptRefs<
|
|
24
|
-
SubPartial<
|
|
25
|
-
ObjectWithout<ExtractPropTypes<typeof promptModalProps>, null | undefined>,
|
|
26
|
-
'acceptColor' | 'cancelColor'
|
|
27
|
-
>
|
|
28
|
-
>
|
|
29
|
-
>;
|
|
30
|
-
|
|
31
|
-
export function usePromptModalProps(): typeof promptModalProps {
|
|
32
|
-
return promptModalProps;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
36
|
-
export function usePromptModal(props: ExtractPropTypes<typeof promptModalProps>) {
|
|
37
|
-
const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));
|
|
38
|
-
const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));
|
|
39
|
-
|
|
40
|
-
return { renderedAcceptText, renderedCancelText };
|
|
41
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal v-slot="{ close }: IAGModalDefaultSlotProps" :cancellable="false" :title="title">
|
|
3
|
-
<AGMarkdown :text="message" />
|
|
4
|
-
|
|
5
|
-
<AGForm :form="form" @submit="close(form.draft)">
|
|
6
|
-
<AGInput name="draft" :placeholder="placeholder" :label="label" />
|
|
7
|
-
|
|
8
|
-
<div class="mt-2 flex flex-row-reverse gap-2">
|
|
9
|
-
<AGButton :color="acceptColor" submit>
|
|
10
|
-
{{ renderedAcceptText }}
|
|
11
|
-
</AGButton>
|
|
12
|
-
<AGButton :color="cancelColor" @click="close()">
|
|
13
|
-
{{ renderedCancelText }}
|
|
14
|
-
</AGButton>
|
|
15
|
-
</div>
|
|
16
|
-
</AGForm>
|
|
17
|
-
</AGModal>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup lang="ts">
|
|
21
|
-
import AGModal from './AGModal.vue';
|
|
22
|
-
import { usePromptModal, usePromptModalProps } from './AGPromptModal';
|
|
23
|
-
import type { IAGModalDefaultSlotProps } from './AGModal';
|
|
24
|
-
|
|
25
|
-
import AGButton from '../forms/AGButton.vue';
|
|
26
|
-
import AGForm from '../forms/AGForm.vue';
|
|
27
|
-
import AGInput from '../forms/AGInput.vue';
|
|
28
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
29
|
-
import { requiredStringInput, useForm } from '../../forms';
|
|
30
|
-
|
|
31
|
-
const props = defineProps(usePromptModalProps());
|
|
32
|
-
const form = useForm({ draft: requiredStringInput(props.defaultValue ?? '') });
|
|
33
|
-
const { renderedAcceptText, renderedCancelText } = usePromptModal(props);
|
|
34
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './AGAlertModal';
|
|
2
|
-
export * from './AGConfirmModal';
|
|
3
|
-
export * from './AGErrorReportModal';
|
|
4
|
-
export * from './AGLoadingModal';
|
|
5
|
-
export * from './AGModal';
|
|
6
|
-
export * from './AGModalContext';
|
|
7
|
-
export * from './AGPromptModal';
|
|
8
|
-
|
|
9
|
-
export { default as AGAlertModal } from './AGAlertModal.vue';
|
|
10
|
-
export { default as AGConfirmModal } from './AGConfirmModal.vue';
|
|
11
|
-
export { default as AGErrorReportModalButtons } from './AGErrorReportModalButtons.vue';
|
|
12
|
-
export { default as AGErrorReportModalTitle } from './AGErrorReportModalTitle.vue';
|
|
13
|
-
export { default as AGLoadingModal } from './AGLoadingModal.vue';
|
|
14
|
-
export { default as AGModal } from './AGModal.vue';
|
|
15
|
-
export { default as AGModalContext } from './AGModalContext.vue';
|
|
16
|
-
export { default as AGModalTitle } from './AGModalTitle.vue';
|
|
17
|
-
export { default as AGPromptModal } from './AGPromptModal.vue';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGHeadlessSnackbar class="flex flex-row items-center justify-center gap-3 p-4" :class="styleClasses">
|
|
3
|
-
<AGMarkdown :text="message" inline />
|
|
4
|
-
<AGButton
|
|
5
|
-
v-for="(action, i) of actions"
|
|
6
|
-
:key="i"
|
|
7
|
-
:color="color"
|
|
8
|
-
@click="activate(action)"
|
|
9
|
-
>
|
|
10
|
-
{{ action.text }}
|
|
11
|
-
</AGButton>
|
|
12
|
-
</AGHeadlessSnackbar>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
import { computed } from 'vue';
|
|
17
|
-
|
|
18
|
-
import { Colors } from '@/components/constants';
|
|
19
|
-
import { useSnackbar, useSnackbarProps } from '@/components/headless/snackbars';
|
|
20
|
-
|
|
21
|
-
import AGButton from '../forms/AGButton.vue';
|
|
22
|
-
import AGHeadlessSnackbar from '../headless/snackbars/AGHeadlessSnackbar.vue';
|
|
23
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
24
|
-
|
|
25
|
-
const props = defineProps(useSnackbarProps());
|
|
26
|
-
const { activate } = useSnackbar(props);
|
|
27
|
-
const styleClasses = computed(() => {
|
|
28
|
-
switch (props.color) {
|
|
29
|
-
case Colors.Danger:
|
|
30
|
-
return 'bg-red-200 text-red-900';
|
|
31
|
-
default:
|
|
32
|
-
case Colors.Secondary:
|
|
33
|
-
return 'bg-gray-900 text-white';
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
</script>
|
package/src/components/utils.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function extractComponentProps<T extends Record<string, unknown>>(
|
|
2
|
-
values: Record<string, unknown>,
|
|
3
|
-
definitions: Record<string, unknown>,
|
|
4
|
-
): T {
|
|
5
|
-
return Object.keys(definitions).reduce((extracted, prop) => {
|
|
6
|
-
extracted[prop] = values[prop];
|
|
7
|
-
|
|
8
|
-
return extracted;
|
|
9
|
-
}, {} as Record<string, unknown>) as T;
|
|
10
|
-
}
|
package/src/forms/composition.ts
DELETED
package/src/main.histoire.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './assets/histoire.css';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { removeInteractiveClasses } from './tailwindcss';
|
|
4
|
-
|
|
5
|
-
describe('TailwindCSS utils', () => {
|
|
6
|
-
|
|
7
|
-
it('Removes interactive classes', () => {
|
|
8
|
-
const cases: [string, string][] = [
|
|
9
|
-
['text-red hover:text-green', 'text-red'],
|
|
10
|
-
['text-red hover:text-green text-lg', 'text-red text-lg'],
|
|
11
|
-
[
|
|
12
|
-
`
|
|
13
|
-
text-red text-lg
|
|
14
|
-
focus:text-yellow
|
|
15
|
-
hover:focus:text-black
|
|
16
|
-
`,
|
|
17
|
-
'text-red text-lg',
|
|
18
|
-
],
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
cases.forEach(([original, expected]) => {
|
|
22
|
-
expect(removeInteractiveClasses(original)).toEqual(expected);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
});
|
package/src/utils/tailwindcss.ts
DELETED
package/tailwind.config.js
DELETED
package/tsconfig.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Aerogel from '@aerogel/vite';
|
|
2
|
-
import Icons from 'unplugin-icons/vite';
|
|
3
|
-
import { defineConfig } from 'vitest/config';
|
|
4
|
-
import { resolve } from 'path';
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
test: {
|
|
8
|
-
clearMocks: true,
|
|
9
|
-
setupFiles: ['./src/testing/setup.ts'],
|
|
10
|
-
},
|
|
11
|
-
plugins: [Aerogel(), Icons()],
|
|
12
|
-
resolve: {
|
|
13
|
-
alias: {
|
|
14
|
-
'@': resolve(__dirname, './src'),
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
});
|
|
File without changes
|