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