vueless 0.0.196 → 0.0.198
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/composable.ui/index.js +4 -2
- package/package.json +1 -1
- package/ui.button/composables/attrs.composable.js +26 -44
- package/ui.button/index.stories.js +2 -4
- package/ui.button/index.vue +1 -1
- package/web-types.json +1 -79
- package/ui.image-logo/Docs.mdx +0 -16
- package/ui.image-logo/composables/attrs.composable.js +0 -41
- package/ui.image-logo/configs/default.config.js +0 -38
- package/ui.image-logo/constants/index.js +0 -5
- package/ui.image-logo/index.stories.js +0 -87
- package/ui.image-logo/index.vue +0 -98
package/composable.ui/index.js
CHANGED
|
@@ -46,7 +46,8 @@ const SYSTEM_CONFIG_KEY = {
|
|
|
46
46
|
4. Component classes (class="...")
|
|
47
47
|
*/
|
|
48
48
|
export default function useUI(defaultConfig = {}, propsConfigGetter = null, topLevelClassKey) {
|
|
49
|
-
const {
|
|
49
|
+
const { type, props } = getCurrentInstance();
|
|
50
|
+
const componentName = type.name;
|
|
50
51
|
const globalConfig = globalComponentConfig[componentName];
|
|
51
52
|
|
|
52
53
|
const isStrategyValid = strategy && Object.values(STRATEGY_TYPE).includes(strategy);
|
|
@@ -88,6 +89,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
88
89
|
delete commonAttrs.value;
|
|
89
90
|
|
|
90
91
|
watch(config, updateVuelessAttrs, { immediate: true });
|
|
92
|
+
watch(props, updateVuelessAttrs);
|
|
91
93
|
|
|
92
94
|
function updateVuelessAttrs() {
|
|
93
95
|
const configKeyValue = config.value[configKey];
|
|
@@ -100,7 +102,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
100
102
|
|
|
101
103
|
const isTopLevelClassKey = configKey === (topLevelClassKey || firstClassKey);
|
|
102
104
|
const attrClass = isTopLevelClassKey && !nestedComponent ? attrs.class : "";
|
|
103
|
-
const classes =
|
|
105
|
+
const classes = toValue(options?.classes) || getBaseClasses(configKeyValue);
|
|
104
106
|
|
|
105
107
|
vuelessAttrs.value = {
|
|
106
108
|
...commonAttrs,
|
package/package.json
CHANGED
|
@@ -1,58 +1,40 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import useUI from "../../composable.ui";
|
|
3
3
|
import { cva } from "../../service.ui";
|
|
4
|
-
|
|
5
4
|
import defaultConfig from "../configs/default.config";
|
|
6
5
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, getColor, setColor } = useUI(
|
|
9
|
-
|
|
6
|
+
export default function useAttrs(props) {
|
|
7
|
+
const { config, getAttrs, hasSlotContent, isSystemKey, getColor, setColor } = useUI(
|
|
8
|
+
defaultConfig,
|
|
9
|
+
() => props.config,
|
|
10
|
+
);
|
|
11
|
+
const attrs = {};
|
|
10
12
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
variants: button.variants,
|
|
14
|
-
compoundVariants: button.compoundVariants,
|
|
15
|
-
});
|
|
13
|
+
for (const key in defaultConfig) {
|
|
14
|
+
if (isSystemKey(key)) continue;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
variants: text.variants,
|
|
20
|
-
compoundVariants: text.compoundVariants,
|
|
21
|
-
});
|
|
16
|
+
const classes = computed(() => {
|
|
17
|
+
const value = config.value[key];
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
filled: props.filled,
|
|
33
|
-
loading: props.loading,
|
|
34
|
-
disabled: props.disabled,
|
|
35
|
-
}),
|
|
36
|
-
props.color,
|
|
37
|
-
),
|
|
38
|
-
);
|
|
19
|
+
if (value.variants || value.compoundVariants) {
|
|
20
|
+
return setColor(
|
|
21
|
+
cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
color: getColor(props.color),
|
|
24
|
+
}),
|
|
25
|
+
props.color,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cvaText({
|
|
43
|
-
color: getColor(props.color),
|
|
44
|
-
}),
|
|
45
|
-
props.color,
|
|
46
|
-
),
|
|
47
|
-
);
|
|
29
|
+
return "";
|
|
30
|
+
});
|
|
48
31
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const textAttrs = getAttrs("text", { classes: textClasses });
|
|
32
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
33
|
+
}
|
|
52
34
|
|
|
53
35
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
...attrs,
|
|
37
|
+
config,
|
|
38
|
+
hasSlotContent,
|
|
57
39
|
};
|
|
58
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UButton from "../ui.button";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -29,9 +29,7 @@ const DefaultTemplate = (args) => ({
|
|
|
29
29
|
},
|
|
30
30
|
template: `
|
|
31
31
|
<UButton v-bind="args">
|
|
32
|
-
|
|
33
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
34
|
-
</template>
|
|
32
|
+
${allSlotsFragment}
|
|
35
33
|
</UButton>
|
|
36
34
|
`,
|
|
37
35
|
});
|
package/ui.button/index.vue
CHANGED
|
@@ -39,7 +39,7 @@ import ULoader from "../ui.loader";
|
|
|
39
39
|
import UIcon from "../ui.image-icon";
|
|
40
40
|
|
|
41
41
|
import defaultConfig from "./configs/default.config";
|
|
42
|
-
import
|
|
42
|
+
import useAttrs from "./composables/attrs.composable";
|
|
43
43
|
import { UButton } from "./constants";
|
|
44
44
|
|
|
45
45
|
/* Should be a string for correct web-types gen */
|
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.198",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -4945,84 +4945,6 @@
|
|
|
4945
4945
|
"symbol": "default"
|
|
4946
4946
|
}
|
|
4947
4947
|
},
|
|
4948
|
-
{
|
|
4949
|
-
"name": "ULogo",
|
|
4950
|
-
"description": "",
|
|
4951
|
-
"attributes": [
|
|
4952
|
-
{
|
|
4953
|
-
"name": "src",
|
|
4954
|
-
"description": "Logo source path.",
|
|
4955
|
-
"value": {
|
|
4956
|
-
"kind": "expression",
|
|
4957
|
-
"type": "string"
|
|
4958
|
-
},
|
|
4959
|
-
"default": "\"\""
|
|
4960
|
-
},
|
|
4961
|
-
{
|
|
4962
|
-
"name": "label",
|
|
4963
|
-
"description": "Logo label.",
|
|
4964
|
-
"value": {
|
|
4965
|
-
"kind": "expression",
|
|
4966
|
-
"type": "string"
|
|
4967
|
-
},
|
|
4968
|
-
"default": "\"\""
|
|
4969
|
-
},
|
|
4970
|
-
{
|
|
4971
|
-
"name": "title",
|
|
4972
|
-
"description": "Logo title.",
|
|
4973
|
-
"value": {
|
|
4974
|
-
"kind": "expression",
|
|
4975
|
-
"type": "string"
|
|
4976
|
-
},
|
|
4977
|
-
"default": "\"\""
|
|
4978
|
-
},
|
|
4979
|
-
{
|
|
4980
|
-
"name": "titleSize",
|
|
4981
|
-
"description": "Logo title size.",
|
|
4982
|
-
"value": {
|
|
4983
|
-
"kind": "expression",
|
|
4984
|
-
"type": "'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'"
|
|
4985
|
-
},
|
|
4986
|
-
"default": "md"
|
|
4987
|
-
},
|
|
4988
|
-
{
|
|
4989
|
-
"name": "size",
|
|
4990
|
-
"description": "title size.",
|
|
4991
|
-
"value": {
|
|
4992
|
-
"kind": "expression",
|
|
4993
|
-
"type": "'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'"
|
|
4994
|
-
},
|
|
4995
|
-
"default": "md"
|
|
4996
|
-
},
|
|
4997
|
-
{
|
|
4998
|
-
"name": "config",
|
|
4999
|
-
"description": "Component ui config object.",
|
|
5000
|
-
"value": {
|
|
5001
|
-
"kind": "expression",
|
|
5002
|
-
"type": "object"
|
|
5003
|
-
},
|
|
5004
|
-
"default": "{}"
|
|
5005
|
-
},
|
|
5006
|
-
{
|
|
5007
|
-
"name": "dataCy",
|
|
5008
|
-
"description": "Data-cy attribute for automated testing.",
|
|
5009
|
-
"value": {
|
|
5010
|
-
"kind": "expression",
|
|
5011
|
-
"type": "string"
|
|
5012
|
-
},
|
|
5013
|
-
"default": "\"\""
|
|
5014
|
-
}
|
|
5015
|
-
],
|
|
5016
|
-
"events": [
|
|
5017
|
-
{
|
|
5018
|
-
"name": "click"
|
|
5019
|
-
}
|
|
5020
|
-
],
|
|
5021
|
-
"source": {
|
|
5022
|
-
"module": "./src/ui.image-logo/index.vue",
|
|
5023
|
-
"symbol": "default"
|
|
5024
|
-
}
|
|
5025
|
-
},
|
|
5026
4948
|
{
|
|
5027
4949
|
"name": "UModal",
|
|
5028
4950
|
"description": "",
|
package/ui.image-logo/Docs.mdx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
|
|
2
|
-
import { getSource } from "../service.storybook";
|
|
3
|
-
|
|
4
|
-
import * as stories from "./index.stories";
|
|
5
|
-
import defaultConfig from "./configs/default.config?raw"
|
|
6
|
-
|
|
7
|
-
<Meta of={stories} />
|
|
8
|
-
<Title of={stories} />
|
|
9
|
-
<Subtitle of={stories} />
|
|
10
|
-
<Description of={stories} />
|
|
11
|
-
<Primary of={stories} />
|
|
12
|
-
<Controls of={stories.Default} />
|
|
13
|
-
<Stories of={stories} />
|
|
14
|
-
|
|
15
|
-
## Default config
|
|
16
|
-
<Source code={getSource(defaultConfig)} language="jsx" dark />
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
|
-
|
|
3
|
-
import useUI from "../../composable.ui";
|
|
4
|
-
import { cva } from "../../service.ui";
|
|
5
|
-
|
|
6
|
-
import defaultConfig from "../configs/default.config";
|
|
7
|
-
|
|
8
|
-
export function useAttrs(props) {
|
|
9
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
10
|
-
const { logo, title } = config.value;
|
|
11
|
-
|
|
12
|
-
const cvaLogo = cva({
|
|
13
|
-
base: logo.base,
|
|
14
|
-
variants: logo.variants,
|
|
15
|
-
compoundVariants: logo.compoundVariants,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const cvaTitle = cva({
|
|
19
|
-
base: title.base,
|
|
20
|
-
variants: title.variants,
|
|
21
|
-
compoundVariants: title.compoundVariants,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const logoClasses = computed(() => cvaLogo({ size: props.size }));
|
|
25
|
-
|
|
26
|
-
const titleClasses = computed(() => cvaTitle({ size: props.size }));
|
|
27
|
-
|
|
28
|
-
const wrapperAttrs = getAttrs("wrapper");
|
|
29
|
-
const logoAttrs = getAttrs("logo", { classes: logoClasses });
|
|
30
|
-
const labelAttrs = getAttrs("label");
|
|
31
|
-
const imageAttrs = getAttrs("image");
|
|
32
|
-
const titleAttrs = getAttrs("title", { classes: titleClasses });
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
titleAttrs,
|
|
36
|
-
logoAttrs,
|
|
37
|
-
wrapperAttrs,
|
|
38
|
-
labelAttrs,
|
|
39
|
-
imageAttrs,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export default /*tw*/ {
|
|
2
|
-
wrapper: "flex items-center",
|
|
3
|
-
logo: {
|
|
4
|
-
base: "relative",
|
|
5
|
-
variants: {
|
|
6
|
-
size: {
|
|
7
|
-
"2xs": "size-3.5",
|
|
8
|
-
xs: "size-4",
|
|
9
|
-
sm: "size-5",
|
|
10
|
-
md: "size-6",
|
|
11
|
-
lg: "size-8",
|
|
12
|
-
xl: "size-10",
|
|
13
|
-
"2xl": "size-12",
|
|
14
|
-
"3xl": "size-14",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
label: "bg-red-500 text-xs font-medium text-white rounded-full absolute -right-7 -top-1.5 px-2 py-0.5",
|
|
19
|
-
image: "h-full w-full bg-contain bg-center bg-no-repeat",
|
|
20
|
-
title: {
|
|
21
|
-
base: "whitespace-nowrap px-3.5 font-bold text-gray-900",
|
|
22
|
-
variants: {
|
|
23
|
-
size: {
|
|
24
|
-
"2xs": "text-xs",
|
|
25
|
-
xs: "text-sm",
|
|
26
|
-
sm: "text-base",
|
|
27
|
-
md: "text-lg",
|
|
28
|
-
lg: "text-2xl",
|
|
29
|
-
xl: "text-3xl",
|
|
30
|
-
"2xl": "text-4xl",
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
defaultVariants: {
|
|
35
|
-
size: "md",
|
|
36
|
-
titleSize: "md",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { getArgTypes } from "../service.storybook";
|
|
2
|
-
|
|
3
|
-
import ULogo from "../ui.image-logo";
|
|
4
|
-
import URow from "../ui.container-row";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The `ULogo` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.image-logo)
|
|
8
|
-
*/
|
|
9
|
-
export default {
|
|
10
|
-
id: "6020",
|
|
11
|
-
title: "Images & Icons / Logo",
|
|
12
|
-
component: ULogo,
|
|
13
|
-
args: {
|
|
14
|
-
src: "https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg",
|
|
15
|
-
},
|
|
16
|
-
argTypes: {
|
|
17
|
-
...getArgTypes(ULogo.name),
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const DefaultTemplate = (args) => ({
|
|
22
|
-
components: { ULogo },
|
|
23
|
-
setup() {
|
|
24
|
-
return { args };
|
|
25
|
-
},
|
|
26
|
-
template: `
|
|
27
|
-
<ULogo v-bind="args"/>
|
|
28
|
-
`,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
32
|
-
components: { ULogo, URow },
|
|
33
|
-
setup() {
|
|
34
|
-
return {
|
|
35
|
-
args,
|
|
36
|
-
sizes: argTypes.size.options,
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
template: `
|
|
40
|
-
<URow>
|
|
41
|
-
<ULogo
|
|
42
|
-
v-for="(size, index) in sizes"
|
|
43
|
-
:key="index"
|
|
44
|
-
v-bind="args"
|
|
45
|
-
:size="size"
|
|
46
|
-
:title="size"
|
|
47
|
-
/>
|
|
48
|
-
</URow>
|
|
49
|
-
`,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const SizesTitleTemplate = (args, { argTypes } = {}) => ({
|
|
53
|
-
components: { ULogo, URow },
|
|
54
|
-
setup() {
|
|
55
|
-
return {
|
|
56
|
-
args,
|
|
57
|
-
sizes: argTypes.sizeTitle.options,
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
template: `
|
|
61
|
-
<URow>
|
|
62
|
-
<ULogo
|
|
63
|
-
v-for="(size, index) in sizes"
|
|
64
|
-
:key="index"
|
|
65
|
-
v-bind="args"
|
|
66
|
-
:size-title="size"
|
|
67
|
-
:title="size"
|
|
68
|
-
size="md"
|
|
69
|
-
/>
|
|
70
|
-
</URow>
|
|
71
|
-
`,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
export const Default = DefaultTemplate.bind({});
|
|
75
|
-
Default.args = {};
|
|
76
|
-
|
|
77
|
-
export const sizes = SizesTemplate.bind({});
|
|
78
|
-
sizes.args = {};
|
|
79
|
-
|
|
80
|
-
export const sizesTitle = SizesTitleTemplate.bind({});
|
|
81
|
-
sizesTitle.args = {};
|
|
82
|
-
|
|
83
|
-
export const title = DefaultTemplate.bind({});
|
|
84
|
-
title.args = { title: "some title" };
|
|
85
|
-
|
|
86
|
-
export const label = DefaultTemplate.bind({});
|
|
87
|
-
label.args = { label: "label" };
|
package/ui.image-logo/index.vue
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :data-cy="dataCy" v-bind="wrapperAttrs" @click="onClick">
|
|
3
|
-
<div v-bind="logoAttrs">
|
|
4
|
-
<div v-if="label" v-bind="labelAttrs" v-text="label" />
|
|
5
|
-
|
|
6
|
-
<div :style="bgImage" v-bind="imageAttrs" />
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<div v-if="title" v-bind="titleAttrs" v-text="title" />
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup>
|
|
14
|
-
import { computed } from "vue";
|
|
15
|
-
|
|
16
|
-
import UIService from "../service.ui";
|
|
17
|
-
|
|
18
|
-
import { useAttrs } from "./composables/attrs.composable";
|
|
19
|
-
import defaultConfig from "./configs/default.config";
|
|
20
|
-
import { ULogo } from "./constants";
|
|
21
|
-
|
|
22
|
-
/* Should be a string for correct web-types gen */
|
|
23
|
-
defineOptions({ name: "ULogo", inheritAttrs: false });
|
|
24
|
-
|
|
25
|
-
const props = defineProps({
|
|
26
|
-
/**
|
|
27
|
-
* Logo source path.
|
|
28
|
-
*/
|
|
29
|
-
src: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: "",
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Logo label.
|
|
36
|
-
*/
|
|
37
|
-
label: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "",
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Logo title.
|
|
44
|
-
*/
|
|
45
|
-
title: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: "",
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Logo title size.
|
|
52
|
-
* @values 2xs, xs, sm, md, lg, xl, 2xl
|
|
53
|
-
*/
|
|
54
|
-
titleSize: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: UIService.get(defaultConfig, ULogo).default.titleSize,
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* title size.
|
|
61
|
-
* @values 2xs, xs, sm, md, lg, xl, 2xl, 3xl
|
|
62
|
-
*/
|
|
63
|
-
size: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: UIService.get(defaultConfig, ULogo).default.size,
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Component ui config object.
|
|
70
|
-
*/
|
|
71
|
-
config: {
|
|
72
|
-
type: Object,
|
|
73
|
-
default: () => ({}),
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Data-cy attribute for automated testing.
|
|
78
|
-
*/
|
|
79
|
-
dataCy: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: "",
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const emit = defineEmits(["click"]);
|
|
86
|
-
|
|
87
|
-
const { titleAttrs, logoAttrs, wrapperAttrs, labelAttrs, imageAttrs } = useAttrs(props);
|
|
88
|
-
|
|
89
|
-
const bgImage = computed(() => {
|
|
90
|
-
let path = props.src.includes("http") ? props.src : import.meta.env.BASE_URL + props.src;
|
|
91
|
-
|
|
92
|
-
return `background-image: url(${path});`;
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
function onClick(event) {
|
|
96
|
-
emit("click", event);
|
|
97
|
-
}
|
|
98
|
-
</script>
|