vueless 0.0.66 → 0.0.67

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.66",
3
+ "version": "0.0.67",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -58,7 +58,8 @@
58
58
  "vite": "^5.2.10",
59
59
  "vite-plugin-compression": "^0.5.1",
60
60
  "vite-plugin-eslint": "^1.8.1",
61
- "vue": "^3.4.25"
61
+ "vue": "^3.4.25",
62
+ "vue-router": "^4.3.2"
62
63
  },
63
64
  "resolutions": {
64
65
  "jackspeak": "2.3.6"
@@ -5,7 +5,7 @@ import { cva, cx } from "../../service.ui";
5
5
 
6
6
  import defaultConfig from "../configs/default.config";
7
7
 
8
- export function useAttrs(props) {
8
+ export function useAttrs(props, { isActive, isExactActive }) {
9
9
  const slots = useSlots();
10
10
 
11
11
  const { config, getAttrs, hasSlotContent, setColor } = useUI(defaultConfig, () => props.config);
@@ -88,6 +88,8 @@ export function useAttrs(props) {
88
88
  class: cx([
89
89
  wrapperAttrsRaw.value.class,
90
90
  (hasDefaultSlot || hasLeftSlot || hasRightSlot) && config.value.withSlots,
91
+ isActive.value && props.wrapperActiveClass,
92
+ isExactActive.value && props.wrapperExactActiveClass,
91
93
  ]),
92
94
  };
93
95
  });
@@ -99,7 +101,12 @@ export function useAttrs(props) {
99
101
 
100
102
  return {
101
103
  ...linkAttrsRaw.value,
102
- class: cx([linkAttrsRaw.value.class, hasDefaultSlot && config.value.withSlots]),
104
+ class: cx([
105
+ linkAttrsRaw.value.class,
106
+ hasDefaultSlot && config.value.withSlots,
107
+ isActive.value && props.activeClass,
108
+ isExactActive.value && props.exactActiveClass,
109
+ ]),
103
110
  };
104
111
  });
105
112
 
@@ -10,8 +10,6 @@
10
10
  :to="route"
11
11
  :target="targetValue"
12
12
  :data-cy="dataCy"
13
- :active-class="activeClass"
14
- :exact-active-class="exactActiveClass"
15
13
  v-bind="linkAttrs"
16
14
  @blur="onBlur"
17
15
  @click="onClick"
@@ -52,6 +50,7 @@
52
50
 
53
51
  <script setup>
54
52
  import { computed, useSlots, ref } from "vue";
53
+ import { RouterLink, useLink } from "vue-router";
55
54
  import UIService from "../service.ui";
56
55
 
57
56
  import { useAttrs } from "./composables/attrs.composable";
@@ -139,6 +138,22 @@ const props = defineProps({
139
138
  default: UIService.get(defaultConfig, ULink).default.exactActiveClass,
140
139
  },
141
140
 
141
+ /**
142
+ * Apply classes to the wrapper div when link route is active or when it matches any parent route.
143
+ */
144
+ wrapperActiveClass: {
145
+ type: Boolean,
146
+ default: UIService.get(defaultConfig, ULink).default.wrapperActiveClass,
147
+ },
148
+
149
+ /**
150
+ * Apply classes to the wrapper div when link route is active.
151
+ */
152
+ wrapperExactActiveClass: {
153
+ type: Boolean,
154
+ default: UIService.get(defaultConfig, ULink).default.wrapperExactActiveClass,
155
+ },
156
+
142
157
  /**
143
158
  * Show underline.
144
159
  */
@@ -197,13 +212,14 @@ const props = defineProps({
197
212
  });
198
213
 
199
214
  const slots = useSlots();
215
+ const { route, isActive, isExactActive } = useLink({ to: props.route });
200
216
 
201
217
  const wrapperRef = ref(null);
202
218
 
203
219
  defineExpose({ wrapperRef });
204
220
 
205
221
  const { wrapperAttrs, linkAttrs, rightSlotAttrs, leftSlotAttrs, textAttrs, hasSlotContent } =
206
- useAttrs(props);
222
+ useAttrs(props, { isActive, isExactActive });
207
223
 
208
224
  const targetValue = computed(() => {
209
225
  return props.targetBlank ? "_blank" : "_self";
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.66",
4
+ "version": "0.0.67",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -4302,6 +4302,24 @@
4302
4302
  },
4303
4303
  "default": "group/router-link-exact-active"
4304
4304
  },
4305
+ {
4306
+ "name": "wrapperActiveClass",
4307
+ "description": "Apply classes to the wrapper div when link route is active or when it matches any parent route.",
4308
+ "value": {
4309
+ "kind": "expression",
4310
+ "type": "boolean"
4311
+ },
4312
+ "default": "UIService.get(defaultConfig, ULink).default.wrapperActiveClass"
4313
+ },
4314
+ {
4315
+ "name": "wrapperExactActiveClass",
4316
+ "description": "Apply classes to the wrapper div when link route is active.",
4317
+ "value": {
4318
+ "kind": "expression",
4319
+ "type": "boolean"
4320
+ },
4321
+ "default": "UIService.get(defaultConfig, ULink).default.wrapperExactActiveClass"
4322
+ },
4305
4323
  {
4306
4324
  "name": "underlined",
4307
4325
  "description": "Show underline.",