vueless 0.0.65 → 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.
|
|
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([
|
|
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
|
|
package/ui.button-link/index.vue
CHANGED
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
<script setup>
|
|
52
52
|
import { computed, useSlots, ref } from "vue";
|
|
53
|
+
import { RouterLink, useLink } from "vue-router";
|
|
53
54
|
import UIService from "../service.ui";
|
|
54
55
|
|
|
55
56
|
import { useAttrs } from "./composables/attrs.composable";
|
|
@@ -121,6 +122,38 @@ const props = defineProps({
|
|
|
121
122
|
default: UIService.get(defaultConfig, ULink).default.targetBlank,
|
|
122
123
|
},
|
|
123
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Apply classes to the link when its route is active or when it matches any parent route.
|
|
127
|
+
*/
|
|
128
|
+
activeClass: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: UIService.get(defaultConfig, ULink).default.activeClass,
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Apply classes to the link when its route is active.
|
|
135
|
+
*/
|
|
136
|
+
exactActiveClass: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: UIService.get(defaultConfig, ULink).default.exactActiveClass,
|
|
139
|
+
},
|
|
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
|
+
|
|
124
157
|
/**
|
|
125
158
|
* Show underline.
|
|
126
159
|
*/
|
|
@@ -179,13 +212,14 @@ const props = defineProps({
|
|
|
179
212
|
});
|
|
180
213
|
|
|
181
214
|
const slots = useSlots();
|
|
215
|
+
const { route, isActive, isExactActive } = useLink({ to: props.route });
|
|
182
216
|
|
|
183
217
|
const wrapperRef = ref(null);
|
|
184
218
|
|
|
185
219
|
defineExpose({ wrapperRef });
|
|
186
220
|
|
|
187
221
|
const { wrapperAttrs, linkAttrs, rightSlotAttrs, leftSlotAttrs, textAttrs, hasSlotContent } =
|
|
188
|
-
useAttrs(props);
|
|
222
|
+
useAttrs(props, { isActive, isExactActive });
|
|
189
223
|
|
|
190
224
|
const targetValue = computed(() => {
|
|
191
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.
|
|
4
|
+
"version": "0.0.67",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -4284,6 +4284,42 @@
|
|
|
4284
4284
|
},
|
|
4285
4285
|
"default": "false"
|
|
4286
4286
|
},
|
|
4287
|
+
{
|
|
4288
|
+
"name": "activeClass",
|
|
4289
|
+
"description": "Apply classes to the link when its route is active or when it matches any parent route.",
|
|
4290
|
+
"value": {
|
|
4291
|
+
"kind": "expression",
|
|
4292
|
+
"type": "boolean"
|
|
4293
|
+
},
|
|
4294
|
+
"default": "group/router-link-active"
|
|
4295
|
+
},
|
|
4296
|
+
{
|
|
4297
|
+
"name": "exactActiveClass",
|
|
4298
|
+
"description": "Apply classes to the link when its route is active.",
|
|
4299
|
+
"value": {
|
|
4300
|
+
"kind": "expression",
|
|
4301
|
+
"type": "boolean"
|
|
4302
|
+
},
|
|
4303
|
+
"default": "group/router-link-exact-active"
|
|
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
|
+
},
|
|
4287
4323
|
{
|
|
4288
4324
|
"name": "underlined",
|
|
4289
4325
|
"description": "Show underline.",
|