vue-datocms 3.0.1 → 3.0.3
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/index.cjs.js +141 -264
- package/dist/index.esm.mjs +141 -264
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -27,8 +27,7 @@ const useInView = ({ threshold, rootMargin }) => {
|
|
|
27
27
|
if (isIntersectionObserverAvailable()) {
|
|
28
28
|
observer.value = new IntersectionObserver(
|
|
29
29
|
(entries) => {
|
|
30
|
-
|
|
31
|
-
if (image.isIntersecting && observer.value) {
|
|
30
|
+
if (entries.some(({ isIntersecting }) => isIntersecting) && observer.value) {
|
|
32
31
|
inView.value = true;
|
|
33
32
|
observer.value.disconnect();
|
|
34
33
|
}
|
|
@@ -51,22 +50,6 @@ const useInView = ({ threshold, rootMargin }) => {
|
|
|
51
50
|
return { inView, elRef };
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
var __defProp$4 = Object.defineProperty;
|
|
55
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
56
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
57
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
58
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
59
|
-
var __spreadValues$4 = (a, b) => {
|
|
60
|
-
for (var prop in b || (b = {}))
|
|
61
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
62
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
63
|
-
if (__getOwnPropSymbols$4)
|
|
64
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
65
|
-
if (__propIsEnum$4.call(b, prop))
|
|
66
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
67
|
-
}
|
|
68
|
-
return a;
|
|
69
|
-
};
|
|
70
53
|
const Source = vueDemi.defineComponent({
|
|
71
54
|
props: {
|
|
72
55
|
srcset: {
|
|
@@ -80,36 +63,23 @@ const Source = vueDemi.defineComponent({
|
|
|
80
63
|
}
|
|
81
64
|
},
|
|
82
65
|
setup({ srcset, sizes, type }) {
|
|
83
|
-
return () => vueDemi.h("source",
|
|
84
|
-
|
|
66
|
+
return () => vueDemi.h("source", {
|
|
67
|
+
...vueDemi.isVue2 && {
|
|
68
|
+
attrs: {
|
|
69
|
+
srcset,
|
|
70
|
+
sizes,
|
|
71
|
+
type
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
...vueDemi.isVue3 && {
|
|
85
75
|
srcset,
|
|
86
76
|
sizes,
|
|
87
77
|
type
|
|
88
78
|
}
|
|
89
|
-
})
|
|
90
|
-
srcset,
|
|
91
|
-
sizes,
|
|
92
|
-
type
|
|
93
|
-
}));
|
|
79
|
+
});
|
|
94
80
|
}
|
|
95
81
|
});
|
|
96
82
|
|
|
97
|
-
var __defProp$3 = Object.defineProperty;
|
|
98
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
99
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
100
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
101
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
102
|
-
var __spreadValues$3 = (a, b) => {
|
|
103
|
-
for (var prop in b || (b = {}))
|
|
104
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
105
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
106
|
-
if (__getOwnPropSymbols$3)
|
|
107
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
108
|
-
if (__propIsEnum$3.call(b, prop))
|
|
109
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
110
|
-
}
|
|
111
|
-
return a;
|
|
112
|
-
};
|
|
113
83
|
const universalBtoa = (str) => isSsr() ? Buffer.from(str.toString(), "binary").toString("base64") : window.btoa(str);
|
|
114
84
|
const Sizer = vueDemi.defineComponent({
|
|
115
85
|
props: {
|
|
@@ -132,43 +102,27 @@ const Sizer = vueDemi.defineComponent({
|
|
|
132
102
|
},
|
|
133
103
|
setup({ sizerClass, sizerStyle, width, height, explicitWidth }) {
|
|
134
104
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"></svg>`;
|
|
135
|
-
return () => vueDemi.h("img",
|
|
105
|
+
return () => vueDemi.h("img", {
|
|
136
106
|
class: sizerClass,
|
|
137
|
-
style:
|
|
107
|
+
style: {
|
|
138
108
|
display: "block",
|
|
139
|
-
width: explicitWidth ? `${width}px` : "100%"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
109
|
+
width: explicitWidth ? `${width}px` : "100%",
|
|
110
|
+
...sizerStyle
|
|
111
|
+
},
|
|
112
|
+
...vueDemi.isVue2 && {
|
|
113
|
+
attrs: {
|
|
114
|
+
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
115
|
+
role: "presentation"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
...vueDemi.isVue3 && {
|
|
143
119
|
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
144
120
|
role: "presentation"
|
|
145
121
|
}
|
|
146
|
-
})
|
|
147
|
-
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
148
|
-
role: "presentation"
|
|
149
|
-
}));
|
|
122
|
+
});
|
|
150
123
|
}
|
|
151
124
|
});
|
|
152
125
|
|
|
153
|
-
var __defProp$2 = Object.defineProperty;
|
|
154
|
-
var __defProps$2 = Object.defineProperties;
|
|
155
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
156
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
157
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
158
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
159
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
160
|
-
var __spreadValues$2 = (a, b) => {
|
|
161
|
-
for (var prop in b || (b = {}))
|
|
162
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
163
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
164
|
-
if (__getOwnPropSymbols$2)
|
|
165
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
166
|
-
if (__propIsEnum$2.call(b, prop))
|
|
167
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
168
|
-
}
|
|
169
|
-
return a;
|
|
170
|
-
};
|
|
171
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
172
126
|
const escape = (s) => {
|
|
173
127
|
s = "" + s;
|
|
174
128
|
s = s.replace(/&/g, "&");
|
|
@@ -314,62 +268,74 @@ const Image = vueDemi.defineComponent({
|
|
|
314
268
|
inView: this.inView,
|
|
315
269
|
loaded: this.loaded
|
|
316
270
|
});
|
|
317
|
-
const webpSource = this.data.webpSrcSet && vueDemi.h(Source,
|
|
318
|
-
|
|
271
|
+
const webpSource = this.data.webpSrcSet && vueDemi.h(Source, {
|
|
272
|
+
...vueDemi.isVue2 && {
|
|
273
|
+
props: {
|
|
274
|
+
srcset: this.data.webpSrcSet,
|
|
275
|
+
sizes: this.data.sizes,
|
|
276
|
+
type: "image/webp"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
...vueDemi.isVue3 && {
|
|
319
280
|
srcset: this.data.webpSrcSet,
|
|
320
281
|
sizes: this.data.sizes,
|
|
321
282
|
type: "image/webp"
|
|
322
283
|
}
|
|
323
|
-
})
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
284
|
+
});
|
|
285
|
+
const regularSource = this.data.srcSet && vueDemi.h(Source, {
|
|
286
|
+
...vueDemi.isVue2 && {
|
|
287
|
+
props: {
|
|
288
|
+
srcset: this.data.srcSet,
|
|
289
|
+
sizes: this.data.sizes
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
...vueDemi.isVue3 && {
|
|
330
293
|
srcset: this.data.srcSet,
|
|
331
294
|
sizes: this.data.sizes
|
|
332
295
|
}
|
|
333
|
-
})
|
|
334
|
-
srcset: this.data.srcSet,
|
|
335
|
-
sizes: this.data.sizes
|
|
336
|
-
}));
|
|
296
|
+
});
|
|
337
297
|
const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms ${this.fadeInDuration || 500}ms` : void 0;
|
|
338
298
|
const placeholder = vueDemi.h("div", {
|
|
339
|
-
style:
|
|
299
|
+
style: {
|
|
340
300
|
backgroundImage: this.data.base64 ? `url(${this.data.base64})` : null,
|
|
341
301
|
backgroundColor: this.data.bgColor,
|
|
342
302
|
backgroundSize: "cover",
|
|
343
303
|
opacity: showImage ? 0 : 1,
|
|
344
304
|
objectFit: this.objectFit,
|
|
345
305
|
objectPosition: this.objectPosition,
|
|
346
|
-
transition
|
|
347
|
-
|
|
306
|
+
transition,
|
|
307
|
+
...absolutePositioning
|
|
308
|
+
}
|
|
348
309
|
});
|
|
349
310
|
const { width, aspectRatio } = this.data;
|
|
350
311
|
const height = this.data.height || width / aspectRatio;
|
|
351
|
-
const sizer = this.layout !== "fill" ? vueDemi.h(Sizer,
|
|
352
|
-
|
|
312
|
+
const sizer = this.layout !== "fill" ? vueDemi.h(Sizer, {
|
|
313
|
+
...vueDemi.isVue2 && {
|
|
314
|
+
props: {
|
|
315
|
+
sizerClass: this.pictureClass,
|
|
316
|
+
sizerStyle: this.pictureStyle,
|
|
317
|
+
width,
|
|
318
|
+
height,
|
|
319
|
+
explicitWidth: this.explicitWidth
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
...vueDemi.isVue3 && {
|
|
353
323
|
sizerClass: this.pictureClass,
|
|
354
324
|
sizerStyle: this.pictureStyle,
|
|
355
325
|
width,
|
|
356
326
|
height,
|
|
357
327
|
explicitWidth: this.explicitWidth
|
|
358
328
|
}
|
|
359
|
-
})
|
|
360
|
-
sizerClass: this.pictureClass,
|
|
361
|
-
sizerStyle: this.pictureStyle,
|
|
362
|
-
width,
|
|
363
|
-
height,
|
|
364
|
-
explicitWidth: this.explicitWidth
|
|
365
|
-
})) : null;
|
|
329
|
+
}) : null;
|
|
366
330
|
return vueDemi.h(
|
|
367
331
|
"div",
|
|
368
332
|
{
|
|
369
|
-
style:
|
|
333
|
+
style: {
|
|
370
334
|
display: this.explicitWidth ? "inline-block" : "block",
|
|
371
|
-
overflow: "hidden"
|
|
372
|
-
|
|
335
|
+
overflow: "hidden",
|
|
336
|
+
...this.layout === "fill" ? absolutePositioning : this.layout === "intrinsic" ? { position: "relative", width: "100%", maxWidth: `${width}px` } : this.layout === "fixed" ? { position: "relative", width: `${width}px` } : { position: "relative" },
|
|
337
|
+
...this.rootStyle
|
|
338
|
+
},
|
|
373
339
|
ref: "elRef"
|
|
374
340
|
},
|
|
375
341
|
[
|
|
@@ -378,32 +344,59 @@ const Image = vueDemi.defineComponent({
|
|
|
378
344
|
addImage && vueDemi.h("picture", null, [
|
|
379
345
|
webpSource,
|
|
380
346
|
regularSource,
|
|
381
|
-
this.data.src && vueDemi.h("img",
|
|
382
|
-
|
|
347
|
+
this.data.src && vueDemi.h("img", {
|
|
348
|
+
...vueDemi.isVue2 && {
|
|
349
|
+
attrs: {
|
|
350
|
+
src: this.data.src,
|
|
351
|
+
alt: this.data.alt,
|
|
352
|
+
title: this.data.title
|
|
353
|
+
},
|
|
354
|
+
on: {
|
|
355
|
+
load: this.handleLoad
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
...vueDemi.isVue3 && {
|
|
383
359
|
src: this.data.src,
|
|
384
360
|
alt: this.data.alt,
|
|
385
|
-
title: this.data.title
|
|
361
|
+
title: this.data.title,
|
|
362
|
+
onLoad: this.handleLoad
|
|
386
363
|
},
|
|
387
|
-
on: {
|
|
388
|
-
load: this.handleLoad
|
|
389
|
-
}
|
|
390
|
-
}), vueDemi.isVue3 && {
|
|
391
|
-
src: this.data.src,
|
|
392
|
-
alt: this.data.alt,
|
|
393
|
-
title: this.data.title,
|
|
394
|
-
onLoad: this.handleLoad
|
|
395
|
-
}), {
|
|
396
364
|
class: this.pictureClass,
|
|
397
|
-
style:
|
|
365
|
+
style: {
|
|
366
|
+
...absolutePositioning,
|
|
367
|
+
...this.pictureStyle,
|
|
398
368
|
opacity: showImage ? 1 : 0,
|
|
399
369
|
transition,
|
|
400
370
|
objectFit: this.objectFit,
|
|
401
371
|
objectPosition: this.objectPosition
|
|
402
|
-
}
|
|
403
|
-
})
|
|
372
|
+
}
|
|
373
|
+
})
|
|
404
374
|
]),
|
|
405
|
-
vueDemi.h("noscript",
|
|
406
|
-
|
|
375
|
+
vueDemi.h("noscript", {
|
|
376
|
+
...vueDemi.isVue2 && {
|
|
377
|
+
domProps: {
|
|
378
|
+
innerHTML: tag("picture", {}, [
|
|
379
|
+
this.data.webpSrcSet && tag("source", {
|
|
380
|
+
srcset: this.data.webpSrcSet,
|
|
381
|
+
sizes: this.data.sizes,
|
|
382
|
+
type: "image/webp"
|
|
383
|
+
}),
|
|
384
|
+
this.data.srcSet && tag("source", {
|
|
385
|
+
srcset: this.data.srcSet,
|
|
386
|
+
sizes: this.data.sizes
|
|
387
|
+
}),
|
|
388
|
+
tag("img", {
|
|
389
|
+
src: this.data.src,
|
|
390
|
+
alt: this.data.alt,
|
|
391
|
+
title: this.data.title,
|
|
392
|
+
class: this.pictureClass,
|
|
393
|
+
style: toCss({ ...this.pictureStyle, ...absolutePositioning }),
|
|
394
|
+
loading: "lazy"
|
|
395
|
+
})
|
|
396
|
+
])
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
...vueDemi.isVue3 && {
|
|
407
400
|
innerHTML: tag("picture", {}, [
|
|
408
401
|
this.data.webpSrcSet && tag("source", {
|
|
409
402
|
srcset: this.data.webpSrcSet,
|
|
@@ -419,32 +412,12 @@ const Image = vueDemi.defineComponent({
|
|
|
419
412
|
alt: this.data.alt,
|
|
420
413
|
title: this.data.title,
|
|
421
414
|
class: this.pictureClass,
|
|
422
|
-
style: toCss(
|
|
415
|
+
style: toCss({ ...this.pictureStyle, ...absolutePositioning }),
|
|
423
416
|
loading: "lazy"
|
|
424
417
|
})
|
|
425
418
|
])
|
|
426
419
|
}
|
|
427
|
-
})
|
|
428
|
-
innerHTML: tag("picture", {}, [
|
|
429
|
-
this.data.webpSrcSet && tag("source", {
|
|
430
|
-
srcset: this.data.webpSrcSet,
|
|
431
|
-
sizes: this.data.sizes,
|
|
432
|
-
type: "image/webp"
|
|
433
|
-
}),
|
|
434
|
-
this.data.srcSet && tag("source", {
|
|
435
|
-
srcset: this.data.srcSet,
|
|
436
|
-
sizes: this.data.sizes
|
|
437
|
-
}),
|
|
438
|
-
tag("img", {
|
|
439
|
-
src: this.data.src,
|
|
440
|
-
alt: this.data.alt,
|
|
441
|
-
title: this.data.title,
|
|
442
|
-
class: this.pictureClass,
|
|
443
|
-
style: toCss(__spreadValues$2(__spreadValues$2({}, this.pictureStyle), absolutePositioning)),
|
|
444
|
-
loading: "lazy"
|
|
445
|
-
})
|
|
446
|
-
])
|
|
447
|
-
}))
|
|
420
|
+
})
|
|
448
421
|
]
|
|
449
422
|
);
|
|
450
423
|
}
|
|
@@ -616,59 +589,8 @@ const DatocmsStructuredTextPlugin = {
|
|
|
616
589
|
}
|
|
617
590
|
};
|
|
618
591
|
|
|
619
|
-
var __defProp$1 = Object.defineProperty;
|
|
620
|
-
var __defProps$1 = Object.defineProperties;
|
|
621
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
622
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
623
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
624
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
625
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
626
|
-
var __spreadValues$1 = (a, b) => {
|
|
627
|
-
for (var prop in b || (b = {}))
|
|
628
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
629
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
630
|
-
if (__getOwnPropSymbols$1)
|
|
631
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
632
|
-
if (__propIsEnum$1.call(b, prop))
|
|
633
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
634
|
-
}
|
|
635
|
-
return a;
|
|
636
|
-
};
|
|
637
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
638
|
-
var __objRest = (source, exclude) => {
|
|
639
|
-
var target = {};
|
|
640
|
-
for (var prop in source)
|
|
641
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
642
|
-
target[prop] = source[prop];
|
|
643
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
644
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
645
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
646
|
-
target[prop] = source[prop];
|
|
647
|
-
}
|
|
648
|
-
return target;
|
|
649
|
-
};
|
|
650
|
-
var __async$1 = (__this, __arguments, generator) => {
|
|
651
|
-
return new Promise((resolve, reject) => {
|
|
652
|
-
var fulfilled = (value) => {
|
|
653
|
-
try {
|
|
654
|
-
step(generator.next(value));
|
|
655
|
-
} catch (e) {
|
|
656
|
-
reject(e);
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
var rejected = (value) => {
|
|
660
|
-
try {
|
|
661
|
-
step(generator.throw(value));
|
|
662
|
-
} catch (e) {
|
|
663
|
-
reject(e);
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
667
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
668
|
-
});
|
|
669
|
-
};
|
|
670
592
|
function useQuerySubscription(options) {
|
|
671
|
-
const
|
|
593
|
+
const { enabled, initialData, ...other } = options;
|
|
672
594
|
const error = vueDemi.ref(null);
|
|
673
595
|
const data = vueDemi.ref(null);
|
|
674
596
|
const status = vueDemi.ref(
|
|
@@ -682,21 +604,20 @@ function useQuerySubscription(options) {
|
|
|
682
604
|
};
|
|
683
605
|
}
|
|
684
606
|
let unsubscribe;
|
|
685
|
-
function subscribe() {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}));
|
|
607
|
+
async function subscribe() {
|
|
608
|
+
unsubscribe = await datocmsListen.subscribeToQuery({
|
|
609
|
+
...subscribeToQueryOptions,
|
|
610
|
+
onStatusChange: (connectionStatus) => {
|
|
611
|
+
status.value = connectionStatus;
|
|
612
|
+
},
|
|
613
|
+
onUpdate: (updateData) => {
|
|
614
|
+
error.value = null;
|
|
615
|
+
data.value = updateData.response.data;
|
|
616
|
+
},
|
|
617
|
+
onChannelError: (errorData) => {
|
|
618
|
+
data.value = null;
|
|
619
|
+
error.value = errorData;
|
|
620
|
+
}
|
|
700
621
|
});
|
|
701
622
|
}
|
|
702
623
|
subscribe();
|
|
@@ -709,26 +630,6 @@ function useQuerySubscription(options) {
|
|
|
709
630
|
return { error, status, data: data || initialData };
|
|
710
631
|
}
|
|
711
632
|
|
|
712
|
-
var __async = (__this, __arguments, generator) => {
|
|
713
|
-
return new Promise((resolve, reject) => {
|
|
714
|
-
var fulfilled = (value) => {
|
|
715
|
-
try {
|
|
716
|
-
step(generator.next(value));
|
|
717
|
-
} catch (e) {
|
|
718
|
-
reject(e);
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
var rejected = (value) => {
|
|
722
|
-
try {
|
|
723
|
-
step(generator.throw(value));
|
|
724
|
-
} catch (e) {
|
|
725
|
-
reject(e);
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
729
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
730
|
-
});
|
|
731
|
-
};
|
|
732
633
|
const highlightPieces = (textWithHighlightMarker) => {
|
|
733
634
|
return textWithHighlightMarker.split(/\[h\](.+?)\[\/h\]/g).map((text, index) => ({
|
|
734
635
|
text,
|
|
@@ -736,11 +637,10 @@ const highlightPieces = (textWithHighlightMarker) => {
|
|
|
736
637
|
}));
|
|
737
638
|
};
|
|
738
639
|
function useSiteSearch(config) {
|
|
739
|
-
var _a, _b, _c;
|
|
740
640
|
const state = vueDemi.reactive({
|
|
741
|
-
query:
|
|
742
|
-
page:
|
|
743
|
-
locale:
|
|
641
|
+
query: config.initialState?.query || "",
|
|
642
|
+
page: config.initialState?.page || 0,
|
|
643
|
+
locale: config.initialState?.locale
|
|
744
644
|
});
|
|
745
645
|
const error = vueDemi.ref();
|
|
746
646
|
const response = vueDemi.reactive({
|
|
@@ -751,7 +651,7 @@ function useSiteSearch(config) {
|
|
|
751
651
|
const resultsPerPage = config.resultsPerPage || 8;
|
|
752
652
|
vueDemi.watchEffect((onCleanup) => {
|
|
753
653
|
let isCancelled = false;
|
|
754
|
-
const run = () =>
|
|
654
|
+
const run = async () => {
|
|
755
655
|
try {
|
|
756
656
|
if (!state.query) {
|
|
757
657
|
response.data = [];
|
|
@@ -772,7 +672,7 @@ function useSiteSearch(config) {
|
|
|
772
672
|
if (config.fuzzySearch) {
|
|
773
673
|
request.fuzzy = "true";
|
|
774
674
|
}
|
|
775
|
-
const results =
|
|
675
|
+
const results = await config.client.searchResults.rawList(request);
|
|
776
676
|
if (!isCancelled) {
|
|
777
677
|
response.data = results.data;
|
|
778
678
|
response.meta.total_count = results.meta.total_count;
|
|
@@ -787,7 +687,7 @@ function useSiteSearch(config) {
|
|
|
787
687
|
error.value = "Unknown error!";
|
|
788
688
|
}
|
|
789
689
|
}
|
|
790
|
-
}
|
|
690
|
+
};
|
|
791
691
|
run();
|
|
792
692
|
onCleanup(() => {
|
|
793
693
|
isCancelled = true;
|
|
@@ -819,25 +719,6 @@ function useSiteSearch(config) {
|
|
|
819
719
|
};
|
|
820
720
|
}
|
|
821
721
|
|
|
822
|
-
var __defProp = Object.defineProperty;
|
|
823
|
-
var __defProps = Object.defineProperties;
|
|
824
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
825
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
826
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
827
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
828
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
829
|
-
var __spreadValues = (a, b) => {
|
|
830
|
-
for (var prop in b || (b = {}))
|
|
831
|
-
if (__hasOwnProp.call(b, prop))
|
|
832
|
-
__defNormalProp(a, prop, b[prop]);
|
|
833
|
-
if (__getOwnPropSymbols)
|
|
834
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
835
|
-
if (__propIsEnum.call(b, prop))
|
|
836
|
-
__defNormalProp(a, prop, b[prop]);
|
|
837
|
-
}
|
|
838
|
-
return a;
|
|
839
|
-
};
|
|
840
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
841
722
|
const toHead = (...args) => {
|
|
842
723
|
const tags = [].concat(...args);
|
|
843
724
|
const titleTag = tags && tags.find((t) => t.tag === "title");
|
|
@@ -845,20 +726,16 @@ const toHead = (...args) => {
|
|
|
845
726
|
const linkTags = tags ? tags.filter((t) => t.tag === "link") : [];
|
|
846
727
|
return {
|
|
847
728
|
title: titleTag && titleTag.content,
|
|
848
|
-
meta: metaTags.map((tag) => {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
hid: ((_a = tag.attributes) == null ? void 0 : _a.name) || `${(_b = tag.attributes) == null ? void 0 : _b.rel}-${(_c = tag.attributes) == null ? void 0 : _c.sizes}`,
|
|
859
|
-
vmid: ((_d = tag.attributes) == null ? void 0 : _d.name) || `${(_e = tag.attributes) == null ? void 0 : _e.rel}-${(_f = tag.attributes) == null ? void 0 : _f.sizes}`
|
|
860
|
-
});
|
|
861
|
-
})
|
|
729
|
+
meta: metaTags.map((tag) => ({
|
|
730
|
+
...tag.attributes,
|
|
731
|
+
hid: tag.attributes?.name || tag.attributes?.property,
|
|
732
|
+
vmid: tag.attributes?.name || tag.attributes?.property
|
|
733
|
+
})),
|
|
734
|
+
link: linkTags.map((tag) => ({
|
|
735
|
+
...tag.attributes,
|
|
736
|
+
hid: tag.attributes?.name || `${tag.attributes?.rel}-${tag.attributes?.sizes}`,
|
|
737
|
+
vmid: tag.attributes?.name || `${tag.attributes?.rel}-${tag.attributes?.sizes}`
|
|
738
|
+
}))
|
|
862
739
|
};
|
|
863
740
|
};
|
|
864
741
|
|
package/dist/index.esm.mjs
CHANGED
|
@@ -21,8 +21,7 @@ const useInView = ({ threshold, rootMargin }) => {
|
|
|
21
21
|
if (isIntersectionObserverAvailable()) {
|
|
22
22
|
observer.value = new IntersectionObserver(
|
|
23
23
|
(entries) => {
|
|
24
|
-
|
|
25
|
-
if (image.isIntersecting && observer.value) {
|
|
24
|
+
if (entries.some(({ isIntersecting }) => isIntersecting) && observer.value) {
|
|
26
25
|
inView.value = true;
|
|
27
26
|
observer.value.disconnect();
|
|
28
27
|
}
|
|
@@ -45,22 +44,6 @@ const useInView = ({ threshold, rootMargin }) => {
|
|
|
45
44
|
return { inView, elRef };
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
var __defProp$4 = Object.defineProperty;
|
|
49
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
50
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
51
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
52
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
53
|
-
var __spreadValues$4 = (a, b) => {
|
|
54
|
-
for (var prop in b || (b = {}))
|
|
55
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
56
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
57
|
-
if (__getOwnPropSymbols$4)
|
|
58
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
59
|
-
if (__propIsEnum$4.call(b, prop))
|
|
60
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
61
|
-
}
|
|
62
|
-
return a;
|
|
63
|
-
};
|
|
64
47
|
const Source = defineComponent({
|
|
65
48
|
props: {
|
|
66
49
|
srcset: {
|
|
@@ -74,36 +57,23 @@ const Source = defineComponent({
|
|
|
74
57
|
}
|
|
75
58
|
},
|
|
76
59
|
setup({ srcset, sizes, type }) {
|
|
77
|
-
return () => h("source",
|
|
78
|
-
|
|
60
|
+
return () => h("source", {
|
|
61
|
+
...isVue2 && {
|
|
62
|
+
attrs: {
|
|
63
|
+
srcset,
|
|
64
|
+
sizes,
|
|
65
|
+
type
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
...isVue3 && {
|
|
79
69
|
srcset,
|
|
80
70
|
sizes,
|
|
81
71
|
type
|
|
82
72
|
}
|
|
83
|
-
})
|
|
84
|
-
srcset,
|
|
85
|
-
sizes,
|
|
86
|
-
type
|
|
87
|
-
}));
|
|
73
|
+
});
|
|
88
74
|
}
|
|
89
75
|
});
|
|
90
76
|
|
|
91
|
-
var __defProp$3 = Object.defineProperty;
|
|
92
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
93
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
94
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
95
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
96
|
-
var __spreadValues$3 = (a, b) => {
|
|
97
|
-
for (var prop in b || (b = {}))
|
|
98
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
99
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
100
|
-
if (__getOwnPropSymbols$3)
|
|
101
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
102
|
-
if (__propIsEnum$3.call(b, prop))
|
|
103
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
104
|
-
}
|
|
105
|
-
return a;
|
|
106
|
-
};
|
|
107
77
|
const universalBtoa = (str) => isSsr() ? Buffer.from(str.toString(), "binary").toString("base64") : window.btoa(str);
|
|
108
78
|
const Sizer = defineComponent({
|
|
109
79
|
props: {
|
|
@@ -126,43 +96,27 @@ const Sizer = defineComponent({
|
|
|
126
96
|
},
|
|
127
97
|
setup({ sizerClass, sizerStyle, width, height, explicitWidth }) {
|
|
128
98
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"></svg>`;
|
|
129
|
-
return () => h("img",
|
|
99
|
+
return () => h("img", {
|
|
130
100
|
class: sizerClass,
|
|
131
|
-
style:
|
|
101
|
+
style: {
|
|
132
102
|
display: "block",
|
|
133
|
-
width: explicitWidth ? `${width}px` : "100%"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
103
|
+
width: explicitWidth ? `${width}px` : "100%",
|
|
104
|
+
...sizerStyle
|
|
105
|
+
},
|
|
106
|
+
...isVue2 && {
|
|
107
|
+
attrs: {
|
|
108
|
+
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
109
|
+
role: "presentation"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
...isVue3 && {
|
|
137
113
|
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
138
114
|
role: "presentation"
|
|
139
115
|
}
|
|
140
|
-
})
|
|
141
|
-
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
142
|
-
role: "presentation"
|
|
143
|
-
}));
|
|
116
|
+
});
|
|
144
117
|
}
|
|
145
118
|
});
|
|
146
119
|
|
|
147
|
-
var __defProp$2 = Object.defineProperty;
|
|
148
|
-
var __defProps$2 = Object.defineProperties;
|
|
149
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
150
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
151
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
152
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
153
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
154
|
-
var __spreadValues$2 = (a, b) => {
|
|
155
|
-
for (var prop in b || (b = {}))
|
|
156
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
157
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
158
|
-
if (__getOwnPropSymbols$2)
|
|
159
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
160
|
-
if (__propIsEnum$2.call(b, prop))
|
|
161
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
162
|
-
}
|
|
163
|
-
return a;
|
|
164
|
-
};
|
|
165
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
166
120
|
const escape = (s) => {
|
|
167
121
|
s = "" + s;
|
|
168
122
|
s = s.replace(/&/g, "&");
|
|
@@ -308,62 +262,74 @@ const Image = defineComponent({
|
|
|
308
262
|
inView: this.inView,
|
|
309
263
|
loaded: this.loaded
|
|
310
264
|
});
|
|
311
|
-
const webpSource = this.data.webpSrcSet && h(Source,
|
|
312
|
-
|
|
265
|
+
const webpSource = this.data.webpSrcSet && h(Source, {
|
|
266
|
+
...isVue2 && {
|
|
267
|
+
props: {
|
|
268
|
+
srcset: this.data.webpSrcSet,
|
|
269
|
+
sizes: this.data.sizes,
|
|
270
|
+
type: "image/webp"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
...isVue3 && {
|
|
313
274
|
srcset: this.data.webpSrcSet,
|
|
314
275
|
sizes: this.data.sizes,
|
|
315
276
|
type: "image/webp"
|
|
316
277
|
}
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
278
|
+
});
|
|
279
|
+
const regularSource = this.data.srcSet && h(Source, {
|
|
280
|
+
...isVue2 && {
|
|
281
|
+
props: {
|
|
282
|
+
srcset: this.data.srcSet,
|
|
283
|
+
sizes: this.data.sizes
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
...isVue3 && {
|
|
324
287
|
srcset: this.data.srcSet,
|
|
325
288
|
sizes: this.data.sizes
|
|
326
289
|
}
|
|
327
|
-
})
|
|
328
|
-
srcset: this.data.srcSet,
|
|
329
|
-
sizes: this.data.sizes
|
|
330
|
-
}));
|
|
290
|
+
});
|
|
331
291
|
const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms ${this.fadeInDuration || 500}ms` : void 0;
|
|
332
292
|
const placeholder = h("div", {
|
|
333
|
-
style:
|
|
293
|
+
style: {
|
|
334
294
|
backgroundImage: this.data.base64 ? `url(${this.data.base64})` : null,
|
|
335
295
|
backgroundColor: this.data.bgColor,
|
|
336
296
|
backgroundSize: "cover",
|
|
337
297
|
opacity: showImage ? 0 : 1,
|
|
338
298
|
objectFit: this.objectFit,
|
|
339
299
|
objectPosition: this.objectPosition,
|
|
340
|
-
transition
|
|
341
|
-
|
|
300
|
+
transition,
|
|
301
|
+
...absolutePositioning
|
|
302
|
+
}
|
|
342
303
|
});
|
|
343
304
|
const { width, aspectRatio } = this.data;
|
|
344
305
|
const height = this.data.height || width / aspectRatio;
|
|
345
|
-
const sizer = this.layout !== "fill" ? h(Sizer,
|
|
346
|
-
|
|
306
|
+
const sizer = this.layout !== "fill" ? h(Sizer, {
|
|
307
|
+
...isVue2 && {
|
|
308
|
+
props: {
|
|
309
|
+
sizerClass: this.pictureClass,
|
|
310
|
+
sizerStyle: this.pictureStyle,
|
|
311
|
+
width,
|
|
312
|
+
height,
|
|
313
|
+
explicitWidth: this.explicitWidth
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
...isVue3 && {
|
|
347
317
|
sizerClass: this.pictureClass,
|
|
348
318
|
sizerStyle: this.pictureStyle,
|
|
349
319
|
width,
|
|
350
320
|
height,
|
|
351
321
|
explicitWidth: this.explicitWidth
|
|
352
322
|
}
|
|
353
|
-
})
|
|
354
|
-
sizerClass: this.pictureClass,
|
|
355
|
-
sizerStyle: this.pictureStyle,
|
|
356
|
-
width,
|
|
357
|
-
height,
|
|
358
|
-
explicitWidth: this.explicitWidth
|
|
359
|
-
})) : null;
|
|
323
|
+
}) : null;
|
|
360
324
|
return h(
|
|
361
325
|
"div",
|
|
362
326
|
{
|
|
363
|
-
style:
|
|
327
|
+
style: {
|
|
364
328
|
display: this.explicitWidth ? "inline-block" : "block",
|
|
365
|
-
overflow: "hidden"
|
|
366
|
-
|
|
329
|
+
overflow: "hidden",
|
|
330
|
+
...this.layout === "fill" ? absolutePositioning : this.layout === "intrinsic" ? { position: "relative", width: "100%", maxWidth: `${width}px` } : this.layout === "fixed" ? { position: "relative", width: `${width}px` } : { position: "relative" },
|
|
331
|
+
...this.rootStyle
|
|
332
|
+
},
|
|
367
333
|
ref: "elRef"
|
|
368
334
|
},
|
|
369
335
|
[
|
|
@@ -372,32 +338,59 @@ const Image = defineComponent({
|
|
|
372
338
|
addImage && h("picture", null, [
|
|
373
339
|
webpSource,
|
|
374
340
|
regularSource,
|
|
375
|
-
this.data.src && h("img",
|
|
376
|
-
|
|
341
|
+
this.data.src && h("img", {
|
|
342
|
+
...isVue2 && {
|
|
343
|
+
attrs: {
|
|
344
|
+
src: this.data.src,
|
|
345
|
+
alt: this.data.alt,
|
|
346
|
+
title: this.data.title
|
|
347
|
+
},
|
|
348
|
+
on: {
|
|
349
|
+
load: this.handleLoad
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
...isVue3 && {
|
|
377
353
|
src: this.data.src,
|
|
378
354
|
alt: this.data.alt,
|
|
379
|
-
title: this.data.title
|
|
355
|
+
title: this.data.title,
|
|
356
|
+
onLoad: this.handleLoad
|
|
380
357
|
},
|
|
381
|
-
on: {
|
|
382
|
-
load: this.handleLoad
|
|
383
|
-
}
|
|
384
|
-
}), isVue3 && {
|
|
385
|
-
src: this.data.src,
|
|
386
|
-
alt: this.data.alt,
|
|
387
|
-
title: this.data.title,
|
|
388
|
-
onLoad: this.handleLoad
|
|
389
|
-
}), {
|
|
390
358
|
class: this.pictureClass,
|
|
391
|
-
style:
|
|
359
|
+
style: {
|
|
360
|
+
...absolutePositioning,
|
|
361
|
+
...this.pictureStyle,
|
|
392
362
|
opacity: showImage ? 1 : 0,
|
|
393
363
|
transition,
|
|
394
364
|
objectFit: this.objectFit,
|
|
395
365
|
objectPosition: this.objectPosition
|
|
396
|
-
}
|
|
397
|
-
})
|
|
366
|
+
}
|
|
367
|
+
})
|
|
398
368
|
]),
|
|
399
|
-
h("noscript",
|
|
400
|
-
|
|
369
|
+
h("noscript", {
|
|
370
|
+
...isVue2 && {
|
|
371
|
+
domProps: {
|
|
372
|
+
innerHTML: tag("picture", {}, [
|
|
373
|
+
this.data.webpSrcSet && tag("source", {
|
|
374
|
+
srcset: this.data.webpSrcSet,
|
|
375
|
+
sizes: this.data.sizes,
|
|
376
|
+
type: "image/webp"
|
|
377
|
+
}),
|
|
378
|
+
this.data.srcSet && tag("source", {
|
|
379
|
+
srcset: this.data.srcSet,
|
|
380
|
+
sizes: this.data.sizes
|
|
381
|
+
}),
|
|
382
|
+
tag("img", {
|
|
383
|
+
src: this.data.src,
|
|
384
|
+
alt: this.data.alt,
|
|
385
|
+
title: this.data.title,
|
|
386
|
+
class: this.pictureClass,
|
|
387
|
+
style: toCss({ ...this.pictureStyle, ...absolutePositioning }),
|
|
388
|
+
loading: "lazy"
|
|
389
|
+
})
|
|
390
|
+
])
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
...isVue3 && {
|
|
401
394
|
innerHTML: tag("picture", {}, [
|
|
402
395
|
this.data.webpSrcSet && tag("source", {
|
|
403
396
|
srcset: this.data.webpSrcSet,
|
|
@@ -413,32 +406,12 @@ const Image = defineComponent({
|
|
|
413
406
|
alt: this.data.alt,
|
|
414
407
|
title: this.data.title,
|
|
415
408
|
class: this.pictureClass,
|
|
416
|
-
style: toCss(
|
|
409
|
+
style: toCss({ ...this.pictureStyle, ...absolutePositioning }),
|
|
417
410
|
loading: "lazy"
|
|
418
411
|
})
|
|
419
412
|
])
|
|
420
413
|
}
|
|
421
|
-
})
|
|
422
|
-
innerHTML: tag("picture", {}, [
|
|
423
|
-
this.data.webpSrcSet && tag("source", {
|
|
424
|
-
srcset: this.data.webpSrcSet,
|
|
425
|
-
sizes: this.data.sizes,
|
|
426
|
-
type: "image/webp"
|
|
427
|
-
}),
|
|
428
|
-
this.data.srcSet && tag("source", {
|
|
429
|
-
srcset: this.data.srcSet,
|
|
430
|
-
sizes: this.data.sizes
|
|
431
|
-
}),
|
|
432
|
-
tag("img", {
|
|
433
|
-
src: this.data.src,
|
|
434
|
-
alt: this.data.alt,
|
|
435
|
-
title: this.data.title,
|
|
436
|
-
class: this.pictureClass,
|
|
437
|
-
style: toCss(__spreadValues$2(__spreadValues$2({}, this.pictureStyle), absolutePositioning)),
|
|
438
|
-
loading: "lazy"
|
|
439
|
-
})
|
|
440
|
-
])
|
|
441
|
-
}))
|
|
414
|
+
})
|
|
442
415
|
]
|
|
443
416
|
);
|
|
444
417
|
}
|
|
@@ -610,59 +583,8 @@ const DatocmsStructuredTextPlugin = {
|
|
|
610
583
|
}
|
|
611
584
|
};
|
|
612
585
|
|
|
613
|
-
var __defProp$1 = Object.defineProperty;
|
|
614
|
-
var __defProps$1 = Object.defineProperties;
|
|
615
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
616
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
617
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
618
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
619
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
620
|
-
var __spreadValues$1 = (a, b) => {
|
|
621
|
-
for (var prop in b || (b = {}))
|
|
622
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
623
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
624
|
-
if (__getOwnPropSymbols$1)
|
|
625
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
626
|
-
if (__propIsEnum$1.call(b, prop))
|
|
627
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
628
|
-
}
|
|
629
|
-
return a;
|
|
630
|
-
};
|
|
631
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
632
|
-
var __objRest = (source, exclude) => {
|
|
633
|
-
var target = {};
|
|
634
|
-
for (var prop in source)
|
|
635
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
636
|
-
target[prop] = source[prop];
|
|
637
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
638
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
639
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
640
|
-
target[prop] = source[prop];
|
|
641
|
-
}
|
|
642
|
-
return target;
|
|
643
|
-
};
|
|
644
|
-
var __async$1 = (__this, __arguments, generator) => {
|
|
645
|
-
return new Promise((resolve, reject) => {
|
|
646
|
-
var fulfilled = (value) => {
|
|
647
|
-
try {
|
|
648
|
-
step(generator.next(value));
|
|
649
|
-
} catch (e) {
|
|
650
|
-
reject(e);
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
var rejected = (value) => {
|
|
654
|
-
try {
|
|
655
|
-
step(generator.throw(value));
|
|
656
|
-
} catch (e) {
|
|
657
|
-
reject(e);
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
661
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
662
|
-
});
|
|
663
|
-
};
|
|
664
586
|
function useQuerySubscription(options) {
|
|
665
|
-
const
|
|
587
|
+
const { enabled, initialData, ...other } = options;
|
|
666
588
|
const error = ref(null);
|
|
667
589
|
const data = ref(null);
|
|
668
590
|
const status = ref(
|
|
@@ -676,21 +598,20 @@ function useQuerySubscription(options) {
|
|
|
676
598
|
};
|
|
677
599
|
}
|
|
678
600
|
let unsubscribe;
|
|
679
|
-
function subscribe() {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}));
|
|
601
|
+
async function subscribe() {
|
|
602
|
+
unsubscribe = await subscribeToQuery({
|
|
603
|
+
...subscribeToQueryOptions,
|
|
604
|
+
onStatusChange: (connectionStatus) => {
|
|
605
|
+
status.value = connectionStatus;
|
|
606
|
+
},
|
|
607
|
+
onUpdate: (updateData) => {
|
|
608
|
+
error.value = null;
|
|
609
|
+
data.value = updateData.response.data;
|
|
610
|
+
},
|
|
611
|
+
onChannelError: (errorData) => {
|
|
612
|
+
data.value = null;
|
|
613
|
+
error.value = errorData;
|
|
614
|
+
}
|
|
694
615
|
});
|
|
695
616
|
}
|
|
696
617
|
subscribe();
|
|
@@ -703,26 +624,6 @@ function useQuerySubscription(options) {
|
|
|
703
624
|
return { error, status, data: data || initialData };
|
|
704
625
|
}
|
|
705
626
|
|
|
706
|
-
var __async = (__this, __arguments, generator) => {
|
|
707
|
-
return new Promise((resolve, reject) => {
|
|
708
|
-
var fulfilled = (value) => {
|
|
709
|
-
try {
|
|
710
|
-
step(generator.next(value));
|
|
711
|
-
} catch (e) {
|
|
712
|
-
reject(e);
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
var rejected = (value) => {
|
|
716
|
-
try {
|
|
717
|
-
step(generator.throw(value));
|
|
718
|
-
} catch (e) {
|
|
719
|
-
reject(e);
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
723
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
724
|
-
});
|
|
725
|
-
};
|
|
726
627
|
const highlightPieces = (textWithHighlightMarker) => {
|
|
727
628
|
return textWithHighlightMarker.split(/\[h\](.+?)\[\/h\]/g).map((text, index) => ({
|
|
728
629
|
text,
|
|
@@ -730,11 +631,10 @@ const highlightPieces = (textWithHighlightMarker) => {
|
|
|
730
631
|
}));
|
|
731
632
|
};
|
|
732
633
|
function useSiteSearch(config) {
|
|
733
|
-
var _a, _b, _c;
|
|
734
634
|
const state = reactive({
|
|
735
|
-
query:
|
|
736
|
-
page:
|
|
737
|
-
locale:
|
|
635
|
+
query: config.initialState?.query || "",
|
|
636
|
+
page: config.initialState?.page || 0,
|
|
637
|
+
locale: config.initialState?.locale
|
|
738
638
|
});
|
|
739
639
|
const error = ref();
|
|
740
640
|
const response = reactive({
|
|
@@ -745,7 +645,7 @@ function useSiteSearch(config) {
|
|
|
745
645
|
const resultsPerPage = config.resultsPerPage || 8;
|
|
746
646
|
watchEffect((onCleanup) => {
|
|
747
647
|
let isCancelled = false;
|
|
748
|
-
const run = () =>
|
|
648
|
+
const run = async () => {
|
|
749
649
|
try {
|
|
750
650
|
if (!state.query) {
|
|
751
651
|
response.data = [];
|
|
@@ -766,7 +666,7 @@ function useSiteSearch(config) {
|
|
|
766
666
|
if (config.fuzzySearch) {
|
|
767
667
|
request.fuzzy = "true";
|
|
768
668
|
}
|
|
769
|
-
const results =
|
|
669
|
+
const results = await config.client.searchResults.rawList(request);
|
|
770
670
|
if (!isCancelled) {
|
|
771
671
|
response.data = results.data;
|
|
772
672
|
response.meta.total_count = results.meta.total_count;
|
|
@@ -781,7 +681,7 @@ function useSiteSearch(config) {
|
|
|
781
681
|
error.value = "Unknown error!";
|
|
782
682
|
}
|
|
783
683
|
}
|
|
784
|
-
}
|
|
684
|
+
};
|
|
785
685
|
run();
|
|
786
686
|
onCleanup(() => {
|
|
787
687
|
isCancelled = true;
|
|
@@ -813,25 +713,6 @@ function useSiteSearch(config) {
|
|
|
813
713
|
};
|
|
814
714
|
}
|
|
815
715
|
|
|
816
|
-
var __defProp = Object.defineProperty;
|
|
817
|
-
var __defProps = Object.defineProperties;
|
|
818
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
819
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
820
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
821
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
822
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
823
|
-
var __spreadValues = (a, b) => {
|
|
824
|
-
for (var prop in b || (b = {}))
|
|
825
|
-
if (__hasOwnProp.call(b, prop))
|
|
826
|
-
__defNormalProp(a, prop, b[prop]);
|
|
827
|
-
if (__getOwnPropSymbols)
|
|
828
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
829
|
-
if (__propIsEnum.call(b, prop))
|
|
830
|
-
__defNormalProp(a, prop, b[prop]);
|
|
831
|
-
}
|
|
832
|
-
return a;
|
|
833
|
-
};
|
|
834
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
835
716
|
const toHead = (...args) => {
|
|
836
717
|
const tags = [].concat(...args);
|
|
837
718
|
const titleTag = tags && tags.find((t) => t.tag === "title");
|
|
@@ -839,20 +720,16 @@ const toHead = (...args) => {
|
|
|
839
720
|
const linkTags = tags ? tags.filter((t) => t.tag === "link") : [];
|
|
840
721
|
return {
|
|
841
722
|
title: titleTag && titleTag.content,
|
|
842
|
-
meta: metaTags.map((tag) => {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
hid: ((_a = tag.attributes) == null ? void 0 : _a.name) || `${(_b = tag.attributes) == null ? void 0 : _b.rel}-${(_c = tag.attributes) == null ? void 0 : _c.sizes}`,
|
|
853
|
-
vmid: ((_d = tag.attributes) == null ? void 0 : _d.name) || `${(_e = tag.attributes) == null ? void 0 : _e.rel}-${(_f = tag.attributes) == null ? void 0 : _f.sizes}`
|
|
854
|
-
});
|
|
855
|
-
})
|
|
723
|
+
meta: metaTags.map((tag) => ({
|
|
724
|
+
...tag.attributes,
|
|
725
|
+
hid: tag.attributes?.name || tag.attributes?.property,
|
|
726
|
+
vmid: tag.attributes?.name || tag.attributes?.property
|
|
727
|
+
})),
|
|
728
|
+
link: linkTags.map((tag) => ({
|
|
729
|
+
...tag.attributes,
|
|
730
|
+
hid: tag.attributes?.name || `${tag.attributes?.rel}-${tag.attributes?.sizes}`,
|
|
731
|
+
vmid: tag.attributes?.name || `${tag.attributes?.rel}-${tag.attributes?.sizes}`
|
|
732
|
+
}))
|
|
856
733
|
};
|
|
857
734
|
};
|
|
858
735
|
|