@eodash/eodash 5.0.0-alpha.2.8 → 5.0.0-processing
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/README.md +1 -1
- package/core/client/App.vue +13 -1
- package/core/client/asWebComponent.js +13 -3
- package/core/client/components/DashboardLayout.vue +6 -2
- package/core/client/composables/DefineEodash.js +1 -1
- package/core/client/composables/EodashMap.js +349 -0
- package/core/client/composables/EodashProcess.js +575 -0
- package/core/client/composables/index.js +107 -24
- package/core/client/eodash.js +83 -10
- package/core/client/plugins/axios.js +8 -0
- package/core/client/plugins/index.js +2 -1
- package/core/client/store/Actions.js +63 -12
- package/core/client/store/States.js +19 -0
- package/core/client/store/stac.js +98 -8
- package/core/client/types.d.ts +25 -18
- package/core/client/utils/createLayers.js +313 -0
- package/core/client/utils/eodashSTAC.js +320 -170
- package/core/client/utils/helpers.js +369 -9
- package/core/client/utils/keys.js +2 -0
- package/core/client/utils/states.js +17 -0
- package/core/client/views/Dashboard.vue +17 -46
- package/core/client/vite-env.d.ts +1 -9
- package/dist/client/DashboardLayout-CVMJ4l8M.js +87 -0
- package/dist/client/DynamicWebComponent-Cv8n457T.js +88 -0
- package/dist/client/EodashDatePicker-VVkiPmpc.js +394 -0
- package/dist/client/EodashItemFilter-CugWNQ86.js +194 -0
- package/dist/client/EodashLayerControl-53WghA8G.js +110 -0
- package/dist/client/EodashMap-CQnOePpy.js +486 -0
- package/dist/client/EodashMapBtns-uaRwFtfB.js +66 -0
- package/dist/client/EodashProcess-cF0unIy8.js +1477 -0
- package/dist/client/ExportState-BT8MLAW7.js +644 -0
- package/dist/client/Footer-C6GUG84G.js +141 -0
- package/dist/client/Header-D2dtCWp8.js +437 -0
- package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
- package/dist/client/MobileLayout-BAo8Wr8T.js +1210 -0
- package/dist/client/PopUp-Bm01q7Ko.js +389 -0
- package/dist/client/VImg-B8AbetCE.js +384 -0
- package/dist/client/VMain-DnGlQUyr.js +43 -0
- package/dist/client/VOverlay-B8Qj7LRG.js +1453 -0
- package/dist/client/WidgetsContainer-CwXRRLS1.js +83 -0
- package/dist/client/asWebComponent-DUUoR7MZ.js +11621 -0
- package/dist/client/eo-dash.js +2 -6
- package/dist/client/forwardRefs-CZJhEAKW.js +245 -0
- package/dist/client/index-DlIO7sJ3.js +199 -0
- package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
- package/dist/client/style.css +2 -2
- package/dist/client/transition-BiR8wMn1.js +37 -0
- package/dist/node/cli.js +4 -4
- package/dist/node/types.d.ts +2 -0
- package/dist/types/core/client/App.vue.d.ts +7 -0
- package/dist/types/core/client/asWebComponent.d.ts +9 -0
- package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -0
- package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +18 -0
- package/dist/types/core/client/components/ErrorAlert.vue.d.ts +2 -0
- package/dist/types/core/client/components/Footer.vue.d.ts +2 -0
- package/dist/types/core/client/components/Header.vue.d.ts +2 -0
- package/dist/types/core/client/components/IframeWrapper.vue.d.ts +7 -0
- package/dist/types/core/client/components/Loading.vue.d.ts +2 -0
- package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -0
- package/dist/types/core/client/composables/DefineEodash.d.ts +2 -0
- package/dist/types/core/client/composables/DefineTemplate.d.ts +15 -0
- package/dist/types/core/client/composables/DefineWidgets.d.ts +14 -0
- package/dist/types/core/client/composables/EodashMap.d.ts +5 -0
- package/dist/types/core/client/composables/index.d.ts +30 -0
- package/dist/types/core/client/eodash.d.ts +8 -0
- package/dist/types/core/client/main.d.ts +2 -0
- package/dist/types/core/client/plugins/axios.d.ts +2 -0
- package/dist/types/core/client/plugins/index.d.ts +3 -0
- package/dist/types/core/client/plugins/vuetify.d.ts +82 -0
- package/dist/types/core/client/render.d.ts +1 -0
- package/dist/types/core/client/store/Actions.d.ts +12 -0
- package/dist/types/core/client/store/States.d.ts +22 -0
- package/dist/types/core/client/store/index.d.ts +2 -0
- package/dist/types/core/client/store/stac.d.ts +25 -0
- package/dist/types/core/client/types.d.ts +279 -0
- package/dist/types/core/client/utils/createLayers.d.ts +45 -0
- package/dist/types/core/client/utils/eodashSTAC.d.ts +82 -0
- package/dist/types/core/client/utils/helpers.d.ts +84 -0
- package/dist/types/core/client/utils/index.d.ts +2 -0
- package/dist/types/core/client/utils/keys.d.ts +6 -0
- package/dist/types/core/client/utils/states.d.ts +14 -0
- package/dist/types/core/client/views/Dashboard.vue.d.ts +9 -0
- package/dist/types/widgets/EodashDatePicker.vue.d.ts +7 -0
- package/dist/types/widgets/EodashItemFilter.vue.d.ts +42 -0
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +11 -0
- package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +9 -0
- package/dist/types/widgets/EodashMap.vue.d.ts +7 -0
- package/dist/types/widgets/EodashMapBtns.vue.d.ts +11 -0
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +21 -0
- package/dist/types/widgets/EodashTools.vue.d.ts +15 -0
- package/dist/types/widgets/ExportState.vue.d.ts +7 -0
- package/dist/types/widgets/PopUp.vue.d.ts +22 -0
- package/dist/types/widgets/WidgetsContainer.vue.d.ts +7 -0
- package/package.json +58 -37
- package/widgets/EodashDatePicker.vue +128 -100
- package/widgets/EodashItemFilter.vue +149 -47
- package/widgets/EodashLayerControl.vue +98 -0
- package/widgets/EodashMap.vue +98 -122
- package/widgets/EodashMapBtns.vue +24 -7
- package/widgets/EodashProcess.vue +151 -0
- package/widgets/ExportState.vue +15 -11
- package/core/client/SuspensedDashboard.ce.vue +0 -105
- package/dist/client/DashboardLayout-CKOExc7r.js +0 -156
- package/dist/client/DynamicWebComponent-m1Zbbw6n.js +0 -57
- package/dist/client/EodashDatePicker-CGdJRGZJ.js +0 -252
- package/dist/client/EodashItemFilter-BjM_LHaE.js +0 -63
- package/dist/client/EodashMap-61UMC8sv.js +0 -86917
- package/dist/client/EodashMapBtns-DVITfAFx.js +0 -36
- package/dist/client/ExportState-DhpK09GR.js +0 -558
- package/dist/client/Footer-CIwjaddz.js +0 -115
- package/dist/client/Header-BcM-pZFi.js +0 -350
- package/dist/client/IframeWrapper-CAe6HPqe.js +0 -19
- package/dist/client/MobileLayout-DcZOQX8r.js +0 -945
- package/dist/client/PopUp-DCaITceG.js +0 -300
- package/dist/client/VImg-C-I_7puM.js +0 -291
- package/dist/client/VMain-Cd3P0YTG.js +0 -39
- package/dist/client/VOverlay-AcvFgk39.js +0 -967
- package/dist/client/WidgetsContainer-B0-q0EMO.js +0 -129
- package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist/client/asWebComponent-zuKR9I1w.js +0 -20361
- package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
- package/dist/client/decoder-CP4lv0Kb-DdKalImK.js +0 -10
- package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
- package/dist/client/eodashSTAC-DGB50vNk.js +0 -2788
- package/dist/client/eox-itemfilter-TaBxgqq_.js +0 -7565
- package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
- package/dist/client/forwardRefs-BnxE4iKQ.js +0 -185
- package/dist/client/index-hSIi5Ygk.js +0 -153
- package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
- package/dist/client/lerc-DzVumYtB-cTUap6k_.js +0 -1027
- package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
- package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
- package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
- package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
- package/dist/client/ssrBoot-D3KF5Thc.js +0 -17
- package/dist/client/transition-D3a4tiJv.js +0 -34
- package/dist/client/webfontloader-qotgY98I.js +0 -435
- package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { createVNode, computed, toRef, shallowRef, ref, watch, onBeforeMount, nextTick, onBeforeUnmount, withDirectives, mergeProps, Fragment, resolveDirective, vShow } from 'vue';
|
|
2
|
+
import { aB as SUPPORTS_INTERSECTION, p as propsFactory, b as makeComponentProps, J as makeDimensionProps, g as genericComponent, K as useDimension, a as useRender, N as makeRoundedProps, C as useBackgroundColor, Q as useRounded, aC as getCurrentInstance, q as convertToUnit } from './asWebComponent-DUUoR7MZ.js';
|
|
3
|
+
import { m as makeTransitionProps, M as MaybeTransition } from './transition-BiR8wMn1.js';
|
|
4
|
+
|
|
5
|
+
// Utilities
|
|
6
|
+
function mounted(el, binding) {
|
|
7
|
+
if (!SUPPORTS_INTERSECTION) return;
|
|
8
|
+
const modifiers = binding.modifiers || {};
|
|
9
|
+
const value = binding.value;
|
|
10
|
+
const {
|
|
11
|
+
handler,
|
|
12
|
+
options
|
|
13
|
+
} = typeof value === 'object' ? value : {
|
|
14
|
+
handler: value,
|
|
15
|
+
options: {}
|
|
16
|
+
};
|
|
17
|
+
const observer = new IntersectionObserver(function () {
|
|
18
|
+
let entries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
19
|
+
let observer = arguments.length > 1 ? arguments[1] : undefined;
|
|
20
|
+
const _observe = el._observe?.[binding.instance.$.uid];
|
|
21
|
+
if (!_observe) return; // Just in case, should never fire
|
|
22
|
+
|
|
23
|
+
const isIntersecting = entries.some(entry => entry.isIntersecting);
|
|
24
|
+
|
|
25
|
+
// If is not quiet or has already been
|
|
26
|
+
// initted, invoke the user callback
|
|
27
|
+
if (handler && (!modifiers.quiet || _observe.init) && (!modifiers.once || isIntersecting || _observe.init)) {
|
|
28
|
+
handler(isIntersecting, entries, observer);
|
|
29
|
+
}
|
|
30
|
+
if (isIntersecting && modifiers.once) unmounted(el, binding);else _observe.init = true;
|
|
31
|
+
}, options);
|
|
32
|
+
el._observe = Object(el._observe);
|
|
33
|
+
el._observe[binding.instance.$.uid] = {
|
|
34
|
+
init: false,
|
|
35
|
+
observer
|
|
36
|
+
};
|
|
37
|
+
observer.observe(el);
|
|
38
|
+
}
|
|
39
|
+
function unmounted(el, binding) {
|
|
40
|
+
const observe = el._observe?.[binding.instance.$.uid];
|
|
41
|
+
if (!observe) return;
|
|
42
|
+
observe.observer.unobserve(el);
|
|
43
|
+
delete el._observe[binding.instance.$.uid];
|
|
44
|
+
}
|
|
45
|
+
const Intersect = {
|
|
46
|
+
mounted,
|
|
47
|
+
unmounted
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function useAspectStyles(props) {
|
|
51
|
+
return {
|
|
52
|
+
aspectStyles: computed(() => {
|
|
53
|
+
const ratio = Number(props.aspectRatio);
|
|
54
|
+
return ratio ? {
|
|
55
|
+
paddingBottom: String(1 / ratio * 100) + '%'
|
|
56
|
+
} : undefined;
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const makeVResponsiveProps = propsFactory({
|
|
61
|
+
aspectRatio: [String, Number],
|
|
62
|
+
contentClass: null,
|
|
63
|
+
inline: Boolean,
|
|
64
|
+
...makeComponentProps(),
|
|
65
|
+
...makeDimensionProps()
|
|
66
|
+
}, 'VResponsive');
|
|
67
|
+
const VResponsive = genericComponent()({
|
|
68
|
+
name: 'VResponsive',
|
|
69
|
+
props: makeVResponsiveProps(),
|
|
70
|
+
setup(props, _ref) {
|
|
71
|
+
let {
|
|
72
|
+
slots
|
|
73
|
+
} = _ref;
|
|
74
|
+
const {
|
|
75
|
+
aspectStyles
|
|
76
|
+
} = useAspectStyles(props);
|
|
77
|
+
const {
|
|
78
|
+
dimensionStyles
|
|
79
|
+
} = useDimension(props);
|
|
80
|
+
useRender(() => createVNode("div", {
|
|
81
|
+
"class": ['v-responsive', {
|
|
82
|
+
'v-responsive--inline': props.inline
|
|
83
|
+
}, props.class],
|
|
84
|
+
"style": [dimensionStyles.value, props.style]
|
|
85
|
+
}, [createVNode("div", {
|
|
86
|
+
"class": "v-responsive__sizer",
|
|
87
|
+
"style": aspectStyles.value
|
|
88
|
+
}, null), slots.additional?.(), slots.default && createVNode("div", {
|
|
89
|
+
"class": ['v-responsive__content', props.contentClass]
|
|
90
|
+
}, [slots.default()])]));
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// not intended for public use, this is passed in by vuetify-loader
|
|
96
|
+
const makeVImgProps = propsFactory({
|
|
97
|
+
absolute: Boolean,
|
|
98
|
+
alt: String,
|
|
99
|
+
cover: Boolean,
|
|
100
|
+
color: String,
|
|
101
|
+
draggable: {
|
|
102
|
+
type: [Boolean, String],
|
|
103
|
+
default: undefined
|
|
104
|
+
},
|
|
105
|
+
eager: Boolean,
|
|
106
|
+
gradient: String,
|
|
107
|
+
lazySrc: String,
|
|
108
|
+
options: {
|
|
109
|
+
type: Object,
|
|
110
|
+
// For more information on types, navigate to:
|
|
111
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
|
|
112
|
+
default: () => ({
|
|
113
|
+
root: undefined,
|
|
114
|
+
rootMargin: undefined,
|
|
115
|
+
threshold: undefined
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
sizes: String,
|
|
119
|
+
src: {
|
|
120
|
+
type: [String, Object],
|
|
121
|
+
default: ''
|
|
122
|
+
},
|
|
123
|
+
crossorigin: String,
|
|
124
|
+
referrerpolicy: String,
|
|
125
|
+
srcset: String,
|
|
126
|
+
position: String,
|
|
127
|
+
...makeVResponsiveProps(),
|
|
128
|
+
...makeComponentProps(),
|
|
129
|
+
...makeRoundedProps(),
|
|
130
|
+
...makeTransitionProps()
|
|
131
|
+
}, 'VImg');
|
|
132
|
+
const VImg = genericComponent()({
|
|
133
|
+
name: 'VImg',
|
|
134
|
+
directives: {
|
|
135
|
+
intersect: Intersect
|
|
136
|
+
},
|
|
137
|
+
props: makeVImgProps(),
|
|
138
|
+
emits: {
|
|
139
|
+
loadstart: value => true,
|
|
140
|
+
load: value => true,
|
|
141
|
+
error: value => true
|
|
142
|
+
},
|
|
143
|
+
setup(props, _ref) {
|
|
144
|
+
let {
|
|
145
|
+
emit,
|
|
146
|
+
slots
|
|
147
|
+
} = _ref;
|
|
148
|
+
const {
|
|
149
|
+
backgroundColorClasses,
|
|
150
|
+
backgroundColorStyles
|
|
151
|
+
} = useBackgroundColor(toRef(props, 'color'));
|
|
152
|
+
const {
|
|
153
|
+
roundedClasses
|
|
154
|
+
} = useRounded(props);
|
|
155
|
+
const vm = getCurrentInstance('VImg');
|
|
156
|
+
const currentSrc = shallowRef(''); // Set from srcset
|
|
157
|
+
const image = ref();
|
|
158
|
+
const state = shallowRef(props.eager ? 'loading' : 'idle');
|
|
159
|
+
const naturalWidth = shallowRef();
|
|
160
|
+
const naturalHeight = shallowRef();
|
|
161
|
+
const normalisedSrc = computed(() => {
|
|
162
|
+
return props.src && typeof props.src === 'object' ? {
|
|
163
|
+
src: props.src.src,
|
|
164
|
+
srcset: props.srcset || props.src.srcset,
|
|
165
|
+
lazySrc: props.lazySrc || props.src.lazySrc,
|
|
166
|
+
aspect: Number(props.aspectRatio || props.src.aspect || 0)
|
|
167
|
+
} : {
|
|
168
|
+
src: props.src,
|
|
169
|
+
srcset: props.srcset,
|
|
170
|
+
lazySrc: props.lazySrc,
|
|
171
|
+
aspect: Number(props.aspectRatio || 0)
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
const aspectRatio = computed(() => {
|
|
175
|
+
return normalisedSrc.value.aspect || naturalWidth.value / naturalHeight.value || 0;
|
|
176
|
+
});
|
|
177
|
+
watch(() => props.src, () => {
|
|
178
|
+
init(state.value !== 'idle');
|
|
179
|
+
});
|
|
180
|
+
watch(aspectRatio, (val, oldVal) => {
|
|
181
|
+
if (!val && oldVal && image.value) {
|
|
182
|
+
pollForSize(image.value);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// TODO: getSrc when window width changes
|
|
187
|
+
|
|
188
|
+
onBeforeMount(() => init());
|
|
189
|
+
function init(isIntersecting) {
|
|
190
|
+
if (props.eager && isIntersecting) return;
|
|
191
|
+
if (SUPPORTS_INTERSECTION && !isIntersecting && !props.eager) return;
|
|
192
|
+
state.value = 'loading';
|
|
193
|
+
if (normalisedSrc.value.lazySrc) {
|
|
194
|
+
const lazyImg = new Image();
|
|
195
|
+
lazyImg.src = normalisedSrc.value.lazySrc;
|
|
196
|
+
pollForSize(lazyImg, null);
|
|
197
|
+
}
|
|
198
|
+
if (!normalisedSrc.value.src) return;
|
|
199
|
+
nextTick(() => {
|
|
200
|
+
emit('loadstart', image.value?.currentSrc || normalisedSrc.value.src);
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
if (vm.isUnmounted) return;
|
|
203
|
+
if (image.value?.complete) {
|
|
204
|
+
if (!image.value.naturalWidth) {
|
|
205
|
+
onError();
|
|
206
|
+
}
|
|
207
|
+
if (state.value === 'error') return;
|
|
208
|
+
if (!aspectRatio.value) pollForSize(image.value, null);
|
|
209
|
+
if (state.value === 'loading') onLoad();
|
|
210
|
+
} else {
|
|
211
|
+
if (!aspectRatio.value) pollForSize(image.value);
|
|
212
|
+
getSrc();
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function onLoad() {
|
|
218
|
+
if (vm.isUnmounted) return;
|
|
219
|
+
getSrc();
|
|
220
|
+
pollForSize(image.value);
|
|
221
|
+
state.value = 'loaded';
|
|
222
|
+
emit('load', image.value?.currentSrc || normalisedSrc.value.src);
|
|
223
|
+
}
|
|
224
|
+
function onError() {
|
|
225
|
+
if (vm.isUnmounted) return;
|
|
226
|
+
state.value = 'error';
|
|
227
|
+
emit('error', image.value?.currentSrc || normalisedSrc.value.src);
|
|
228
|
+
}
|
|
229
|
+
function getSrc() {
|
|
230
|
+
const img = image.value;
|
|
231
|
+
if (img) currentSrc.value = img.currentSrc || img.src;
|
|
232
|
+
}
|
|
233
|
+
let timer = -1;
|
|
234
|
+
onBeforeUnmount(() => {
|
|
235
|
+
clearTimeout(timer);
|
|
236
|
+
});
|
|
237
|
+
function pollForSize(img) {
|
|
238
|
+
let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
239
|
+
const poll = () => {
|
|
240
|
+
clearTimeout(timer);
|
|
241
|
+
if (vm.isUnmounted) return;
|
|
242
|
+
const {
|
|
243
|
+
naturalHeight: imgHeight,
|
|
244
|
+
naturalWidth: imgWidth
|
|
245
|
+
} = img;
|
|
246
|
+
if (imgHeight || imgWidth) {
|
|
247
|
+
naturalWidth.value = imgWidth;
|
|
248
|
+
naturalHeight.value = imgHeight;
|
|
249
|
+
} else if (!img.complete && state.value === 'loading' && timeout != null) {
|
|
250
|
+
timer = window.setTimeout(poll, timeout);
|
|
251
|
+
} else if (img.currentSrc.endsWith('.svg') || img.currentSrc.startsWith('data:image/svg+xml')) {
|
|
252
|
+
naturalWidth.value = 1;
|
|
253
|
+
naturalHeight.value = 1;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
poll();
|
|
257
|
+
}
|
|
258
|
+
const containClasses = computed(() => ({
|
|
259
|
+
'v-img__img--cover': props.cover,
|
|
260
|
+
'v-img__img--contain': !props.cover
|
|
261
|
+
}));
|
|
262
|
+
const __image = () => {
|
|
263
|
+
if (!normalisedSrc.value.src || state.value === 'idle') return null;
|
|
264
|
+
const img = createVNode("img", {
|
|
265
|
+
"class": ['v-img__img', containClasses.value],
|
|
266
|
+
"style": {
|
|
267
|
+
objectPosition: props.position
|
|
268
|
+
},
|
|
269
|
+
"src": normalisedSrc.value.src,
|
|
270
|
+
"srcset": normalisedSrc.value.srcset,
|
|
271
|
+
"alt": props.alt,
|
|
272
|
+
"crossorigin": props.crossorigin,
|
|
273
|
+
"referrerpolicy": props.referrerpolicy,
|
|
274
|
+
"draggable": props.draggable,
|
|
275
|
+
"sizes": props.sizes,
|
|
276
|
+
"ref": image,
|
|
277
|
+
"onLoad": onLoad,
|
|
278
|
+
"onError": onError
|
|
279
|
+
}, null);
|
|
280
|
+
const sources = slots.sources?.();
|
|
281
|
+
return createVNode(MaybeTransition, {
|
|
282
|
+
"transition": props.transition,
|
|
283
|
+
"appear": true
|
|
284
|
+
}, {
|
|
285
|
+
default: () => [withDirectives(sources ? createVNode("picture", {
|
|
286
|
+
"class": "v-img__picture"
|
|
287
|
+
}, [sources, img]) : img, [[vShow, state.value === 'loaded']])]
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
const __preloadImage = () => createVNode(MaybeTransition, {
|
|
291
|
+
"transition": props.transition
|
|
292
|
+
}, {
|
|
293
|
+
default: () => [normalisedSrc.value.lazySrc && state.value !== 'loaded' && createVNode("img", {
|
|
294
|
+
"class": ['v-img__img', 'v-img__img--preload', containClasses.value],
|
|
295
|
+
"style": {
|
|
296
|
+
objectPosition: props.position
|
|
297
|
+
},
|
|
298
|
+
"src": normalisedSrc.value.lazySrc,
|
|
299
|
+
"alt": props.alt,
|
|
300
|
+
"crossorigin": props.crossorigin,
|
|
301
|
+
"referrerpolicy": props.referrerpolicy,
|
|
302
|
+
"draggable": props.draggable
|
|
303
|
+
}, null)]
|
|
304
|
+
});
|
|
305
|
+
const __placeholder = () => {
|
|
306
|
+
if (!slots.placeholder) return null;
|
|
307
|
+
return createVNode(MaybeTransition, {
|
|
308
|
+
"transition": props.transition,
|
|
309
|
+
"appear": true
|
|
310
|
+
}, {
|
|
311
|
+
default: () => [(state.value === 'loading' || state.value === 'error' && !slots.error) && createVNode("div", {
|
|
312
|
+
"class": "v-img__placeholder"
|
|
313
|
+
}, [slots.placeholder()])]
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
const __error = () => {
|
|
317
|
+
if (!slots.error) return null;
|
|
318
|
+
return createVNode(MaybeTransition, {
|
|
319
|
+
"transition": props.transition,
|
|
320
|
+
"appear": true
|
|
321
|
+
}, {
|
|
322
|
+
default: () => [state.value === 'error' && createVNode("div", {
|
|
323
|
+
"class": "v-img__error"
|
|
324
|
+
}, [slots.error()])]
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
const __gradient = () => {
|
|
328
|
+
if (!props.gradient) return null;
|
|
329
|
+
return createVNode("div", {
|
|
330
|
+
"class": "v-img__gradient",
|
|
331
|
+
"style": {
|
|
332
|
+
backgroundImage: `linear-gradient(${props.gradient})`
|
|
333
|
+
}
|
|
334
|
+
}, null);
|
|
335
|
+
};
|
|
336
|
+
const isBooted = shallowRef(false);
|
|
337
|
+
{
|
|
338
|
+
const stop = watch(aspectRatio, val => {
|
|
339
|
+
if (val) {
|
|
340
|
+
// Doesn't work with nextTick, idk why
|
|
341
|
+
requestAnimationFrame(() => {
|
|
342
|
+
requestAnimationFrame(() => {
|
|
343
|
+
isBooted.value = true;
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
stop();
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
useRender(() => {
|
|
351
|
+
const responsiveProps = VResponsive.filterProps(props);
|
|
352
|
+
return withDirectives(createVNode(VResponsive, mergeProps({
|
|
353
|
+
"class": ['v-img', {
|
|
354
|
+
'v-img--absolute': props.absolute,
|
|
355
|
+
'v-img--booting': !isBooted.value
|
|
356
|
+
}, backgroundColorClasses.value, roundedClasses.value, props.class],
|
|
357
|
+
"style": [{
|
|
358
|
+
width: convertToUnit(props.width === 'auto' ? naturalWidth.value : props.width)
|
|
359
|
+
}, backgroundColorStyles.value, props.style]
|
|
360
|
+
}, responsiveProps, {
|
|
361
|
+
"aspectRatio": aspectRatio.value,
|
|
362
|
+
"aria-label": props.alt,
|
|
363
|
+
"role": props.alt ? 'img' : undefined
|
|
364
|
+
}), {
|
|
365
|
+
additional: () => createVNode(Fragment, null, [createVNode(__image, null, null), createVNode(__preloadImage, null, null), createVNode(__gradient, null, null), createVNode(__placeholder, null, null), createVNode(__error, null, null)]),
|
|
366
|
+
default: slots.default
|
|
367
|
+
}), [[resolveDirective("intersect"), {
|
|
368
|
+
handler: init,
|
|
369
|
+
options: props.options
|
|
370
|
+
}, null, {
|
|
371
|
+
once: true
|
|
372
|
+
}]]);
|
|
373
|
+
});
|
|
374
|
+
return {
|
|
375
|
+
currentSrc,
|
|
376
|
+
image,
|
|
377
|
+
state,
|
|
378
|
+
naturalWidth,
|
|
379
|
+
naturalHeight
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
export { VImg as V };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createVNode } from 'vue';
|
|
2
|
+
import { p as propsFactory, b as makeComponentProps, J as makeDimensionProps, c as makeTagProps, g as genericComponent, K as useDimension, H as useLayout, a as useRender } from './asWebComponent-DUUoR7MZ.js';
|
|
3
|
+
import { u as useSsrBoot } from './ssrBoot-BP7SYRyC.js';
|
|
4
|
+
|
|
5
|
+
const makeVMainProps = propsFactory({
|
|
6
|
+
scrollable: Boolean,
|
|
7
|
+
...makeComponentProps(),
|
|
8
|
+
...makeDimensionProps(),
|
|
9
|
+
...makeTagProps({
|
|
10
|
+
tag: 'main'
|
|
11
|
+
})
|
|
12
|
+
}, 'VMain');
|
|
13
|
+
const VMain = genericComponent()({
|
|
14
|
+
name: 'VMain',
|
|
15
|
+
props: makeVMainProps(),
|
|
16
|
+
setup(props, _ref) {
|
|
17
|
+
let {
|
|
18
|
+
slots
|
|
19
|
+
} = _ref;
|
|
20
|
+
const {
|
|
21
|
+
dimensionStyles
|
|
22
|
+
} = useDimension(props);
|
|
23
|
+
const {
|
|
24
|
+
mainStyles
|
|
25
|
+
} = useLayout();
|
|
26
|
+
const {
|
|
27
|
+
ssrBootStyles
|
|
28
|
+
} = useSsrBoot();
|
|
29
|
+
useRender(() => createVNode(props.tag, {
|
|
30
|
+
"class": ['v-main', {
|
|
31
|
+
'v-main--scrollable': props.scrollable
|
|
32
|
+
}, props.class],
|
|
33
|
+
"style": [mainStyles.value, ssrBootStyles.value, dimensionStyles.value, props.style]
|
|
34
|
+
}, {
|
|
35
|
+
default: () => [props.scrollable ? createVNode("div", {
|
|
36
|
+
"class": "v-main__scroller"
|
|
37
|
+
}, [slots.default?.()]) : slots.default?.()]
|
|
38
|
+
}));
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { VMain as V };
|