vueless 0.0.338 → 0.0.340

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,34 +1,37 @@
1
1
  import tippy from "tippy.js";
2
2
  import { merge } from "lodash-es";
3
3
 
4
- // Fix for SSR
5
- import "tippy.js/dist/tippy.css";
6
- import "tippy.js/themes/light.css";
7
- import "tippy.js/animations/shift-away.css";
8
-
9
4
  import { vuelessConfig } from "../utils/utilUI.js";
10
5
  import { isCSR, isSSR } from "../utils/utilHelper.js";
11
6
 
12
- const globalSettings = vuelessConfig?.directive?.tooltip || {};
13
- const defaultSettings = {
14
- arrow: true,
15
- theme: "light",
16
- animation: "shift-away",
17
- };
7
+ let settings = {};
18
8
 
19
- const mergedSettings = merge(defaultSettings, globalSettings);
9
+ if (isCSR) {
10
+ import("tippy.js/dist/tippy.css");
11
+ import("tippy.js/themes/light.css");
12
+ import("tippy.js/animations/shift-away.css");
20
13
 
21
- isCSR && tippy.setDefaultProps(mergedSettings);
14
+ const defaultSettings = {
15
+ arrow: true,
16
+ theme: "light",
17
+ animation: "shift-away",
18
+ };
19
+
20
+ settings = merge(defaultSettings, vuelessConfig?.directive?.tooltip || {});
21
+ tippy.setDefaultProps(settings);
22
+ }
22
23
 
23
24
  export default {
24
25
  mounted(el, bindings) {
25
- isCSR && tippy(el, merge(mergedSettings, bindings.value || {}));
26
+ if (isSSR) return;
27
+
28
+ tippy(el, merge(settings, bindings.value || {}));
26
29
  },
27
30
 
28
31
  updated(el, bindings) {
29
32
  if (!el._tippy || isSSR) return;
30
33
 
31
- el._tippy.setProps(merge(mergedSettings, bindings.value || {}));
34
+ el._tippy.setProps(merge(settings, bindings.value || {}));
32
35
  },
33
36
 
34
37
  unmounted(el) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.338",
3
+ "version": "0.0.340",
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.59",
40
+ "@vueless/plugin-vite": "^0.0.60",
41
41
  "@vueless/storybook": "^0.0.34",
42
42
  "@vueless/web-types": "^0.0.15",
43
43
  "autoprefixer": "^10.4.19",
@@ -53,7 +53,7 @@ import { computed, inject, onMounted, ref } from "vue";
53
53
  import UButton from "../ui.button/UButton.vue";
54
54
  import { getRandomId, getDefault } from "../utils/utilUI.js";
55
55
 
56
- import { TYPE_RADIO } from "../ui.button-toggle/constants";
56
+ import { TYPE_RADIO } from "../ui.button-toggle/constants.js";
57
57
 
58
58
  import useAttrs from "./useAttrs.js";
59
59
  import defaultConfig from "./config.js";
@@ -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;
@@ -14,7 +14,7 @@ import {
14
14
  DARK_MODE_SELECTOR,
15
15
  GRAY_COLORS,
16
16
  PX_IN_REM,
17
- } from "../constants";
17
+ } from "../constants.js";
18
18
 
19
19
  export function themeInit() {
20
20
  const prefersColorSchemeDark = window && window.matchMedia("(prefers-color-scheme: dark)");
package/utils/utilUI.js CHANGED
@@ -7,29 +7,27 @@ import {
7
7
  GRAYSCALE_COLOR,
8
8
  DEFAULT_BRAND_COLOR,
9
9
  NESTED_COMPONENT_REG_EXP,
10
- } from "../constants";
10
+ } from "../constants.js";
11
11
 
12
12
  /**
13
13
  Load Vueless config from the project root.
14
14
  Both for server and client side renderings.
15
- IIFE is used to cache the results.
15
+ IIFE for SSR is used to prevent top level await issue.
16
16
  */
17
- export const vuelessConfig = (() => {
18
- let config = {};
17
+ export let vuelessConfig = {};
19
18
 
20
- if (isSSR) {
21
- // TODO: test it in SSR, maybe `await` is needed
22
- config = import(/* @vite-ignore */ `${process.cwd()}/vueless.config.js`).default;
23
- }
24
-
25
- if (isCSR) {
26
- config = Object.values(
27
- import.meta.glob("/vueless.config.js", { eager: true, import: "default" }),
28
- )[0];
29
- }
19
+ if (isSSR) {
20
+ (async () =>
21
+ (vuelessConfig = (
22
+ await import(/* @vite-ignore */ `${process.cwd()}/vueless.config.js?${Date.now()}`)
23
+ ).default))();
24
+ }
30
25
 
31
- return config;
32
- })();
26
+ if (isCSR) {
27
+ vuelessConfig = Object.values(
28
+ import.meta.glob("/vueless.config.js", { eager: true, import: "default" }),
29
+ )[0];
30
+ }
33
31
 
34
32
  /**
35
33
  Extend twMerge (tailwind merge) by vueless and user config:
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.338",
4
+ "version": "0.0.340",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",