vueless 0.0.143 → 0.0.144

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.143",
3
+ "version": "0.0.144",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -1,20 +1,32 @@
1
+ import { computed } from "vue";
1
2
  import useUI from "../../composable.ui";
3
+ import { cva } from "../../service.ui";
2
4
 
3
5
  import defaultConfig from "../configs/default.config";
4
6
 
5
7
  export function useAttrs(props) {
6
- const { getAttrs, config } = useUI(defaultConfig, () => props.config);
8
+ const { getAttrs, setColor, config } = useUI(defaultConfig, () => props.config);
9
+ const { wrapper } = config.value;
7
10
 
8
- const wrapperAttrs = getAttrs("wrapper");
9
- const loaderAttrs = getAttrs("loader");
10
- const rippleAttrs = getAttrs("ripple");
11
- const rippleElementAttrs = getAttrs("rippleElement");
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: props.color,
21
+ }),
22
+ props.color,
23
+ ),
24
+ );
25
+
26
+ const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
12
27
 
13
28
  return {
14
29
  wrapperAttrs,
15
- loaderAttrs,
16
- rippleAttrs,
17
- rippleElementAttrs,
18
30
  config,
19
31
  };
20
32
  }
@@ -1,13 +1,24 @@
1
1
  export default /*tw*/ {
2
- wrapper: "",
3
- loader: `
4
- flex justify-center items-center fixed left-0 top-0 z-[9999] h-screen w-screen bg-gray-800
5
- transition-all duration-300"
6
- `,
7
- ripple: "relative h-40 w-40 ml-auto mr-auto",
8
- rippleElement: "absolute opacity-100 rounded-full border-4 border-solid border-white",
2
+ wrapper: {
3
+ base: `
4
+ bg-{color}-600
5
+ h-screen w-screen
6
+ flex justify-center items-center
7
+ fixed left-0 top-0 z-[9999]
8
+ transition-all duration-300
9
+ `,
10
+ variants: {
11
+ color: {
12
+ white: "bg-white",
13
+ grayscale: "bg-gray-800",
14
+ },
15
+ },
16
+ },
9
17
  transition: {
10
18
  enterFromClass: "scale-110 transform",
11
19
  leaveActiveClass: "scale-110 transform",
12
20
  },
21
+ defaultVariants: {
22
+ color: "brand",
23
+ },
13
24
  };
@@ -1,17 +1,19 @@
1
1
  <template>
2
- <Transition name="loader" v-bind="{ ...config.transition, ...wrapperAttrs }">
3
- <div v-if="showLoader" v-bind="loaderAttrs">
4
- <div v-bind="rippleAttrs">
5
- <div v-bind="rippleElementAttrs" class="ripple-element" />
6
- <div v-bind="rippleElementAttrs" class="ripple-element" />
7
- </div>
2
+ <Transition v-bind="config.transition">
3
+ <div v-if="showLoader" v-bind="wrapperAttrs">
4
+ <ULoader size="lg" :color="color === 'white' ? 'grayscale' : 'white'" />
8
5
  </div>
9
6
  </Transition>
10
7
  </template>
11
8
 
12
9
  <script setup>
13
10
  import { computed, onMounted, onUnmounted } from "vue";
11
+ import UIService from "../service.ui";
14
12
 
13
+ import ULoader from "../ui.loader";
14
+
15
+ import { ULoaderRendering } from "./constants";
16
+ import defaultConfig from "./configs/default.config";
15
17
  import { useAttrs } from "./composables/attrs.composable";
16
18
  import { useLoaderRendering } from "./composables/useLoaderRendering";
17
19
 
@@ -19,13 +21,25 @@ import { useLoaderRendering } from "./composables/useLoaderRendering";
19
21
  defineOptions({ name: "ULoaderRendering", inheritAttrs: false });
20
22
 
