vueless 0.0.176 → 0.0.177

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.176",
3
+ "version": "0.0.177",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -37,7 +37,7 @@
37
37
  "@release-it/bumper": "^6.0.1",
38
38
  "@vitejs/plugin-vue": "^5.0.5",
39
39
  "@vue/eslint-config-prettier": "^9.0.0",
40
- "@vueless/plugin-vite": "^0.0.32",
40
+ "@vueless/plugin-vite": "^0.0.34",
41
41
  "@vueless/storybook": "^0.0.32",
42
42
  "@vueless/web-types": "^0.0.12",
43
43
  "autoprefixer": "^10.4.19",
@@ -67,7 +67,7 @@
67
67
 
68
68
  <ULoaderTop
69
69
  v-if="resource && isHeaderSticky"
70
- :resource-names="resource"
70
+ :resources="resource"
71
71
  v-bind="stickyHeaderLoaderAttrs"
72
72
  />
73
73
  </div>
@@ -126,7 +126,7 @@
126
126
  </th>
127
127
  </tr>
128
128
 
129
- <ULoaderTop v-if="resource" :resource-names="resource" v-bind="headerLoaderAttrs" />
129
+ <ULoaderTop v-if="resource" :resources="resource" v-bind="headerLoaderAttrs" />
130
130
  </thead>
131
131
 
132
132
  <tbody v-if="tableRows.length" v-bind="bodyAttrs">
