vueless 0.0.677 → 0.0.679

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.677",
3
+ "version": "0.0.679",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useSlots } from "vue";
3
- import { RouterLink, useLink } from "vue-router";
3
+ import { RouterLink } from "vue-router";
4
4
 
5
5
  import useUI from "../composables/useUI.ts";
6
6
  import { hasSlotContent } from "../utils/helper.ts";
@@ -53,31 +53,7 @@ const isPresentRoute = computed(() => {
53
53
  });
54
54
 
55
55
  const safeTo = computed(() => {
56
- if (!props.to) {
57
- return "/";
58
- }
59
-
60
- return props.to;
61
- });
62
-
63
- const useLinkOptions = {
64
- activeClass: props.activeClass,
65
- ariaCurrentValue: props.ariaCurrentValue,
66
- exactActiveClass: props.exactActiveClass,
67
- custom: props.custom,
68
- replace: props.replace,
69
- to: safeTo.value,
70
- };
71
-
72
- const { route, isActive, isExactActive } = useLink(useLinkOptions);
73
-
74
- const linkActiveClasses = computed(() => [
75
- isActive.value && props.activeClass,
76
- isExactActive.value && props.exactActiveClass,
77
- ]);
78
-
79
- const targetValue = computed(() => {
80
- return props.targetBlank ? "_blank" : "_self";
56
+ return props.to || "/";
81
57
  });
82
58
 