21
23
  const props = defineProps({
24
+ /**
25
+ * Set loader on.
26
+ */
22
27
  loading: {
23
28
  type: Boolean,
24
29
  default: false,
25
30
  },
31
+
32
+ /**
33
+ * Loader color.
34
+ * @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
35
+ */
36
+ color: {
37
+ type: String,
38
+ default: UIService.get(defaultConfig, ULoaderRendering).default.color,
39
+ },
26
40
  });
27
41
 
28
- const { wrapperAttrs, loaderAttrs, rippleAttrs, rippleElementAttrs, config } = useAttrs(props);
42
+ const { wrapperAttrs, config } = useAttrs(props);
29
43
  const { isRenderingPage, setRenderingStarted, setRenderingFinished } = useLoaderRendering();
30
44
 
31
45
  onMounted(() => {
@@ -42,31 +56,3 @@ const showLoader = computed(() => {
42
56
  return props.loading || isRenderingPage.value;
43
57
  });
44
58
  </script>
45
-
46
- <style lang="postcss" scoped>
47
- .ripple-element {
48
- animation: ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
49
-
50
- &:nth-child(2) {
51
- animation-delay: -0.5s;
52
- }
53
- }
54
-
55
- @keyframes ripple {
56
- 0% {
57
- left: 5rem;
58
- top: 5rem;
59
- height: 0px;
60
- width: 0px;
61
- opacity: 1;
62
- }
63
-
64
- 100% {
65
- left: 0px;
66
- top: 0px;
67
- height: 10rem;
68
- width: 10rem;
69
- opacity: 0;
70
- }
71
- }
72
- </style>
@@ -1,4 +1,5 @@
1
1
  export default /*tw*/ {
2
+ wrapper: "absolute overflow-visible md:w-[22rem]",
2
3
  transitionGroup: {
3
4
  moveClass: "transition-all duration-500",
4
5
  enterActiveClass: "transition-all duration-500",
@@ -6,7 +7,6 @@ export default /*tw*/ {
6
7
  enterFromClass: "opacity-0",
7
8
  leaveToClass: "opacity-0",
8
9
  },
9
- wrapper: "absolute overflow-visible md:w-[22rem]",
10
10
  body: `
11
11
  mb-3 flex w-full items-center justify-center gap-3 rounded-2xl bg-gray-900/90
12
12
  p-4 shadow-[0_4px_16px_rgba(17,24,39,0.5)] backdrop-blur-md md:shadow-[0_0px_12px_rgba(0,0,0,0.25)]
@@ -25,6 +25,10 @@ export default /*tw*/ {
25
25
  errorIconName: "error",
26
26
  closeIcon: "",
27
27
  closeIconName: "close",
28
+ positionClasses: {
29
+ page: "UNotifyPage",
30
+ aside: "UNotifyAside",
31
+ },
28
32
  duration: {
29
33
  short: 4000,
30
34
  medium: 8000,
@@ -41,10 +45,6 @@ export default /*tw*/ {
41
45
  default: "Operation error.",
42
46
  },
43
47
  },
44
- positionClasses: {
45
- page: "UNotifyPage",
46
- aside: "UNotifyAside",
47
- },
48
48
  defaultVariants: {
49
49
  xPosition: "center",
50
50
  yPosition: "top",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.143",
4
+ "version": "0.0.144",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -4508,11 +4508,21 @@
4508
4508
  "attributes": [
4509
4509
  {
4510
4510
  "name": "loading",
4511
+ "description": "Set loader on.",
4511
4512
  "value": {
4512
4513
  "kind": "expression",
4513
4514
  "type": "boolean"
4514
4515
  },
4515
4516
  "default": "false"
4517
+ },
4518
+ {
4519
+ "name": "color",
4520
+ "description": "Loader color.",
4521
+ "value": {
4522
+ "kind": "expression",
4523
+ "type": "'brand' | 'grayscale' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'white'"
4524
+ },
4525
+ "default": "brand"
4516
4526
  }
4517
4527
  ],
4518
4528
  "source": {