@@ -10,7 +10,7 @@ export default /*tw*/ {
10
10
  hover:transition hover:duration-100 hover:ease-in-out bg-white opacity-1
11
11
  `,
12
12
  subGroupLabel: {
13
- base: "pointer-events-none bg-transparent !font-medium leading-none !uppercase !text-gray-500/[85] pt-1",
13
+ base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-1",
14
14
  variants: {
15
15
  size: {
16
16
  sm: "text-2xs",
@@ -20,7 +20,7 @@ export default /*tw*/ {
20
20
  },
21
21
  },
22
22
  groupLabel: {
23
- base: "pointer-events-none bg-transparent !font-medium leading-none !uppercase !text-gray-500/[85] pt-6 group-first/item:pt-2",
23
+ base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-6 group-first/item:pt-2",
24
24
  variants: {
25
25
  size: {
26
26
  sm: "text-2xs pb-1 mt-4",
@@ -20,6 +20,7 @@ export default /*tw*/ {
20
20
  icon: "",
21
21
  checkbox: {
22
22
  base: `
23
+ transition duration-100 ease-in-out
23
24
  border border-solid rounded
24
25
  border-gray-300 bg-white
25
26
  hover:border-gray-400
@@ -34,11 +35,11 @@ export default /*tw*/ {
34
35
  sm: "size-5 text-sm",
35
36
  md: "size-6",
36
37
  lg: "size-7 text-lg",
37
- xl: "size-6 text-xl",
38
+ xl: "size-8 text-xl",
38
39
  },
39
40
  color: {
40
41
  grayscale: `
41
- focus:border-gray-500 focus:ring-gray-200
42
+ focus:border-gray-500 focus:ring-gray-500
42
43
  checked:border-gray-900 checked:bg-gray-900 checked:text-gray-900
43
44
  active:border-gray-900 active:bg-gray-900
44
45
  `,
@@ -135,7 +135,7 @@ const props = defineProps({
135
135
 
136
136
  /**
137
137
  * Checkbox size.
138
- * @values sm, md, lg
138
+ * @values xs, sm, md, lg, xl
139
139
  */
140
140
  size: {
141
141
  type: String,
@@ -192,9 +192,11 @@ const { config, checkboxAttrs, iconWrapperCellAttrs, labelAttrs, iconAttrs } = u
192
192
 
193
193
  const iconSize = computed(() => {
194
194
  const sizes = {
195
+ xs: "2xs",
195
196
  sm: "xs",
196
197
  md: "sm",
197
198
  lg: "md",
199
+ xl: "lg",
198
200
  };
199
201
 
200
202
  return sizes[props.size];
@@ -49,9 +49,9 @@ export default /*tw*/ {
49
49
  `,
50
50
  },
51
51
  compoundVariants: [
52
- { labelAlign: "topInside", label: true, size: "sm", class: "pt-6 pb-2" },
53
- { labelAlign: "topInside", label: true, size: "md", class: "pt-7 pb-2.5" },
54
- { labelAlign: "topInside", label: true, size: "lg", class: "pt-8 pb-3" },
52
+ { labelAlign: "topInside", label: true, size: "sm", class: "pt-5 pb-1.5" },
53
+ { labelAlign: "topInside", label: true, size: "md", class: "pt-6 pb-1.5" },
54
+ { labelAlign: "topInside", label: true, size: "lg", class: "pt-7 pb-2" },
55
55
  ],
56
56
  },
57
57
  defaultVariants: {
@@ -3,38 +3,38 @@ export default /*tw*/ {
3
3
  base: "flex",
4
4
  variants: {
5
5
  size: {
6
+ xs: "gap-2",
6
7
  sm: "gap-2",
7
8
  md: "gap-2.5",
8
9
  lg: "gap-3",
10
+ xl: "gap-3.5",
9
11
  },
10
12
  align: {
11
13
  top: "flex-col",
12
- topInside: "flex-col",
14
+ topInside: "flex-col gap-0",
13
15
  topWithDesc: "flex-col-reverse w-fit",
14
16
  left: "flex-row w-fit",
15
17
  right: "flex-row-reverse w-fit",
16
18
  bottom: "flex-col-reverse w-fit",
17
19
  },
18
20
  },
19
- compoundVariants: [
20
- { align: "topInside", size: "sm", class: "gap-0" },
21
- { align: "topInside", size: "md", class: "gap-0" },
22
- { align: "topInside", size: "lg", class: "gap-0" },
23
- ],
24
21
  },
25
22
  labelWrapper: "",
26
23
  label: {
27
24
  base: "text-gray-500 z-10 font-normal block !leading-none",
28
25
  variants: {
29
26
  size: {
27
+ xs: "text-2xs",
30
28
  sm: "text-xs",
31
29
  md: "text-sm",
32
30
  lg: "text-base",
31
+ xl: "text-lg",
33
32
  },
34
33
  align: {
35
34
  topInside: "absolute left-4",
36
- left: "text-gray-900",
37
- right: "text-gray-900",
35
+ topWithDesc: "pt-1 pb-1.5",
36
+ left: "pt-1 pb-1 text-gray-900",
37
+ right: "pt-1 pb-1 text-gray-900",
38
38
  },
39
39
  error: {
40
40
  true: "text-red-500",
@@ -44,49 +44,55 @@ export default /*tw*/ {
44
44
  },
45
45
  },
46
46
  compoundVariants: [
47
+ { align: "topInside", size: "xs", class: "top-1.5" },
47
48
  { align: "topInside", size: "sm", class: "top-2" },
48
49
  { align: "topInside", size: "md", class: "top-2.5" },
49
50
  { align: "topInside", size: "lg", class: "top-3" },
50
- { align: "topWithDesc", size: "sm", class: "pt-1 pb-1.5" },
51
- { align: "topWithDesc", size: "md", class: "pt-1 pb-1.5 mt-px" },
52
- { align: "topWithDesc", size: "lg", class: "pt-1 pb-1.5 mt-0.5" },
53
- { align: "left", size: "sm", class: "pt-1 pb-1.5 text-sm" },
54
- { align: "left", size: "md", class: "pt-1 pb-1.5 mt-px text-base" },
55
- { align: "left", size: "lg", class: "pt-1 pb-1.5 mt-0.5 text-lg" },
56
- { align: "right", size: "sm", class: "pt-1 pb-1.5 text-sm" },
57
- { align: "right", size: "md", class: "pt-1 pb-1.5 mt-px text-base" },
58
- { align: "right", size: "lg", class: "pt-1 pb-1.5 mt-0.5 text-lg" },
51
+ { align: "topInside", size: "xl", class: "top-3.5" },
52
+ { align: "topWithDesc", size: "xs", class: "-mt-px" },
53
+ { align: "topWithDesc", size: "sm", class: "" },
54
+ { align: "topWithDesc", size: "md", class: "mt-px" },
55
+ { align: "topWithDesc", size: "lg", class: "mt-0.5" },
56
+ { align: "topWithDesc", size: "xl", class: "mt-1" },
57
+ { align: "left", size: "xs", class: "-mt-0.5 text-sm" },
58
+ { align: "left", size: "sm", class: "text-sm" },
59
+ { align: "left", size: "md", class: "mt-px text-base" },
60
+ { align: "left", size: "lg", class: "mt-0.5 text-lg" },
61
+ { align: "left", size: "xl", class: "mt-1 text-xl" },
62
+ { align: "right", size: "sm", class: "-mt-0.5 text-xs" },
63
+ { align: "right", size: "sm", class: "text-sm" },
64
+ { align: "right", size: "md", class: "mt-px text-base" },
65
+ { align: "right", size: "lg", class: "mt-0.5 text-lg" },
66
+ { align: "right", size: "xl", class: "mt-1 text-xl" },
59
67
  ],
60
68
  },
61
69
  description: {
62
70
  base: "font-normal text-gray-500/[85] !leading-none",
63
71
  variants: {
64
72
  size: {
73
+ xs: "text-2xs",
65
74
  sm: "text-2xs",
66
75
  md: "text-xs",
67
76
  lg: "text-sm",
77
+ xl: "text-base",
68
78
  },
69
79
  align: {
70
80
  topInside: "pl-4",
71
- top: "pl-0",
81
+ top: "pl-0 -mt-0.5",
72
82
  left: "pl-0",
73
83
  right: "pl-0",
74
- bottom: "-order-1",
84
+ bottom: "-order-1 -mt-2",
75
85
  },
76
86
  error: {
77
87
  true: "text-red-500",
78
88
  },
79
89
  },
80
90
  compoundVariants: [
81
- { align: "bottom", size: "sm", class: "-mt-2" },
82
- { align: "bottom", size: "md", class: "-mt-2" },
83
- { align: "bottom", size: "lg", class: "-mt-2" },
84
- { align: "top", size: "sm", class: "-mt-0.5" },
85
- { align: "top", size: "md", class: "-mt-0.5" },
86
- { align: "top", size: "lg", class: "-mt-0.5" },
91
+ { align: "topInside", size: "xs", class: "mt-1" },
87
92
  { align: "topInside", size: "sm", class: "mt-1.5" },
88
93
  { align: "topInside", size: "md", class: "mt-2" },
89
94
  { align: "topInside", size: "lg", class: "mt-2.5" },
95
+ { align: "topInside", size: "xl", class: "mt-3" },
90
96
  ],
91
97
  },
92
98
  defaultVariants: {
@@ -16,12 +16,7 @@
16
16
  v-text="label"
17
17
  />
18
18
 
19
- <div
20
- v-if="error"
21
- :data-cy="`${dataCy}-error-message`"
22
- v-bind="descriptionAttrs"
23
- v-text="error"
24
- />
19
+ <div v-if="error" :data-cy="`${dataCy}-error`" v-bind="descriptionAttrs" v-text="error" />
25
20
 
26
21
  <div
27
22
  v-if="description && !error"
@@ -46,12 +41,7 @@
46
41
 
47
42
  <slot />
48
43
 
49
- <div
50
- v-if="error"
51
- :data-cy="`${dataCy}-error-message`"
52
- v-bind="descriptionAttrs"
53
- v-text="error"
54
- />
44
+ <div v-if="error" :data-cy="`${dataCy}-error`" v-bind="descriptionAttrs" v-text="error" />
55
45
 
56
46
  <div
57
47
  v-if="description && !error"
@@ -89,7 +79,7 @@ const props = defineProps({
89
79
 
90
80
  /**
91
81
  * Set label size.
92
- * @values sm, md, lg
82
+ * @values xs, sm, md, lg, xl
93
83
  */
94
84
  size: {
95
85
  type: String,
@@ -2,6 +2,7 @@ export default /*tw*/ {
2
2
  label: "inline-flex",
3
3
  radio: {
4
4
  base: `
5
+ transition duration-100 ease-in-out
5
6
  border border-solid border-{color}-300 text-{color}-500
6
7
  hover:border-{color}-400
7
8
  active:border-{color}-500
@@ -10,9 +11,11 @@ export default /*tw*/ {
10
11
  `,
11
12
  variants: {
12
13
  size: {
14
+ xs: "size-4",
13
15
  sm: "size-5",
14
16
  md: "size-6",
15
17
  lg: "size-7",
18
+ xl: "size-8",
16
19
  },
17
20
  },
18
21
  compoundVariants: [
@@ -77,7 +77,7 @@ const props = defineProps({
77
77
 
78
78
  /**
79
79
  * Radio size.
80
- * @values sm, md, lg
80
+ * @values xs, sm, md, lg, xl
81
81
  */
82
82
  size: {
83
83
  type: String,
@@ -9,9 +9,9 @@ export default /*tw*/ {
9
9
  `,
10
10
  variants: {
11
11
  size: {
12
- sm: "pt-2 pb-2",
13
- md: "pt-2.5 pb-2.5",
14
- lg: "pt-3 pb-3",
12
+ sm: "pt-2 pb-1.5",
13
+ md: "pt-2.5 pb-1.5",
14
+ lg: "pt-3 pb-2",
15
15
  },
16
16
  error: {
17
17
  true: `
@@ -27,9 +27,9 @@ export default /*tw*/ {
27
27
  },
28
28
  },
29
29
  compoundVariants: [
30
- { labelAlign: "topInside", label: true, size: "sm", class: "pt-6" },
31
- { labelAlign: "topInside", label: true, size: "md", class: "pt-7" },
32
- { labelAlign: "topInside", label: true, size: "lg", class: "pt-8" },
30
+ { labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
31
+ { labelAlign: "topInside", label: true, size: "md", class: "pt-6" },
32
+ { labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
33
33
  ],
34
34
  },
35
35
  innerWrapper: {
@@ -48,8 +48,8 @@ export default /*tw*/ {
48
48
  base: "flex items-center mt-0",
49
49
  compoundVariants: [
50
50
  { labelAlign: "topInside", size: "sm", label: true, class: "-mt-3" },
51
- { labelAlign: "topInside", size: "md", label: true, class: "-mt-4" },
52
- { labelAlign: "topInside", size: "lg", label: true, class: "-mt-5" },
51
+ { labelAlign: "topInside", size: "md", label: true, class: "-mt-3" },
52
+ { labelAlign: "topInside", size: "lg", label: true, class: "-mt-4" },
53
53
  ],
54
54
  },
55
55
  beforeCaretSlot: "",
@@ -41,7 +41,7 @@
41
41
  internal
42
42
  interactive
43
43
  color="gray"
44
- :size="size"
44
+ :size="iconSize"
45
45
  :name="config.toggleIconName"
46
46
  v-bind="toggleIconAttrs"
47
47
  />
@@ -60,7 +60,7 @@
60
60
  internal
61
61
  interactive
62
62
  color="gray"
63
- :size="size"
63
+ :size="iconSize"
64
64
  :name="config.clearIconName"
65
65
  v-bind="clearIconAttrs"
66
66
  @mousedown="removeElement"
@@ -93,7 +93,7 @@
93
93
  internal
94
94
  interactive
95
95
  color="gray"
96
- :size="size"
96
+ :size="iconSize"
97
97
  :name="config.removeItemIconName"
98
98
  v-bind="removeItemIconAttrs"
99
99
  @mousedown="removeElement(item)"
@@ -503,6 +503,16 @@ const {
503
503
  const i18nGlobal = tm(USelect);
504
504
  const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
505
505
 
506
+ const iconSize = computed(() => {
507
+ const sizes = {
508
+ sm: "sm",
509
+ md: "md",
510
+ lg: "md",
511
+ };
512
+
513
+ return sizes[props.size];
514
+ });
515
+
506
516
  const inputPlaceholder = computed(() => {
507
517
  const message = currentLocale.value.addMore;
508
518
 
@@ -4,10 +4,10 @@ export default /*tw*/ {
4
4
  rightSlot: "flex items-center justify-center h-full w-11 absolute right-0",
5
5
  textareaWrapper: {
6
6
  base: `
7
- transition duration-100 ease-in-out focus-within:outline-none rounded-lg border
8
- border-solid border-gray-300 focus-within:border-gray-500 focus-within:ring-4
9
- focus-within:ring-gray-600/[.15] ring-0 hover:border-gray-400 pl-4 hover:focus-within:border-gray-500
10
- cursor-text bg-white
7
+ transition duration-100 ease-in-out focus-within:outline-none
8
+ rounded-lg border border-solid border-gray-300 ring-0 cursor-text bg-white pr-4
9
+ hover:border-gray-400 pl-4 hover:focus-within:border-gray-500
10
+ focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15]
11
11
  `,
12
12
  variants: {
13
13
  error: {
@@ -24,18 +24,15 @@ export default /*tw*/ {
24
24
  true: "ring-0 border-gray-300 focus-within:ring-0 focus-within:border-brand-300",
25
25
  },
26
26
  size: {
27
- sm: "pb-2 pr-4 pt-6",
28
- md: "pb-2.5 pr-4 pt-7",
29
- lg: "pb-3 pr-4 pt-8",
27
+ sm: "pt-2 pb-2",
28
+ md: "pt-2.5 pb-2.5",
29
+ lg: "pt-3 pb-3",
30
30
  },
31
31
  },
32
32
  compoundVariants: [
33
- { labelAlign: "top", size: "sm", class: "pt-2" },
34
- { labelAlign: "top", size: "md", class: "pt-2.5" },
35
- { labelAlign: "top", size: "lg", class: "pt-3" },
36
- { labelAlign: "topInside", label: false, class: "pt-2" },
37
- { labelAlign: "topInside", label: false, class: "pt-2.5" },
38
- { labelAlign: "topInside", label: false, class: "pt-3" },
33
+ { labelAlign: "topInside", label: true, class: "pt-5 pb-1.5" },
34
+ { labelAlign: "topInside", label: true, class: "pt-6 pb-1.5" },
35
+ { labelAlign: "topInside", label: true, class: "pt-7 pb-2" },
39
36
  ],
40
37
  },
41
38
  textarea: {
@@ -1,7 +1,8 @@
1
- import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source, Markdown } from "@storybook/blocks";
1
+ import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../service.storybook";
3
3
 
4
4
  import * as stories from "./index.stories";
5
+ import defaultConfig from "./configs/default.config?raw"
5
6
 
6
7
  <Meta of={stories} />
7
8
  <Title of={stories} />
@@ -1,5 +1,6 @@
1
1
  import ULoaderRendering from "../ui.loader-rendering";
2
2
  import UButton from "../ui.button";
3
+ import UGroup from "../ui.container-group";
3
4
 
4
5
  import { useLoaderRendering } from "./composables/useLoaderRendering";
5
6
 
@@ -10,11 +11,18 @@ import { getArgTypes } from "../service.storybook";
10
11
  */
11
12
  export default {
12
13
  id: "9030",
13
- title: "Loaders and Skeletons / Loader rendering",
14
+ title: "Loaders and Skeletons / Loader Rendering",
14
15
  component: ULoaderRendering,
15
16
  argTypes: {
16
17
  ...getArgTypes(ULoaderRendering.name),
17
18
  },
19
+ parameters: {
20
+ docs: {
21
+ story: {
22
+ height: "420px",
23
+ },
24
+ },
25
+ },
18
26
  };
19
27
 
20
28
  const DefaultTemplate = (args) => ({
@@ -23,32 +31,29 @@ const DefaultTemplate = (args) => ({
23
31
  return { args };
24
32
  },
25
33
  template: `
26
- <div>
27
- <ULoaderRendering v-bind="args" class="!static !w-full" />
28
- </div>
34
+ <ULoaderRendering v-bind="args" class="w-full h-full" />
29
35
  `,
30
36
  });
31
37
 
32
38
  const LoadingTemplate = (args) => ({
33
- components: { ULoaderRendering, UButton },
39
+ components: { ULoaderRendering, UButton, UGroup },
34
40
  setup() {
35
- const { setRenderingFinished, isRenderingPage, setRenderingStarted } = useLoaderRendering();
41
+ const { loaderRenderingOn, loaderRenderingOff, isLoading } = useLoaderRendering();
36
42
 
37
- return { args, setRenderingFinished, setRenderingStarted, isRenderingPage };
43
+ return { args, loaderRenderingOn, loaderRenderingOff, isLoading };
38
44
  },
39
45
  methods: {
40
46
  toggleLoading() {
41
- this.isRenderingPage ? this.setRenderingFinished() : this.setRenderingStarted();
47
+ this.isLoading ? this.loaderRenderingOff() : this.loaderRenderingOn();
42
48
  },
43
49
  },
44
50
  template: `
45
- <div class="flex justify-center items-center pb-4">
46
- <UButton label="Toggle loading" @click="toggleLoading"/>
47
- </div>
48
- <div>
49
- <ULoaderRendering v-bind="args" class="!static !w-full" />
50
- </div>
51
- `,
51
+ <UGroup align="center" class="pb-4">
52
+ <UButton label="Toggle loading" size="sm" @click="toggleLoading"/>
53
+ </UGroup>
54
+
55
+ <ULoaderRendering v-bind="args" class="!static w-full h-96" />
56
+ `,
52
57
  });
53
58
 
54
59
  export const Default = DefaultTemplate.bind({});
@@ -12,25 +12,57 @@ import defaultConfig from "./configs/default.config?raw"
12
12
  <Controls of={stories.Default} />
13
13
  <Stories of={stories} />
14
14
 
15
- ## Control loader
16
- You can control loader state using *useLoaderRendering* composable.
15
+ ## Using loader
16
+ To control the loader state in Vue components use `useLoaderTop` composable.
17
+
18
+ The loader uses queue of resources and will be shown until at least one item is present in a queue.
17
19
 
18
20
  <Source code={`
19
21
  import { useLoaderTop } from "vueless";
20
22
 
21
23
  const {
22
- loaderTopOn,
23
- loaderTopOff,
24
- addRequestUrl,
25
- removeRequestUrl
24
+ isLoading,
25
+ loaderTopOn,
26
+ loaderTopOff,
27
+ requestQueue,
28
+ componentRequestQueue,
29
+ setComponentRequestQueue,
30
+ removeComponentRequestQueue
26
31
  } = useLoaderTop();
32
+
33
+ // get loader state
34
+ console.log(isLoading.value);
35
+
36
+ // show loader (add resource into queue)
37
+ loaderTopOn("/transactions");
38
+
39
+ // hide loader (remove resource from queue)
40
+ loaderTopOff("/transactions");
41
+
42
+ // get current resource array
43
+ console.log(requestQueue.value);
44
+
45
+ // get current resource array for component relayed loaders (UTable)
46
+ console.log(componentRequestQueue.value);
47
+
48
+ // add resource into component related loader queue
49
+ setComponentRequestQueue("/transactions");
50
+
51
+ // remove resource from component related loader queue
52
+ removeComponentRequestQueue("/transactions");
27
53
  `} language="jsx" dark />
28
54
 
29
- ## Control outside a component
30
- You can control loader state outside vue components using the following methods.
55
+ ## Using loader outside Vue components
56
+ To control the loader state outside Vue components, use the following methods.
31
57
 
32
58
  <Source code={`
33
59
  import { loaderTopOn, loaderTopOff } from "vueless";
60
+
61
+ // show loader
62
+ loaderTopOn("/transactions");
63
+
64
+ // hide loader
65
+ loaderTopOff("/transactions");
34
66
  `} language="jsx" dark />
35
67
 
36
68
  ## Default config
@@ -4,54 +4,41 @@ export const LoaderTopSymbol = Symbol.for("vueless:loader-top");
4
4
 
5
5
  const isLoading = ref(true);
6
6
  const requestQueue = ref([]);
7
- const loaderRequestQueue = ref([]);
8
- const loaderRequestTimeout = ref(0);
9
- const componentLoaderRequestQueue = ref([]);
7
+ const requestTimeout = ref(0);
8
+ const componentRequestQueue = ref([]);
10
9
 
11
10
  function loaderTopOn(url) {
12
- loaderRequestQueue.value.push(url);
11
+ requestQueue.value.push(url);
13
12
  isLoading.value = true;
14
13
 
15
- clearTimeout(loaderRequestTimeout.value);
14
+ clearTimeout(requestTimeout.value);
16
15
  }
17
16
 
18
17
  function loaderTopOff(url) {
19
- loaderRequestQueue.value = url ? loaderRequestQueue.value.filter((item) => item !== url) : [];
18
+ requestQueue.value = url ? requestQueue.value.filter((item) => item !== url) : [];
20
19
 
21
- loaderRequestTimeout.value = setTimeout(() => {
22
- if (!loaderRequestQueue.value.length) {
20
+ requestTimeout.value = setTimeout(() => {
21
+ if (!requestQueue.value.length) {
23
22
  isLoading.value = false;
24
23
  }
25
24
  }, 50);
26
25
  }
27
26
 
28
- function addRequestUrl(url) {
29
- requestQueue.value.push(url);
30
- }
31
-
32
- function removeRequestUrl(url) {
33
- requestQueue.value = requestQueue.value.filter((item) => item !== url);
34
- }
35
-
36
27
  function setComponentRequestQueue(requests) {
37
- componentLoaderRequestQueue.value = [...componentLoaderRequestQueue.value, ...requests];
28
+ componentRequestQueue.value = [...componentRequestQueue.value, ...requests];
38
29
  }
39
30
 
40
31
  function removeComponentRequestQueue() {
41
- componentLoaderRequestQueue.value = [];
32
+ componentRequestQueue.value = [];
42
33
  }
43
34
 
44
35
  export function createLoaderTop() {
45
36
  return {
46
37
  isLoading: readonly(isLoading),
47
38
  requestQueue: readonly(requestQueue),
48
- loaderRequestQueue: readonly(loaderRequestQueue),
49
- loaderRequestTimeout: readonly(loaderRequestTimeout),
50
- componentLoaderRequestQueue: readonly(componentLoaderRequestQueue),
39
+ componentRequestQueue: readonly(componentRequestQueue),
51
40
  loaderTopOn,
52
41
  loaderTopOff,
53
- addRequestUrl,
54
- removeRequestUrl,
55
42
  setComponentRequestQueue,
56
43
  removeComponentRequestQueue,
57
44
  };