vueless 0.0.209 → 0.0.210

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.209",
3
+ "version": "0.0.210",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -4,49 +4,46 @@ import { cva, cx } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs, getColor, setColor } = useUI(defaultConfig, () => props.config);
9
- const { loader, ellipse } = config.value;
10
-
11
- const cvaLoader = cva({
12
- base: loader.base,
13
- variants: loader.variants,
14
- compoundVariants: loader.compoundVariants,
15
- });
16
-
17
- const cvaEllipse = cva({
18
- base: ellipse.base,
19
- variants: ellipse.variants,
20
- compoundVariants: ellipse.compoundVariants,
21
- });
22
-
23
- const loaderClasses = computed(() =>
24
- cvaLoader({
25
- size: props.size,
26
- }),
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
27
11
  );
12
+ const attrs = {};
28
13
 
29
- const ellipseClasses = computed(() =>
30
- setColor(
31
- cvaEllipse({
32
- size: props.size,
33
- color: getColor(props.color),
34
- }),
35
- props.color,
36
- ),
37
- );
14
+ for (const key in defaultConfig) {
15
+ if (isSystemKey(key)) continue;
16
+
17
+ const classes = computed(() => {
18
+ const value = config.value[key];
19
+
20
+ if (value.variants || value.compoundVariants) {
21
+ return setColor(
22
+ cva(value)({
23
+ ...props,
24
+ color: getColor(props.color),
25
+ }),
26
+ props.color,
27
+ );
28
+ }
29
+
30
+ return "";
31
+ });
32
+
33
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
38
34
 
39
- const loaderAttrs = getAttrs("loader", { classes: loaderClasses });
40
- const ellipseRaw = getAttrs("ellipse", { classes: ellipseClasses });
35
+ if (key === "ellipse") {
36
+ const ellipseAttrs = attrs[`${key}Attrs`];
41
37
 
42
- const ellipseAttrs = computed(() => (classes) => ({
43
- ...ellipseRaw.value,
44
- class: cx([ellipseRaw.value.class, classes]),
45
- }));
38
+ attrs[`${key}Attrs`] = computed(() => (classes) => ({
39
+ ...ellipseAttrs,
40
+ class: cx([ellipseAttrs.value.class, classes]),
41
+ }));
42
+ }
43
+ }
46
44
 
47
45
  return {
48
- loaderAttrs,
49
- ellipseAttrs,
46
+ ...attrs,
50
47
  config,
51
48
  };
52
49
  }
@@ -16,7 +16,7 @@ import UIService from "../service.ui";
16
16
 
17
17
  import { ULoader } from "./constants";
18
18
  import defaultConfig from "./configs/default.config";
19
- import { useAttrs } from "./composables/attrs.composable";
19
+ import useAttrs from "./composables/attrs.composable";
20
20
 
21
21
  /* Should be a string for correct web-types gen */
22
22
  defineOptions({ name: "ULoader", inheritAttrs: false });
@@ -4,29 +4,37 @@ import { cva } from "../../service.ui";
4
4
 
5
5
  import defaultConfig from "../configs/default.config";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs, getColor, setColor } = useUI(defaultConfig, () => props.config);
9
- const { wrapper } = config.value;
10
-
11
- const cvaWrapper = cva({
12
- base: wrapper.base,
13
- variants: wrapper.variants,
14
- compoundVariants: wrapper.compoundVariants,
15
- });
16
-
17
- const wrapperClasses = computed(() =>
18
- setColor(
19
- cvaWrapper({
20
- color: getColor(props.color),
21
- }),
22
- props.color,
23
- ),
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
24
11
  );
12
+ const attrs = {};
25
13
 
26
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses, isComponent: true });
14
+ for (const key in defaultConfig) {
15
+ if (isSystemKey(key)) continue;
16
+
17
+ const classes = computed(() => {
18
+ const value = config.value[key];
19
+
20
+ if (value.variants || value.compoundVariants) {
21
+ return setColor(
22
+ cva(value)({
23
+ ...props,
24
+ color: getColor(props.color),
25
+ }),
26
+ props.color,
27
+ );
28
+ }
29
+
30
+ return "";
31
+ });
32
+
33
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
34
+ }
27
35
 
28
36
  return {
29
- wrapperAttrs,
37
+ ...attrs,
30
38
  config,
31
39
  };
32
40
  }
@@ -14,6 +14,7 @@ export default /*tw*/ {
14
14
  },
15
15
  },
16
16
  },
