vueless 0.0.50 → 0.0.52

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.
Files changed (43) hide show
  1. package/adatper.locale/locales/en.js +2 -0
  2. package/composable.breakpoint/index.js +93 -0
  3. package/index.js +9 -0
  4. package/package.json +4 -6
  5. package/service.ui/index.js +1 -0
  6. package/ui.button/composables/attrs.composable.js +9 -2
  7. package/ui.button-link/composables/attrs.composable.js +23 -3
  8. package/ui.button-toggle/configs/default.config.js +1 -0
  9. package/ui.container-card/composable/attrs.composable.js +2 -2
  10. package/ui.container-card/index.vue +3 -6
  11. package/ui.container-modal/composables/attrs.composable.js +5 -8
  12. package/ui.container-modal-confirm/composable/attrs.composable.js +55 -5
  13. package/ui.container-page/composables/attrs.composable.js +3 -3
  14. package/ui.container-page/index.vue +4 -6
  15. package/ui.form-calendar/configs/default.config.js +21 -21
  16. package/ui.form-color-picker/composables/attrs.composable.js +2 -9
  17. package/ui.form-date-picker/configs/default.config.js +1 -1
  18. package/ui.form-date-picker-range/configs/default.config.js +16 -16
  19. package/ui.form-date-picker-range/index.vue +3 -4
  20. package/ui.form-input/configs/default.config.js +2 -2
  21. package/ui.form-radio-card/composables/attrs.composable.js +2 -2
  22. package/ui.form-radio-card/index.vue +6 -10
  23. package/ui.form-select/configs/default.config.js +2 -2
  24. package/ui.form-textarea/configs/default.config.js +1 -1
  25. package/ui.loader-rendering/composables/useLoaderRendering.js +19 -0
  26. package/ui.loader-rendering/index.vue +15 -16
  27. package/ui.navigation-pagination/configs/default.config.js +2 -2
  28. package/ui.notify/Docs.mdx +84 -0
  29. package/ui.notify/composables/attrs.composable.js +30 -0
  30. package/ui.notify/configs/default.config.js +47 -0
  31. package/ui.notify/constants/index.js +19 -0
  32. package/ui.notify/index.stories.js +77 -0
  33. package/ui.notify/index.vue +196 -214
  34. package/ui.notify/services/index.js +65 -63
  35. package/ui.other-loader-top/composables/useLoaderTop.js +57 -0
  36. package/ui.other-loader-top/index.vue +12 -13
  37. package/ui.text-alert/composables/attrs.composable.js +1 -1
  38. package/web-types.json +21 -16
  39. package/ui.loader-rendering/store/index.js +0 -17
  40. package/ui.notify/index.sto_ries.js +0 -102
  41. package/ui.other-loader-top/store/index.js +0 -59
  42. package/ui.viewport/index.vue +0 -78
  43. package/ui.viewport/store/index.js +0 -47
@@ -7,16 +7,16 @@
7
7
  <script setup>
8
8
  import { computed, onBeforeUnmount, watch, ref } from "vue";
9
9
 
10
- import { useStore } from "vuex";
11
-
12
10
  import UIService, { isMobileApp } from "../service.ui";
13
11
  import { clamp, queue } from "./services/loaderTop.service";
12
+ import useLoaderTop from "./composables/useLoaderTop";
14
13
 
15
14
  import { ULoaderTop, MAXIMUM, SPEED } from "./constants";
16
15
  import defaultConfig from "./configs/default.config";
17
16
  import { useAttrs } from "./composables/attrs.composable";
18
17
 
19
- defineOptions({ name: "ULoaderTop" });
18
+ /* Should be a string for correct web-types gen */
19
+ defineOptions({ name: "ULoaderTop", inheritAttrs: false });
20
20
 
