@exakt/ui 0.0.45 → 0.0.46
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/dist/module.json +1 -1
- package/dist/runtime/components/e/chip.vue +68 -0
- package/dist/runtime/components/e/tr/scale.vue +23 -22
- package/dist/runtime/css/main.scss +6 -1
- package/package.json +1 -1
- package/dist/runtime/components/e/chat-bubble.vue +0 -201
- package/dist/runtime/components/e/chat-renderer.vue +0 -84
- package/dist/runtime/components/e/image-lazy-view.vue +0 -237
package/dist/module.json
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="e-chip py-3 px-4 ma-1 d-flex flex-center"
|
|
4
|
+
:class="{ active }"
|
|
5
|
+
@click="active = !active"
|
|
6
|
+
>
|
|
7
|
+
<e-icon
|
|
8
|
+
:fill="false"
|
|
9
|
+
size="17"
|
|
10
|
+
class="mr-1 icon"
|
|
11
|
+
>
|
|
12
|
+
{{ icon }}
|
|
13
|
+
</e-icon><e-icon
|
|
14
|
+
size="17"
|
|
15
|
+
class="mr-1 check"
|
|
16
|
+
>
|
|
17
|
+
check
|
|
18
|
+
</e-icon>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { computed } from '#imports';
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
icon: string;
|
|
26
|
+
modelValue: boolean;
|
|
27
|
+
|
|
28
|
+
}>()
|
|
29
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
30
|
+
|
|
31
|
+
const active = computed({
|
|
32
|
+
get() {
|
|
33
|
+
return props.modelValue;
|
|
34
|
+
},
|
|
35
|
+
set(v) {
|
|
36
|
+
emit("update:modelValue", v);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
<style scoped lang="scss">
|
|
41
|
+
.e-chip {
|
|
42
|
+
outline: var(--e-color-i-outline) solid 0.1rem;
|
|
43
|
+
width: fit-content;
|
|
44
|
+
background-color: var(--e-color-i-inactive);
|
|
45
|
+
transition: background-color 0.15s;
|
|
46
|
+
border-radius: 15rem;
|
|
47
|
+
user-select: none;
|
|
48
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
|
|
51
|
+
&>.check {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.active {
|
|
56
|
+
background-color: var(--e-color-i-active);
|
|
57
|
+
outline: var(--e-color-primary) solid 0.1rem;
|
|
58
|
+
|
|
59
|
+
&>.icon {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&>.check {
|
|
64
|
+
display: inline-block;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -4,25 +4,26 @@
|
|
|
4
4
|
<slot /> <!-- pass down slot content -->
|
|
5
5
|
</Transition>
|
|
6
6
|
</template>
|
|
7
|
-
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
const props = withDefaults(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<style>
|
|
18
|
-
.e-tr-scale-enter-active,
|
|
19
|
-
.e-tr-scale-leave-active {
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.e-tr-scale-enter-from,
|
|
24
|
-
.e-tr-scale-leave-to {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
</style>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
multiplier?: number
|
|
12
|
+
}>(),
|
|
13
|
+
{ multiplier: 1 }
|
|
14
|
+
);
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.e-tr-scale-enter-active,
|
|
19
|
+
.e-tr-scale-leave-active {
|
|
20
|
+
transition: all calc(0.15s * v-bind('props.multiplier')) ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.e-tr-scale-enter-from,
|
|
24
|
+
.e-tr-scale-leave-to {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
transform: scale(90%) translateY(-6%);
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
|
|
@@ -83,13 +83,18 @@ a,
|
|
|
83
83
|
$root-i-depressed-2: color.adjust($source-i, $lightness: -7.5%);
|
|
84
84
|
$root-i-depressed-active: color.adjust($source-i, $lightness: -5%, $saturation: 2%);
|
|
85
85
|
//$root-depressed: color.change($source, $lightness: $full + $factor*20%, $saturation:22%);
|
|
86
|
+
--e-color-i-inactive: #{color.adjust($source-i, $lightness: 10%)};
|
|
87
|
+
--e-color-i: #{color.adjust($source-i, $lightness: 20%)};
|
|
88
|
+
--e-color-i-active: #{color.change($root-primary, $lightness: 30%)};
|
|
89
|
+
|
|
90
|
+
|
|
86
91
|
--e-color-i-depressed: #{$root-i-depressed};
|
|
87
92
|
--e-color-i-depressed-active: #{$root-i-depressed-active};
|
|
88
93
|
//--e-color-depressed: #{$root-depressed};
|
|
89
94
|
--e-color-i-depressed-2: #{$root-i-depressed-2};
|
|
90
95
|
|
|
91
96
|
|
|
92
|
-
$root-i-outline: color.change($source, $lightness: $full + $factor*30%, $saturation: 20%);
|
|
97
|
+
$root-i-outline: color.change($source-i, $lightness: $full + $factor*30%, $saturation: 20%);
|
|
93
98
|
--e-color-i-outline: #{$root-i-outline};
|
|
94
99
|
|
|
95
100
|
$root-bg: color.adjust($source, $lightness: -2%);
|
package/package.json
CHANGED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bubble"
|
|
4
|
-
:class="bubbleClasses"
|
|
5
|
-
>
|
|
6
|
-
<div
|
|
7
|
-
class="content"
|
|
8
|
-
:style="{textAlign}"
|
|
9
|
-
>
|
|
10
|
-
<slot />
|
|
11
|
-
</div>
|
|
12
|
-
<div
|
|
13
|
-
v-if="!hideStatus"
|
|
14
|
-
class="status text-secondary"
|
|
15
|
-
>
|
|
16
|
-
<slot name="status" />
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
<script lang="ts" setup>
|
|
21
|
-
import { computed } from "#imports";
|
|
22
|
-
// Define props for the position and color of the bubble
|
|
23
|
-
const props = withDefaults(
|
|
24
|
-
defineProps<{
|
|
25
|
-
posx?:
|
|
26
|
-
"left" | "right" | "center";
|
|
27
|
-
posy?: "top" | "bottom";
|
|
28
|
-
textAlign?: "left" | "right" | "center";
|
|
29
|
-
color?: string;
|
|
30
|
-
liveTyping?: boolean;
|
|
31
|
-
pointer?: boolean;
|
|
32
|
-
hideStatus?: boolean;
|
|
33
|
-
}>(),
|
|
34
|
-
{
|
|
35
|
-
posx: "left",
|
|
36
|
-
posy: "bottom",
|
|
37
|
-
color: "turquoise",
|
|
38
|
-
liveTyping: false,
|
|
39
|
-
pointer: true
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const bubbleClasses = computed(() => {
|
|
44
|
-
const classes = [props.posx, props.posy];
|
|
45
|
-
if (props.liveTyping) {
|
|
46
|
-
classes.push("live-typing");
|
|
47
|
-
}
|
|
48
|
-
if (props.pointer === false) {
|
|
49
|
-
classes.push("no-pointer");
|
|
50
|
-
}
|
|
51
|
-
return classes;
|
|
52
|
-
});
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<style scoped lang="scss">
|
|
56
|
-
$bottom-triangle-height: 0.3rem;
|
|
57
|
-
|
|
58
|
-
.bubble {
|
|
59
|
-
--current-color: var(--e-color-elev);
|
|
60
|
-
--text-color: var(--e-color-dark);
|
|
61
|
-
position: relative;
|
|
62
|
-
font-family: var(--e-font-family);
|
|
63
|
-
|
|
64
|
-
width: fit-content;
|
|
65
|
-
min-width: 0;
|
|
66
|
-
overflow-wrap: break-word;
|
|
67
|
-
padding: var(--e-core-padding-x);
|
|
68
|
-
background: var(--current-color);
|
|
69
|
-
//outline: 0.07rem solid var(--e-color-elev-2);
|
|
70
|
-
|
|
71
|
-
border-radius: 1rem;
|
|
72
|
-
color: rgb(var(--text-color));
|
|
73
|
-
margin-top: 0px;
|
|
74
|
-
max-width: 50%;
|
|
75
|
-
min-width: 10rem;
|
|
76
|
-
transition: transform 0.15s ease-in-out;
|
|
77
|
-
|
|
78
|
-
&:active {
|
|
79
|
-
transform: scale(0.95);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.overline {
|
|
83
|
-
font-weight: bold;
|
|
84
|
-
text-align: left;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.status {
|
|
88
|
-
text-align: right;
|
|
89
|
-
margin-top: 0.5rem;
|
|
90
|
-
display: flex;
|
|
91
|
-
justify-content: flex-end;
|
|
92
|
-
align-items: center;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&:before {
|
|
96
|
-
content: "";
|
|
97
|
-
width: 0px;
|
|
98
|
-
height: 0px;
|
|
99
|
-
position: absolute;
|
|
100
|
-
animation: anim2 2s ease-in-out infinite;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&.no-pointer {
|
|
104
|
-
&:before {
|
|
105
|
-
display: none;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
margin-bottom: 0.5rem !important;
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&.right {
|
|
113
|
-
&:before {
|
|
114
|
-
left: unset;
|
|
115
|
-
right: calc($bottom-triangle-height * 2);
|
|
116
|
-
border-right: calc($bottom-triangle-height * 2) solid var(--current-color);
|
|
117
|
-
border-left: $bottom-triangle-height solid transparent;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
align-self: flex-end;
|
|
121
|
-
animation: enter-right 0.3s ease-in-out;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
&.center{
|
|
125
|
-
align-self: center;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&.left {
|
|
129
|
-
&:before {
|
|
130
|
-
left: calc($bottom-triangle-height * 2);
|
|
131
|
-
border-left: calc($bottom-triangle-height * 2) solid var(--current-color);
|
|
132
|
-
border-right: $bottom-triangle-height solid transparent;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
animation: enter-left 0.3s ease-in-out;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&.live-typing {
|
|
139
|
-
.content {
|
|
140
|
-
animation: live-typing 5s linear infinite;
|
|
141
|
-
background-clip: text;
|
|
142
|
-
background: linear-gradient(to right,
|
|
143
|
-
rgba(var(--text-color), 1) 20%,
|
|
144
|
-
rgba(var(--text-color), 0.5) 40%,
|
|
145
|
-
rgba(var(--text-color), 0.5) 60%,
|
|
146
|
-
rgba(var(--text-color), 1) 80%);
|
|
147
|
-
-webkit-background-clip: text;
|
|
148
|
-
|
|
149
|
-
background-size: 200% auto;
|
|
150
|
-
color: transparent;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.bottom {
|
|
156
|
-
margin-bottom: $bottom-triangle-height * 4;
|
|
157
|
-
|
|
158
|
-
&:before {
|
|
159
|
-
border-top: $bottom-triangle-height solid var(--current-color);
|
|
160
|
-
border-bottom: calc($bottom-triangle-height * 2) solid transparent;
|
|
161
|
-
left: calc($bottom-triangle-height * 2);
|
|
162
|
-
bottom: calc(-2.5 * $bottom-triangle-height);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.top {
|
|
167
|
-
margin-top: $bottom-triangle-height * 4;
|
|
168
|
-
|
|
169
|
-
&:before {
|
|
170
|
-
top: calc(-2.5 * $bottom-triangle-height);
|
|
171
|
-
border-bottom: $bottom-triangle-height solid var(--current-color);
|
|
172
|
-
border-top: calc($bottom-triangle-height * 2) solid transparent;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
@keyframes enter-left {
|
|
177
|
-
from {
|
|
178
|
-
transform: scale(0.8) translateX(-30%) translateY(20%);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
to {
|
|
182
|
-
transform: scale(1) translateX(0%) translateY(0%);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
@keyframes enter-right {
|
|
187
|
-
from {
|
|
188
|
-
transform: scale(0.8) translateX(30%) translateY(20%);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
to {
|
|
192
|
-
transform: scale(1) translateX(0%) translateY(0%);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@keyframes live-typing {
|
|
197
|
-
to {
|
|
198
|
-
background-position: -200% center;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
</style>
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="d-flex flex-column">
|
|
3
|
-
<e-dropdown
|
|
4
|
-
:items="items"
|
|
5
|
-
width="13rem"
|
|
6
|
-
:visible="status.dropdown.visible"
|
|
7
|
-
fixed
|
|
8
|
-
:position="{ x: status.dropdown.x, y: status.dropdown.y }"
|
|
9
|
-
@update:visible="status.dropdown.visible = $event"
|
|
10
|
-
/>
|
|
11
|
-
|
|
12
|
-
<slot
|
|
13
|
-
v-for="m in computedMessages"
|
|
14
|
-
:key="m.id"
|
|
15
|
-
v-bind="m"
|
|
16
|
-
:name="(m.status === 'system') ? 'system' : 'default'"
|
|
17
|
-
@click.right.prevent="openDropdown"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { reactive, computed } from "#imports";
|
|
23
|
-
|
|
24
|
-
const status = reactive({ dropdown: { visible: false, x: 0, y: 0 } });
|
|
25
|
-
const items = [{ icon: 'delete', name: "Delete" }, { icon: 'remove', name: "Delete just for me" }, { icon: 'flag', name: "Dox" }];
|
|
26
|
-
|
|
27
|
-
const openDropdown = ({ clientX, clientY }: MouseEvent) => {
|
|
28
|
-
status.dropdown.visible = true;
|
|
29
|
-
status.dropdown.x = clientX;
|
|
30
|
-
status.dropdown.y = clientY;
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
type MessageArray = {
|
|
34
|
-
liveTyping?: boolean;
|
|
35
|
-
pointer?: boolean;
|
|
36
|
-
id: string;
|
|
37
|
-
text: string;
|
|
38
|
-
date?: Date;
|
|
39
|
-
status: "sending" | "sent" | "read" | "received" | "system";
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
}[]
|
|
42
|
-
const props = defineProps<{
|
|
43
|
-
messages: MessageArray
|
|
44
|
-
}>()
|
|
45
|
-
|
|
46
|
-
const computedMessages = computed(() => {
|
|
47
|
-
const newMessages = <MessageArray>[];
|
|
48
|
-
const msgs = props.messages;
|
|
49
|
-
const entries = props.messages.entries();
|
|
50
|
-
for (const [i, m] of entries ) {
|
|
51
|
-
if ((msgs[i + 1] != undefined) && (msgs[i + 1].status === msgs[i].status)) {
|
|
52
|
-
m.pointer = false;
|
|
53
|
-
const nextDate = msgs[i + 1].date;
|
|
54
|
-
const thisDate = msgs[i].date;
|
|
55
|
-
if (nextDate && thisDate && nextDate.getMinutes() == thisDate.getMinutes() && nextDate.getHours() == thisDate.getHours() && msgs[i + 1].status == msgs[i].status) {
|
|
56
|
-
m.hideStatus = true
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
} else {
|
|
60
|
-
m.pointer = true
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
switch (m.status) {
|
|
64
|
-
case "system":
|
|
65
|
-
m.hideStatus = true;
|
|
66
|
-
m.pointer = false;
|
|
67
|
-
m.posx = "center";
|
|
68
|
-
m.textAlign = "center";
|
|
69
|
-
break;
|
|
70
|
-
case "received":
|
|
71
|
-
m.posx = "left";
|
|
72
|
-
break;
|
|
73
|
-
default:
|
|
74
|
-
m.posx = "right";
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
newMessages.push(m);
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return newMessages
|
|
83
|
-
})
|
|
84
|
-
</script>
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- v-intersect="onIntersect"-->
|
|
3
|
-
<e-scroll-sense-internal @input="onIntersect">
|
|
4
|
-
<div
|
|
5
|
-
class="fullsize"
|
|
6
|
-
:style="{
|
|
7
|
-
width: finalWidth,
|
|
8
|
-
height: finalHeight,
|
|
9
|
-
aspectRatio: String(aspectRatio),
|
|
10
|
-
}"
|
|
11
|
-
>
|
|
12
|
-
<div
|
|
13
|
-
ref="wrapper"
|
|
14
|
-
class="lv-image fullsize d-flex flex-shrink-1 flex-grow-1 justify-center align-center border-rad-custom"
|
|
15
|
-
:style="{ backgroundImage }"
|
|
16
|
-
:class="{
|
|
17
|
-
contain,
|
|
18
|
-
'sc-image-as-bg': slotContentPresent,
|
|
19
|
-
rounded: !borderRadius,
|
|
20
|
-
}"
|
|
21
|
-
>
|
|
22
|
-
<canvas
|
|
23
|
-
v-if="state.renderBlur"
|
|
24
|
-
ref="canvas"
|
|
25
|
-
:width="state.blurWidth"
|
|
26
|
-
:height="state.blurHeight"
|
|
27
|
-
class="rounded lv-blur fullsize border-rad-custom"
|
|
28
|
-
:class="{ hidden: state.loaded, rounded: !borderRadius }"
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div
|
|
33
|
-
v-if="slotContentPresent"
|
|
34
|
-
class="sc-sloe-content fullsize"
|
|
35
|
-
>
|
|
36
|
-
<slot />
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</e-scroll-sense-internal>
|
|
40
|
-
</template>
|
|
41
|
-
<script setup lang="ts">
|
|
42
|
-
import { decode } from "blurhash";
|
|
43
|
-
import {
|
|
44
|
-
computed,
|
|
45
|
-
reactive,
|
|
46
|
-
watch,
|
|
47
|
-
onMounted,
|
|
48
|
-
nextTick,
|
|
49
|
-
ref,
|
|
50
|
-
useSlots,
|
|
51
|
-
} from "vue";
|
|
52
|
-
|
|
53
|
-
const props = defineProps<{
|
|
54
|
-
width: number;
|
|
55
|
-
height: number;
|
|
56
|
-
aspectRatio?: number;
|
|
57
|
-
blur?: string;
|
|
58
|
-
src?: string;
|
|
59
|
-
contain?: Boolean;
|
|
60
|
-
immediateRender?: Boolean;
|
|
61
|
-
borderRadius?: string;
|
|
62
|
-
}>();
|
|
63
|
-
|
|
64
|
-
const slots = useSlots();
|
|
65
|
-
const wrapper = ref();
|
|
66
|
-
const canvas = ref();
|
|
67
|
-
|
|
68
|
-
const state = reactive<{loaded: boolean|undefined, renderBlur:boolean, blurHeight:number, blurWidth:number, resizeListenerActive:boolean, intersected:boolean}>({
|
|
69
|
-
loaded: undefined,
|
|
70
|
-
renderBlur: true,
|
|
71
|
-
blurHeight: 32,
|
|
72
|
-
blurWidth: 32,
|
|
73
|
-
|
|
74
|
-
resizeListenerActive: false,
|
|
75
|
-
|
|
76
|
-
intersected: false,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const finalWidth = computed(() => {
|
|
80
|
-
return dimensionFix(props.width);
|
|
81
|
-
});
|
|
82
|
-
const finalHeight = computed(() => {
|
|
83
|
-
return dimensionFix(props.height);
|
|
84
|
-
});
|
|
85
|
-
const slotContentPresent = computed(() => {
|
|
86
|
-
return Boolean(slots.default);
|
|
87
|
-
});
|
|
88
|
-
const backgroundImage = computed(() => {
|
|
89
|
-
if(!props.src) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
return "url(".concat(props.src, ")");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
watch(
|
|
96
|
-
() => props.blur,
|
|
97
|
-
(newBlur: string|undefined) => {
|
|
98
|
-
if (!state.loaded) {
|
|
99
|
-
initialize(newBlur);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
watch(
|
|
105
|
-
() => props.src,
|
|
106
|
-
() => {
|
|
107
|
-
state.loaded = false;
|
|
108
|
-
state.renderBlur = true;
|
|
109
|
-
|
|
110
|
-
nextTick(() => {
|
|
111
|
-
initialize();
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
onMounted(() => {
|
|
117
|
-
if (props.immediateRender) {
|
|
118
|
-
initialize();
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const getAspectRatio = () => {
|
|
123
|
-
if (props.aspectRatio) {
|
|
124
|
-
return props.aspectRatio;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const givenAspectRatio = props.width / props.height;
|
|
128
|
-
if (!isNaN(givenAspectRatio) && !Number.isNaN(givenAspectRatio)) {
|
|
129
|
-
return givenAspectRatio;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (wrapper.value) {
|
|
133
|
-
const { width, height } = wrapper.value.getBoundingClientRect();
|
|
134
|
-
return width / height;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return undefined;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const dimensionFix = (value: string|number) => {
|
|
141
|
-
if (!value) {
|
|
142
|
-
return undefined;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if(typeof value === "number") {
|
|
146
|
-
value = value.toString();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (/^\d+$/.test(value)) {
|
|
150
|
-
return value + "px";
|
|
151
|
-
}
|
|
152
|
-
return value;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const onIntersect = (intersecting: boolean) => {
|
|
158
|
-
if (intersecting && !state.intersected) {
|
|
159
|
-
initialize();
|
|
160
|
-
state.intersected = true;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const initialize = (blur = props.blur) => {
|
|
165
|
-
// const wrapper = state.$refs.wrapper
|
|
166
|
-
const aspectRatio = getAspectRatio();
|
|
167
|
-
|
|
168
|
-
if (blur && canvas && aspectRatio) {
|
|
169
|
-
const blurHeight = state.blurHeight;
|
|
170
|
-
|
|
171
|
-
state.blurWidth = Math.floor(state.blurHeight * aspectRatio);
|
|
172
|
-
const blurWidth = state.blurWidth;
|
|
173
|
-
|
|
174
|
-
const ctx = canvas.value.getContext("2d");
|
|
175
|
-
|
|
176
|
-
const pixels = decode(blur, blurWidth, blurHeight);
|
|
177
|
-
|
|
178
|
-
const imageData = ctx.createImageData(blurWidth, blurHeight);
|
|
179
|
-
imageData.data.set(pixels);
|
|
180
|
-
ctx.putImageData(imageData, 0, 0);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (props.src) {
|
|
184
|
-
const img = new Image();
|
|
185
|
-
img.onload = () => {
|
|
186
|
-
state.loaded = true;
|
|
187
|
-
};
|
|
188
|
-
img.src = props.src;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
</script>
|
|
192
|
-
|
|
193
|
-
<style lang="scss" scoped>
|
|
194
|
-
.border-rad-custom {
|
|
195
|
-
border-radius: v-bind(borderRadius);
|
|
196
|
-
}
|
|
197
|
-
.lv-wrapper {
|
|
198
|
-
position: relative;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.lv-image {
|
|
202
|
-
background-repeat: no-repeat;
|
|
203
|
-
background-position: center center;
|
|
204
|
-
background-size: cover;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.lv-image.contain {
|
|
208
|
-
background-size: contain;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.lv-blur {
|
|
212
|
-
opacity: 1;
|
|
213
|
-
width: 100%;
|
|
214
|
-
height: 100%;
|
|
215
|
-
transition: opacity 0.5s;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.lv-blur.hidden {
|
|
219
|
-
opacity: 0;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.sc-sloe-content {
|
|
223
|
-
position: relative;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.sc-image-as-bg {
|
|
227
|
-
position: absolute;
|
|
228
|
-
height: 100%;
|
|
229
|
-
width: 100%;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.fullsize {
|
|
233
|
-
width: 100%;
|
|
234
|
-
height: 100%;
|
|
235
|
-
overflow: clip;
|
|
236
|
-
}
|
|
237
|
-
</style>
|