17
+ loader: "{ULoader}",
17
18
  transition: {
18
19
  enterFromClass: "scale-110 transform",
19
20
  leaveActiveClass: "scale-110 transform",
@@ -1,7 +1,12 @@
1
1
  <template>
2
2
  <Transition v-bind="config.transition">
3
3
  <div v-if="showLoader" v-bind="wrapperAttrs">
4
- <ULoader :loading="showLoader" size="lg" :color="color === 'white' ? 'grayscale' : 'white'" />
4
+ <ULoader
5
+ :loading="showLoader"
6
+ size="lg"
7
+ :color="color === 'white' ? 'grayscale' : 'white'"
8
+ v-bind="loaderAttrs"
9
+ />
5
10
  </div>
6
11
  </Transition>
7
12
  </template>
@@ -14,7 +19,7 @@ import ULoader from "../ui.loader";
14
19
 
15
20
  import { ULoaderRendering } from "./constants";
16
21
  import defaultConfig from "./configs/default.config";
17
- import { useAttrs } from "./composables/attrs.composable";
22
+ import useAttrs from "./composables/attrs.composable";
18
23
  import { useLoaderRendering } from "./composables/useLoaderRendering";
19
24
 
20
25
  /* Should be a string for correct web-types gen */
@@ -39,7 +44,7 @@ const props = defineProps({
39
44
  },
40
45
  });
41
46
 
42
- const { wrapperAttrs, config } = useAttrs(props);
47
+ const { wrapperAttrs, loaderAttrs, config } = useAttrs(props);
43
48
  const { isLoading, loaderRenderingOn, loaderRenderingOff } = useLoaderRendering();
44
49
 
45
50
  onMounted(() => {
@@ -4,28 +4,37 @@ import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs, getColor, setColor } = useUI(defaultConfig, () => props.config);
9
- const { progress } = config.value;
10
-
11
- const cvaProgress = cva({
12
- base: progress.base,
13
- variants: progress.variants,
14
- compoundVariants: progress.compoundVariants,
15
- });
16
-
17
- const progressClasses = computed(() =>
18
- setColor(
19
- cvaProgress({
20
- color: getColor(props.color),
21
- }),
22
- props.color,
23
- ),
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
24
11
  );
12
+ const attrs = {};
25
13
 
26
- const progressAttrs = getAttrs("progress", { classes: progressClasses.value });
14
+ for (const key in defaultConfig) {
15
+ if (isSystemKey(key)) continue;
16
+
17
+ const classes = computed(() => {
18
+ const value = config.value[key];
19
+
20
+ if (value.variants || value.compoundVariants) {
21
+ return setColor(
22
+ cva(value)({
23
+ ...props,
24
+ color: getColor(props.color),
25
+ }),
26
+ props.color,
27
+ );
28
+ }
29
+
30
+ return "";
31
+ });
32
+
33
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
34
+ }
27
35
 
28
36
  return {
29
- progressAttrs,
37
+ ...attrs,
38
+ config,
30
39
  };
31
40
  }
@@ -13,7 +13,7 @@ import { useLoaderTop } from "./composables/useLoaderTop";
13
13
 
14
14
  import { ULoaderTop, MAXIMUM, SPEED } from "./constants";
15
15
  import defaultConfig from "./configs/default.config";
16
- import { useAttrs } from "./composables/attrs.composable";
16
+ import useAttrs from "./composables/attrs.composable";
17
17
 
18
18
  /* Should be a string for correct web-types gen */
19
19
  defineOptions({ name: "ULoaderTop", inheritAttrs: false });
@@ -4,29 +4,37 @@ import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs, getColor, setColor } = useUI(defaultConfig, () => props.config);
9
- const { wrapper } = config.value;
10
-
11
- const cvaWrapper = cva({
12
- base: wrapper.base,
13
- variants: wrapper.variants,
14
- compoundVariants: wrapper.compoundVariants,
15
- });
16
-
17
- const wrapperClasses = computed(() =>
18
- setColor(
19
- cvaWrapper({
20
- size: props.size,
21
- color: getColor(props.color),
22
- }),
23
- props.color,
24
- ),
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
25
11
  );
12
+ const attrs = {};
26
13
 
27
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
14
+ for (const key in defaultConfig) {
15
+ if (isSystemKey(key)) continue;
16
+
17
+ const classes = computed(() => {
18
+ const value = config.value[key];
19
+
20
+ if (value.variants || value.compoundVariants) {
21
+ return setColor(
22
+ cva(value)({
23
+ ...props,
24
+ color: getColor(props.color),
25
+ }),
26
+ props.color,
27
+ );
28
+ }
29
+
30
+ return "";
31
+ });
32
+
33
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
34
+ }
28
35
 
29
36
  return {
30
- wrapperAttrs,
37
+ ...attrs,
38
+ config,
31
39
  };
32
40
  }
@@ -7,7 +7,7 @@ import UIService from "../service.ui";
7
7
 
8
8
  import { UDot } from "./constants";
9
9
  import defaultConfig from "./configs/default.config";
10
- import { useAttrs } from "./composables/attrs.composable";
10
+ import useAttrs from "./composables/attrs.composable";
11
11
 
12
12
  /* Should be a string for correct web-types gen */
13
13
  defineOptions({ name: "UDot", inheritAttrs: false });
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.209",
4
+ "version": "0.0.210",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",