@resee-movies/nuxt-ux 0.3.1 → 0.4.1
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/module.json +1 -1
- package/dist/module.mjs +11 -1
- package/dist/runtime/components/Dialog.vue.d.ts +1 -1
- package/dist/runtime/components/Image.vue +1 -1
- package/dist/runtime/components/Message.vue +11 -4
- package/dist/runtime/components/Message.vue.d.ts +3 -0
- package/dist/runtime/components/NotificationContainer.vue +11 -3
- package/dist/runtime/composables/use-notification.d.ts +18 -11
- package/dist/runtime/composables/use-notification.js +27 -27
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -133,6 +133,13 @@ function importModules(nuxt) {
|
|
|
133
133
|
...primeOptions?.includeComponents ?? []
|
|
134
134
|
])
|
|
135
135
|
);
|
|
136
|
+
nuxt.options.vite.optimizeDeps ??= {};
|
|
137
|
+
nuxt.options.vite.optimizeDeps.include ??= [];
|
|
138
|
+
nuxt.options.vite.optimizeDeps.include.push(
|
|
139
|
+
"primevue/usetoast",
|
|
140
|
+
"primevue/toasteventbus",
|
|
141
|
+
"primevue/toastservice"
|
|
142
|
+
);
|
|
136
143
|
const Primevue = {
|
|
137
144
|
defaults: {
|
|
138
145
|
autoImport: false,
|
|
@@ -214,7 +221,10 @@ const module = defineNuxtModule({
|
|
|
214
221
|
const sources = options.tailwind?.sources?.slice() ?? [];
|
|
215
222
|
const plugins = options.tailwind?.plugins?.slice() ?? [];
|
|
216
223
|
const imports = options.tailwind?.plugins?.slice() ?? [];
|
|
217
|
-
|
|
224
|
+
const constants = await resolver.resolvePath("./runtime/constants", {
|
|
225
|
+
extensions: ["ts", "js"]
|
|
226
|
+
});
|
|
227
|
+
sources.push(components, constants);
|
|
218
228
|
plugins.push(await resolvePath("@egoist/tailwindcss-icons"));
|
|
219
229
|
imports.push(stylesheet);
|
|
220
230
|
addComponentsDir({ path: components, prefix: options.componentPrefix });
|
|
@@ -11,12 +11,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Dialog
|
|
|
11
11
|
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
13
|
size: "xxs" | "xs" | "sm" | "md" | "lg";
|
|
14
|
+
closable: boolean;
|
|
14
15
|
showHeaderText: boolean;
|
|
15
16
|
showHeaderStyle: boolean;
|
|
16
17
|
showModalStyle: boolean;
|
|
17
18
|
modal: boolean;
|
|
18
19
|
contentClass: any;
|
|
19
|
-
closable: boolean;
|
|
20
20
|
dismissableMask: boolean;
|
|
21
21
|
showHeader: boolean;
|
|
22
22
|
position: import("@primevue/core").HintedString<"top" | "center" | "bottom" | "left" | "right" | "topleft" | "topright" | "bottomleft" | "bottomright">;
|
|
@@ -145,5 +145,5 @@ const altText = computed(() => {
|
|
|
145
145
|
</script>
|
|
146
146
|
|
|
147
147
|
<style scoped>
|
|
148
|
-
@reference "tailwindcss";.image{background-color:#fff;overflow:clip;position:relative;width:-moz-
|
|
148
|
+
@reference "tailwindcss";.image{background-color:#fff;overflow:clip;position:relative;width:-moz-fit-content;width:fit-content;@variant dark{background-color:#000}}.image.bordered{border:2px solid var(--color-global-background-accent)}.image.beveled{border-bottom-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.image.raised{box-shadow:var(--shadow-heavy)}.image.glass:after{background-image:linear-gradient(110deg,transparent 25%,hsla(0,0%,100%,.15) 80%,transparent);content:var(--zero-width-space);inset:0;position:absolute}.image .icon{color:var(--color-global-background-accent);left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%)}
|
|
149
149
|
</style>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<PrimeMessage :severity="props.severity" class="message" :pt="passthroughProps">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
</
|
|
3
|
+
<template #icon>
|
|
4
|
+
<Icon :name="props.icon" :size="props.iconSize" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #default>
|
|
8
|
+
<slot>{{ props.text }}</slot>
|
|
9
|
+
</template>
|
|
6
10
|
</PrimeMessage>
|
|
7
11
|
</template>
|
|
8
12
|
|
|
@@ -12,12 +16,15 @@ import { computed } from "vue";
|
|
|
12
16
|
|
|
13
17
|
<script setup>
|
|
14
18
|
import PrimeMessage from "primevue/message";
|
|
19
|
+
import Icon from "./Icon.vue";
|
|
15
20
|
const props = defineProps({
|
|
16
21
|
severity: { type: String, required: false },
|
|
17
22
|
text: { type: String, required: false },
|
|
18
23
|
class: { type: String, required: false },
|
|
19
24
|
style: { type: String, required: false },
|
|
20
|
-
accented: { type: Boolean, required: false }
|
|
25
|
+
accented: { type: Boolean, required: false },
|
|
26
|
+
icon: { type: String, required: false },
|
|
27
|
+
iconSize: { type: String, required: false }
|
|
21
28
|
});
|
|
22
29
|
const passthroughProps = computed(() => {
|
|
23
30
|
return {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { StatusLevel } from '../types/index.js';
|
|
2
|
+
import type { IconProps } from './Icon.vue.js';
|
|
2
3
|
export interface MessageProps {
|
|
3
4
|
severity?: StatusLevel;
|
|
4
5
|
text?: string;
|
|
5
6
|
class?: string;
|
|
6
7
|
style?: string;
|
|
7
8
|
accented?: boolean;
|
|
9
|
+
icon?: IconProps['name'];
|
|
10
|
+
iconSize?: IconProps['size'];
|
|
8
11
|
}
|
|
9
12
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<MessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MessageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
10
13
|
default?: (props: {}) => any;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
|
+
import { isString } from "@resee-movies/utilities/strings/is-string";
|
|
10
11
|
import PrimeToast, {} from "primevue/toast";
|
|
11
12
|
import { StatusLevelIcons } from "../constants";
|
|
12
13
|
const passthroughProps = {
|
|
@@ -19,9 +20,16 @@ const passthroughProps = {
|
|
|
19
20
|
props.message?.summary?.trim() ? "has-summary" : void 0
|
|
20
21
|
]
|
|
21
22
|
}),
|
|
22
|
-
messageIcon: ({ props }) =>
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
messageIcon: ({ props }) => {
|
|
24
|
+
let iconClassName = StatusLevelIcons[props.message?.severity ?? "default"];
|
|
25
|
+
if (props.message && "icon" in props.message && isString(props.message.icon)) {
|
|
26
|
+
iconClassName = props.message.icon;
|
|
27
|
+
}
|
|
28
|
+
console.log(iconClassName);
|
|
29
|
+
return {
|
|
30
|
+
class: ["icon", iconClassName]
|
|
31
|
+
};
|
|
32
|
+
},
|
|
25
33
|
root: { class: "notification-container" },
|
|
26
34
|
messageContent: { class: "content" },
|
|
27
35
|
messageText: { class: "text" },
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ToastServiceMethods } from 'primevue/toastservice';
|
|
2
|
+
import type { StatusLevel } from '../types/index.js';
|
|
3
|
+
export interface NotificationOptions {
|
|
2
4
|
headline?: string;
|
|
3
5
|
closable?: boolean;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
icon?: string;
|
|
7
|
+
lifetime?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class NotificationService {
|
|
10
|
+
readonly notify: (message: string, options?: NotificationOptions & {
|
|
11
|
+
severity?: StatusLevel;
|
|
12
|
+
}) => void;
|
|
13
|
+
readonly notifyInfo: (message: string, options?: NotificationOptions) => void;
|
|
14
|
+
readonly notifyHelp: (message: string, options?: NotificationOptions) => void;
|
|
15
|
+
readonly notifySuccess: (message: string, options?: NotificationOptions) => void;
|
|
16
|
+
readonly notifyWarning: (message: string, options?: NotificationOptions) => void;
|
|
17
|
+
readonly notifyError: (message: string, options?: NotificationOptions) => void;
|
|
18
|
+
constructor(toast: ToastServiceMethods);
|
|
19
|
+
}
|
|
13
20
|
/**
|
|
14
21
|
* Returns a collection of methods for providing user feedback via popup
|
|
15
22
|
* notifications (a.k.a. toast notifications / snackbar notifications).
|
|
16
23
|
*/
|
|
17
|
-
export declare function useNotification():
|
|
24
|
+
export declare function useNotification(): NotificationService;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
+
import { isNumber } from "@resee-movies/utilities/numbers/is-number";
|
|
1
2
|
import { useToast } from "primevue/usetoast";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
export class NotificationService {
|
|
4
|
+
notify;
|
|
5
|
+
notifyInfo;
|
|
6
|
+
notifyHelp;
|
|
7
|
+
notifySuccess;
|
|
8
|
+
notifyWarning;
|
|
9
|
+
notifyError;
|
|
10
|
+
constructor(toast) {
|
|
11
|
+
this.notify = (message, options) => {
|
|
12
|
+
toast.add({
|
|
13
|
+
detail: message,
|
|
14
|
+
severity: options?.severity,
|
|
15
|
+
summary: options?.headline,
|
|
16
|
+
closable: options?.closable === true,
|
|
17
|
+
life: isNumber(options?.lifetime) ? options?.lifetime : 5e3,
|
|
18
|
+
/* @ts-expect-error - adding custom props to extend functionality */
|
|
19
|
+
icon: options?.icon
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.notifyInfo = (message, options) => this.notify(message, { severity: "info", ...options });
|
|
23
|
+
this.notifyHelp = (message, options) => this.notify(message, { severity: "help", ...options });
|
|
24
|
+
this.notifySuccess = (message, options) => this.notify(message, { severity: "success", ...options });
|
|
25
|
+
this.notifyWarning = (message, options) => this.notify(message, { severity: "warn", ...options });
|
|
26
|
+
this.notifyError = (message, options) => this.notify(message, { severity: "error", ...options });
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
export function useNotification() {
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
notify: createToastMessageClosure(toast, void 0),
|
|
25
|
-
notifyInfo: createToastMessageClosure(toast, "info"),
|
|
26
|
-
notifyHelp: createToastMessageClosure(toast, "help"),
|
|
27
|
-
notifySuccess: createToastMessageClosure(toast, "success"),
|
|
28
|
-
notifyWarning: createToastMessageClosure(toast, "warn"),
|
|
29
|
-
notifyError: createToastMessageClosure(toast, "error")
|
|
30
|
-
};
|
|
30
|
+
return new NotificationService(useToast());
|
|
31
31
|
}
|
package/package.json
CHANGED