vueless 0.0.202 → 0.0.203

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.202",
3
+ "version": "0.0.203",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -4,35 +4,31 @@ import { cva } from "../../service.ui";
4
4
 
5
5
  import defaultConfig from "../configs/default.config";
6
6
 
7
- export function useAttrs(props, { focus }) {
8
- const { config, getAttrs } = useUI(defaultConfig, () => props.config);
9
- const { label } = config.value;
10
-
11
- const cvaLabel = cva({
12
- base: label.base,
13
- variants: label.variants,
14
- compoundVariants: label.compoundVariants,
15
- });
16
-
17
- const labelClasses = computed(() =>
18
- cvaLabel({
19
- focus: Boolean(focus.value),
20
- size: props.size,
21
- }),
22
- );
23
-
24
- const labelAttrs = getAttrs("label", { classes: labelClasses });
25
- const fileAttrs = getAttrs("file", { isComponent: true });
26
- const infoAttrs = getAttrs("info");
27
- const iconAttrs = getAttrs("icon", { isComponent: true });
28
- const imageAttrs = getAttrs("image");
7
+ export default function useAttrs(props, { focus }) {
8
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
9
+ const attrs = {};
10
+
11
+ for (const key in defaultConfig) {
12
+ if (isSystemKey(key)) continue;
13
+
14
+ const classes = computed(() => {
15
+ const value = config.value[key];
16
+
17
+ if (value.variants || value.compoundVariants) {
18
+ return cva(value)({
19
+ ...props,
20
+ focus: Boolean(focus.value),
21
+ });
22
+ }
23
+
24
+ return "";
25
+ });
26
+
27
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
28
+ }
29
29
 
30
30
  return {
31
+ ...attrs,
31
32
  config,
32
- fileAttrs,
33
- infoAttrs,
34
- iconAttrs,
35
- labelAttrs,
36
- imageAttrs,
37
33
  };
38
34
  }
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
- file: "",
2
+ file: "{UFile}",
3
3
  info: "flex items-center gap-2 ",
4
- icon: "",
4
+ icon: "{UIcon}",
5
5
  iconName: "description",
6
6
  image: "rounded-sm max-w-7",
7
7
  label: {
@@ -31,7 +31,7 @@ import UIcon from "../ui.image-icon";
31
31
 
32
32
  import UIService, { getRandomId } from "../service.ui";
33
33
 
34
- import { useAttrs } from "./composables/attrs.composable";
34
+ import useAttrs from "./composables/attrs.composable";
35
35
  import { UFile } from "./constants";
36
36
  import defaultConfig from "./configs/default.config";
37
37
 
@@ -4,25 +4,31 @@ import { cva } from "../../service.ui";
4
4
 
5
5
  import defaultConfig from "../configs/default.config";
6
6
 
7
- export function useAttrs(props) {
8
- const { getAttrs, config } = useUI(defaultConfig, () => props.config);
9
- const { body } = config.value;
7
+ export default function useAttrs(props) {
8
+ const { getAttrs, config, isSystemKey } = useUI(defaultConfig, () => props.config);
9
+ const attrs = {};
10
10
 
11
- const cvaBody = cva({
12
- base: body.base,
13
- variants: body.variants,
14
- compoundVariants: body.compoundVariants,
15
- });
11
+ for (const key in defaultConfig) {
12
+ if (isSystemKey(key)) continue;
16
13
 
17
- const bodyClasses = computed(() => cvaBody({ label: Boolean(props.label) }));
14
+ const classes = computed(() => {
15
+ const value = config.value[key];
18
16
 
19
- const labelAttrs = getAttrs("label");
20
- const bodyAttrs = getAttrs("body", { classes: bodyClasses });
21
- const fileAttrs = getAttrs("file", { isComponent: true });
17
+ if (value.variants || value.compoundVariants) {
18
+ return cva(value)({
19
+ ...props,
20
+ label: Boolean(props.label),
21
+ });
22
+ }
23
+
24
+ return "";
25
+ });
26
+
27
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
28
+ }
22
29
 
23
30
  return {
24
- labelAttrs,
25
- bodyAttrs,
26
- fileAttrs,
31
+ ...attrs,
32
+ config,
27
33
  };
28
34
  }
@@ -8,7 +8,7 @@ export default /*tw*/ {
8
8
  },
9
9
  },
10
10
  },
11
- file: "block",
11
+ file: "{UFile} block",
12
12
  defaultVariants: {
13
13
  placement: "topInside",
14
14
  size: "md",
@@ -14,12 +14,16 @@
14
14
  :data-cy="`${dataCy}-item`"
15
15
  >
16
16
  <template #left="{ file: currentFile }">
17
- <!-- @slot Use it to add something left. -->
17
+ <!-- @slot Use it to add something left.
18
+ @binding {object} file
19
+ -->
18
20
  <slot name="left" :file="currentFile" />
19
21
  </template>
20
22
 
21
23
  <template #right="{ file: currentFile }">
22
- <!-- @slot Use it to add something right. -->
24
+ <!-- @slot Use it to add something right.
25
+ @binding {object} file
26
+ -->
23
27
  <slot name="right" :file="currentFile" />
24
28
  </template>
25
29
  </UFile>
@@ -35,7 +39,7 @@ import UIService from "../service.ui";
35
39
 
36
40
  import { UFiles } from "./constants";
37
41
  import defaultConfig from "./configs/default.config";
38
- import { useAttrs } from "./composables/attrs.composable";
42
+ import useAttrs from "./composables/attrs.composable";
39
43
  import { computed } from "vue";
40
44
 
41
45
  /* Should be a string for correct web-types gen */
@@ -1,30 +1,32 @@
1
1
  import useUI from "../../composable.ui";
2
-
2
+ import { computed } from "vue";
3
3
  import defaultConfig from "../configs/default.config";
4
+ import { cva } from "../../service.ui";
5
+
6
+ export default function useAttrs(props) {
7
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
8
+ const attrs = {};
9
+
10
+ for (const key in defaultConfig) {
11
+ if (isSystemKey(key)) continue;
12
+
13
+ const classes = computed(() => {
14
+ const value = config.value[key];
15
+
16
+ if (value.variants || value.compoundVariants) {
17
+ return cva(value)({
18
+ ...props,
19
+ });
20
+ }
4
21
 
5
- export function useAttrs(props) {
6
- const { config, getAttrs } = useUI(defaultConfig, () => props.config);
22
+ return "";
23
+ });
7
24
 
8
- const wrapperAttrs = getAttrs("wrapper");
9
- const bodyAttrs = getAttrs("body");
10
- const contentAttrs = getAttrs("content");
11
- const labelAttrs = getAttrs("label");
12
- const descriptionAttrs = getAttrs("description");
13
- const successIconAttrs = getAttrs("successIcon");
14
- const warningIconAttrs = getAttrs("warningIcon");
15
- const errorIconAttrs = getAttrs("errorIcon");
16
- const closeIconAttrs = getAttrs("closeIcon");
25
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
26
+ }
17
27
 
18
28
  return {
29
+ ...attrs,
19
30
  config,
20
- wrapperAttrs,
21
- bodyAttrs,
22
- contentAttrs,
23
- labelAttrs,
24
- descriptionAttrs,
25
- successIconAttrs,
26
- warningIconAttrs,
27
- errorIconAttrs,
28
- closeIconAttrs,
29
31
  };
30
32
  }
@@ -83,7 +83,7 @@ import { merge } from "lodash-es";
83
83
  import UIService, { globalComponentConfig, cx } from "../service.ui";
84
84
 
85
85
  import { useLocale } from "../composable.locale";
86
- import { useAttrs } from "./composables/attrs.composable";
86
+ import useAttrs from "./composables/attrs.composable";
87
87
 
88
88
  import defaultConfig from "./configs/default.config";
89
89
  import { UNotify, NOTIFY_TYPE, POSITION } from "./constants";
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.202",
4
+ "version": "0.0.203",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -3331,6 +3331,7 @@
3331
3331
  "description": "Use it to add something left.",
3332
3332
  "bindings": [
3333
3333
  {
3334
+ "type": "object",
3334
3335
  "name": "file"
3335
3336
  }
3336
3337
  ]
@@ -3341,6 +3342,7 @@
3341
3342
  "description": "Use it to add something right.",
3342
3343
  "bindings": [
3343
3344
  {
3345
+ "type": "object",
3344
3346
  "name": "file"
3345
3347
  }
3346
3348
  ]