vueless 0.0.195 → 0.0.197
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 +18 -10
- package/package.json +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
|
@@ -162,6 +162,7 @@ function getMergedConfig({ defaultConfig, globalConfig, propsConfig, vuelessStra
|
|
|
162
162
|
@param {Object} propsConfig
|
|
163
163
|
@param {Object} config - final merged config.
|
|
164
164
|
@param {boolean} isReplace - enables class replacement instead of merge.
|
|
165
|
+
@param {boolean} isVarinants - if true, prevents adding a "base" key into nested objects.
|
|
165
166
|
|
|
166
167
|
@returns {Object}
|
|
167
168
|
*/
|
|
@@ -171,6 +172,7 @@ function mergeConfigs({
|
|
|
171
172
|
propsConfig,
|
|
172
173
|
config = {},
|
|
173
174
|
isReplace = false,
|
|
175
|
+
isVariants = false,
|
|
174
176
|
}) {
|
|
175
177
|
globalConfig = cloneDeep(globalConfig || {});
|
|
176
178
|
propsConfig = cloneDeep(propsConfig || {});
|
|
@@ -213,7 +215,7 @@ function mergeConfigs({
|
|
|
213
215
|
} else if (key === safelist || key === safelistColors) {
|
|
214
216
|
if (propsConfig[key]) {
|
|
215
217
|
// eslint-disable-next-line no-console
|
|
216
|
-
console.warn(`Passing '${key}' key
|
|
218
|
+
console.warn(`Passing '${key}' key in 'config' prop is not allowed.`);
|
|
217
219
|
}
|
|
218
220
|
} else if (key === defaultVariants) {
|
|
219
221
|
config[key] = { ...defaultConfig[key], ...globalConfig[key], ...propsConfig[key] };
|
|
@@ -235,14 +237,19 @@ function mergeConfigs({
|
|
|
235
237
|
const isIconName = key.includes(iconName) || key.includes(iconNameCapitalize);
|
|
236
238
|
const isI18n = key === i18n;
|
|
237
239
|
|
|
240
|
+
if (key === "variants" && !isVariants) {
|
|
241
|
+
isVariants = true;
|
|
242
|
+
}
|
|
243
|
+
|
|
238
244
|
config[key] =
|
|
239
245
|
isObject && !isEmpty && !isI18n
|
|
240
246
|
? mergeConfigs({
|
|
241
|
-
defaultConfig: stringToObject(composedConfig[key]),
|
|
242
|
-
globalConfig: stringToObject(globalConfig[key]),
|
|
243
|
-
propsConfig: stringToObject(propsConfig[key]),
|
|
244
|
-
config: stringToObject(composedConfig[key]),
|
|
247
|
+
defaultConfig: stringToObject(composedConfig[key], { addBase: !isVariants }),
|
|
248
|
+
globalConfig: stringToObject(globalConfig[key], { addBase: !isVariants }),
|
|
249
|
+
propsConfig: stringToObject(propsConfig[key], { addBase: !isVariants }),
|
|
250
|
+
config: stringToObject(composedConfig[key], { addBase: !isVariants }),
|
|
245
251
|
isReplace,
|
|
252
|
+
isVariants,
|
|
246
253
|
})
|
|
247
254
|
: isReplace || isIconName || isI18n
|
|
248
255
|
? propsConfig[key] || globalConfig[key] || defaultConfig[key]
|
|
@@ -257,14 +264,15 @@ function mergeConfigs({
|
|
|
257
264
|
}
|
|
258
265
|
|
|
259
266
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
267
|
+
Turn simplified nested component config to regular config.
|
|
268
|
+
@param {Object | String} value
|
|
269
|
+
@param {Boolean} addBase
|
|
270
|
+
@returns {Object}
|
|
263
271
|
*/
|
|
264
|
-
function stringToObject(value) {
|
|
272
|
+
function stringToObject(value, { addBase = false }) {
|
|
265
273
|
if (value === undefined) value = "";
|
|
266
274
|
|
|
267
|
-
return typeof value
|
|
275
|
+
return typeof value !== "object" ? addBase && { base: value } : value;
|
|
268
276
|
}
|
|
269
277
|
|
|
270
278
|
/**
|
package/package.json
CHANGED
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.197",
|
|
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>
|