@witchcraft/ui 0.2.1-beta.3 → 0.2.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 +1 -1
- package/dist/runtime/build/WitchcraftUiResolver.d.ts +2 -2
- package/dist/runtime/build/generateTheme.js +2 -2
- package/dist/runtime/components/Aria/Aria.vue +4 -2
- package/dist/runtime/components/Aria/Aria.vue.d.ts +1 -1
- package/dist/runtime/components/Icon/Icon.vue +3 -3
- package/dist/runtime/components/Icon/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/LibButton/LibButton.vue +9 -4
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +1 -1
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +3 -4
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +15 -8
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +10 -6
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorPicker/utils/truncate.js +1 -1
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +5 -2
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -6
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +7 -5
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDebug/LibDebug.vue +9 -4
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +1 -1
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +2 -1
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +4 -1
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +29 -13
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +2 -2
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +42 -12
- package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +3 -3
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +1 -2
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +2 -2
- package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -8
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +10 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +2 -2
- package/dist/runtime/components/LibPagination/LibPagination.vue +25 -12
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +2 -2
- package/dist/runtime/components/LibPalette/LibPalette.vue +6 -5
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +5 -5
- package/dist/runtime/components/LibPopup/LibPopup.vue +6 -4
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +3 -3
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +5 -3
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +9 -9
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +1 -1
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +2 -2
- package/dist/runtime/components/LibRoot/LibRoot.vue +11 -6
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +1 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +1 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +1 -1
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +5 -3
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +1 -1
- package/dist/runtime/components/LibTable/LibTable.vue +23 -8
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +1 -1
- package/dist/runtime/components/Template/NAME.vue +2 -3
- package/dist/runtime/components/Template/NAME.vue.d.ts +1 -1
- package/dist/runtime/components/TestControls/TestControls.vue +4 -2
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +1 -1
- package/dist/runtime/composables/useDragWithThreshold.d.ts +1 -1
- package/dist/runtime/composables/useInjectedI18n.d.ts +1 -1
- package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +1 -1
- package/dist/runtime/composables/useSetupI18n.d.ts +1 -1
- package/dist/runtime/composables/useSuggestions.d.ts +2 -2
- package/dist/runtime/helpers/NotificationHandler.d.ts +1 -1
- package/dist/runtime/helpers/base64ToImg.js +2 -2
- package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +1 -1
- package/dist/runtime/utils/notifyIfError.d.ts +1 -1
- package/package.json +4 -6
- package/src/module.ts +25 -28
- package/src/runtime/build/WitchcraftUiResolver.ts +3 -3
- package/src/runtime/build/generateTheme.ts +3 -2
- package/src/runtime/build/unpluginIconViteOptions.ts +1 -1
- package/src/runtime/components/Aria/Aria.vue +5 -6
- package/src/runtime/components/Focus.stories.ts +11 -12
- package/src/runtime/components/Icon/Icon.vue +5 -9
- package/src/runtime/components/LibButton/LibButton.stories.ts +21 -22
- package/src/runtime/components/LibButton/LibButton.vue +23 -21
- package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +6 -10
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +17 -19
- package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +8 -13
- package/src/runtime/components/LibColorInput/LibColorInput.vue +49 -45
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +14 -18
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +50 -52
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -2
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -2
- package/src/runtime/components/LibColorPicker/utils/truncate.ts +1 -2
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +5 -8
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
- package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +14 -15
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +1 -2
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +13 -13
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +9 -8
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +2 -1
- package/src/runtime/components/LibDatePicker/helpers.ts +0 -2
- package/src/runtime/components/LibDebug/LibDebug.stories.ts +11 -15
- package/src/runtime/components/LibDebug/LibDebug.vue +14 -11
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +8 -4
- package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +12 -15
- package/src/runtime/components/LibFileInput/LibFileInput.vue +65 -47
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +59 -67
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +73 -48
- package/src/runtime/components/LibLabel/LibLabel.stories.ts +4 -8
- package/src/runtime/components/LibLabel/LibLabel.vue +8 -8
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +10 -15
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +14 -18
- package/src/runtime/components/LibNotifications/LibNotification.stories.ts +30 -34
- package/src/runtime/components/LibNotifications/LibNotification.vue +27 -17
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +11 -15
- package/src/runtime/components/LibNotifications/LibNotifications.vue +21 -16
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +5 -9
- package/src/runtime/components/LibPagination/LibPagination.vue +46 -32
- package/src/runtime/components/LibPalette/LibPalette.stories.ts +3 -7
- package/src/runtime/components/LibPalette/LibPalette.vue +13 -12
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +19 -23
- package/src/runtime/components/LibPopup/LibPopup.vue +31 -35
- package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +13 -17
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +36 -33
- package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +11 -12
- package/src/runtime/components/LibRecorder/LibRecorder.vue +34 -34
- package/src/runtime/components/LibRoot/LibRoot.vue +16 -12
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +20 -24
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +17 -21
- package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +16 -19
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +27 -30
- package/src/runtime/components/LibTable/LibTable.stories.ts +30 -33
- package/src/runtime/components/LibTable/LibTable.vue +38 -24
- package/src/runtime/components/Reset.stories.ts +3 -6
- package/src/runtime/components/Scrolling.stories.ts +5 -8
- package/src/runtime/components/Template/NAME.vue +11 -11
- package/src/runtime/components/Template/TemplateStory.ts +9 -10
- package/src/runtime/components/TestControls/TestControls.vue +5 -5
- package/src/runtime/components/shared/props.ts +4 -6
- package/src/runtime/components/shared/storyHelpers/playInput.ts +2 -3
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +5 -9
- package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
- package/src/runtime/composables/useAriaLabel.ts +1 -1
- package/src/runtime/composables/useDarkMode.ts +15 -19
- package/src/runtime/composables/useDragWithThreshold.ts +6 -8
- package/src/runtime/composables/useGlobalResizeObserver.ts +0 -1
- package/src/runtime/composables/useInjectedDarkMode.ts +2 -2
- package/src/runtime/composables/useInjectedI18n.ts +1 -1
- package/src/runtime/composables/useInjectedLocale.ts +3 -4
- package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +4 -4
- package/src/runtime/composables/useScrollNearContainerEdges.ts +12 -13
- package/src/runtime/composables/useSetupI18n.ts +4 -7
- package/src/runtime/composables/useSetupLocale.ts +3 -5
- package/src/runtime/composables/useSuggestions.ts +25 -30
- package/src/runtime/directives/vDetectFlex.ts +5 -8
- package/src/runtime/directives/vExtractRootEl.ts +1 -1
- package/src/runtime/directives/vResizableCols.ts +3 -7
- package/src/runtime/directives/vResizeObserver.ts +1 -2
- package/src/runtime/globalResizeObserver.ts +0 -1
- package/src/runtime/helpers/NotificationHandler.ts +8 -12
- package/src/runtime/helpers/base64ToImg.ts +2 -3
- package/src/runtime/helpers/createNoonUtcDate.ts +0 -1
- package/src/runtime/helpers/defaultTranslationFunction.ts +0 -1
- package/src/runtime/helpers/getTimeZoneList.ts +0 -1
- package/src/runtime/helpers/readFile.ts +2 -2
- package/src/runtime/helpers/resizeObserverWrapper.ts +0 -1
- package/src/runtime/helpers/storybook.ts +2 -3
- package/src/runtime/main.lib.ts +0 -2
- package/src/runtime/nuxt/plugins/vue-plugin.ts +4 -5
- package/src/runtime/tailwind/themeConvertionOpts.ts +3 -4
- package/src/runtime/theme.ts +0 -1
- package/src/runtime/types/index.ts +3 -4
- package/src/runtime/utils/notifyIfError.ts +2 -2
- package/src/runtime/utils/twMerge.ts +2 -2
- package/src/runtime/vue/VueComponentsPlugin.ts +1 -2
- package/src/runtime/vue/registerComponents.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<slot
|
|
2
|
+
<slot
|
|
3
|
+
name="button"
|
|
3
4
|
:extract-el="(_) => buttonEl = _"
|
|
4
5
|
/>
|
|
5
6
|
<!-- <Transition> -->
|
|
@@ -26,7 +27,8 @@
|
|
|
26
27
|
ref="dialogEl"
|
|
27
28
|
@mousedown.self="handleMouseup"
|
|
28
29
|
>
|
|
29
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
v-if="modelValue"
|
|
30
32
|
:class="`popup z-100 fixed ${props.avoidRepositioning ? 'transition-[top,left]' : ''}`"
|
|
31
33
|
:style="`
|
|
32
34
|
top:${pos.y}px;
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
</template>
|
|
47
49
|
|
|
48
50
|
<script setup>
|
|
49
|
-
import { onMounted,
|
|
51
|
+
import { onMounted, ref, useAttrs, watch } from "vue";
|
|
50
52
|
import { getFallbackId } from "../shared/props.js";
|
|
51
53
|
import { twMerge } from "../../utils/twMerge.js";
|
|
52
54
|
import { castType } from "@alanscodelog/utils/castType";
|
|
@@ -64,7 +66,7 @@ const props = defineProps({
|
|
|
64
66
|
});
|
|
65
67
|
const $attrs = useAttrs();
|
|
66
68
|
defineOptions({
|
|
67
|
-
name: "
|
|
69
|
+
name: "LibPopup",
|
|
68
70
|
inheritAttrs: false
|
|
69
71
|
});
|
|
70
72
|
const emit = defineEmits(["close"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "vue";
|
|
2
2
|
import { type LinkableByIdProps, type TailwindClassProp, type PopupProps } from "../shared/props.js.js";
|
|
3
|
-
import type { IPopupReference
|
|
3
|
+
import type { IPopupReference } from "../../types/index.js.js";
|
|
4
4
|
type RealProps = LinkableByIdProps & PopupProps;
|
|
5
5
|
interface Props extends
|
|
6
6
|
/** @vue-ignore */
|
|
@@ -25,8 +25,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
|
|
|
25
25
|
canClose: boolean;
|
|
26
26
|
useDialogForBackdrop: false;
|
|
27
27
|
useBackdrop: boolean;
|
|
28
|
-
preferredHorizontal: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | PopupPositioner;
|
|
29
|
-
preferredVertical: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | PopupPositioner;
|
|
28
|
+
preferredHorizontal: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | import("../../main.lib.js.js").PopupPositioner;
|
|
29
|
+
preferredVertical: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | import("../../main.lib.js.js").PopupPositioner;
|
|
30
30
|
avoidRepositioning: boolean;
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
32
32
|
button?: (props: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Transition>
|
|
3
|
-
<div
|
|
3
|
+
<div
|
|
4
|
+
v-if="!hide"
|
|
4
5
|
:id="id ?? fallbackId"
|
|
5
6
|
:class="twMerge(`
|
|
6
7
|
progress-bar
|
|
@@ -52,7 +53,8 @@
|
|
|
52
53
|
<span class="before:content-vertical-holder"/>
|
|
53
54
|
<Transition>
|
|
54
55
|
<slot>
|
|
55
|
-
<label
|
|
56
|
+
<label
|
|
57
|
+
v-if="!psuedoHide"
|
|
56
58
|
:for="id"
|
|
57
59
|
class="
|
|
58
60
|
text-bg
|
|
@@ -100,7 +102,7 @@ import { twMerge } from "../../utils/twMerge.js";
|
|
|
100
102
|
import { getFallbackId } from "../shared/props.js";
|
|
101
103
|
const clampVal = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
102
104
|
defineOptions({
|
|
103
|
-
name: "
|
|
105
|
+
name: "LibProgressBar",
|
|
104
106
|
inheritAttrs: false
|
|
105
107
|
});
|
|
106
108
|
const fallbackId = getFallbackId();
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { type HTMLAttributes } from "vue";
|
|
2
1
|
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js.js";
|
|
2
|
+
import type { HTMLAttributes } from "vue";
|
|
3
3
|
type RealProps = LinkableByIdProps & BaseInteractiveProps & LabelProps & {
|
|
4
4
|
progress: number;
|
|
5
5
|
/** Will auto hide after this given time if progress is 100% or more or less than 0% until progress is set to something else. Disabled (-1) by default. */
|
|
6
6
|
autohideOnComplete?: number;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
* Do not actually hide the element, just leave an unstyled div,
|
|
9
|
+
* so the whole layout doesn't change on completion when autohideOnComplete is set.
|
|
10
|
+
*/
|
|
11
11
|
keepSpaceWhenHidden?: boolean;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
* By default the progress bar is visually clamped to 0-100, even if the value might be something else.
|
|
14
|
+
* You can change what it's clamped to here, to for example,
|
|
15
|
+
* show at least a small sliver of the progress bar when it's still 0.
|
|
16
|
+
*/
|
|
17
17
|
clamp?: [start: number, end: number];
|
|
18
18
|
};
|
|
19
19
|
interface Props extends
|
|
20
20
|
/** @vue-ignore */
|
|
21
21
|
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
|
|
22
22
|
}
|
|
23
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props,
|
|
23
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
24
24
|
disabled: boolean;
|
|
25
25
|
readonly: boolean;
|
|
26
26
|
border: boolean;
|
|
@@ -78,7 +78,7 @@ import { useInjectedI18n } from "../../composables/useInjectedI18n.js";
|
|
|
78
78
|
import { twMerge } from "../../utils/twMerge.js";
|
|
79
79
|
import { getFallbackId } from "../shared/props.js";
|
|
80
80
|
defineOptions({
|
|
81
|
-
name: "
|
|
81
|
+
name: "LibRecorder",
|
|
82
82
|
inheritAttrs: false
|
|
83
83
|
});
|
|
84
84
|
const t = useInjectedI18n();
|
|
@@ -14,7 +14,7 @@ type RealProps = LinkableByIdProps & BaseInteractiveProps & LabelProps & {
|
|
|
14
14
|
* Note that the component does not handle the setting of `recording` (unless the component is disabled), `modelValue`, or `recordingValue` at all and has no mechanism for cancelling a recording. It is left to the recorder listeners and any `recorder:*` handlers to determine what to do.
|
|
15
15
|
*/
|
|
16
16
|
recorder?: undefined | Record<string, any>;
|
|
17
|
-
/** This provides a way to manually attach/remove event listeners to/from the element. It is an alternative to the `recorder` prop, see it for more details. Both cannot be specified at the same time
|
|
17
|
+
/** This provides a way to manually attach/remove event listeners to/from the element. It is an alternative to the `recorder` prop, see it for more details. Both cannot be specified at the same time. */
|
|
18
18
|
binders?: undefined | {
|
|
19
19
|
bind: (el: HTMLElement) => void;
|
|
20
20
|
unbind: (el: HTMLElement) => void;
|
|
@@ -33,7 +33,7 @@ declare const _default: import("vue").DefineComponent<Props & {
|
|
|
33
33
|
recording?: boolean;
|
|
34
34
|
/** The final value of the recorder. For intermediate values while recording, pass a recorder and set an appropriate recording value. */
|
|
35
35
|
modelValue: string;
|
|
36
|
-
},
|
|
36
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
37
|
"update:modelValue": (value: string) => any;
|
|
38
38
|
"update:recording": (value: boolean) => any;
|
|
39
39
|
} & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
:id="id"
|
|
3
4
|
tabindex="-1"
|
|
4
5
|
:class="twMerge(
|
|
5
6
|
showOutline ? 'group outlined outlined-visible' : '[&_*]:outline-hidden',
|
|
@@ -33,9 +34,14 @@
|
|
|
33
34
|
$attrs.attrs?.class
|
|
34
35
|
)"
|
|
35
36
|
>
|
|
36
|
-
<TestControls
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
<TestControls
|
|
38
|
+
v-if="testWrapperMode"
|
|
39
|
+
:show-outline="showOutline"
|
|
40
|
+
/>
|
|
41
|
+
<Notifications
|
|
42
|
+
v-if="useNotifications && isClientSide"
|
|
43
|
+
data-allow-mismatch
|
|
44
|
+
/>
|
|
39
45
|
<slot/>
|
|
40
46
|
</div>
|
|
41
47
|
</div>
|
|
@@ -43,7 +49,6 @@
|
|
|
43
49
|
|
|
44
50
|
<script setup>
|
|
45
51
|
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
46
|
-
import {} from "metamorphosis";
|
|
47
52
|
import { computed, onBeforeUnmount, onMounted, ref, toRaw } from "vue";
|
|
48
53
|
import { useAccesibilityOutline } from "../../composables/useAccesibilityOutline.js";
|
|
49
54
|
import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
|
|
@@ -58,7 +63,7 @@ import { twMerge } from "../../utils/twMerge.js";
|
|
|
58
63
|
import Notifications from "../LibNotifications/LibNotifications.vue";
|
|
59
64
|
import TestControls from "../TestControls/TestControls.vue";
|
|
60
65
|
const $attrs = useDivideAttrs(["wrapper"]);
|
|
61
|
-
defineOptions({ name: "
|
|
66
|
+
defineOptions({ name: "Root", inheritAttrs: false, suspensible: false });
|
|
62
67
|
const props = defineProps({
|
|
63
68
|
theme: { type: Object, required: false, default: void 0 },
|
|
64
69
|
outline: { type: Boolean, required: false, default: true },
|
|
@@ -78,7 +78,7 @@ import { hasModifiers } from "../../helpers/hasModifiers.js";
|
|
|
78
78
|
import { twMerge } from "../../utils/twMerge.js";
|
|
79
79
|
import { getFallbackId } from "../shared/props.js";
|
|
80
80
|
defineOptions({
|
|
81
|
-
name: "
|
|
81
|
+
name: "LibSimpleInput",
|
|
82
82
|
inheritAttrs: false
|
|
83
83
|
});
|
|
84
84
|
const fallbackId = getFallbackId();
|
|
@@ -18,7 +18,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
18
18
|
readonly "onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
19
19
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onInput" | "onSubmit" | "onUpdate:modelValue"> & (Props & {
|
|
20
20
|
modelValue: T;
|
|
21
|
-
}) &
|
|
21
|
+
}) & {}> & import("vue").PublicProps;
|
|
22
22
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
23
23
|
attrs: any;
|
|
24
24
|
slots: {};
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
v-bind="{ ...$.attrs, class: void 0 }"
|
|
18
18
|
>
|
|
19
19
|
<!-- Click event is just in case, it should not really be triggered. We can do click selections via the blur handler. -->
|
|
20
|
-
<div
|
|
20
|
+
<div
|
|
21
|
+
:id="`suggestion-${id ?? fallbackId}-${index}`"
|
|
21
22
|
role="option"
|
|
22
23
|
:class="twMerge(
|
|
23
24
|
`
|
|
@@ -41,7 +42,8 @@
|
|
|
41
42
|
@mousedown.prevent
|
|
42
43
|
@mouseup="suggestions.enterIndex(index, !Array.isArray($modelValue))"
|
|
43
44
|
>
|
|
44
|
-
<slot
|
|
45
|
+
<slot
|
|
46
|
+
name="item"
|
|
45
47
|
:item="item"
|
|
46
48
|
:index="index"
|
|
47
49
|
:is-selected="Array.isArray($modelValue) ? $modelValue.includes(item) : $modelValue === item"
|
|
@@ -68,7 +70,7 @@ import { twMerge } from "../../utils/twMerge.js";
|
|
|
68
70
|
import LibCheckbox from "../LibCheckbox/LibCheckbox.vue";
|
|
69
71
|
import { getFallbackId } from "../shared/props.js";
|
|
70
72
|
defineOptions({
|
|
71
|
-
name: "
|
|
73
|
+
name: "LibSuggestions",
|
|
72
74
|
inheritAttrs: false
|
|
73
75
|
});
|
|
74
76
|
const $ = useDivideAttrs(["item"]);
|
|
@@ -43,7 +43,7 @@ declare const _default: <TSuggestion extends string | object, TValue extends str
|
|
|
43
43
|
*/
|
|
44
44
|
inputValue?: string;
|
|
45
45
|
open?: boolean;
|
|
46
|
-
}) &
|
|
46
|
+
}) & {}> & import("vue").PublicProps;
|
|
47
47
|
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
48
48
|
suggestions: {
|
|
49
49
|
list: any[] | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- Assumes no scrollbars on children -->
|
|
3
|
-
<table
|
|
3
|
+
<table
|
|
4
|
+
:class="twMerge(
|
|
4
5
|
`table
|
|
5
6
|
table-fixed
|
|
6
7
|
border-separate
|
|
@@ -42,10 +43,17 @@
|
|
|
42
43
|
)"
|
|
43
44
|
v-resizable-cols="resizableOptions"
|
|
44
45
|
>
|
|
45
|
-
<thead
|
|
46
|
+
<thead
|
|
47
|
+
v-if="header"
|
|
48
|
+
class="table--header"
|
|
49
|
+
>
|
|
46
50
|
<tr class="table--row">
|
|
47
|
-
<template
|
|
48
|
-
|
|
51
|
+
<template
|
|
52
|
+
v-for="col, i of cols"
|
|
53
|
+
:key="col"
|
|
54
|
+
>
|
|
55
|
+
<slot
|
|
56
|
+
:name="`header-${col.toString()}`"
|
|
49
57
|
:class="[
|
|
50
58
|
extraClasses[`-1-${i}`],
|
|
51
59
|
'cell table--header-cell',
|
|
@@ -54,7 +62,8 @@
|
|
|
54
62
|
:style="`width:${widths.length > 0 ? widths[i] : ``}; `"
|
|
55
63
|
:col-key="col"
|
|
56
64
|
>
|
|
57
|
-
<td
|
|
65
|
+
<td
|
|
66
|
+
:class="[
|
|
58
67
|
extraClasses[`-1-${i}`],
|
|
59
68
|
'cell table--header-cell',
|
|
60
69
|
colConfig[col]?.resizable === false ? 'no-resize' : ''
|
|
@@ -68,9 +77,15 @@
|
|
|
68
77
|
</tr>
|
|
69
78
|
</thead>
|
|
70
79
|
<tbody class="table--body">
|
|
71
|
-
<template
|
|
80
|
+
<template
|
|
81
|
+
v-for="item, i of values"
|
|
82
|
+
:key="typeof itemKey === 'function' ? itemKey(item) : item[itemKey]"
|
|
83
|
+
>
|
|
72
84
|
<tr class="table--row">
|
|
73
|
-
<template
|
|
85
|
+
<template
|
|
86
|
+
v-for="col, j of cols"
|
|
87
|
+
:key="(typeof itemKey === 'function' ? itemKey(item) : item[itemKey]) + col.toString()"
|
|
88
|
+
>
|
|
74
89
|
<slot
|
|
75
90
|
:name="col"
|
|
76
91
|
:item="item"
|
|
@@ -94,7 +109,7 @@ import { computed, ref } from "vue";
|
|
|
94
109
|
import { vResizableCols } from "../../directives/vResizableCols.js";
|
|
95
110
|
import { twMerge } from "../../utils/twMerge.js";
|
|
96
111
|
defineOptions({
|
|
97
|
-
name: "
|
|
112
|
+
name: "LibTable"
|
|
98
113
|
});
|
|
99
114
|
const props = defineProps({
|
|
100
115
|
resizable: { type: Object, required: false, default: () => ({}) },
|
|
@@ -19,7 +19,7 @@ interface Props extends
|
|
|
19
19
|
Partial<Omit<TableHTMLAttributes, "class" | "readonly" | "disabled"> & TailwindClassProp>, RealProps {
|
|
20
20
|
}
|
|
21
21
|
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
22
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & Props &
|
|
22
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & Props & {}> & import("vue").PublicProps;
|
|
23
23
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
24
24
|
attrs: any;
|
|
25
25
|
slots: {
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
<script setup>
|
|
12
12
|
import { ref } from "vue";
|
|
13
13
|
import { twMerge } from "../../utils/twMerge.js";
|
|
14
|
-
import {} from "../shared/props.js";
|
|
15
14
|
defineOptions({
|
|
16
|
-
name: "
|
|
15
|
+
name: "LibName",
|
|
17
16
|
/* todo */
|
|
18
17
|
inheritAttrs: false
|
|
19
18
|
});
|
|
@@ -23,6 +22,6 @@ const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
|
23
22
|
|
|
24
23
|
<script>
|
|
25
24
|
export default {
|
|
26
|
-
name: "
|
|
25
|
+
name: "LibName"
|
|
27
26
|
};
|
|
28
27
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
2
2
|
modelValue: string;
|
|
3
|
-
},
|
|
3
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
4
|
"update:modelValue": (value: string) => any;
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<{
|
|
6
6
|
modelValue: string;
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
<!-- Width 100% + 2xmargin in combination with the margins in LibRoot is a bit of a hack so that it looks like there's padding around the content in test mode (for storybook). We can't just absolutely position these controls or they make the container scroll. -->
|
|
3
3
|
<div class="test-controls flex gap-2 p-1 pb-10 -ml-10 w-[calc(100%_+_var(--spacing)*20)]">
|
|
4
4
|
<div class="flex-grow"/>
|
|
5
|
-
<div class="outline-indicator">
|
|
5
|
+
<div class="outline-indicator">
|
|
6
|
+
{{ showOutline ? "Outline Enabled" : "Outline Disabled" }}
|
|
7
|
+
</div>
|
|
6
8
|
<lib-dark-mode-switcher/>
|
|
7
9
|
</div>
|
|
8
10
|
</template>
|
|
9
11
|
|
|
10
12
|
<script setup>
|
|
11
13
|
import LibDarkModeSwitcher from "../LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
|
|
12
|
-
defineOptions({ name: "
|
|
14
|
+
defineOptions({ name: "TestControls" });
|
|
13
15
|
defineProps({
|
|
14
16
|
showOutline: { type: Boolean, required: true }
|
|
15
17
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
showOutline: boolean;
|
|
3
3
|
};
|
|
4
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props,
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
5
|
export default _default;
|
|
@@ -52,7 +52,7 @@ import type { Point } from "../types/index.js.js";
|
|
|
52
52
|
* }
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare const useDragWithThreshold: ({ initialOffset, pointerCoords, threshold
|
|
55
|
+
export declare const useDragWithThreshold: ({ initialOffset, pointerCoords, threshold }?: {
|
|
56
56
|
initialOffset?: Ref<Point | undefined>;
|
|
57
57
|
pointerCoords?: Ref<Point | undefined>;
|
|
58
58
|
threshold?: Ref<number>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TranslationFunction } from "./useSetupI18n.js.js";
|
|
2
2
|
export declare function useInjectedI18n(): TranslationFunction;
|
|
@@ -52,7 +52,7 @@ import type { ScrollNearContainerEdgesOptions } from "../types/index.js.js";
|
|
|
52
52
|
* </div>
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare const useScrollNearContainerEdges: ({ containerEl, scrollMargin, outerScrollMargin, fastPixelMultiplier, fastPixelAmount, useTimer, timerInterval
|
|
55
|
+
export declare const useScrollNearContainerEdges: ({ containerEl, scrollMargin, outerScrollMargin, fastPixelMultiplier, fastPixelAmount, useTimer, timerInterval }: ScrollNearContainerEdgesOptions) => {
|
|
56
56
|
scrollEdges: (clientX: number, clientY: number, overrideUseTimer?: boolean) => void;
|
|
57
57
|
/** Reactive. */
|
|
58
58
|
scrollIndicator: {
|
|
@@ -9,7 +9,7 @@ export type TranslationFunction = (key: string, replacements?: Record<string, an
|
|
|
9
9
|
*
|
|
10
10
|
* To avoid hydration errors, on the server, the message loading is awaited.
|
|
11
11
|
*/
|
|
12
|
-
export declare function useSetupI18n({ locale, useBuiltinTranslations, useDummyMessageSetWhileLoading, translationFunction
|
|
12
|
+
export declare function useSetupI18n({ locale, useBuiltinTranslations, useDummyMessageSetWhileLoading, translationFunction }: {
|
|
13
13
|
locale: Ref<string>;
|
|
14
14
|
/** Will asynchronously load the built-in translations for the current locale (watching and updating if needed). If you don't use this, you'll need to provide a custom translation function. */
|
|
15
15
|
useBuiltinTranslations?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AnyFunction } from "@alanscodelog/utils";
|
|
2
2
|
import { type Ref } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import type { SuggestionsEmits, SuggestionsOptions } from "../components/shared/props.js.js";
|
|
4
4
|
/**
|
|
5
5
|
* The logic for the suggestions component.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ export declare class NotificationHandler<TRawEntry extends RawNotificationEntry<
|
|
|
8
8
|
maxHistory: number;
|
|
9
9
|
listeners: NotificationListener<TEntry>[];
|
|
10
10
|
stringifier?: NotificationStringifier<TEntry>;
|
|
11
|
-
constructor({ timeout, stringifier, maxHistory
|
|
11
|
+
constructor({ timeout, stringifier, maxHistory }?: {
|
|
12
12
|
timeout?: NotificationHandler<TRawEntry>["timeout"];
|
|
13
13
|
stringifier?: NotificationHandler<TRawEntry>["stringifier"];
|
|
14
14
|
maxHistory?: NotificationHandler<TRawEntry>["maxHistory"];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const base64ToImg = async (imageSrc) => {
|
|
2
2
|
const img = new Image();
|
|
3
|
-
const loaded = new Promise((
|
|
3
|
+
const loaded = new Promise((resolve) => {
|
|
4
4
|
img.addEventListener("load", () => {
|
|
5
5
|
resolve(img);
|
|
6
6
|
});
|
|
7
|
-
})
|
|
7
|
+
});
|
|
8
8
|
img.src = imageSrc;
|
|
9
9
|
await loaded;
|
|
10
10
|
return img;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { themeAsTailwindCss } from "metamorphosis/tailwind";
|
|
2
2
|
export declare const themeConvertionOpts: Parameters<typeof themeAsTailwindCss>[1];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* If the value is not an error, it is returned.
|
|
7
7
|
*/
|
|
8
|
-
export declare function notifyIfError<T>(err: T, { logger, ns, force
|
|
8
|
+
export declare function notifyIfError<T>(err: T, { logger, ns, force }?: {
|
|
9
9
|
logger?: {
|
|
10
10
|
debug: (...args: any[]) => void;
|
|
11
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/ui",
|
|
3
|
-
"version": "0.2.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Vue component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/runtime/main.lib.js",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@alanscodelog/utils": "^6.0.1",
|
|
89
|
-
"@egoist/vue-to-react": "^1.2.0",
|
|
90
89
|
"@iconify/json": "^2.2.379",
|
|
91
90
|
"@nuxt/kit": "^4.0.3",
|
|
92
91
|
"@nuxt/schema": "^4.0.3",
|
|
@@ -106,10 +105,10 @@
|
|
|
106
105
|
},
|
|
107
106
|
"devDependencies": {
|
|
108
107
|
"@alanscodelog/commitlint-config": "^3.1.2",
|
|
109
|
-
"@alanscodelog/eslint-config": "^
|
|
108
|
+
"@alanscodelog/eslint-config": "^6.0.0",
|
|
110
109
|
"@alanscodelog/semantic-release-config": "^5.0.4",
|
|
111
110
|
"@alanscodelog/tsconfigs": "^6.1.0",
|
|
112
|
-
"@alanscodelog/vite-config": "^0.0.
|
|
111
|
+
"@alanscodelog/vite-config": "^0.0.6",
|
|
113
112
|
"@chromatic-com/storybook": "^3.2.7",
|
|
114
113
|
"@commitlint/cli": "^19.8.1",
|
|
115
114
|
"@internationalized/date": "^3.9.0",
|
|
@@ -141,7 +140,6 @@
|
|
|
141
140
|
"autoprefixer": "^10.4.21",
|
|
142
141
|
"concurrently": "^9.2.1",
|
|
143
142
|
"eslint": "^9.34.0",
|
|
144
|
-
"eslint-plugin-jsdoc": "^48.11.0",
|
|
145
143
|
"http-server": "^14.1.1",
|
|
146
144
|
"husky": "^9.1.7",
|
|
147
145
|
"indexit": "2.1.0-beta.3",
|
|
@@ -159,7 +157,7 @@
|
|
|
159
157
|
"vite": "^7.1.3",
|
|
160
158
|
"vite-tsconfig-paths": "^5.1.4",
|
|
161
159
|
"vue": "^3.5.20",
|
|
162
|
-
"vue-tsc": "3.0.
|
|
160
|
+
"vue-tsc": "3.0.6",
|
|
163
161
|
"wait-on": "^8.0.4"
|
|
164
162
|
},
|
|
165
163
|
"author": "Alan <alanscodelog@gmail.com>",
|