@dargmuesli/nuxt-vio 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/components/VioHr.vue +3 -0
- package/components/VioLink.vue +57 -0
- package/layouts/default.vue +7 -0
- package/package.json +3 -1
@@ -0,0 +1,57 @@
|
|
1
|
+
<template>
|
2
|
+
<a
|
3
|
+
v-if="to.match(/^((ftp|http(s)?):\/\/|(mailto):)/)"
|
4
|
+
:aria-label="ariaLabel"
|
5
|
+
:class="classes"
|
6
|
+
:href="to"
|
7
|
+
:rel="
|
8
|
+
[...(nofollow ? ['nofollow'] : []), 'noopener', 'noreferrer'].join(' ')
|
9
|
+
"
|
10
|
+
target="_blank"
|
11
|
+
@click="emit('click')"
|
12
|
+
>
|
13
|
+
<slot />
|
14
|
+
</a>
|
15
|
+
<NuxtLink
|
16
|
+
v-else
|
17
|
+
:aria-label="ariaLabel"
|
18
|
+
:class="classes"
|
19
|
+
:to="isToRelative ? append(route.path, to) : to"
|
20
|
+
@click="emit('click')"
|
21
|
+
>
|
22
|
+
<slot />
|
23
|
+
</NuxtLink>
|
24
|
+
</template>
|
25
|
+
|
26
|
+
<script setup lang="ts">
|
27
|
+
export interface Props {
|
28
|
+
ariaLabel?: string
|
29
|
+
isColored?: boolean
|
30
|
+
isToRelative?: boolean
|
31
|
+
isUnderlined?: boolean
|
32
|
+
nofollow?: boolean
|
33
|
+
to: string
|
34
|
+
}
|
35
|
+
const props = withDefaults(defineProps<Props>(), {
|
36
|
+
ariaLabel: undefined,
|
37
|
+
isColored: true,
|
38
|
+
isToRelative: false,
|
39
|
+
isUnderlined: false,
|
40
|
+
nofollow: false,
|
41
|
+
})
|
42
|
+
|
43
|
+
const emit = defineEmits<{
|
44
|
+
(e: 'click'): void
|
45
|
+
}>()
|
46
|
+
|
47
|
+
const route = useRoute()
|
48
|
+
|
49
|
+
// computations
|
50
|
+
const classes = computed(() => {
|
51
|
+
return [
|
52
|
+
'rounded',
|
53
|
+
...(props.isColored ? ['text-link-dark dark:text-link-bright'] : []),
|
54
|
+
...(props.isUnderlined ? ['underline'] : []),
|
55
|
+
].join(' ')
|
56
|
+
})
|
57
|
+
</script>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dargmuesli/nuxt-vio",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.3.0",
|
4
4
|
"type": "module",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -10,7 +10,9 @@
|
|
10
10
|
},
|
11
11
|
"packageManager": "pnpm@8.2.0",
|
12
12
|
"files": [
|
13
|
+
"components",
|
13
14
|
"composables",
|
15
|
+
"layouts",
|
14
16
|
"server",
|
15
17
|
"plugins",
|
16
18
|
"utils",
|