21
21
  const props = defineProps({
22
22
  /**
@@ -46,22 +46,21 @@ const props = defineProps({
46
46
  },
47
47
  });
48
48
 
49
- const store = useStore();
50
-
51
49
  const error = ref(false);
52
50
  const show = ref(false);
53
51
  const progress = ref(0);
54
52
  const opacity = ref(1);
55
53
  const status = ref(null);
56
54
 
55
+ const {
56
+ loaderRequestQueue,
57
+ isLoading,
58
+ componentLoaderRequestQueue,
59
+ setComponentRequestQueue,
60
+ removeComponentRequestQueue,
61
+ } = useLoaderTop();
57
62
  const { progressAttrs } = useAttrs(props, { error, isMobileApp });
58
63
 
59
- const loaderRequestQueue = computed(() => store.state.loaderTop.loaderRequestQueue);
60
- const isLoading = computed(() => store.state.loaderTop.isLoading);
61
- const componentLoaderRequestQueue = computed(
62
- () => store.state.loaderTop.componentLoaderRequestQueue,
63
- );
64
-
65
64
  const isStarted = computed(() => {
66
65
  return typeof status.value === "number";
67
66
  });
@@ -81,12 +80,12 @@ watch(loaderRequestQueue, onChangeRequestsQueue, { deep: true });
81
80
  watch(isLoading, onChangeLoadingState, { deep: true });
82
81
 
83
82
  if (props.resourceNames) {
84
- store.commit("loaderTop/SET_COMPONENT_REQUEST_QUEUE", resourceNamesArray.value);
83
+ setComponentRequestQueue(resourceNamesArray.value);
85
84
  }
86
85
 
87
86
  onBeforeUnmount(() => {
88
87
  if (props.resourceNames) {
89
- store.commit("loaderTop/REMOVE_COMPONENT_REQUEST_QUEUE");
88
+ removeComponentRequestQueue();
90
89
  }
91
90
  });
92
91
 
@@ -30,7 +30,7 @@ export function useAttrs(props) {
30
30
  ),
31
31
  );
32
32
 
33
- const bodyClasses = computed(() => cvaBody({ size: props.size }));
33
+ const bodyClasses = computed(() => setColor(cvaBody({ size: props.size }), props.color));
34
34
 
35
35
  const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
36
36
  const bodyAttrs = getAttrs("body", { classes: bodyClasses });
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.50",
4
+ "version": "0.0.52",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -5027,7 +5027,7 @@
5027
5027
  "kind": "expression",
5028
5028
  "type": "'left' | 'center' | 'right'"
5029
5029
  },
5030
- "default": "\"center\""
5030
+ "default": "center"
5031
5031
  },
5032
5032
  {
5033
5033
  "name": "yPosition",
@@ -5036,7 +5036,25 @@
5036
5036
  "kind": "expression",
5037
5037
  "type": "'top' | 'bottom'"
5038
5038
  },
5039
- "default": "\"top\""
5039
+ "default": "top"
5040
+ },
5041
+ {
5042
+ "name": "vHtml",
5043
+ "description": "Use v-html to render notification label and description content.",
5044
+ "value": {
5045
+ "kind": "expression",
5046
+ "type": "boolean"
5047
+ },
5048
+ "default": "false"
5049
+ },
5050
+ {
5051
+ "name": "config",
5052
+ "description": "Sets component ui config object.",
5053
+ "value": {
5054
+ "kind": "expression",
5055
+ "type": "object"
5056
+ },
5057
+ "default": "{}"
5040
5058
  }
5041
5059
  ],
5042
5060
  "source": {
@@ -6993,19 +7011,6 @@
6993
7011
  "symbol": "default"
6994
7012
  }
6995
7013
  },
6996
- {
6997
- "name": "UViewport",
6998
- "description": "",
6999
- "slots": [
7000
- {
7001
- "name": "default"
7002
- }
7003
- ],
7004
- "source": {
7005
- "module": "vueless/ui.viewport/index.vue",
7006
- "symbol": "default"
7007
- }
7008
- },
7009
7014
  {
7010
7015
  "name": "YearView",
7011
7016
  "description": "",
@@ -1,17 +0,0 @@
1
- export default {
2
- namespaced: true,
3
-
4
- state: {
5
- isRenderingPage: true,
6
- },
7
-
8
- mutations: {
9
- SET_RENDERING_STARTED(state) {
10
- state.isRenderingPage = true;
11
- },
12
-
13
- SET_RENDERING_FINISHED(state) {
14
- state.isRenderingPage = false;
15
- },
16
- },
17
- };
@@ -1,102 +0,0 @@
1
- import NotifyServiceDefault from "../ui.notify/services";
2
-
3
- import UNotify from "../ui.notify";
4
- import UButton from "../ui.button";
5
-
6
- import { getArgTypes } from "../service.storybook";
7
-
8
- const NotifyService = new NotifyServiceDefault();
9
-
10
- export default {
11
- title: "Other / Notify",
12
- component: UNotify,
13
- args: {
14
- type: "success",
15
- code: "code",
16
- title: "",
17
- text: "",
18
- duration: "short",
19
- ignoreDuplicates: false,
20
- },
21
- argTypes: {
22
- ...getArgTypes(UNotify.name),
23
- type: {
24
- description: "The type of notify.",
25
- defaultValue: { summary: "success" },
26
- options: ["success", "warning", "error"],
27
- control: {
28
- type: "radio",
29
- },
30
- },
31
- code: {
32
- description:
33
- "Unique translation code, for ex. `categoryCreated`, " +
34
- "which will be used in i18n translation path, for ex. `UNotify.success.categoryCreated`.",
35
- defaultValue: { summary: "" },
36
- control: {
37
- type: "text",
38
- },
39
- },
40
- title: {
41
- description: "Notify title.",
42
- defaultValue: { summary: "" },
43
- control: {
44
- type: "text",
45
- },
46
- },
47
- text: {
48
- description: "Notify text (description).",
49
- defaultValue: { summary: "" },
50
- control: {
51
- type: "text",
52
- },
53
- },
54
- duration: {
55
- description: "The notify visibility duration.",
56
- defaultValue: { summary: "short" },
57
- options: ["short", "medium", "long", "permanent"], //4000, 8000, 12000, 300000
58
- control: {
59
- type: "radio",
60
- },
61
- },
62
- ignoreDuplicates: {
63
- description: "Show only 1 notify at once.",
64
- defaultValue: { summary: false },
65
- control: {
66
- type: "boolean",
67
- },
68
- },
69
- },
70
- };
71
-
72
- const DefaultTemplate = (args) => ({
73
- components: { UNotify, UButton },
74
- setup() {
75
- return { args };
76
- },
77
- template: `
78
- <div>
79
- <UNotify v-bind="args"/>
80
-
81
- <UButton label="show notify" @click="onClick"/>
82
- </div>
83
- `,
84
-
85
- methods: {
86
- onClick() {
87
- const settings = {
88
- type: args.type,
89
- code: args.code,
90
- title: args.title,
91
- text: args.text,
92
- duration: args.duration,
93
- ignoreDuplicates: args.ignoreDuplicates,
94
- };
95
-
96
- NotifyService.notify(settings);
97
- },
98
- },
99
- });
100
-
101
- export const Default = DefaultTemplate.bind({});
102
- Default.args = {};
@@ -1,59 +0,0 @@
1
- export default {
2
- namespaced: true,
3
-
4
- state: {
5
- isLoading: false,
6
- requestQueue: [],
7
- loaderRequestQueue: [],
8
- loaderRequestTimeout: 0,
9
- componentLoaderRequestQueue: [],
10
- },
11
-
12
- mutations: {
13
- SET_LOADING_ON: (state, url) => {
14
- state.loaderRequestQueue.push(url);
15
-
16
- state.isLoading = true;
17
-
18
- clearTimeout(state.loaderRequestTimeout);
19
- },
20
-
21
- SET_LOADING_OFF: (state, url) => {
22
- if (url) {
23
- state.loaderRequestQueue.forEach((item, index) => {
24
- if (item === url) {
25
- state.loaderRequestQueue.splice(index, 1);
26
- }
27
- });
28
- } else {
29
- state.loaderRequestQueue = [];
30
- }
31
-
32
- state.loaderRequestTimeout = setTimeout(() => {
33
- if (!state.loaderRequestQueue.length) {
34
- state.isLoading = false;
35
- }
36
- }, 50);
37
- },
38
-
39
- ADD_REQUEST_URL: (state, url) => {
40
- state.requestQueue.push(url);
41
- },
42
-
43
- REMOVE_REQUEST_URL: (state, url) => {
44
- state.requestQueue.forEach((item, index) => {
45
- if (item === url) {
46
- state.requestQueue.splice(index, 1);
47
- }
48
- });
49
- },
50
-
51
- SET_COMPONENT_REQUEST_QUEUE(state, requests) {
52
- state.componentLoaderRequestQueue = [...state.componentLoaderRequestQueue, ...requests];
53
- },
54
-
55
- REMOVE_COMPONENT_REQUEST_QUEUE(state) {
56
- state.componentLoaderRequestQueue = [];
57
- },
58
- },
59
- };
@@ -1,78 +0,0 @@
1
- <template>
2
- <div>
3
- <slot :breakpoint="breakpoint" />
4
- </div>
5
- </template>
6
-
7
- <script>
8
- import { mapMutations } from "vuex";
9
-
10
- export default {
11
- name: "UViewport",
12
-
13
- data() {
14
- return {
15
- windowWidth: 0,
16
- breakpoint: "",
17
- };
18
- },
19
-
20
- watch: {
21
- windowWidth: {
22
- immediate: true,
23
- handler: "setBreakpoint",
24
- },
25
- },
26
-
27
- mounted() {
28
- this.setWindowWidth();
29
- this.setListener();
30
- },
31
-
32
- methods: {
33
- ...mapMutations("breakpoint", ["SET_BREAKPOINT"]),
34
-
35
- setWindowWidth() {
36
- this.windowWidth = window.innerWidth;
37
- },
38
-
39
- setListener() {
40
- let timeout;
41
-
42
- window.addEventListener(
43
- "resize",
44
- () => {
45
- if (timeout) {
46
- window.cancelAnimationFrame(timeout);
47
- }
48
-
49
- timeout = window.requestAnimationFrame(() => {
50
- this.setWindowWidth();
51
- });
52
- },
53
- { passive: true },
54
- );
55
- },
56
-
57
- setBreakpoint(windowWidth) {
58
- if (!windowWidth) return;
59
-
60
- this.breakpoint = "xs";
61
-
62
- if (windowWidth >= 640 && windowWidth < 768) {
63
- this.breakpoint = "sm";
64
- } else if (windowWidth >= 768 && windowWidth < 1024) {
65
- this.breakpoint = "md";
66
- } else if (windowWidth >= 1024 && windowWidth < 1280) {
67
- this.breakpoint = "lg";
68
- } else if (windowWidth >= 1280 && windowWidth < 1536) {
69
- this.breakpoint = "xl";
70
- } else if (windowWidth >= 1536) {
71
- this.breakpoint = "2xl";
72
- }
73
-
74
- this.SET_BREAKPOINT(this.breakpoint);
75
- },
76
- },
77
- };
78
- </script>
@@ -1,47 +0,0 @@
1
- export default {
2
- namespaced: true,
3
-
4
- state: {
5
- breakpoint: "",
6
- mobileDevices: ["xs", "sm"],
7
- portableDevices: ["xs", "sm", "md"],
8
- },
9
-
10
- getters: {
11
- isLaptopDevice(state) {
12
- const { breakpoint } = state;
13
-
14
- return breakpoint === "lg";
15
- },
16
-
17
- isTabletDevice(state) {
18
- const { breakpoint } = state;
19
-
20
- return breakpoint === "md";
21
- },
22
-
23
- isMobileDevice(state) {
24
- const { breakpoint, mobileDevices } = state;
25
-
26
- return mobileDevices.includes(breakpoint);
27
- },
28
-
29
- isPortableDevice(state) {
30
- const { breakpoint, portableDevices } = state;
31
-
32
- return portableDevices.includes(breakpoint);
33
- },
34
-
35
- elementSize(state, getters) {
36
- const { isMobileDevice } = getters;
37
-
38
- return isMobileDevice ? "md" : "lg";
39
- },
40
- },
41
-
42
- mutations: {
43
- SET_BREAKPOINT(state, breakpoint) {
44
- state.breakpoint = breakpoint;
45
- },
46
- },
47
- };