@d0rich/esprit-design 0.2.2 → 0.3.0
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/CHANGELOG.md +42 -0
- package/dist/components/DChip.vue.d.ts +1 -1
- package/dist/components/DPagination.vue.d.ts +2 -2
- package/dist/components/DStats.vue.d.ts +1 -1
- package/dist/components/animations/DAnimationAccordion.vue.d.ts +2 -2
- package/dist/components/animations/DAnimationDefLetterD.vue.d.ts +1 -1
- package/dist/components/animations/DAnimationFloatingLetter.vue.d.ts +2 -2
- package/dist/components/animations/DAnimationHypnosis.vue.d.ts +2 -2
- package/dist/components/animations/DAnimationSpinner.vue.d.ts +2 -2
- package/dist/components/animations/index.d.ts +5 -4
- package/dist/components/buttons/DBigBangButton.vue.d.ts +3 -3
- package/dist/components/buttons/DBigBangButtonAnimation.vue.d.ts +1 -1
- package/dist/components/buttons/DBtn.vue.d.ts +4 -3
- package/dist/components/buttons/index.d.ts +4 -3
- package/dist/components/cards/DCard.vue.d.ts +2 -2
- package/dist/components/cards/DCardTitle.vue.d.ts +1 -1
- package/dist/components/cards/index.d.ts +3 -2
- package/dist/components/content/DAlert.vue.d.ts +2 -2
- package/dist/components/content/DQuote.vue.d.ts +2 -2
- package/dist/components/content/index.d.ts +3 -2
- package/dist/components/index.d.ts +4 -3
- package/dist/components/lists/DActionsFan.vue.d.ts +5 -4
- package/dist/components/lists/DActionsList.vue.d.ts +5 -4
- package/dist/components/lists/index.d.ts +3 -2
- package/dist/components/utils/DWrapBackground.vue.d.ts +4 -3
- package/dist/components/utils/DWrapFocusHighlight.vue.d.ts +2 -2
- package/dist/components/utils/DWrapShape.vue.d.ts +8 -7
- package/dist/components/utils/index.d.ts +4 -3
- package/dist/composables/big-bang-button-utils.d.ts +1 -1
- package/dist/composables/router.d.ts +9 -6
- package/dist/composables/utils.d.ts +1 -0
- package/dist/esprit-design.js +1380 -1344
- package/dist/esprit-design.umd.cjs +13 -13
- package/dist/style.css +1 -1
- package/dist/utils/boundings.d.ts +2 -1
- package/index.html +14 -0
- package/package.json +9 -13
- package/plugins/shadows.js +87 -0
- package/src/components/DChip.vue +32 -0
- package/src/components/DPagination.vue +91 -0
- package/src/components/DStats.vue +514 -0
- package/src/components/animations/DAnimationAccordion.vue +103 -0
- package/src/components/animations/DAnimationDefLetterD.vue +11 -0
- package/src/components/animations/DAnimationFloatingLetter.vue +58 -0
- package/src/components/animations/DAnimationHypnosis.vue +102 -0
- package/src/components/animations/DAnimationSpinner.vue +114 -0
- package/src/components/animations/index.ts +11 -0
- package/src/components/buttons/DBigBangButton.vue +70 -0
- package/src/components/buttons/DBigBangButtonAnimation.vue +117 -0
- package/src/components/buttons/DBtn.vue +107 -0
- package/src/components/buttons/index.ts +5 -0
- package/src/components/cards/DCard.vue +98 -0
- package/src/components/cards/DCardTitle.vue +67 -0
- package/src/components/cards/index.ts +4 -0
- package/src/components/content/DAlert.vue +112 -0
- package/src/components/content/DQuote.vue +71 -0
- package/src/components/content/index.ts +4 -0
- package/src/components/index.ts +12 -0
- package/src/components/lists/DActionsFan.vue +153 -0
- package/src/components/lists/DActionsList.vue +100 -0
- package/src/components/lists/index.ts +4 -0
- package/src/components/utils/DWrapBackground.vue +76 -0
- package/src/components/utils/DWrapFocusHighlight.vue +241 -0
- package/src/components/utils/DWrapShape.vue +170 -0
- package/src/components/utils/index.ts +7 -0
- package/src/composables/big-bang-button-utils.ts +7 -0
- package/src/composables/index.ts +2 -0
- package/src/composables/router.ts +81 -0
- package/src/composables/utils.ts +5 -0
- package/src/index.ts +3 -0
- package/src/style.css +3 -0
- package/src/utils/boundings.ts +35 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/pagination.ts +4 -0
- package/src/utils/polygon-animation.ts +139 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +22 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +35 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import DWrapShape from './DWrapShape.vue'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'DWrapFocusHighlight',
|
|
7
|
+
components: {
|
|
8
|
+
DWrapShape
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
export type HighlightVariant =
|
|
15
|
+
| 'negative-tile'
|
|
16
|
+
| 'list-item'
|
|
17
|
+
| 'negative-list-item'
|
|
18
|
+
| 'composite-list-item'
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
/**
|
|
22
|
+
* If true, the highlight will be shown only if the link is exact string a URL.
|
|
23
|
+
*/
|
|
24
|
+
linkExact: Boolean,
|
|
25
|
+
/**
|
|
26
|
+
* Turn off the highlight for active links.
|
|
27
|
+
*/
|
|
28
|
+
noPassiveLink: Boolean,
|
|
29
|
+
/**
|
|
30
|
+
* Turn on the highlight even if the link is not active.
|
|
31
|
+
*/
|
|
32
|
+
active: Boolean,
|
|
33
|
+
variant: {
|
|
34
|
+
type: String as () => HighlightVariant,
|
|
35
|
+
default: 'negative-tile'
|
|
36
|
+
},
|
|
37
|
+
tag: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'div'
|
|
40
|
+
},
|
|
41
|
+
colorClass: {
|
|
42
|
+
type: [String, Object as () => Record<string, boolean>],
|
|
43
|
+
default: 'd-focus-hl--default-color'
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const currentComponent = computed(() => {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
if (props.to || props.href) return resolveComponent('NuxtLink')
|
|
50
|
+
return props.tag
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<DWrapShape>
|
|
56
|
+
<Component
|
|
57
|
+
v-bind="props"
|
|
58
|
+
:is="currentComponent"
|
|
59
|
+
class="d-focus-hl"
|
|
60
|
+
:class="{
|
|
61
|
+
'd-focus-hl--exact': linkExact,
|
|
62
|
+
'd-focus-hl--not-exact': !linkExact,
|
|
63
|
+
'd-focus-hl--no-passive-link': noPassiveLink,
|
|
64
|
+
'd-focus-hl--active': active
|
|
65
|
+
}"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
v-if="variant === 'negative-tile'"
|
|
69
|
+
class="d-focus-hl__hl--negative-tile"
|
|
70
|
+
/>
|
|
71
|
+
<div
|
|
72
|
+
v-else-if="variant === 'list-item'"
|
|
73
|
+
class="d-focus-hl__hl--list-item"
|
|
74
|
+
:class="colorClass"
|
|
75
|
+
/>
|
|
76
|
+
<div
|
|
77
|
+
v-else-if="variant === 'negative-list-item'"
|
|
78
|
+
class="d-focus-hl__hl--negative-list-item"
|
|
79
|
+
/>
|
|
80
|
+
<template v-else-if="variant === 'composite-list-item'">
|
|
81
|
+
<div class="d-focus-hl__hl--list-item" :class="colorClass" />
|
|
82
|
+
<div class="d-focus-hl__hl--negative-list-item" />
|
|
83
|
+
</template>
|
|
84
|
+
<slot />
|
|
85
|
+
</Component>
|
|
86
|
+
</DWrapShape>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<!-- common -->
|
|
90
|
+
<style>
|
|
91
|
+
.d-focus-hl {
|
|
92
|
+
@apply relative;
|
|
93
|
+
}
|
|
94
|
+
.d-focus-hl--default-color {
|
|
95
|
+
@apply bg-red-600;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
98
|
+
|
|
99
|
+
<!-- negative-tile -->
|
|
100
|
+
<style>
|
|
101
|
+
.d-focus-hl:has(.d-focus-hl__hl--negative-tile) {
|
|
102
|
+
@apply w-fit;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.d-focus-hl > .d-focus-hl__hl--negative-tile {
|
|
106
|
+
width: 0%;
|
|
107
|
+
height: 0%;
|
|
108
|
+
top: 50%;
|
|
109
|
+
left: 50%;
|
|
110
|
+
content: '';
|
|
111
|
+
opacity: 0;
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
@apply absolute backdrop-invert transition-all;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.d-focus-hl:hover > .d-focus-hl__hl--negative-tile,
|
|
117
|
+
*:focus .d-focus-hl__hl--negative-tile {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
animation: hl--negative-tile-animation linear 1s infinite;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.d-focus-hl:hover > .d-focus-hl__hl--negative-tile {
|
|
123
|
+
width: 110%;
|
|
124
|
+
height: 130%;
|
|
125
|
+
top: -15%;
|
|
126
|
+
left: -5%;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
*:focus .d-focus-hl__hl--negative-tile {
|
|
130
|
+
width: 140% !important;
|
|
131
|
+
height: 200% !important;
|
|
132
|
+
top: -50% !important;
|
|
133
|
+
left: -20% !important;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:is(
|
|
137
|
+
:is(
|
|
138
|
+
.router-link-active
|
|
139
|
+
.d-focus-hl--not-exact:not(.d-focus-hl--no-passive-link),
|
|
140
|
+
.router-link-exact-active
|
|
141
|
+
.d-focus-hl--exact:not(.d-focus-hl--no-passive-link)
|
|
142
|
+
),
|
|
143
|
+
.d-focus-hl--active
|
|
144
|
+
)
|
|
145
|
+
:is(.d-focus-hl__hl--negative-tile) {
|
|
146
|
+
opacity: 1;
|
|
147
|
+
width: 120% !important;
|
|
148
|
+
height: 120% !important;
|
|
149
|
+
top: -10% !important;
|
|
150
|
+
left: -10% !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@keyframes hl--negative-tile-animation {
|
|
154
|
+
0%,
|
|
155
|
+
100% {
|
|
156
|
+
transform: skew(0deg) rotate(6deg);
|
|
157
|
+
}
|
|
158
|
+
50% {
|
|
159
|
+
transform: skew(-40deg) rotate(-6deg) scaleX(0.8);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
</style>
|
|
163
|
+
|
|
164
|
+
<!-- list-item -->
|
|
165
|
+
<style>
|
|
166
|
+
.d-focus-hl:has(
|
|
167
|
+
.d-focus-hl__hl--list-item,
|
|
168
|
+
.d-focus-hl__hl--negative-list-item
|
|
169
|
+
) {
|
|
170
|
+
@apply w-full;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.d-focus-hl
|
|
174
|
+
> :is(.d-focus-hl__hl--list-item, .d-focus-hl__hl--negative-list-item) {
|
|
175
|
+
width: 0%;
|
|
176
|
+
height: 200%;
|
|
177
|
+
top: -50%;
|
|
178
|
+
left: 0;
|
|
179
|
+
content: '';
|
|
180
|
+
margin-left: -1.2em;
|
|
181
|
+
pointer-events: none;
|
|
182
|
+
clip-path: polygon(1rem 0, 0% 100%, 90% 50%);
|
|
183
|
+
@apply absolute transition-all;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.d-focus-hl > .d-focus-hl__hl--negative-list-item {
|
|
187
|
+
@apply backdrop-invert;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.d-focus-hl > .d-focus-hl__hl--list-item {
|
|
191
|
+
@apply -z-10;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:is(.d-focus-hl:hover, *:focus)
|
|
195
|
+
:is(.d-focus-hl__hl--list-item, .d-focus-hl__hl--negative-list-item) {
|
|
196
|
+
opacity: 1;
|
|
197
|
+
animation: hl--list-item-animation 0.3s infinite;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.d-focus-hl:hover
|
|
201
|
+
> :is(.d-focus-hl__hl--list-item, .d-focus-hl__hl--negative-list-item) {
|
|
202
|
+
width: 200%;
|
|
203
|
+
height: 130%;
|
|
204
|
+
top: -15%;
|
|
205
|
+
left: -5%;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
*:focus :is(.d-focus-hl__hl--list-item, .d-focus-hl__hl--negative-list-item) {
|
|
209
|
+
width: 220% !important;
|
|
210
|
+
height: 200% !important;
|
|
211
|
+
top: -50% !important;
|
|
212
|
+
left: -5% !important;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:is(
|
|
216
|
+
:is(
|
|
217
|
+
.router-link-active
|
|
218
|
+
.d-focus-hl--not-exact:not(.d-focus-hl--no-passive-link),
|
|
219
|
+
.router-link-exact-active
|
|
220
|
+
.d-focus-hl--exact:not(.d-focus-hl--no-passive-link)
|
|
221
|
+
),
|
|
222
|
+
.d-focus-hl--active
|
|
223
|
+
)
|
|
224
|
+
:is(.d-focus-hl__hl--list-item, .d-focus-hl__hl--negative-list-item) {
|
|
225
|
+
opacity: 1;
|
|
226
|
+
width: 220% !important;
|
|
227
|
+
height: 130% !important;
|
|
228
|
+
top: -15% !important;
|
|
229
|
+
left: -5% !important;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@keyframes hl--list-item-animation {
|
|
233
|
+
0%,
|
|
234
|
+
100% {
|
|
235
|
+
clip-path: polygon(1em 0, 0% 100%, 100% 50%);
|
|
236
|
+
}
|
|
237
|
+
50% {
|
|
238
|
+
clip-path: polygon(1em 10%, 0% 90%, 100% 50%);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
</style>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type StyleValue } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: 'DWrapShape'
|
|
6
|
+
}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
defineProps<{
|
|
11
|
+
shapeClass?: string | Record<string, boolean>
|
|
12
|
+
shapeStyle?: StyleValue
|
|
13
|
+
filterClass?: string | Record<string, boolean>
|
|
14
|
+
filterStyle?: StyleValue
|
|
15
|
+
tag?: string
|
|
16
|
+
}>()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<Component :is="tag ?? 'div'">
|
|
21
|
+
<div class="d-shape">
|
|
22
|
+
<div class="d-shape__bg-filter" :class="filterClass" :style="filterStyle">
|
|
23
|
+
<div class="d-shape__bg-wrapper">
|
|
24
|
+
<div class="d-shape__bg" :class="shapeClass" :style="shapeStyle">
|
|
25
|
+
<slot name="shape-content" />
|
|
26
|
+
</div>
|
|
27
|
+
<slot name="bg-overlay" />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<slot />
|
|
31
|
+
</div>
|
|
32
|
+
</Component>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.d-shape,
|
|
37
|
+
.d-shape > * {
|
|
38
|
+
@apply relative;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.d-shape__bg-filter {
|
|
42
|
+
@apply absolute top-0 left-0 w-full h-full;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.d-shape__bg-wrapper {
|
|
46
|
+
@apply relative w-full h-full;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.d-shape__bg {
|
|
50
|
+
@apply absolute w-full h-full;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
|
|
54
|
+
<!-- Global shapes -->
|
|
55
|
+
<style>
|
|
56
|
+
:root {
|
|
57
|
+
--shape-bubble--right: polygon(
|
|
58
|
+
0 calc(100% - 20px),
|
|
59
|
+
20px calc(100% - 10px),
|
|
60
|
+
25px calc(100% - 15px),
|
|
61
|
+
45px calc(100% - 5px),
|
|
62
|
+
70px calc(100% - 10px),
|
|
63
|
+
100% 100%,
|
|
64
|
+
calc(100% - 40px) 0,
|
|
65
|
+
45px 30px,
|
|
66
|
+
40px calc(100% - 30px),
|
|
67
|
+
20px calc(100% - 45px),
|
|
68
|
+
18px calc(100% - 25px)
|
|
69
|
+
);
|
|
70
|
+
--shape-bubble--right__outline: polygon(
|
|
71
|
+
0 calc(100% - 20px),
|
|
72
|
+
5px calc(100% - 20px),
|
|
73
|
+
20px calc(100% - 10px),
|
|
74
|
+
25px calc(100% - 15px),
|
|
75
|
+
45px calc(100% - 5px),
|
|
76
|
+
70px calc(100% - 10px),
|
|
77
|
+
calc(100% - 20px) calc(100% - 10px),
|
|
78
|
+
calc(100% - 50px) 7px,
|
|
79
|
+
45px 30px,
|
|
80
|
+
40px calc(100% - 30px),
|
|
81
|
+
20px calc(100% - 45px),
|
|
82
|
+
18px calc(100% - 25px),
|
|
83
|
+
5px calc(100% - 20px),
|
|
84
|
+
0 calc(100% - 20px),
|
|
85
|
+
16px calc(100% - 28px),
|
|
86
|
+
17px calc(100% - 53px),
|
|
87
|
+
39px calc(100% - 40px),
|
|
88
|
+
38px 23px,
|
|
89
|
+
calc(100% - 40px) 0,
|
|
90
|
+
100% 100%,
|
|
91
|
+
70px calc(100% - 7px),
|
|
92
|
+
45px 100%,
|
|
93
|
+
25px calc(100% - 11px),
|
|
94
|
+
19px calc(100% - 7px),
|
|
95
|
+
0 calc(100% - 20px)
|
|
96
|
+
);
|
|
97
|
+
--shape-bubble--right__padding: 35px 45px 15px 50px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:root {
|
|
101
|
+
--shape-bubble--left: polygon(
|
|
102
|
+
100% calc(100% - 20px),
|
|
103
|
+
calc(100% - 20px) calc(100% - 10px),
|
|
104
|
+
calc(100% - 25px) calc(100% - 15px),
|
|
105
|
+
calc(100% - 45px) calc(100% - 5px),
|
|
106
|
+
calc(100% - 70px) calc(100% - 10px),
|
|
107
|
+
0 100%,
|
|
108
|
+
40px 0,
|
|
109
|
+
calc(100% - 45px) 30px,
|
|
110
|
+
calc(100% - 40px) calc(100% - 30px),
|
|
111
|
+
calc(100% - 20px) calc(100% - 45px),
|
|
112
|
+
calc(100% - 18px) calc(100% - 25px)
|
|
113
|
+
);
|
|
114
|
+
--shape-bubble--left__outline: polygon(
|
|
115
|
+
100% calc(100% - 20px),
|
|
116
|
+
calc(100% - 5px) calc(100% - 20px),
|
|
117
|
+
calc(100% - 20px) calc(100% - 10px),
|
|
118
|
+
calc(100% - 25px) calc(100% - 15px),
|
|
119
|
+
calc(100% - 45px) calc(100% - 5px),
|
|
120
|
+
calc(100% - 70px) calc(100% - 10px),
|
|
121
|
+
20px calc(100% - 10px),
|
|
122
|
+
50px 7px,
|
|
123
|
+
calc(100% - 45px) 30px,
|
|
124
|
+
calc(100% - 40px) calc(100% - 30px),
|
|
125
|
+
calc(100% - 20px) calc(100% - 45px),
|
|
126
|
+
calc(100% - 18px) calc(100% - 25px),
|
|
127
|
+
calc(100% - 5px) calc(100% - 20px),
|
|
128
|
+
100% calc(100% - 20px),
|
|
129
|
+
calc(100% - 16px) calc(100% - 28px),
|
|
130
|
+
calc(100% - 17px) calc(100% - 53px),
|
|
131
|
+
calc(100% - 39px) calc(100% - 40px),
|
|
132
|
+
calc(100% - 38px) 23px,
|
|
133
|
+
40px 0,
|
|
134
|
+
0 100%,
|
|
135
|
+
calc(100% - 70px) calc(100% - 7px),
|
|
136
|
+
calc(100% - 45px) 100%,
|
|
137
|
+
calc(100% - 25px) calc(100% - 11px),
|
|
138
|
+
calc(100% - 19px) calc(100% - 7px),
|
|
139
|
+
100% calc(100% - 20px)
|
|
140
|
+
);
|
|
141
|
+
--shape-bubble--left__padding: 35px 50px 15px 45px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:root {
|
|
145
|
+
--shape-card: polygon(2em 0, 0% 100%, 100% calc(100% - 5em), 100% 4em);
|
|
146
|
+
--shape-card-padding: 4.5em 0.5em 5.5em 2.5em;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:root {
|
|
150
|
+
--shape-card--dense: polygon(
|
|
151
|
+
0.5em 0,
|
|
152
|
+
0% 100%,
|
|
153
|
+
100% calc(100% - 2em),
|
|
154
|
+
100% 1.5em
|
|
155
|
+
);
|
|
156
|
+
--shape-card--dense__outline: polygon(
|
|
157
|
+
0.5em 0,
|
|
158
|
+
0.8em 0.3em,
|
|
159
|
+
0.4em calc(100% - 0.7em),
|
|
160
|
+
calc(100% - 0.3em) calc(100% - 2em),
|
|
161
|
+
calc(100% - 0.4em) 1.5em,
|
|
162
|
+
0.8em 0.3em,
|
|
163
|
+
0.5em 0,
|
|
164
|
+
100% 1em,
|
|
165
|
+
100% calc(100% - 1.8em),
|
|
166
|
+
0% 100%
|
|
167
|
+
);
|
|
168
|
+
--shape-card--dense__padding: 2em 0.5em 2.5em 1em;
|
|
169
|
+
}
|
|
170
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import DWrapFocusHighlight, {
|
|
2
|
+
type HighlightVariant
|
|
3
|
+
} from './DWrapFocusHighlight.vue'
|
|
4
|
+
import DWrapBackground from './DWrapBackground.vue'
|
|
5
|
+
import DWrapShape from './DWrapShape.vue'
|
|
6
|
+
|
|
7
|
+
export { DWrapFocusHighlight, HighlightVariant, DWrapBackground, DWrapShape }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { resolveDynamicComponent, computed } from 'vue'
|
|
2
|
+
import type { RouterLink as _RouterLink, RouteLocationRaw } from 'vue-router'
|
|
3
|
+
|
|
4
|
+
export interface LinkProps {
|
|
5
|
+
readonly href?: string
|
|
6
|
+
readonly replace?: boolean
|
|
7
|
+
readonly to?: RouteLocationRaw
|
|
8
|
+
readonly exact?: boolean
|
|
9
|
+
readonly tag?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useLink(props: LinkProps) {
|
|
13
|
+
const RouterLink = resolveDynamicComponent('RouterLink') as
|
|
14
|
+
| typeof _RouterLink
|
|
15
|
+
| string
|
|
16
|
+
const NuxtLink =
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
typeof defineNuxtLink === 'function'
|
|
19
|
+
? // @ts-ignore
|
|
20
|
+
(defineNuxtLink({
|
|
21
|
+
componentName: 'DNuxtLink'
|
|
22
|
+
}) as typeof _RouterLink)
|
|
23
|
+
: undefined
|
|
24
|
+
|
|
25
|
+
const isLink = computed(() => !!(props.href || props.to))
|
|
26
|
+
const isExternalLink = computed(() => {
|
|
27
|
+
if (!props.href) return false
|
|
28
|
+
const href = props.href
|
|
29
|
+
return (
|
|
30
|
+
href.startsWith('http') ||
|
|
31
|
+
href.startsWith('mailto:') ||
|
|
32
|
+
href.startsWith('tel:') ||
|
|
33
|
+
href.startsWith('#')
|
|
34
|
+
)
|
|
35
|
+
})
|
|
36
|
+
const propsToProvide = computed(() => {
|
|
37
|
+
const propsToProvide: Record<string, any> = { ...props }
|
|
38
|
+
if (props.href && props.to) {
|
|
39
|
+
delete propsToProvide.href
|
|
40
|
+
} else if (props.href) {
|
|
41
|
+
delete propsToProvide.to
|
|
42
|
+
} else if (props.to) {
|
|
43
|
+
delete propsToProvide.href
|
|
44
|
+
}
|
|
45
|
+
return propsToProvide
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
if (isLink.value) {
|
|
49
|
+
if (typeof NuxtLink !== 'undefined') {
|
|
50
|
+
return {
|
|
51
|
+
isLink,
|
|
52
|
+
isExternalLink,
|
|
53
|
+
linkComponent: NuxtLink,
|
|
54
|
+
propsToProvide
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof RouterLink !== 'string') {
|
|
59
|
+
return {
|
|
60
|
+
isLink,
|
|
61
|
+
isExternalLink,
|
|
62
|
+
linkComponent: RouterLink,
|
|
63
|
+
propsToProvide
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
isLink,
|
|
69
|
+
isExternalLink,
|
|
70
|
+
linkComponent: 'a',
|
|
71
|
+
propsToProvide
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
isLink,
|
|
77
|
+
isExternalLink,
|
|
78
|
+
linkComponent: props.tag || 'span',
|
|
79
|
+
propsToProvide
|
|
80
|
+
}
|
|
81
|
+
}
|
package/src/index.ts
ADDED
package/src/style.css
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function getAbsoluteBoundingsGetters(
|
|
4
|
+
el: Ref<Element | null>,
|
|
5
|
+
correlations: { x?: () => number; y?: () => number } = {}
|
|
6
|
+
) {
|
|
7
|
+
return {
|
|
8
|
+
top: () =>
|
|
9
|
+
(el.value?.getBoundingClientRect().top ?? 0) +
|
|
10
|
+
window.scrollY +
|
|
11
|
+
(correlations.y ? correlations.y() : 0),
|
|
12
|
+
bottom: () =>
|
|
13
|
+
(el.value?.getBoundingClientRect().bottom ?? 0) +
|
|
14
|
+
window.scrollY +
|
|
15
|
+
(correlations.y ? correlations.y() : 0),
|
|
16
|
+
right: () =>
|
|
17
|
+
(el.value?.getBoundingClientRect().right ?? 0) +
|
|
18
|
+
window.scrollX +
|
|
19
|
+
(correlations.x ? correlations.x() : 0),
|
|
20
|
+
left: () =>
|
|
21
|
+
(el.value?.getBoundingClientRect().left ?? 0) +
|
|
22
|
+
window.scrollX +
|
|
23
|
+
(correlations.x ? correlations.x() : 0)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getAbsoluteBoundings(el: Ref<Element | null>) {
|
|
28
|
+
const getters = getAbsoluteBoundingsGetters(el)
|
|
29
|
+
return {
|
|
30
|
+
top: getters.top(),
|
|
31
|
+
bottom: getters.bottom(),
|
|
32
|
+
right: getters.right(),
|
|
33
|
+
left: getters.left()
|
|
34
|
+
}
|
|
35
|
+
}
|