vueless 0.0.339 → 0.0.341

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.339",
3
+ "version": "0.0.341",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -175,8 +175,12 @@ const DefaultTemplate = (args) => ({
175
175
  itemsData() {
176
176
  let rows = [];
177
177
 
178
- for (let i = 0; i < args.numberOfRows; i++) {
179
- rows.push(args.row());
178
+ if (typeof args.row === "function") {
179
+ for (let i = 0; i < args.numberOfRows; i++) {
180
+ rows.push(args.row());
181
+ }
182
+ } else {
183
+ rows.push(args.row);
180
184
  }
181
185
 
182
186
  return rows;
@@ -65,7 +65,9 @@ export function debounce(func, wait) {
65
65
  @returns {VoidFunction}
66
66
  */
67
67
  export function setTitle({ title, separator = " / ", suffix = "" }) {
68
- document.title = title ? title + separator + suffix : suffix;
68
+ if (isCSR) {
69
+ document.title = title ? title + separator + suffix : suffix;
70
+ }
69
71
  }
70
72
 
71
73
  /**
@@ -1,9 +1,10 @@
1
- const isBrowser = typeof window !== "undefined";
2
- const isMac = isBrowser && checkIsMac();
3
- const isPWA = isBrowser && checkIsPWA();
4
- const isIOS = isBrowser && checkIsIOS();
5
- const isWindows = isBrowser && checkIsWindows();
6
- const isAndroid = isBrowser && checkIsAndroid();
1
+ import { isCSR } from "./utilHelper.js";
2
+
3
+ const isWindows = isCSR && checkIsWindows();
4
+ const isMac = isCSR && checkIsMac();
5
+ const isPWA = isCSR && checkIsPWA();
6
+ const isIOS = isCSR && checkIsIOS();
7
+ const isAndroid = isCSR && checkIsAndroid();
7
8
  const isMobileApp = isPWA || isIOS || isAndroid;
8
9
 
9
10
  function checkIsWindows() {
@@ -42,4 +43,4 @@ function getPlatform() {
42
43
  return navigator.userAgentData?.platform || navigator.platform || "unknown";
43
44
  }
44
45
 
45
- export { isBrowser, isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows };
46
+ export { isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows };
@@ -15,8 +15,11 @@ import {
15
15
  GRAY_COLORS,
16
16
  PX_IN_REM,
17
17
  } from "../constants.js";
18
+ import { isSSR } from "./utilHelper.js";
18
19
 
19
20
  export function themeInit() {
21
+ if (isSSR) return;
22
+
20
23
  const prefersColorSchemeDark = window && window.matchMedia("(prefers-color-scheme: dark)");
21
24
 
22
25
  setTheme({ systemDarkMode: prefersColorSchemeDark.matches });
@@ -27,6 +30,8 @@ export function themeInit() {
27
30
  }
28
31
 
29
32
  export function setTheme(config = {}) {
33
+ if (isSSR) return;
34
+
30
35
  const isDarkMode = setDarkMode(config);
31
36
  const ring = config?.ring ?? vuelessConfig?.ring ?? DEFAULT_RING;
32
37
  const ringOffset = config?.ringOffset ?? vuelessConfig?.ringOffset ?? DEFAULT_RING_OFFSET;
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.339",
4
+ "version": "0.0.341",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",