vueless 0.0.340 → 0.0.342

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.
@@ -1,4 +1,5 @@
1
1
  import { computed, toValue, ref } from "vue";
2
+ import { isSSR } from "../utils/utilHelper.js";
2
3
 
3
4
  export const POSITION = {
4
5
  left: "left",
@@ -50,7 +51,7 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
50
51
  });
51
52
 
52
53
  function adjustPositionY() {
53
- if (typeof window === "undefined") return;
54
+ if (isSSR) return;
54
55
 
55
56
  const spaceAbove = localAnchorElement.value.getBoundingClientRect().top;
56
57
  const spaceBelow = window.innerHeight - localAnchorElement.value.getBoundingClientRect().bottom;
@@ -71,7 +72,7 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
71
72
  }
72
73
 
73
74
  function adjustPositionX() {
74
- if (typeof window === "undefined") return;
75
+ if (isSSR) return;
75
76
 
76
77
  const spaceRight = localAnchorElement.value.getBoundingClientRect().right;
77
78
  const spaceLeft = window.innerWidth - localAnchorElement.value.getBoundingClientRect().left;
@@ -1,4 +1,5 @@
1
1
  import { onMounted, ref, watch, computed, onBeforeUnmount } from "vue";
2
+ import { isSSR } from "../utils/utilHelper.js";
2
3
 
3
4
  const BREAKPOINT_NAME = {
4
5
  xs: "xs",
@@ -48,18 +49,24 @@ export default function useBreakpoint() {
48
49
  });
49
50
 
50
51
  onMounted(() => {
52
+ if (isSSR) return;
53
+
51
54
  windowWidth.value = window.innerWidth;
52
55
 
53
56
  window.addEventListener("resize", resizeListener, { passive: true });
54
57
  });
55
58
 
56
59
  onBeforeUnmount(() => {
60
+ if (isSSR) return;
61
+
57
62
  window.removeEventListener("resize", resizeListener, { passive: true });
58
63
  });
59
64
 
60
65
  watch(windowWidth, setBreakpoint, { immediate: true });
61
66
 
62
67
  function resizeListener() {
68
+ if (isSSR) return;
69
+
63
70
  if (timeout) {
64
71
  window.cancelAnimationFrame(timeout);
65
72
  }
@@ -1,10 +1,13 @@
1
1
  import { onBeforeUnmount, onMounted, toValue, watch } from "vue";
2
+ import { isSSR } from "../utils/utilHelper.js";
2
3
 
3
4
  export function useMutationObserver(
4
5
  target,
5
6
  callBack,
6
7
  config = { childList: true, attributes: true, characterData: true },
7
8
  ) {
9
+ if (isSSR) return;
10
+
8
11
  const observer = new MutationObserver(callBack);
9
12
 
10
13
  onMounted(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.340",
3
+ "version": "0.0.342",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -55,7 +55,7 @@
55
55
  "vite": "^5.2.13",
56
56
  "vite-plugin-compression": "^0.5.1",
57
57
  "vite-plugin-eslint": "^1.8.1",
58
- "vue": "^3.4.27",
58
+ "vue": "^3.5.4",
59
59
  "vue-router": "^4.3.2"
60
60
  },
61
61
  "resolutions": {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <component
3
3
  :is="tag"
4
- :id="id"
4
+ :id="elementId"
5
5
  ref="buttonRef"
6
6
  :disabled="disabled"
7
7
  v-bind="buttonAttrs"
@@ -80,9 +80,9 @@
80
80
  </template>
81
81
 
82
82
  <script setup>
83
- import { computed, ref, watchEffect } from "vue";
83
+ import { computed, ref, watchEffect, useId } from "vue";
84
84
 
85
- import { getRandomId, getDefault } from "../utils/utilUI.js";
85
+ import { getDefault } from "../utils/utilUI.js";
86
86
  import ULoader from "../ui.loader/ULoader.vue";
87
87
  import UIcon from "../ui.image-icon/UIcon.vue";
88
88
 
@@ -225,12 +225,11 @@ const props = defineProps({
225
225
  },
226
226
 
227
227
  /**
228
- * Generates unique element id.
229
- * @ignore
228
+ * Unique element id.
230
229
  */
231
230
  id: {
232
231
  type: String,
233
- default: () => getRandomId(),
232
+ default: "",
234
233
  },
235
234
 
236
235
  /**
@@ -250,6 +249,8 @@ const props = defineProps({
250
249
  },
251
250
  });
252
251
 
252
+ const elementId = props.id || useId();
253
+
253
254
  const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs } =
254
255
  useAttrs(props);
255
256
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <UButton
3
3
  tabindex="0"
4
- :for="id"
4
+ :for="elementId"
5
5
  :no-ring="!getToggleSeparated()"
6
6
  color="grayscale"
7
7
  variant="secondary"
@@ -22,7 +22,7 @@
22
22
  <!-- @slot Use it to add something instead of the label. -->
23
23
  <template #default>
24
24
  <input
25
- :id="id"
25
+ :id="elementId"
26
26
  v-model="selectedItem"
27
27
  :name="getToggleName()"
28
28
  :type="getToggleType()"
@@ -48,10 +48,10 @@
48
48
  </template>
49
49
 
50
50
  <script setup>
51
- import { computed, inject, onMounted, ref } from "vue";
51
+ import { computed, inject, onMounted, ref, useId } from "vue";
52
52
 
53
53
  import UButton from "../ui.button/UButton.vue";
54
- import { getRandomId, getDefault } from "../utils/utilUI.js";
54
+ import { getDefault } from "../utils/utilUI.js";
55
55
 
56
56
  import { TYPE_RADIO } from "../ui.button-toggle/constants.js";
57
57
 
@@ -95,12 +95,11 @@ const props = defineProps({
95
95
  },
96
96
 
97
97
  /**
98
- * Generates unique element id.
99
- * @ignore
98
+ * Unique element id.
100
99
  */
101
100
  id: {
102
101
  type: String,
103
- default: () => getRandomId(),
102
+ default: "",
104
103
  },
105
104
 
106
105
  /**
@@ -142,6 +141,8 @@ const getToggleDisabled = inject("getToggleDisabled", () => props.disabled || ge
142
141
 
143
142
  const { selectedValue, updateSelectedValue } = inject("toggleSelectedValue", {});
144
143
 
144
+ const elementId = props.id || useId();
145
+
145
146
  const selectedItem = ref("");
146
147
 
147
148
  const isSelected = computed(() => {
@@ -13,7 +13,7 @@
13
13
  </slot>
14
14
  </div>
15
15
 
16
- <div :id="`description-${id}`" v-bind="descriptionAttrs" v-text="description" />
16
+ <div :id="`description-${elementId}`" v-bind="descriptionAttrs" v-text="description" />
17
17
  </div>
18
18
 
19
19
  <UDivider :size="dividerSize" v-bind="dividerAttrs" />
@@ -21,11 +21,11 @@
21
21
  </template>
22
22
 
23
23
  <script setup>
24
- import { computed, ref } from "vue";
24
+ import { computed, ref, useId } from "vue";
25
25
 
26
26
  import UIcon from "../ui.image-icon/UIcon.vue";
27
27
  import UDivider from "../ui.container-divider/UDivider.vue";
28
- import { getRandomId, getDefault } from "../utils/utilUI.js";
28
+ import { getDefault } from "../utils/utilUI.js";
29
29
 
30
30
  import { UAccordion } from "./constants.js";
31
31
  import defaultConfig from "./config.js";
@@ -68,12 +68,11 @@ const props = defineProps({
68
68
  },
69
69
 
70
70
  /**
71
- * Generates unique element id.
72
- * @ignore
71
+ * Unique element id.
73
72
  */
74
73
  id: {
75
74
  type: String,
76
- default: () => getRandomId(),
75
+ default: "",
77
76
  },
78
77
 
79
78
  /**
@@ -95,6 +94,8 @@ const emit = defineEmits([
95
94
 
96
95
  const isOpened = ref(false);
97
96
 
97
+ const elementId = props.id || useId();
98
+
98
99
  const {
99
100
  config,
100
101
  wrapperAttrs,
@@ -6,7 +6,7 @@
6
6
  <transition v-bind="config.wrapperTransition">
7
7
  <div
8
8
  v-if="isShownModal"
9
- :id="id"
9
+ :id="elementId"
10
10
  ref="wrapperRef"
11
11
  tabindex="0"
12
12
  :data-test="dataTest"
@@ -109,9 +109,9 @@
109
109
  </template>
110
110
 
111
111
  <script setup>
112
- import { computed, useSlots, watch, ref } from "vue";
112
+ import { computed, useSlots, watch, ref, useId } from "vue";
113
113
 
114
- import { getRandomId, getDefault } from "../utils/utilUI.js";
114
+ import { getDefault } from "../utils/utilUI.js";
115
115
 
116
116
  import ULink from "../ui.button-link/ULink.vue";
117
117
  import UIcon from "../ui.image-icon/UIcon.vue";
@@ -235,11 +235,10 @@ const props = defineProps({
235
235
 
236
236
  /**
237
237
  * Unique element id.
238
- * @ignore
239
238
  */
240
239
  id: {
241
240
  type: String,
242
- default: () => getRandomId(),
241
+ default: "",
243
242
  },
244
243
 
245
244
  /**
@@ -264,6 +263,8 @@ const emit = defineEmits([
264
263
  "back",
265
264
  ]);
266
265
 
266
+ const elementId = props.id || useId();
267
+
267
268
  const {
268
269
  config,
269
270
  modalAttrs,
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div v-click-outside="hideOptions" v-bind="wrapperAttrs">
3
3
  <UBadge
4
- :id="id"
4
+ :id="elementId"
5
5
  :label="label"
6
6
  :size="size"
7
7
  :color="color"
@@ -64,13 +64,13 @@
64
64
  </template>
65
65
 
66
66
  <script setup>
67
- import { nextTick, ref, watch } from "vue";
67
+ import { nextTick, ref, watch, useId } from "vue";
68
68
 
69
69
  import UIcon from "../ui.image-icon/UIcon.vue";
70
70
  import UBadge from "../ui.text-badge/UBadge.vue";
71
71
  import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
72
72
 
73
- import { getRandomId, getDefault } from "../utils/utilUI.js";
73
+ import { getDefault } from "../utils/utilUI.js";
74
74
 
75
75
  import vClickOutside from "../directives/vClickOutside.js";
76
76
 
@@ -175,12 +175,11 @@ const props = defineProps({
175
175
  },
176
176
 
177
177
  /**
178
- * Generates unique element id.
179
- * @ignore
178
+ * Unique element id.
180
179
  */
181
180
  id: {
182
181
  type: String,
183
- default: () => getRandomId(),
182
+ default: "",
184
183
  },
185
184
 
186
185
  /**
@@ -212,6 +211,8 @@ const isShownOptions = ref(false);
212
211
  const selectedItem = ref("");
213
212
  const dropdownListRef = ref(null);
214
213
 
214
+ const elementId = props.id || useId();
215
+
215
216
  const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIconAttrs } = useAttrs(
216
217
  props,
217
218
  {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div v-click-outside="hideOptions" v-bind="wrapperAttrs">
3
3
  <UButton
4
- :id="id"
4
+ :id="elementId"
5
5
  :label="label"
6
6
  :size="size"
7
7
  :color="color"
@@ -66,13 +66,13 @@
66
66
  </template>
67
67
 
68
68
  <script setup>
69
- import { computed, provide, ref, watch } from "vue";
69
+ import { computed, provide, ref, watch, useId } from "vue";
70
70
 
71
71
  import UIcon from "../ui.image-icon/UIcon.vue";
72
72
  import UButton from "../ui.button/UButton.vue";
73
73
  import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
74
74
 
75
- import { getRandomId, getDefault } from "../utils/utilUI.js";
75
+ import { getDefault } from "../utils/utilUI.js";
76
76
 
77
77
  import vClickOutside from "../directives/vClickOutside.js";
78
78
 
@@ -201,12 +201,11 @@ const props = defineProps({
201
201
  },
202
202
 
203
203
  /**
204
- * Generates unique element id.
205
- * @ignore
204
+ * Unique element id.
206
205
  */
207
206
  id: {
208
207
  type: String,
209
- default: () => getRandomId(),
208
+ default: "",
210
209
  },
211
210
 
212
211
  /**
@@ -239,6 +238,8 @@ provide("hideDropdownOptions", hideOptions);
239
238
  const isShownOptions = ref(false);
240
239
  const selectedItem = ref("");
241
240
 
241
+ const elementId = props.id || useId();
242
+
242
243
  const { config, dropdownButtonAttrs, dropdownListAttrs, dropdownIconAttrs, wrapperAttrs } =
243
244
  useAttrs(props, { isShownOptions });
244
245
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div v-click-outside="hideOptions" v-bind="wrapperAttrs">
3
3
  <ULink
4
- :id="id"
4
+ :id="elementId"
5
5
  :size="size"
6
6
  :label="label"
7
7
  :color="color"
@@ -68,13 +68,13 @@
68
68
  </template>
69
69
 
70
70
  <script setup>
71
- import { computed, provide, ref, watch } from "vue";
71
+ import { computed, provide, ref, watch, useId } from "vue";
72
72
 
73
73
  import UIcon from "../ui.image-icon/UIcon.vue";
74
74
  import ULink from "../ui.button-link/ULink.vue";
75
75
  import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
76
76
 
77
- import { getRandomId, getDefault } from "../utils/utilUI.js";
77
+ import { getDefault } from "../utils/utilUI.js";
78
78
 
79
79
  import vClickOutside from "../directives/vClickOutside.js";
80
80
 
@@ -194,12 +194,11 @@ const props = defineProps({
194
194
  },
195
195
 
196
196
  /**
197
- * Generates unique element id.
198
- * @ignore
197
+ * Unique element id.
199
198
  */
200
199
  id: {
201
200
  type: String,
202
- default: () => getRandomId(),
201
+ default: "",
203
202
  },
204
203
 
205
204
  /**
@@ -232,6 +231,8 @@ provide("hideDropdownOptions", hideOptions);
232
231
  const isShownOptions = ref(false);
233
232
  const selectedItem = ref("");
234
233
 
234
+ const elementId = props.id || useId();
235
+
235
236
  const { config, wrapperAttrs, dropdownLinkAttrs, dropdownListAttrs, dropdownIconAttrs } = useAttrs(
236
237
  props,
237
238
  { isShownOptions },
@@ -8,10 +8,10 @@
8
8
  @keydown.self.up.prevent="pointerBackward"
9
9
  @keydown.enter.stop.self="addPointerElement"
10
10
  >
11
- <ul :id="`listbox-${id}`" v-bind="listAttrs" role="listbox">
11
+ <ul :id="`listbox-${elementId}`" v-bind="listAttrs" role="listbox">
12
12
  <li
13
13
  v-for="(option, index) of options"
14
- :id="`${id}-${index}`"
14
+ :id="`${elementId}-${index}`"
15
15
  :key="index"
16
16
  v-bind="listItemAttrs"
17
17
  ref="optionsRef"
@@ -103,13 +103,13 @@
103
103
  </template>
104
104
 
105
105
  <script setup>
106
- import { computed, ref } from "vue";
106
+ import { computed, ref, useId } from "vue";
107
107
  import { merge } from "lodash-es";
108
108
 
109
109
  import UIcon from "../ui.image-icon/UIcon.vue";
110
110
  import UButton from "../ui.button/UButton.vue";
111
111
 
112
- import { getRandomId, getDefault } from "../utils/utilUI.js";
112
+ import { getDefault } from "../utils/utilUI.js";
113
113
  import { isMac } from "../utils/utilPlatform.js";
114
114
 
115
115
  import usePointer from "./usePointer.js";
@@ -183,12 +183,11 @@ const props = defineProps({
183
183
  },
184
184
 
185
185
  /**
186
- * Generates unique element id.
187
- * @ignore
186
+ * Unique element id.
188
187
  */
189
188
  id: {
190
189
  type: String,
191
- default: () => getRandomId(),
190
+ default: "",
192
191
  },
193
192
 
194
193
  /**
@@ -213,6 +212,8 @@ const optionsRef = ref([]);
213
212
  const { pointer, pointerDirty, pointerSet, pointerBackward, pointerForward, pointerReset } =
214
213
  usePointer(props.options, optionsRef, wrapperRef);
215
214
 
215
+ const elementId = props.id || useId();
216
+
216
217
  const {
217
218
  config,
218
219
  wrapperAttrs,
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ULabel
3
- :for="id"
3
+ :for="elementId"
4
4
  :label="label"
5
5
  :error="error"
6
6
  :size="checkboxSize"
@@ -11,7 +11,7 @@
11
11
  :data-test="`${dataTest}-label`"
12
12
  >
13
13
  <input
14
- :id="id"
14
+ :id="elementId"
15
15
  type="checkbox"
16
16
  :value="checkboxValue"
17
17
  :true-value="trueValue"
@@ -24,7 +24,7 @@
24
24
  @change="onChange"
25
25
  />
26
26
 
27
- <label v-if="isChecked" v-bind="iconWrapperAttrs" :for="id">
27
+ <label v-if="isChecked" v-bind="iconWrapperAttrs" :for="elementId">
28
28
  <UIcon
29
29
  internal
30
30
  :name="partial ? config.defaults.partiallyCheckedIcon : config.defaults.checkedIcon"
@@ -41,13 +41,13 @@
41
41
  </template>
42
42
 
43
43
  <script setup>
44
- import { inject, ref, onMounted, computed, watchEffect, toValue } from "vue";
44
+ import { inject, ref, onMounted, computed, watchEffect, toValue, useId } from "vue";
45
45
  import { isEqual } from "lodash-es";
46
46
 
47
47
  import UIcon from "../ui.image-icon/UIcon.vue";
48
48
  import ULabel from "../ui.form-label/ULabel.vue";
49
49
 
50
- import { getRandomId, getDefault } from "../utils/utilUI.js";
50
+ import { getDefault } from "../utils/utilUI.js";
51
51
 
52
52
  import defaultConfig from "./config.js";
53
53
  import { UCheckbox } from "./constants.js";
@@ -170,12 +170,11 @@ const props = defineProps({
170
170
  },
171
171
 
172
172
  /**
173
- * Generates unique element id.
174
- * @ignore
173
+ * Unique element id.
175
174
  */
176
175
  id: {
177
176
  type: String,
178
- default: () => getRandomId(),
177
+ default: "",
179
178
  },
180
179
 
181
180
  /**
@@ -213,6 +212,8 @@ const checkboxName = ref("");
213
212
  const checkboxSize = ref(props.size);
214
213
  const checkboxColor = ref(props.color);
215
214
 
215
+ const elementId = props.id || useId();
216
+
216
217
  const { config, checkboxAttrs, iconWrapperAttrs, checkboxLabelAttrs, checkedIconAttrs } = useAttrs(
217
218
  props,
218
219
  {
@@ -12,7 +12,7 @@
12
12
  <div v-bind="listAttrs">
13
13
  <div v-bind="unselectedAttrs">
14
14
  <URadio
15
- :id="id"
15
+ :id="elementId"
16
16
  :name="name"
17
17
  :size="size"
18
18
  color="gray"
@@ -22,7 +22,7 @@
22
22
  @update:model-value="onUpdateValue('')"
23
23
  />
24
24
 
25
- <label :for="id">
25
+ <label :for="elementId">
26
26
  <UIcon
27
27
  v-if="selectedItem === ''"
28
28
  internal
@@ -51,12 +51,12 @@
51
51
  </template>
52
52
 
53
53
  <script setup>
54
- import { computed } from "vue";
54
+ import { computed, useId } from "vue";
55
55
 
56
56
  import UIcon from "../ui.image-icon/UIcon.vue";
57
57
  import URadio from "../ui.form-radio/URadio.vue";
58
58
  import ULabel from "../ui.form-label/ULabel.vue";
59
- import { getRandomId, getDefault } from "../utils/utilUI.js";
59
+ import { getDefault } from "../utils/utilUI.js";
60
60
 
61
61
  import { UColorPicker } from "./constants.js";
62
62
  import defaultConfig from "./config.js";
@@ -131,12 +131,11 @@ const props = defineProps({
131
131
  },
132
132
 
133
133
  /**
134
- * Generates unique element id.
135
- * @ignore
134
+ * Unique element id.
136
135
  */
137
136
  id: {
138
137
  type: String,
139
- default: () => getRandomId(),
138
+ default: "",
140
139
  },
141
140
 
142
141
  /**
@@ -164,6 +163,8 @@ const emit = defineEmits([
164
163
  "update:modelValue",
165
164
  ]);
166
165
 
166
+ const elementId = props.id || useId();
167
+
167
168
  const {
168
169
  config,
169
170
  colorPickerLabelAttrs,
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div v-bind="wrapperAttrs" ref="wrapperRef">
3
3
  <UInput
4
- :id="id"
4
+ :id="elementId"
5
5
  :key="isShownCalendar"
6
6
  v-model="userFormatDate"
7
7
  :label-align="labelAlign"
@@ -65,14 +65,14 @@
65
65
  </template>
66
66
 
67
67
  <script setup>
68
- import { computed, nextTick, ref } from "vue";
68
+ import { computed, nextTick, ref, useId } from "vue";
69
69
  import { merge } from "lodash-es";
70
70
 
71
71
  import UInput from "../ui.form-input/UInput.vue";
72
72
  import UCalendar from "../ui.form-calendar/UCalendar.vue";
73
73
  import { VIEW, STANDARD_USER_FORMAT } from "../ui.form-calendar/constants.js";
74
74
 
75
- import { getRandomId, getDefault } from "../utils/utilUI.js";
75
+ import { getDefault } from "../utils/utilUI.js";
76
76
 
77
77
  import { addDays, isSameDay } from "../ui.form-calendar/utilDate.js";
78
78
 
@@ -244,11 +244,10 @@ const props = defineProps({
244
244
 
245
245
  /**
246
246
  * Unique element id.
247
- * @ignore
248
247
  */
249
248
  id: {
250
249
  type: String,
251
- default: () => getRandomId(),
250
+ default: "",
252
251
  },
253
252
 
254
253
  /**
@@ -316,6 +315,8 @@ const localValue = computed({
316
315
 
317
316
  const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
318
317
 
318
+ const elementId = props.id || useId();
319
+
319
320
  const { config, inputAttrs, calendarAttrs, wrapperAttrs } = useAttrs(props, {
320
321
  isShownCalendar,
321
322
  isTop,