@witchcraft/ui 0.1.0 → 0.1.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 +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Aria/Aria.vue +5 -9
- package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
- package/dist/runtime/components/Icon/Icon.vue +10 -31
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +58 -77
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +48 -75
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -108
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +271 -352
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +32 -57
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +53 -82
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +50 -67
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +42 -70
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +113 -157
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +215 -242
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +44 -59
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +32 -49
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -84
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +67 -112
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +20 -23
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +314 -352
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +70 -92
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +133 -178
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +73 -100
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +49 -78
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +123 -157
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +63 -100
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
- package/dist/runtime/components/Template/NAME.vue +15 -36
- package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
- package/dist/runtime/components/TestControls/TestControls.vue +6 -9
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/directives/vResizableCols.js +89 -83
- package/dist/types.d.mts +2 -6
- package/package.json +11 -11
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +0 -1
- package/src/runtime/components/LibButton/LibButton.vue +0 -1
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -1
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -1
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +0 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +0 -1
- package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -1
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -1
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -1
- package/src/runtime/components/LibNotifications/LibNotification.vue +0 -1
- package/src/runtime/components/LibNotifications/LibNotifications.vue +0 -1
- package/src/runtime/components/LibPagination/LibPagination.vue +0 -1
- package/src/runtime/components/LibPopup/LibPopup.vue +0 -1
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -1
- package/src/runtime/components/LibRecorder/LibRecorder.vue +0 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +0 -1
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -1
- package/src/runtime/components/LibTable/LibTable.vue +0 -1
- package/src/runtime/directives/vResizableCols.ts +79 -73
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -36
- package/dist/runtime/components/Focus.stories.d.ts +0 -11
- package/dist/runtime/components/Focus.stories.js +0 -53
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
- package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
- package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
- package/dist/runtime/components/Reset.stories.d.ts +0 -5
- package/dist/runtime/components/Reset.stories.js +0 -19
- package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
- package/dist/runtime/components/Scrolling.stories.js +0 -44
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/types.d.ts +0 -7
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type TableHTMLAttributes } from "vue";
|
|
2
|
+
import type { ResizableOptions, TableColConfig } from "../../types/index.js.js";
|
|
3
|
+
import type { TailwindClassProp } from "../shared/props.js.js";
|
|
4
|
+
type T = any;
|
|
5
|
+
type RealProps = {
|
|
6
|
+
resizable?: Partial<ResizableOptions>;
|
|
7
|
+
values?: T[];
|
|
8
|
+
itemKey?: keyof T | ((item: T) => string);
|
|
9
|
+
/** Let's the table know the shape of the data since values might be empty. */
|
|
10
|
+
cols?: (keyof T)[];
|
|
11
|
+
rounded?: boolean;
|
|
12
|
+
border?: boolean;
|
|
13
|
+
cellBorder?: boolean;
|
|
14
|
+
header?: boolean;
|
|
15
|
+
colConfig?: TableColConfig<T>;
|
|
16
|
+
};
|
|
17
|
+
interface Props extends
|
|
18
|
+
/** @vue-ignore */
|
|
19
|
+
Partial<Omit<TableHTMLAttributes, "class" | "readonly" | "disabled"> & TailwindClassProp>, RealProps {
|
|
20
|
+
}
|
|
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 & Partial<{}>> & import("vue").PublicProps;
|
|
23
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
24
|
+
attrs: any;
|
|
25
|
+
slots: {
|
|
26
|
+
[x: string]: ((props: {
|
|
27
|
+
colKey: any;
|
|
28
|
+
style: string;
|
|
29
|
+
class: string;
|
|
30
|
+
}) => any) | undefined;
|
|
31
|
+
} & {
|
|
32
|
+
[x: string]: ((props: {
|
|
33
|
+
class: string;
|
|
34
|
+
item: any;
|
|
35
|
+
value: any;
|
|
36
|
+
}) => any) | undefined;
|
|
37
|
+
};
|
|
38
|
+
emit: {};
|
|
39
|
+
}>) => import("vue").VNode & {
|
|
40
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
41
|
+
};
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_PrettifyLocal<T> = {
|
|
44
|
+
[K in keyof T as K]: T[K];
|
|
45
|
+
} & {};
|
|
@@ -1,49 +1,28 @@
|
|
|
1
|
-
<!-- eslint-disable -->
|
|
2
1
|
<template>
|
|
3
2
|
<div :class="twMerge(`
|
|
4
3
|
|
|
5
|
-
`,
|
|
6
|
-
v-bind="{...$attrs, class:
|
|
4
|
+
`, $attrs.class)"
|
|
5
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
7
6
|
>
|
|
8
7
|
<slot/>
|
|
9
8
|
</div>
|
|
10
9
|
</template>
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
|
|
13
|
-
import { computed, type HTMLAttributes, onBeforeUnmount, onMounted, type PropType, reactive, type Ref, ref, watch } from "vue"
|
|
14
|
-
|
|
15
|
-
import { twMerge } from "../../utils/twMerge.js"
|
|
16
|
-
import { baseInteractiveProps, type TailwindClassProp } from "../shared/props.js"
|
|
17
|
-
|
|
18
10
|
|
|
11
|
+
<script setup>
|
|
12
|
+
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
|
|
13
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
14
|
+
import { baseInteractiveProps } from "../shared/props.js";
|
|
19
15
|
defineOptions({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const el = ref<null | HTMLElement>(null)
|
|
28
|
-
|
|
29
|
-
const modelValue = defineModel<string>({ required: true })
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
name: "lib-name",
|
|
17
|
+
/* todo */
|
|
18
|
+
inheritAttrs: false
|
|
19
|
+
});
|
|
20
|
+
const el = ref(null);
|
|
21
|
+
const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
32
22
|
</script>
|
|
33
23
|
|
|
34
|
-
<script
|
|
24
|
+
<script>
|
|
35
25
|
export default {
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type RealProps = {
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface Props
|
|
43
|
-
extends
|
|
44
|
-
/** @vue-ignore */
|
|
45
|
-
Partial<Omit<HTMLAttributes, "class">
|
|
46
|
-
& TailwindClassProp
|
|
47
|
-
& RealProps
|
|
48
|
-
> { }
|
|
26
|
+
name: "lib-name"
|
|
27
|
+
};
|
|
49
28
|
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
2
|
+
modelValue: string;
|
|
3
|
+
}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
"update:modelValue": (value: string) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
6
|
+
modelValue: string;
|
|
7
|
+
}> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
10
|
+
default?: (props: {}) => any;
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -7,13 +7,10 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script setup
|
|
11
|
-
import LibDarkModeSwitcher from "../LibDarkModeSwitcher/LibDarkModeSwitcher.vue"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}>()
|
|
17
|
-
|
|
10
|
+
<script setup>
|
|
11
|
+
import LibDarkModeSwitcher from "../LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
|
|
12
|
+
defineOptions({ name: "test-controls" });
|
|
13
|
+
defineProps({
|
|
14
|
+
showOutline: { type: Boolean, required: true }
|
|
15
|
+
});
|
|
18
16
|
</script>
|
|
19
|
-
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
showOutline: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -48,7 +48,7 @@ export const vResizableCols = {
|
|
|
48
48
|
return {};
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
function setWidth(col, amountInPx, el) {
|
|
52
52
|
const $el = getElInfo(el);
|
|
53
53
|
const width = Math.max($el.margin, amountInPx);
|
|
54
54
|
const index = getColEls(el).findIndex((_) => col === _);
|
|
@@ -57,12 +57,12 @@ const setWidth = (col, amountInPx, el) => {
|
|
|
57
57
|
} else {
|
|
58
58
|
$el.widths.value[index] = `${width}px`;
|
|
59
59
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
60
|
+
}
|
|
61
|
+
function getBox(el) {
|
|
62
62
|
const rect = el.getBoundingClientRect();
|
|
63
63
|
return { x: Math.round(rect.x), width: Math.round(rect.width) };
|
|
64
|
-
}
|
|
65
|
-
|
|
64
|
+
}
|
|
65
|
+
function getCols(el) {
|
|
66
66
|
const $el = getElInfo(el);
|
|
67
67
|
if (!$el.target) unreachable();
|
|
68
68
|
let col = getColEls(el)[$el.grips.get($el.target)];
|
|
@@ -77,75 +77,81 @@ const getCols = (el) => {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
return { col, colNext };
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
80
|
+
}
|
|
81
|
+
function createPointerDownHandler(el) {
|
|
82
|
+
return (e) => {
|
|
83
|
+
const $el = getElInfo(el);
|
|
84
|
+
if (!$el.isDragging) {
|
|
85
|
+
castType(e.target);
|
|
86
|
+
$el.target = e.target;
|
|
87
|
+
$el.isDragging = true;
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
document.addEventListener("pointerup", $el.pointerUpHandler);
|
|
90
|
+
const { col, colNext } = getCols(el);
|
|
91
|
+
if (col === null || colNext === null) {
|
|
92
|
+
el.classList.add("resizable-cols-error");
|
|
93
|
+
} else {
|
|
94
|
+
document.addEventListener("pointermove", $el.pointerMoveHandler);
|
|
95
|
+
const box = getBox(col);
|
|
96
|
+
if (box) {
|
|
97
|
+
$el.offset = e.pageX - (box.x + box.width);
|
|
98
|
+
}
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function createPointerMoveHandler(el) {
|
|
104
|
+
return (e) => {
|
|
105
|
+
const $el = getElInfo(el);
|
|
106
|
+
if ($el.isDragging) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
const { col, colNext } = getCols(el);
|
|
109
|
+
if (col !== null) {
|
|
110
|
+
const leftBox = getBox(col);
|
|
111
|
+
const oldWidth = leftBox.width;
|
|
112
|
+
const leftBound = leftBox.x;
|
|
113
|
+
const rightBox = colNext ? getBox(colNext) : getBox(el);
|
|
114
|
+
const rightBound = rightBox.x + rightBox.width;
|
|
115
|
+
const margin = $el.margin;
|
|
116
|
+
const pos = e.pageX - $el.offset;
|
|
117
|
+
if ($el.fitWidth) {
|
|
118
|
+
if (pos > leftBound + margin && pos < rightBound - margin) {
|
|
119
|
+
const newWidth = pos - leftBound;
|
|
120
|
+
const diff = oldWidth - newWidth;
|
|
121
|
+
if (rightBox.width + diff < margin) {
|
|
122
|
+
el.classList.add("resizable-cols-error");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
setWidth(col, newWidth, el);
|
|
126
|
+
setWidth(colNext, rightBox.width + diff, el);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
if (pos > leftBound + margin) {
|
|
130
|
+
const newWidth = pos - leftBound;
|
|
131
|
+
setWidth(col, newWidth, el);
|
|
121
132
|
}
|
|
122
|
-
setWidth(col, newWidth, el);
|
|
123
|
-
setWidth(colNext, rightBox.width + diff, el);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
if (pos > leftBound + margin) {
|
|
127
|
-
const newWidth = pos - leftBound;
|
|
128
|
-
setWidth(col, newWidth, el);
|
|
129
133
|
}
|
|
134
|
+
positionGrips(el);
|
|
130
135
|
}
|
|
131
|
-
positionGrips(el);
|
|
132
136
|
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function createPointerUpHandler(el) {
|
|
140
|
+
return (e) => {
|
|
141
|
+
const $el = getElInfo(el);
|
|
142
|
+
if ($el.isDragging) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
$el.isDragging = false;
|
|
145
|
+
el.classList.remove("resizable-cols-error");
|
|
146
|
+
$el.offset = 0;
|
|
147
|
+
delete $el.target;
|
|
148
|
+
document.removeEventListener("pointermove", $el.pointerMoveHandler);
|
|
149
|
+
document.removeEventListener("pointerup", $el.pointerUpHandler);
|
|
150
|
+
document.removeEventListener("pointerleave", $el.pointerLeaveHandler);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function createGrip() {
|
|
149
155
|
const grip = document.createElement("div");
|
|
150
156
|
grip.style.position = "absolute";
|
|
151
157
|
grip.style.cursor = "col-resize";
|
|
@@ -153,31 +159,31 @@ const createGrip = () => {
|
|
|
153
159
|
grip.style.bottom = "0";
|
|
154
160
|
grip.classList.add("grip");
|
|
155
161
|
return grip;
|
|
156
|
-
}
|
|
162
|
+
}
|
|
157
163
|
const removeGrips = (el) => {
|
|
158
164
|
const grips = Array.from(el.querySelectorAll(".grip") ?? []);
|
|
159
165
|
for (const grip of grips) {
|
|
160
166
|
el.removeChild(grip);
|
|
161
167
|
}
|
|
162
168
|
};
|
|
163
|
-
|
|
169
|
+
function getTestGripSize(el) {
|
|
164
170
|
const testGrip = createGrip();
|
|
165
171
|
el.appendChild(testGrip);
|
|
166
172
|
const dynamicMinWidth = getBox(testGrip).width * 3;
|
|
167
173
|
el.removeChild(testGrip);
|
|
168
174
|
return dynamicMinWidth;
|
|
169
|
-
}
|
|
170
|
-
|
|
175
|
+
}
|
|
176
|
+
function getElInfo(el) {
|
|
171
177
|
const $el = elMap.get(el);
|
|
172
178
|
if (!$el) unreachable("El went missing.");
|
|
173
179
|
return $el;
|
|
174
|
-
}
|
|
175
|
-
|
|
180
|
+
}
|
|
181
|
+
function getColEls(el) {
|
|
176
182
|
const $el = elMap.get(el);
|
|
177
183
|
if (!$el) unreachable("El went missing.");
|
|
178
184
|
return [...el.querySelectorAll(`:scope ${$el.selector ? $el.selector : "tr > td"}`)];
|
|
179
|
-
}
|
|
180
|
-
|
|
185
|
+
}
|
|
186
|
+
function setupColumns(el, opts) {
|
|
181
187
|
const gripWidth = getTestGripSize(el);
|
|
182
188
|
const $el = {
|
|
183
189
|
grips: /* @__PURE__ */ new Map(),
|
|
@@ -207,8 +213,8 @@ const setupColumns = (el, opts) => {
|
|
|
207
213
|
}
|
|
208
214
|
positionGrips(el);
|
|
209
215
|
el.classList.add("resizable-cols-setup");
|
|
210
|
-
}
|
|
211
|
-
|
|
216
|
+
}
|
|
217
|
+
function positionGrips(el) {
|
|
212
218
|
let xPos = 0;
|
|
213
219
|
const $el = getElInfo(el);
|
|
214
220
|
for (const grip of $el.grips.keys()) {
|
|
@@ -220,8 +226,8 @@ const positionGrips = (el) => {
|
|
|
220
226
|
grip.style.left = `${xPos + colBox.width - gripBox.width / 2}px`;
|
|
221
227
|
xPos += colBox.width;
|
|
222
228
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
229
|
+
}
|
|
230
|
+
function setColWidths(el, children) {
|
|
225
231
|
const $el = getElInfo(el);
|
|
226
232
|
const header = children ?? getColEls(el).slice(0, $el.colCount);
|
|
227
233
|
const len = $el.colCount;
|
|
@@ -239,8 +245,8 @@ const setColWidths = (el, children) => {
|
|
|
239
245
|
} else {
|
|
240
246
|
el.style.minWidth = "";
|
|
241
247
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
248
|
+
}
|
|
249
|
+
function teardownColumns(el) {
|
|
244
250
|
const $el = getElInfo(el);
|
|
245
251
|
el.removeEventListener("pointerdown", $el.pointerDownHandler);
|
|
246
252
|
document.removeEventListener("pointermove", $el.pointerMoveHandler);
|
|
@@ -251,4 +257,4 @@ const teardownColumns = (el) => {
|
|
|
251
257
|
elMap.delete(el);
|
|
252
258
|
el.classList.remove("resizable-cols-setup");
|
|
253
259
|
removeGrips(el);
|
|
254
|
-
}
|
|
260
|
+
}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from './module.mjs'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
-
|
|
7
|
-
export { default } from './module.js'
|
|
3
|
+
export { type ModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vue component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/runtime/main.lib.js",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"./utils.css": "./src/runtime/assets/utils.css",
|
|
54
54
|
"./base.css": "./src/runtime/assets/base.css",
|
|
55
55
|
"./nuxt": {
|
|
56
|
-
"
|
|
57
|
-
"
|
|
56
|
+
"types": "./dist/types.d.mts",
|
|
57
|
+
"import": "./dist/module.mjs"
|
|
58
58
|
},
|
|
59
59
|
"./types": {
|
|
60
60
|
"types": "./dist/runtime/types/index.d.ts",
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"@alanscodelog/utils": "^5.1.0",
|
|
104
104
|
"@egoist/vue-to-react": "^1.2.0",
|
|
105
105
|
"@iconify/json": "^2.2.323",
|
|
106
|
-
"@nuxt/kit": "^
|
|
107
|
-
"@nuxt/schema": "^
|
|
106
|
+
"@nuxt/kit": "^4.0.1",
|
|
107
|
+
"@nuxt/schema": "^4.0.1",
|
|
108
108
|
"@nuxt/types": "^2.17.3",
|
|
109
109
|
"@tailwindcss/vite": "^4.1.0",
|
|
110
110
|
"@witchcraft/nuxt-utils": "^0.1.0",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"@commitlint/cli": "^19.3.0",
|
|
130
130
|
"@internationalized/date": "^3.1.0",
|
|
131
131
|
"@nuxt/eslint-config": "^1.3.0",
|
|
132
|
-
"@nuxt/module-builder": "^0.
|
|
132
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
133
133
|
"@nuxtjs/i18n": "^9.5.3",
|
|
134
134
|
"@playwright/test": "=1.50.0",
|
|
135
135
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
@@ -147,15 +147,15 @@
|
|
|
147
147
|
"@storybook/vue3-vite": "^8.6.12",
|
|
148
148
|
"@tailwindcss/cli": "^4.1.4",
|
|
149
149
|
"@tailwindcss/postcss": "^4.1.2",
|
|
150
|
-
"@types/node": "^
|
|
151
|
-
"@vitejs/plugin-vue": "^
|
|
150
|
+
"@types/node": "^24.1.0",
|
|
151
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
152
152
|
"@vue/runtime-core": "^3.4.27",
|
|
153
153
|
"@vue/runtime-dom": "^3.4.27",
|
|
154
154
|
"@vueuse/components": "^13.0.0",
|
|
155
155
|
"@vueuse/core": "^13.0.0",
|
|
156
156
|
"autoprefixer": "^10.4.19",
|
|
157
157
|
"concurrently": "^9.1.2",
|
|
158
|
-
"eslint": "
|
|
158
|
+
"eslint": "^9.32.0",
|
|
159
159
|
"eslint-plugin-jsdoc": "^48.0.0",
|
|
160
160
|
"http-server": "^14.1.1",
|
|
161
161
|
"husky": "^9.0.11",
|
|
@@ -171,11 +171,11 @@
|
|
|
171
171
|
"ts-node": "^10.9.2",
|
|
172
172
|
"typescript": "~5.8.2",
|
|
173
173
|
"unbuild": "^3.5.0",
|
|
174
|
-
"vite": "^
|
|
174
|
+
"vite": "^7.0.6",
|
|
175
175
|
"vite-plugin-externalize-deps": "^0.9.0",
|
|
176
176
|
"vite-tsconfig-paths": "^5.0.1",
|
|
177
177
|
"vue": "^3.5.13",
|
|
178
|
-
"vue-tsc": "3.0.
|
|
178
|
+
"vue-tsc": "3.0.4",
|
|
179
179
|
"wait-on": "^8.0.3"
|
|
180
180
|
},
|
|
181
181
|
"author": "Alan <alanscodelog@gmail.com>",
|
|
@@ -24,13 +24,14 @@ const template = `
|
|
|
24
24
|
<div class="outline-hidden focus:border-danger-500 border border-accent-600" tabindex="0">Has Manual Focus Classes</div>
|
|
25
25
|
`
|
|
26
26
|
export default meta
|
|
27
|
-
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
28
|
+
type Story = StoryObj<{}>
|
|
28
29
|
|
|
29
30
|
export const Primary: Story = {
|
|
30
31
|
render: args => ({
|
|
31
32
|
components,
|
|
32
33
|
setup: () => {
|
|
33
|
-
const el = ref<HTMLElement>(null)
|
|
34
|
+
const el = ref<HTMLElement | null>(null)
|
|
34
35
|
onMounted(() => {
|
|
35
36
|
// el.value.focus()
|
|
36
37
|
})
|
|
@@ -207,7 +207,6 @@ const emits = defineEmits<{
|
|
|
207
207
|
}>()
|
|
208
208
|
|
|
209
209
|
const fallbackId = getFallbackId()
|
|
210
|
-
// eslint-disable-next-line no-use-before-define
|
|
211
210
|
const props = withDefaults(defineProps<Props>(), {
|
|
212
211
|
multiple: false,
|
|
213
212
|
formats: () => ["image/*", ".jpeg", ".jpg", ".png"],
|
|
@@ -58,7 +58,6 @@ import { isArray } from "@alanscodelog/utils/isArray.js"
|
|
|
58
58
|
import type { IPopupReference, PopupPosition, PopupPositioner, PopupPositionModifier, SimpleDOMRect } from "../../types/index.js"
|
|
59
59
|
|
|
60
60
|
const fallbackId = getFallbackId()
|
|
61
|
-
// eslint-disable-next-line no-use-before-define
|
|
62
61
|
const props = withDefaults(defineProps<Props>(), {
|
|
63
62
|
useBackdrop: true,
|
|
64
63
|
useDialogForBackdrop: false,
|
|
@@ -107,7 +107,6 @@ defineOptions({
|
|
|
107
107
|
inheritAttrs: false,
|
|
108
108
|
})
|
|
109
109
|
const fallbackId = getFallbackId()
|
|
110
|
-
// eslint-disable-next-line no-use-before-define
|
|
111
110
|
const props = withDefaults(defineProps<Props>(), {
|
|
112
111
|
autohideOnComplete: -1,
|
|
113
112
|
keepSpaceWhenHidden: false,
|