@witchcraft/ui 0.3.1 → 0.3.3
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/runtime/assets/animations.css +1 -0
- package/dist/runtime/assets/base.css +1 -1
- package/dist/runtime/assets/tailwind.css +1 -1
- package/dist/runtime/components/LibButton/LibButton.d.vue.ts +1 -1
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +1 -1
- package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +1 -1
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +2 -2
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +2 -2
- package/dist/runtime/components/LibColorPicker/LibColorPicker.d.vue.ts +2 -2
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +2 -2
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +1 -1
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +1 -1
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +1 -1
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts +1 -1
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.d.vue.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +2 -2
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +2 -2
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +1 -1
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +1 -1
- package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +1 -1
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +1 -1
- package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +1 -1
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +1 -1
- package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +17 -4
- package/dist/runtime/components/LibNotifications/LibNotification.vue +84 -25
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -4
- package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +2 -2
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +110 -87
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +2 -2
- package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +1 -1
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +1 -1
- package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +1 -1
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +1 -1
- package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +4 -4
- package/dist/runtime/components/LibPopup/LibPopup.vue +2 -6
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +4 -4
- package/dist/runtime/components/LibProgressBar/LibProgressBar.d.vue.ts +2 -1
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +1 -1
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +2 -1
- package/dist/runtime/components/LibRecorder/LibRecorder.d.vue.ts +1 -1
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +1 -1
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +1 -1
- package/dist/runtime/components/LibRoot/LibRoot.d.vue.ts +2 -2
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +2 -2
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +1 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +1 -1
- package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +1 -1
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +1 -1
- package/dist/runtime/components/LibTable/LibTable.d.vue.ts +2 -2
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +2 -2
- package/dist/runtime/components/Template/TemplateStory.d.ts +1 -1
- package/dist/runtime/components/index.d.ts +20 -20
- package/dist/runtime/components/shared/props.d.ts +1 -1
- package/dist/runtime/composables/index.d.ts +17 -15
- package/dist/runtime/composables/index.js +2 -0
- package/dist/runtime/composables/useDragWithThreshold.d.ts +1 -1
- package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
- package/dist/runtime/composables/useInjectedI18n.d.ts +1 -1
- package/dist/runtime/composables/useInjectedLocale.d.ts +1 -1
- package/dist/runtime/composables/useNotificationHandler.d.ts +1 -1
- package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +1 -1
- package/dist/runtime/composables/useSetupDarkMode.d.ts +1 -1
- package/dist/runtime/composables/useSlotVars.d.ts +32 -0
- package/dist/runtime/composables/useSlotVars.js +12 -0
- package/dist/runtime/composables/useSuggestions.d.ts +1 -1
- package/dist/runtime/directives/index.d.ts +4 -4
- package/dist/runtime/globalResizeObserver.d.ts +1 -1
- package/dist/runtime/helpers/NotificationHandler.d.ts +11 -4
- package/dist/runtime/helpers/NotificationHandler.js +34 -16
- package/dist/runtime/helpers/index.d.ts +10 -10
- package/dist/runtime/helpers/resizeObserverWrapper.d.ts +1 -1
- package/dist/runtime/injectionKeys.d.ts +2 -2
- package/dist/runtime/main.lib.d.ts +10 -10
- package/dist/runtime/tailwind/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/runtime/assets/animations.css +75 -0
- package/src/runtime/assets/base.css +0 -27
- package/src/runtime/assets/tailwind.css +1 -0
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +1 -1
- package/src/runtime/components/LibNotifications/LibNotification.vue +86 -25
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +4 -4
- package/src/runtime/components/LibNotifications/LibNotifications.vue +112 -90
- package/src/runtime/components/LibPopup/LibPopup.vue +2 -6
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +2 -1
- package/src/runtime/components/LibRecorder/LibRecorder.vue +1 -1
- package/src/runtime/composables/index.ts +2 -0
- package/src/runtime/composables/useSlotVars.ts +41 -0
- package/src/runtime/helpers/NotificationHandler.ts +44 -22
package/dist/module.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@theme{--animate-blinkInf:blink 1s linear-infinite;@keyframes blink{0%{opacity:0}25%{opacity:1}75%{opacity:1}to{opacity:0}}--animate-slideBgInf:slide-bg 10s linear-infinite;@keyframes slide{0%{background-position:0}to{background-position:100%}}--animate-hide:hide 500ms ease-in;@keyframes hide{0%{opacity:1}to{opacity:0}}--animate-slideIn:slideIn 500ms cubic-bezier(0.16,1,0.3,1);@keyframes slideIn{0%{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}--animate-overlayShow:overlayShow 500ms cubic-bezier(0.16,1,0.3,1);@keyframes overlayShow{0%{opacity:0}to{opacity:1}}--animate-contentShow:contentShow 500ms cubic-bezier(0.16,1,0.3,1);@keyframes contentShow{0%{opacity:0;transform:translateY(-10%) scale(.96)}to{opacity:1;transform:scale(1)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(100%)}.list-leave-active{position:absolute}.list-leave-to,.list-move{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}
|
|
1
|
+
.v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(100%)}.list-leave-active{position:absolute}.list-leave-to,.list-move{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}a{@apply link-like}*{@apply styled-scrollbar}textarea{@apply styled-resizer}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss" source("../../");@import "./theme.css";@import "./base.css";@import "./utils.css";
|
|
1
|
+
@import "tailwindcss" source("../../");@import "./theme.css";@import "./animations.css";@import "./base.css";@import "./utils.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
-
import { type BaseInteractiveProps, type ButtonProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import { type BaseInteractiveProps, type ButtonProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & ButtonProps;
|
|
4
4
|
interface Props extends
|
|
5
5
|
/** @vue-ignore */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
-
import { type BaseInteractiveProps, type ButtonProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import { type BaseInteractiveProps, type ButtonProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & ButtonProps;
|
|
4
4
|
interface Props extends
|
|
5
5
|
/** @vue-ignore */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
|
|
2
|
-
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js
|
|
2
|
+
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js";
|
|
3
3
|
type WrapperTypes = Partial<WrapperProps<"label", HTMLAttributes, {
|
|
4
4
|
/** Tailwind classes. */
|
|
5
5
|
class?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
|
|
2
|
-
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js
|
|
2
|
+
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js";
|
|
3
3
|
type WrapperTypes = Partial<WrapperProps<"label", HTMLAttributes, {
|
|
4
4
|
/** Tailwind classes. */
|
|
5
5
|
class?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
-
import type { HsvaColor, RgbaColor } from "../../types/index.js
|
|
3
|
-
import { type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import type { HsvaColor, RgbaColor } from "../../types/index.js";
|
|
3
|
+
import { type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js";
|
|
4
4
|
type RealProps = LabelProps & LinkableByIdProps & {
|
|
5
5
|
allowAlpha?: boolean;
|
|
6
6
|
border?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
-
import type { HsvaColor, RgbaColor } from "../../types/index.js
|
|
3
|
-
import { type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import type { HsvaColor, RgbaColor } from "../../types/index.js";
|
|
3
|
+
import { type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js";
|
|
4
4
|
type RealProps = LabelProps & LinkableByIdProps & {
|
|
5
5
|
allowAlpha?: boolean;
|
|
6
6
|
border?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HsvaColor, RgbaColor } from "../../types/index.js
|
|
2
|
-
import { type LabelProps, type LinkableByIdProps } from "../shared/props.js
|
|
1
|
+
import type { HsvaColor, RgbaColor } from "../../types/index.js";
|
|
2
|
+
import { type LabelProps, type LinkableByIdProps } from "../shared/props.js";
|
|
3
3
|
type __VLS_Props = LabelProps & LinkableByIdProps & {
|
|
4
4
|
allowAlpha?: boolean;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HsvaColor, RgbaColor } from "../../types/index.js
|
|
2
|
-
import { type LabelProps, type LinkableByIdProps } from "../shared/props.js
|
|
1
|
+
import type { HsvaColor, RgbaColor } from "../../types/index.js";
|
|
2
|
+
import { type LabelProps, type LinkableByIdProps } from "../shared/props.js";
|
|
3
3
|
type __VLS_Props = LabelProps & LinkableByIdProps & {
|
|
4
4
|
allowAlpha?: boolean;
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { HsvaColor, RgbaColor } from "../../../types/index.js
|
|
1
|
+
import type { HsvaColor, RgbaColor } from "../../../types/index.js";
|
|
2
2
|
export declare function safeConvertToHsva(val: string | RgbaColor, allowAlpha: boolean): HsvaColor | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { HsvaColor, RgbaColor } from "../../../types/index.js
|
|
1
|
+
import type { HsvaColor, RgbaColor } from "../../../types/index.js";
|
|
2
2
|
export declare function safeConvertToRgba(val: string | HsvaColor, allowAlpha: boolean): RgbaColor | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { RgbaColor } from "../../../main.lib.js
|
|
1
|
+
import type { RgbaColor } from "../../../main.lib.js";
|
|
2
2
|
export declare function toLowPrecisionRgbaString(rgba: RgbaColor, withAlpha: boolean, precision: number): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
-
import type { TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import type { TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
4
|
"update:darkMode": (value: boolean) => any;
|
|
5
5
|
"update:darkModeState": (value: "system" | "dark" | "light") => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
-
import type { TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import type { TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
4
|
"update:darkMode": (value: boolean) => any;
|
|
5
5
|
"update:darkModeState": (value: "system" | "dark" | "light") => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
|
|
2
|
-
import type { FileInputError } from "../../types/index.js
|
|
3
|
-
import { type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js
|
|
2
|
+
import type { FileInputError } from "../../types/index.js";
|
|
3
|
+
import { type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js";
|
|
4
4
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
5
5
|
input: (val: File[]) => any;
|
|
6
6
|
errors: (val: FileInputError[]) => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
|
|
2
|
-
import type { FileInputError } from "../../types/index.js
|
|
3
|
-
import { type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js
|
|
2
|
+
import type { FileInputError } from "../../types/index.js";
|
|
3
|
+
import { type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js";
|
|
4
4
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
5
5
|
input: (val: File[]) => any;
|
|
6
6
|
errors: (val: FileInputError[]) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
|
|
2
|
-
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type SuggestionsProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js
|
|
2
|
+
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type SuggestionsProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js";
|
|
3
3
|
type WrapperTypes = WrapperProps<"suggestions", HTMLAttributes> & WrapperProps<"wrapper", HTMLAttributes> & WrapperProps<"inner-wrapper", HTMLAttributes>;
|
|
4
4
|
type RealProps = SuggestionsProps & LinkableByIdProps & LabelProps & BaseInteractiveProps & {
|
|
5
5
|
suggestions?: SuggestionsProps["suggestions"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
|
|
2
|
-
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type SuggestionsProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js
|
|
2
|
+
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type SuggestionsProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js";
|
|
3
3
|
type WrapperTypes = WrapperProps<"suggestions", HTMLAttributes> & WrapperProps<"wrapper", HTMLAttributes> & WrapperProps<"inner-wrapper", HTMLAttributes>;
|
|
4
4
|
type RealProps = SuggestionsProps & LinkableByIdProps & LabelProps & BaseInteractiveProps & {
|
|
5
5
|
suggestions?: SuggestionsProps["suggestions"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LabelHTMLAttributes } from "vue";
|
|
2
|
-
import type { BaseInteractiveProps, LabelProps, LinkableByIdProps, TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import type { BaseInteractiveProps, LabelProps, LinkableByIdProps, TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & {
|
|
4
4
|
unstyled?: boolean;
|
|
5
5
|
valid?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LabelHTMLAttributes } from "vue";
|
|
2
|
-
import type { BaseInteractiveProps, LabelProps, LinkableByIdProps, TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import type { BaseInteractiveProps, LabelProps, LinkableByIdProps, TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & {
|
|
4
4
|
unstyled?: boolean;
|
|
5
5
|
valid?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "vue";
|
|
2
|
-
import type { BaseInteractiveProps, LabelProps, TailwindClassProp, WrapperProps } from "../shared/props.js
|
|
2
|
+
import type { BaseInteractiveProps, LabelProps, TailwindClassProp, WrapperProps } from "../shared/props.js";
|
|
3
3
|
type WrapperTypes = Partial<WrapperProps<"item", HTMLAttributes>>;
|
|
4
4
|
type RealProps = LabelProps & BaseInteractiveProps & {
|
|
5
5
|
border?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "vue";
|
|
2
|
-
import type { BaseInteractiveProps, LabelProps, TailwindClassProp, WrapperProps } from "../shared/props.js
|
|
2
|
+
import type { BaseInteractiveProps, LabelProps, TailwindClassProp, WrapperProps } from "../shared/props.js";
|
|
3
3
|
type WrapperTypes = Partial<WrapperProps<"item", HTMLAttributes>>;
|
|
4
4
|
type RealProps = LabelProps & BaseInteractiveProps & {
|
|
5
5
|
border?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "vue";
|
|
2
|
-
import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js
|
|
3
|
-
import type { TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js";
|
|
3
|
+
import type { TailwindClassProp } from "../shared/props.js";
|
|
4
4
|
type RealProps = {
|
|
5
5
|
notification: NotificationEntry;
|
|
6
6
|
handler?: NotificationHandler;
|
|
@@ -9,9 +9,22 @@ interface Props extends
|
|
|
9
9
|
/** @vue-ignore */
|
|
10
10
|
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
|
|
11
11
|
}
|
|
12
|
-
declare const _default: import("vue").DefineComponent<Props, {
|
|
12
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
|
|
13
13
|
focus: () => void;
|
|
14
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
15
15
|
handler: NotificationHandler;
|
|
16
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
17
|
+
top?: (props: {
|
|
18
|
+
notification: any;
|
|
19
|
+
}) => any;
|
|
20
|
+
} & {
|
|
21
|
+
title?: (props: any) => any;
|
|
22
|
+
} & {
|
|
23
|
+
message?: (props: any) => any;
|
|
24
|
+
}>;
|
|
17
25
|
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
+
v-if="notification"
|
|
3
4
|
:class="twMerge(
|
|
4
|
-
`
|
|
5
|
+
`
|
|
6
|
+
notification
|
|
5
7
|
max-w-700px
|
|
6
8
|
bg-neutral-50
|
|
7
9
|
dark:bg-neutral-900
|
|
@@ -9,11 +11,15 @@
|
|
|
9
11
|
dark:text-bg
|
|
10
12
|
border
|
|
11
13
|
border-neutral-400
|
|
14
|
+
dark:border-neutral-700
|
|
12
15
|
rounded-sm
|
|
13
16
|
focus-outline
|
|
14
|
-
flex
|
|
17
|
+
flex
|
|
18
|
+
flex-col
|
|
15
19
|
gap-2
|
|
16
|
-
p-
|
|
20
|
+
p-1
|
|
21
|
+
text-sm
|
|
22
|
+
focus:border-accent-500
|
|
17
23
|
`,
|
|
18
24
|
$attrs.class
|
|
19
25
|
)"
|
|
@@ -22,30 +28,59 @@
|
|
|
22
28
|
ref="notificationEl"
|
|
23
29
|
@keydown.enter.self="NotificationHandler.resolveToDefault(notification)"
|
|
24
30
|
>
|
|
25
|
-
<
|
|
26
|
-
|
|
31
|
+
<slot
|
|
32
|
+
name="top"
|
|
33
|
+
:notification="notification"
|
|
34
|
+
/>
|
|
35
|
+
<div
|
|
36
|
+
class="
|
|
37
|
+
notification--header
|
|
38
|
+
flex-reverse
|
|
39
|
+
flex
|
|
40
|
+
justify-between
|
|
41
|
+
items-center
|
|
42
|
+
"
|
|
43
|
+
>
|
|
44
|
+
<slot
|
|
27
45
|
v-if="notification.title"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
name="title"
|
|
47
|
+
v-bind="setSlotVar('title', {
|
|
48
|
+
title: notification.title,
|
|
49
|
+
class: `
|
|
50
|
+
notification--title
|
|
51
|
+
focus-outline
|
|
52
|
+
rounded-sm
|
|
53
|
+
font-bold
|
|
54
|
+
`,
|
|
55
|
+
tabindex: 0
|
|
56
|
+
})"
|
|
34
57
|
>
|
|
35
|
-
|
|
36
|
-
|
|
58
|
+
<div
|
|
59
|
+
v-bind="slotVars.title"
|
|
60
|
+
>
|
|
61
|
+
{{ notification.title }}
|
|
62
|
+
</div>
|
|
63
|
+
</slot>
|
|
37
64
|
<div class="notification--spacer flex-1"/>
|
|
38
65
|
<div class="actions flex">
|
|
39
66
|
<LibButton
|
|
40
67
|
:border="false"
|
|
41
|
-
class="
|
|
68
|
+
class="
|
|
69
|
+
notification--title-button
|
|
70
|
+
notification--copy-button
|
|
71
|
+
text-neutral-700
|
|
72
|
+
dark:text-neutral-300
|
|
73
|
+
"
|
|
42
74
|
@click="copy(handler ? handler.stringify(notification) : JSON.stringify(notification))"
|
|
43
75
|
>
|
|
44
76
|
<icon><i-fa6-regular-copy/></icon>
|
|
45
77
|
</LibButton>
|
|
46
78
|
<lib-button
|
|
47
79
|
v-if="notification.cancellable"
|
|
48
|
-
class="
|
|
80
|
+
class="
|
|
81
|
+
notification--title-button
|
|
82
|
+
notification--cancel-button
|
|
83
|
+
"
|
|
49
84
|
:border="false"
|
|
50
85
|
@click="NotificationHandler.dismiss(notification)"
|
|
51
86
|
>
|
|
@@ -53,12 +88,27 @@
|
|
|
53
88
|
</lib-button>
|
|
54
89
|
</div>
|
|
55
90
|
</div>
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
91
|
+
<slot
|
|
92
|
+
v-if="notification.message"
|
|
93
|
+
name="message"
|
|
94
|
+
v-bind="setSlotVar('message', {
|
|
95
|
+
class: `
|
|
96
|
+
notification--message
|
|
97
|
+
whitespace-pre-wrap
|
|
98
|
+
text-neutral-800
|
|
99
|
+
dark:text-neutral-200
|
|
100
|
+
mb-1
|
|
101
|
+
`,
|
|
102
|
+
message: notification.message,
|
|
103
|
+
tabindex: 0
|
|
104
|
+
})"
|
|
59
105
|
>
|
|
60
|
-
|
|
61
|
-
|
|
106
|
+
<div
|
|
107
|
+
v-bind="slotVars.message"
|
|
108
|
+
>
|
|
109
|
+
{{ notification.message }}
|
|
110
|
+
</div>
|
|
111
|
+
</slot>
|
|
62
112
|
<div class="notification--footer flex items-end justify-between">
|
|
63
113
|
<div
|
|
64
114
|
v-if="notification.code"
|
|
@@ -69,8 +119,11 @@
|
|
|
69
119
|
<div class="notification--footer-spacer flex-1 py-1"/>
|
|
70
120
|
<div
|
|
71
121
|
v-if="notification.options"
|
|
72
|
-
class="
|
|
73
|
-
|
|
122
|
+
class="
|
|
123
|
+
notification--options
|
|
124
|
+
flex
|
|
125
|
+
flex-wrap
|
|
126
|
+
justify-end
|
|
74
127
|
gap-2
|
|
75
128
|
"
|
|
76
129
|
>
|
|
@@ -78,11 +131,12 @@
|
|
|
78
131
|
:label="option"
|
|
79
132
|
:class="twMerge(
|
|
80
133
|
`
|
|
134
|
+
notification--button
|
|
81
135
|
notification--option-button
|
|
136
|
+
px-2
|
|
82
137
|
`,
|
|
83
|
-
|
|
138
|
+
notification.default === option && `notification--default`
|
|
84
139
|
)"
|
|
85
|
-
:border="buttonColors[i] !== 'secondary'"
|
|
86
140
|
:color="buttonColors[i]"
|
|
87
141
|
v-for="option, i in notification.options"
|
|
88
142
|
:key="option"
|
|
@@ -94,9 +148,10 @@
|
|
|
94
148
|
</template>
|
|
95
149
|
|
|
96
150
|
<script setup>
|
|
97
|
-
import { computed, ref, useAttrs } from "vue";
|
|
151
|
+
import { computed, onMounted, ref, useAttrs } from "vue";
|
|
98
152
|
import IFa6RegularCopy from "~icons/fa6-regular/copy";
|
|
99
153
|
import IFa6SolidXmark from "~icons/fa6-solid/xmark";
|
|
154
|
+
import { useSlotVars } from "../../composables/useSlotVars.js";
|
|
100
155
|
import { copy } from "../../helpers/copy.js";
|
|
101
156
|
import { NotificationHandler } from "../../helpers/NotificationHandler.js";
|
|
102
157
|
import { twMerge } from "../../utils/twMerge.js";
|
|
@@ -107,6 +162,7 @@ defineOptions({
|
|
|
107
162
|
inheritAttrs: false
|
|
108
163
|
});
|
|
109
164
|
const $attrs = useAttrs();
|
|
165
|
+
const { setSlotVar, slotVars } = useSlotVars();
|
|
110
166
|
const props = defineProps({
|
|
111
167
|
notification: { type: null, required: true },
|
|
112
168
|
handler: { type: Object, required: false, default: void 0 }
|
|
@@ -114,6 +170,9 @@ const props = defineProps({
|
|
|
114
170
|
const getColor = (notification, option) => notification.default === option ? "primary" : notification.dangerous.includes(option) ? "danger" : "secondary";
|
|
115
171
|
const buttonColors = computed(() => props.notification.options.map((option) => getColor(props.notification, option)));
|
|
116
172
|
const notificationEl = ref(null);
|
|
173
|
+
onMounted(() => {
|
|
174
|
+
notificationEl.value?.focus();
|
|
175
|
+
});
|
|
117
176
|
defineExpose({
|
|
118
177
|
focus: () => {
|
|
119
178
|
notificationEl.value?.focus();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "vue";
|
|
2
|
-
import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js
|
|
3
|
-
import type { TailwindClassProp } from "../shared/props.js
|
|
2
|
+
import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js";
|
|
3
|
+
import type { TailwindClassProp } from "../shared/props.js";
|
|
4
4
|
type RealProps = {
|
|
5
5
|
notification: NotificationEntry;
|
|
6
6
|
handler?: NotificationHandler;
|
|
@@ -9,9 +9,22 @@ interface Props extends
|
|
|
9
9
|
/** @vue-ignore */
|
|
10
10
|
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
|
|
11
11
|
}
|
|
12
|
-
declare const _default: import("vue").DefineComponent<Props, {
|
|
12
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
|
|
13
13
|
focus: () => void;
|
|
14
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
15
15
|
handler: NotificationHandler;
|
|
16
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
17
|
+
top?: (props: {
|
|
18
|
+
notification: any;
|
|
19
|
+
}) => any;
|
|
20
|
+
} & {
|
|
21
|
+
title?: (props: any) => any;
|
|
22
|
+
} & {
|
|
23
|
+
message?: (props: any) => any;
|
|
24
|
+
}>;
|
|
17
25
|
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NotificationHandler } from "../../helpers/NotificationHandler.js
|
|
2
|
-
import type { LinkableByIdProps, TailwindClassProp } from "../shared/props.js
|
|
1
|
+
import { NotificationHandler } from "../../helpers/NotificationHandler.js";
|
|
2
|
+
import type { LinkableByIdProps, TailwindClassProp } from "../shared/props.js";
|
|
3
3
|
import type { HTMLAttributes } from "vue";
|
|
4
4
|
type RealProps = LinkableByIdProps & {
|
|
5
5
|
/** If not provided, uses the global handler (this requires useNotificationHandler be called and configured). */
|