83
59
  const prefixedHref = computed(() => {
@@ -125,10 +101,15 @@ const { getDataTest, linkAttrs } = useUI<Config>(defaultConfig, mutatedProps);
125
101
  <template>
126
102
  <router-link
127
103
  v-if="isPresentRoute"
128
- :to="route"
129
- :target="targetValue"
104
+ :to="safeTo"
105
+ :custom="custom"
106
+ :replace="replace"
107
+ :target="target"
108
+ :active-class="activeClass"
109
+ :exact-active-class="exactActiveClass"
110
+ :aria-current-value="ariaCurrentValue"
111
+ :view-transition="viewTransition"
130
112
  v-bind="linkAttrs"
131
- :class="linkActiveClasses"
132
113
  :data-test="getDataTest()"
133
114
  tabindex="0"
134
115
  @blur="onBlur"
@@ -143,10 +124,10 @@ const { getDataTest, linkAttrs } = useUI<Config>(defaultConfig, mutatedProps);
143
124
 
144
125
  <a
145
126
  v-else
127
+ :rel="rel"
146
128
  :href="prefixedHref"
147
- :target="targetValue"
129
+ :target="target"
148
130
  v-bind="linkAttrs"
149
- :class="linkActiveClasses"
150
131
  :data-test="getDataTest()"
151
132
  tabindex="0"
152
133
  @blur="onBlur"
@@ -55,16 +55,18 @@ export default /*tw*/ {
55
55
  color: "brand",
56
56
  type: "link",
57
57
  size: "md",
58
- ariaCurrentValue: "page",
58
+ target: "_self",
59
59
  activeClass: "",
60
60
  exactActiveClass: "",
61
+ ariaCurrentValue: "page",
62
+ rel: "noopener noreferrer",
61
63
  underlined: undefined,
62
- block: false,
63
64
  ring: false,
65
+ block: false,
64
66
  dashed: false,
65
- disabled: false,
66
- targetBlank: false,
67
67
  custom: false,
68
68
  replace: false,
69
+ disabled: false,
70
+ viewTransition: false,
69
71
  },
70
72
  };
@@ -12,14 +12,14 @@ export interface Props {
12
12
  label?: string;
13
13
 
14
14
  /**
15
- * Link href url.
15
+ * Vue-router route object.
16
16
  */
17
- href?: string;
17
+ to?: RouteLocationRaw;
18
18
 
19
19
  /**
20
- * Vue-router route object.
20
+ * Link href url.
21
21
  */
22
- to?: RouteLocationRaw;
22
+ href?: string;
23
23
 
24
24
  /**
25
25
  * Link size.
@@ -58,34 +58,29 @@ export interface Props {
58
58
  type?: "phone" | "email" | "link";
59
59
 
60
60
  /**
61
- * Open link in the new tab.
62
- */
63
- targetBlank?: boolean;
64
-
65
- /**
66
- * Pass value to the attribute aria-current when the link is exact active.
61
+ * Apply classes to the link when its route is active or when it matches any parent route.
67
62
  */
68
- ariaCurrentValue?: string;
63
+ activeClass?: string;
69
64
 
70
65
  /**
71
- * Whether RouterLink should not wrap its content in a tag.
66
+ * Apply classes to the link when its route is active.
72
67
  */
73
- custom?: boolean;
68
+ exactActiveClass?: string;
74
69
 
75
70
  /**
76
- * Whether RouterLink should not wrap its content in a tag.
71
+ * Pass value to the attribute aria-current when the link is exact active.
77
72
  */
78
- replace?: boolean;
73
+ ariaCurrentValue?: "time" | "location" | "page" | "step" | "date" | "true" | "false";
79
74
 
80
75
  /**
81
- * Apply classes to the link when its route is active or when it matches any parent route.
76
+ * Specifies where to open the linked page.
82
77
  */
83
- activeClass?: string;
78
+ target?: "_blank" | "_self" | "_parent" | "_top" | string;
84
79
 
85
80
  /**
86
- * Apply classes to the link when its route is active.
81
+ * A rel attribute value to apply on the external link.
87
82
  */
88
- exactActiveClass?: string;
83
+ rel?: string;
89
84
 
90
85
  /**
91
86
  * Show underline.
@@ -112,6 +107,21 @@ export interface Props {
112
107
  */
113
108
  ring?: boolean;
114
109
 
110
+ /**
111
+ * Whether RouterLink should not wrap its content in a tag.
112
+ */
113
+ custom?: boolean;
114
+
115
+ /**
116
+ * Calls `router.replace` instead of `router.push`.
117
+ */
118
+ replace?: boolean;
119
+
120
+ /**
121
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
122
+ */
123
+ viewTransition?: boolean;
124
+
115
125
  /**
116
126
  * Component config object.
117
127
  */
@@ -141,7 +141,9 @@ const sortedRows: ComputedRef<Row[]> = computed(() => {
141
141
 
142
142
  const isFooterSticky = computed(() => {
143
143
  return (
144
- window.innerHeight < tableHeight.value && props.stickyFooter && !isShownFooterPosition.value
144
+ Number(window?.innerHeight) < tableHeight.value &&
145
+ props.stickyFooter &&
146
+ !isShownFooterPosition.value
145
147
  );
146
148
  });
147
149
 
@@ -165,15 +167,15 @@ const isShownActionsHeader = computed(
165
167
 
166
168
  const isHeaderSticky = computed(() => {
167
169
  const positionForFixHeader =
168
- Number(headerRowRef.value?.getBoundingClientRect()?.top) + window.scrollY || 0;
170
+ Number(headerRowRef.value?.getBoundingClientRect()?.top) + Number(window?.scrollY) || 0;
169
171
 
170
172
  return positionForFixHeader <= pagePositionY.value && props.stickyHeader;
171
173
  });
172
174
 
173
175
  const isShownFooterPosition = computed(() => {
174
- const pageBottom = pagePositionY.value + window.innerHeight;
176
+ const pageBottom = pagePositionY.value + Number(window?.innerHeight);
175
177
  const positionForFixFooter =
176
- Number(footerRowRef.value?.getBoundingClientRect()?.bottom) + window.scrollY;
178
+ Number(footerRowRef.value?.getBoundingClientRect()?.bottom) + Number(window?.scrollY);
177
179
 
178
180
  return pageBottom >= positionForFixFooter;
179
181
  });
@@ -310,7 +312,7 @@ function setHeaderCellWidth() {
310
312
  }
311
313
 
312
314
  function onScroll() {
313
- pagePositionY.value = window.scrollY;
315
+ pagePositionY.value = Number(window?.scrollY);
314
316
  }
315
317
 
316
318
  function synchronizeTableItemsWithProps() {
@@ -8,12 +8,12 @@ export interface Props {
8
8
  /**
9
9
  * Selected brand color (v-model).
10
10
  */
11
- brand: BrandColors;
11
+ brand?: BrandColors;
12
12
 
13
13
  /**
14
14
  * Selected gray color (v-model).
15
15
  */
16
- gray: GrayColors;
16
+ gray?: GrayColors;
17
17
 
18
18
  /**
19
19
  * Component size.
package/utils/theme.ts CHANGED
@@ -100,11 +100,11 @@ export function setColorMode(colorMode: `${ColorMode}`) {
100
100
  }
101
101
 
102
102
  export function getSelectedBrandColor() {
103
- return localStorage.getItem("brand") || undefined;
103
+ return (isCSR && localStorage.getItem("brand")) || undefined;
104
104
  }
105
105
 
106
106
  export function getSelectedGrayColor() {
107
- return localStorage.getItem("gray") || undefined;
107
+ return (isCSR && localStorage.getItem("gray")) || undefined;
108
108
  }
109
109
 
110
110
  export function setTheme(config: Config = {}) {
@@ -138,8 +138,8 @@ export function setTheme(config: Config = {}) {
138
138
  const defaultGrayShade = isDarkMode ? 400 : 600;
139
139
  const defaultRingOffsetColor = isDarkMode ? ringOffsetColorDark : ringOffsetColorLight;
140
140
 
141
- localStorage.setItem("brand", brand);
142
- localStorage.setItem("gray", gray);
141
+ isCSR && localStorage.setItem("brand", brand);
142
+ isCSR && localStorage.setItem("gray", gray);
143
143
 
144
144
  if (gray === COOL_COLOR) {
145
145
  gray = GRAY_COLOR;