vueless 0.0.554 → 0.0.556
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/composables/useUI.ts +28 -64
- package/constants.js +21 -2
- package/index.d.ts +8 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/types.ts +4 -10
- package/ui.button/UButton.vue +21 -7
- package/ui.button-link/ULink.vue +14 -2
- package/ui.button-link/config.ts +6 -1
- package/ui.button-link/useAttrs.ts +8 -39
- package/ui.button-toggle/useAttrs.ts +2 -8
- package/ui.button-toggle-item/config.ts +9 -11
- package/ui.button-toggle-item/useAttrs.ts +4 -18
- package/ui.container-accordion/config.ts +3 -1
- package/ui.container-accordion/useAttrs.ts +6 -17
- package/ui.container-card/UCard.vue +2 -1
- package/ui.container-card/useAttrs.ts +2 -8
- package/ui.container-col/useAttrs.ts +2 -8
- package/ui.container-divider/useAttrs.ts +2 -8
- package/ui.container-group/useAttrs.ts +2 -8
- package/ui.container-groups/useAttrs.ts +2 -8
- package/ui.container-modal/UModal.vue +1 -1
- package/ui.container-modal/useAttrs.ts +2 -12
- package/ui.container-modal-confirm/UModalConfirm.vue +3 -7
- package/ui.container-modal-confirm/useAttrs.ts +2 -8
- package/ui.container-page/UPage.vue +4 -5
- package/ui.container-page/useAttrs.ts +3 -32
- package/ui.container-row/useAttrs.ts +2 -8
- package/ui.data-list/UDataList.vue +3 -2
- package/ui.data-list/config.js +1 -1
- package/ui.data-list/useAttrs.js +2 -18
- package/ui.data-table/UTable.vue +6 -6
- package/ui.data-table/UTableRow.vue +1 -5
- package/ui.data-table/config.ts +28 -13
- package/ui.data-table/useAttrs.ts +10 -75
- package/ui.dropdown-badge/config.ts +10 -2
- package/ui.dropdown-badge/useAttrs.ts +8 -21
- package/ui.dropdown-button/config.ts +6 -6
- package/ui.dropdown-button/useAttrs.ts +6 -19
- package/ui.dropdown-link/config.ts +8 -2
- package/ui.dropdown-link/useAttrs.ts +10 -20
- package/ui.dropdown-list/config.ts +3 -2
- package/ui.dropdown-list/useAttrs.ts +2 -25
- package/ui.form-calendar/config.ts +36 -36
- package/ui.form-calendar/useAttrs.ts +2 -264
- package/ui.form-checkbox/useAttrs.ts +2 -8
- package/ui.form-checkbox-group/useAttrs.ts +2 -8
- package/ui.form-checkbox-multi-state/useAttrs.ts +2 -6
- package/ui.form-color-picker/useAttrs.js +2 -8
- package/ui.form-date-picker/useAttrs.ts +2 -6
- package/ui.form-date-picker-range/UDatePickerRange.vue +28 -28
- package/ui.form-date-picker-range/config.ts +30 -16
- package/ui.form-date-picker-range/useAttrs.ts +9 -70
- package/ui.form-input/UInput.vue +1 -1
- package/ui.form-input/useAttrs.js +2 -8
- package/ui.form-input-file/UInputFile.vue +3 -4
- package/ui.form-input-file/useAttrs.js +2 -8
- package/ui.form-input-money/useAttrs.js +2 -8
- package/ui.form-input-number/useAttrs.js +2 -8
- package/ui.form-input-rating/UInputRating.vue +5 -11
- package/ui.form-input-rating/useAttrs.js +2 -8
- package/ui.form-input-search/useAttrs.js +2 -8
- package/ui.form-label/useAttrs.js +2 -8
- package/ui.form-radio/useAttrs.ts +2 -8
- package/ui.form-radio-group/useAttrs.ts +2 -8
- package/ui.form-select/USelect.vue +37 -38
- package/ui.form-select/config.js +30 -11
- package/ui.form-select/useAttrs.js +6 -50
- package/ui.form-switch/useAttrs.js +2 -8
- package/ui.form-textarea/UTextarea.vue +5 -9
- package/ui.form-textarea/useAttrs.js +2 -8
- package/ui.image-avatar/useAttrs.ts +2 -8
- package/ui.image-icon/useAttrs.ts +2 -8
- package/ui.loader/config.ts +4 -1
- package/ui.loader/useAttrs.ts +2 -17
- package/ui.loader-overlay/useAttrs.ts +2 -12
- package/ui.loader-progress/ULoaderProgress.vue +2 -2
- package/ui.loader-progress/config.ts +8 -2
- package/ui.loader-progress/types.ts +5 -0
- package/ui.loader-progress/useAttrs.ts +3 -27
- package/ui.navigation-pagination/config.ts +6 -6
- package/ui.navigation-pagination/useAttrs.ts +2 -34
- package/ui.navigation-progress/config.ts +3 -1
- package/ui.navigation-progress/useAttrs.ts +5 -17
- package/ui.navigation-tab/config.ts +3 -1
- package/ui.navigation-tab/useAttrs.ts +4 -18
- package/ui.navigation-tabs/useAttrs.ts +2 -8
- package/ui.other-dot/useAttrs.ts +2 -8
- package/ui.text-alert/UAlert.vue +2 -1
- package/ui.text-alert/useAttrs.ts +2 -8
- package/ui.text-badge/useAttrs.ts +3 -8
- package/ui.text-block/UText.vue +2 -1
- package/ui.text-block/useAttrs.ts +2 -8
- package/ui.text-empty/useAttrs.ts +2 -8
- package/ui.text-file/useAttrs.ts +2 -8
- package/ui.text-files/useAttrs.ts +2 -8
- package/ui.text-header/useAttrs.ts +2 -8
- package/ui.text-money/UMoney.vue +1 -1
- package/ui.text-money/useAttrs.ts +2 -8
- package/ui.text-notify/useAttrs.ts +2 -8
- package/utils/helper.ts +29 -0
- package/utils/node/tailwindSafelist.js +2 -2
- package/utils/ui.ts +3 -4
- package/web-types.json +17 -1
- package/ui.button/useAttrs.ts +0 -26
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UMoneyProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export function useAttrs(props: UMoneyProps): UseAttrs<Config> {
|
|
9
|
-
const { config, getKeysAttrs
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
config,
|
|
15
|
-
...keysAttrs,
|
|
16
|
-
hasSlotContent,
|
|
17
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
18
12
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UNotifyProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UNotifyProps): UseAttrs<Config> {
|
|
9
|
-
const { config, getKeysAttrs
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
config,
|
|
15
|
-
...keysAttrs,
|
|
16
|
-
hasSlotContent,
|
|
17
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
18
12
|
}
|
package/utils/helper.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { Comment, Text, Fragment } from "vue";
|
|
2
|
+
|
|
3
|
+
import type { Slot, VNode } from "vue";
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Deeply clone given object (same as lodash.cloneDeep).
|
|
3
7
|
*/
|
|
@@ -48,6 +52,31 @@ export function createDebounce(func: () => void, ms: number) {
|
|
|
48
52
|
};
|
|
49
53
|
}
|
|
50
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Check if Vue slot defined, and have a content.
|
|
57
|
+
*/
|
|
58
|
+
export function hasSlotContent(slot: Slot | undefined | null, props = {}): boolean {
|
|
59
|
+
type Args = VNode | VNode[] | undefined | null;
|
|
60
|
+
|
|
61
|
+
const asArray = (arg: Args) => {
|
|
62
|
+
return Array.isArray(arg) ? arg : arg != null ? [arg] : [];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const isVNodeEmpty = (vnode: Args) => {
|
|
66
|
+
return (
|
|
67
|
+
!vnode ||
|
|
68
|
+
asArray(vnode).every(
|
|
69
|
+
(vnode) =>
|
|
70
|
+
vnode.type === Comment ||
|
|
71
|
+
(vnode.type === Text && !vnode.children?.length) ||
|
|
72
|
+
(vnode.type === Fragment && !vnode.children?.length),
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return !isVNodeEmpty(slot?.(props));
|
|
78
|
+
}
|
|
79
|
+
|
|
51
80
|
/**
|
|
52
81
|
* Change page title in runtime by provided config.
|
|
53
82
|
*/
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
DYNAMIC_COLOR_PATTERN,
|
|
18
18
|
TAILWIND_VARIANT_DELIMITER,
|
|
19
19
|
TAILWIND_MERGE_EXTENSION,
|
|
20
|
-
|
|
20
|
+
NESTED_COMPONENT_PATTERN_REG_EXP,
|
|
21
21
|
TAILWIND_COLOR_OPACITY_DELIMITER,
|
|
22
22
|
TAILWIND_VARIANT_DELIMITER_REG_EXP,
|
|
23
23
|
STRATEGY_TYPE,
|
|
@@ -28,7 +28,7 @@ const twMerge = extendTailwindMerge(merge(TAILWIND_MERGE_EXTENSION, vuelessConfi
|
|
|
28
28
|
|
|
29
29
|
export const { cx } = defineConfig({
|
|
30
30
|
hooks: {
|
|
31
|
-
onComplete: (classNames) => twMerge(classNames).replace(
|
|
31
|
+
onComplete: (classNames) => twMerge(classNames).replace(NESTED_COMPONENT_PATTERN_REG_EXP, ""),
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
|
package/utils/ui.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
BRAND_COLOR,
|
|
8
8
|
GRAYSCALE_COLOR,
|
|
9
9
|
DEFAULT_BRAND_COLOR,
|
|
10
|
-
NESTED_COMPONENT_REG_EXP,
|
|
11
10
|
TAILWIND_MERGE_EXTENSION,
|
|
11
|
+
NESTED_COMPONENT_PATTERN_REG_EXP,
|
|
12
12
|
} from "../constants.js";
|
|
13
13
|
|
|
14
14
|
import type {
|
|
@@ -62,8 +62,6 @@ if (isCSR) {
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* Extend twMerge (tailwind merge) by vueless and user config:
|
|
65
|
-
* All list of rules available here:
|
|
66
|
-
* https://github.com/dcastil/tailwind-merge/blob/v2.3.0/src/lib/default-config.ts
|
|
67
65
|
*/
|
|
68
66
|
const twMerge = extendTailwindMerge(merge(TAILWIND_MERGE_EXTENSION, vuelessConfig.tailwindMerge));
|
|
69
67
|
|
|
@@ -79,7 +77,8 @@ export const {
|
|
|
79
77
|
cva: classVarianceAuthority,
|
|
80
78
|
} = defineConfig({
|
|
81
79
|
hooks: {
|
|
82
|
-
onComplete: (classNames) =>
|
|
80
|
+
onComplete: (classNames) =>
|
|
81
|
+
twMerge(classNames).replaceAll(NESTED_COMPONENT_PATTERN_REG_EXP, ""),
|
|
83
82
|
},
|
|
84
83
|
});
|
|
85
84
|
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.556",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -7720,6 +7720,22 @@
|
|
|
7720
7720
|
"type": "union"
|
|
7721
7721
|
}
|
|
7722
7722
|
},
|
|
7723
|
+
{
|
|
7724
|
+
"name": "size",
|
|
7725
|
+
"required": false,
|
|
7726
|
+
"description": "Progress size.",
|
|
7727
|
+
"enum": [
|
|
7728
|
+
"xs",
|
|
7729
|
+
"sm",
|
|
7730
|
+
"md",
|
|
7731
|
+
"lg"
|
|
7732
|
+
],
|
|
7733
|
+
"value": {
|
|
7734
|
+
"kind": "expression",
|
|
7735
|
+
"type": "union"
|
|
7736
|
+
},
|
|
7737
|
+
"default": "md"
|
|
7738
|
+
},
|
|
7723
7739
|
{
|
|
7724
7740
|
"name": "loading",
|
|
7725
7741
|
"required": false,
|
package/ui.button/useAttrs.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useSlots, computed } from "vue";
|
|
2
|
-
import useUI from "../composables/useUI.ts";
|
|
3
|
-
|
|
4
|
-
import defaultConfig from "./config.ts";
|
|
5
|
-
|
|
6
|
-
import type { UseAttrs } from "../types.ts";
|
|
7
|
-
import type { UButtonProps, Config } from "./types.ts";
|
|
8
|
-
|
|
9
|
-
export default function useAttrs(props: UButtonProps): UseAttrs<Config> {
|
|
10
|
-
const { config, getKeysAttrs, hasSlotContent } = useUI<Config>(defaultConfig, () => props.config);
|
|
11
|
-
const slots = useSlots();
|
|
12
|
-
|
|
13
|
-
const mutatedProps = computed(() => ({
|
|
14
|
-
leftIcon: Boolean(props.leftIcon) || hasSlotContent(slots["left"]),
|
|
15
|
-
rightIcon: Boolean(props.rightIcon) || hasSlotContent(slots["right"]),
|
|
16
|
-
label: Boolean(props.label),
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
config,
|
|
23
|
-
...keysAttrs,
|
|
24
|
-
hasSlotContent,
|
|
25
|
-
};
|
|
26
|
-
}
|