vue-datocms 1.1.0 → 2.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +103 -39
- package/dist/index.esm.js +93 -165
- package/dist/index.min.js +104 -174
- package/dist/index.umd.js +104 -174
- package/package.json +16 -20
package/dist/index.min.js
CHANGED
|
@@ -1,59 +1,22 @@
|
|
|
1
|
-
var VueDatocms=(function(exports,hypenateStyleName,
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols$3)
|
|
11
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
12
|
-
if (__propIsEnum$3.call(b, prop))
|
|
13
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest$1 = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
23
|
-
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
function crossH(tag, data, ...rest) {
|
|
30
|
-
if (vueDemi.isVue3) {
|
|
31
|
-
let vue3Data = null;
|
|
32
|
-
if (data) {
|
|
33
|
-
const _a = data, {domProps, attrs, props, on} = _a, other = __objRest$1(_a, ["domProps", "attrs", "props", "on"]);
|
|
34
|
-
vue3Data = __objSpread$2(__objSpread$2(__objSpread$2(__objSpread$2(__objSpread$2({}, other), attrs), props), domProps), Object.entries(on || {}).reduce((acc, [key, value]) => __objSpread$2(__objSpread$2({}, acc), {
|
|
35
|
-
[`on${key.charAt(0).toUpperCase() + key.slice(1)}`]: value
|
|
36
|
-
}), {}));
|
|
37
|
-
}
|
|
38
|
-
return vueDemi.h(tag, vue3Data, ...rest);
|
|
39
|
-
}
|
|
40
|
-
return vueDemi.h(tag, data, ...rest);
|
|
41
|
-
}var __defProp$1 = Object.defineProperty;
|
|
42
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
43
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
44
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
45
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
46
|
-
var __objSpread$1 = (a, b) => {
|
|
1
|
+
var VueDatocms=(function(exports,hypenateStyleName,vue,datocmsStructuredTextGenericHtmlRenderer,datocmsStructuredTextUtils){'use strict';function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var hypenateStyleName__default=/*#__PURE__*/_interopDefaultLegacy(hypenateStyleName);var __defProp$1 = Object.defineProperty;
|
|
2
|
+
var __defProps$1 = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues$1 = (a, b) => {
|
|
47
9
|
for (var prop in b || (b = {}))
|
|
48
|
-
if (__hasOwnProp$
|
|
10
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
49
11
|
__defNormalProp$1(a, prop, b[prop]);
|
|
50
|
-
if (__getOwnPropSymbols$
|
|
51
|
-
for (var prop of __getOwnPropSymbols$
|
|
52
|
-
if (__propIsEnum$
|
|
12
|
+
if (__getOwnPropSymbols$1)
|
|
13
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
14
|
+
if (__propIsEnum$1.call(b, prop))
|
|
53
15
|
__defNormalProp$1(a, prop, b[prop]);
|
|
54
16
|
}
|
|
55
17
|
return a;
|
|
56
18
|
};
|
|
19
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
57
20
|
const escape = (s) => {
|
|
58
21
|
s = "" + s;
|
|
59
22
|
s = s.replace(/&/g, "&");
|
|
@@ -70,7 +33,7 @@ const toCss = (object) => {
|
|
|
70
33
|
let result = "";
|
|
71
34
|
for (var styleName in object) {
|
|
72
35
|
if (Object.prototype.hasOwnProperty.call(object, styleName) && object[styleName]) {
|
|
73
|
-
result += `${hypenateStyleName__default[
|
|
36
|
+
result += `${hypenateStyleName__default["default"](styleName)}: ${object[styleName]}; `;
|
|
74
37
|
}
|
|
75
38
|
}
|
|
76
39
|
return result.length > 0 ? result : null;
|
|
@@ -90,9 +53,11 @@ const tag = (tagName, attrs, content) => {
|
|
|
90
53
|
const attrsString = serializedAttrs.length > 0 ? ` ${serializedAttrs.join(" ")}` : "";
|
|
91
54
|
return content ? `<${tagName}${attrsString}>${content.join("")}</${tagName}>` : `<${tagName}${attrsString} />`;
|
|
92
55
|
};
|
|
93
|
-
const isSsr = typeof window === "undefined";
|
|
94
|
-
const isIntersectionObserverAvailable =
|
|
95
|
-
|
|
56
|
+
const isSsr = () => typeof window === "undefined";
|
|
57
|
+
const isIntersectionObserverAvailable = () => {
|
|
58
|
+
return isSsr() ? false : !!window.IntersectionObserver;
|
|
59
|
+
};
|
|
60
|
+
const universalBtoa = (str) => isSsr() ? Buffer.from(str.toString(), "binary").toString("base64") : window.btoa(str);
|
|
96
61
|
const absolutePositioning = {
|
|
97
62
|
position: "absolute",
|
|
98
63
|
left: "0px",
|
|
@@ -100,12 +65,12 @@ const absolutePositioning = {
|
|
|
100
65
|
width: "100%",
|
|
101
66
|
height: "100%"
|
|
102
67
|
};
|
|
103
|
-
const useInView = ({threshold, rootMargin}) => {
|
|
104
|
-
const observer =
|
|
105
|
-
const elRef =
|
|
106
|
-
const inView =
|
|
107
|
-
|
|
108
|
-
if (isIntersectionObserverAvailable) {
|
|
68
|
+
const useInView = ({ threshold, rootMargin }) => {
|
|
69
|
+
const observer = vue.ref(null);
|
|
70
|
+
const elRef = vue.ref(null);
|
|
71
|
+
const inView = vue.ref(false);
|
|
72
|
+
vue.onMounted(() => {
|
|
73
|
+
if (isIntersectionObserverAvailable()) {
|
|
109
74
|
observer.value = new IntersectionObserver((entries) => {
|
|
110
75
|
const image = entries[0];
|
|
111
76
|
if (image.isIntersecting && observer.value) {
|
|
@@ -121,38 +86,38 @@ const useInView = ({threshold, rootMargin}) => {
|
|
|
121
86
|
}
|
|
122
87
|
}
|
|
123
88
|
});
|
|
124
|
-
|
|
125
|
-
if (isIntersectionObserverAvailable && observer.value) {
|
|
89
|
+
vue.onBeforeUnmount(() => {
|
|
90
|
+
if (isIntersectionObserverAvailable() && observer.value) {
|
|
126
91
|
observer.value.disconnect();
|
|
127
92
|
}
|
|
128
93
|
});
|
|
129
|
-
return {inView, elRef};
|
|
94
|
+
return { inView, elRef };
|
|
130
95
|
};
|
|
131
|
-
const imageAddStrategy = ({lazyLoad, inView, loaded}) => {
|
|
96
|
+
const imageAddStrategy = ({ lazyLoad, inView, loaded }) => {
|
|
132
97
|
if (!lazyLoad) {
|
|
133
98
|
return true;
|
|
134
99
|
}
|
|
135
|
-
if (isSsr) {
|
|
100
|
+
if (isSsr()) {
|
|
136
101
|
return false;
|
|
137
102
|
}
|
|
138
|
-
if (isIntersectionObserverAvailable) {
|
|
103
|
+
if (isIntersectionObserverAvailable()) {
|
|
139
104
|
return inView || loaded;
|
|
140
105
|
}
|
|
141
106
|
return true;
|
|
142
107
|
};
|
|
143
|
-
const imageShowStrategy = ({lazyLoad, loaded}) => {
|
|
108
|
+
const imageShowStrategy = ({ lazyLoad, loaded }) => {
|
|
144
109
|
if (!lazyLoad) {
|
|
145
110
|
return true;
|
|
146
111
|
}
|
|
147
|
-
if (isSsr) {
|
|
112
|
+
if (isSsr()) {
|
|
148
113
|
return false;
|
|
149
114
|
}
|
|
150
|
-
if (isIntersectionObserverAvailable) {
|
|
115
|
+
if (isIntersectionObserverAvailable()) {
|
|
151
116
|
return loaded;
|
|
152
117
|
}
|
|
153
118
|
return true;
|
|
154
119
|
};
|
|
155
|
-
const Image =
|
|
120
|
+
const Image = vue.defineComponent({
|
|
156
121
|
name: "DatocmsImage",
|
|
157
122
|
props: {
|
|
158
123
|
data: {
|
|
@@ -189,11 +154,11 @@ const Image = vueDemi.defineComponent({
|
|
|
189
154
|
}
|
|
190
155
|
},
|
|
191
156
|
setup(props) {
|
|
192
|
-
const loaded =
|
|
157
|
+
const loaded = vue.ref(false);
|
|
193
158
|
function handleLoad() {
|
|
194
159
|
loaded.value = true;
|
|
195
160
|
}
|
|
196
|
-
const {inView, elRef} = useInView({
|
|
161
|
+
const { inView, elRef } = useInView({
|
|
197
162
|
threshold: props.intersectionThreshold || props.intersectionTreshold || 0,
|
|
198
163
|
rootMargin: props.intersectionMargin || "0px 0px 0px 0px"
|
|
199
164
|
});
|
|
@@ -215,22 +180,18 @@ const Image = vueDemi.defineComponent({
|
|
|
215
180
|
inView: this.inView,
|
|
216
181
|
loaded: this.loaded
|
|
217
182
|
});
|
|
218
|
-
const webpSource = this.data.webpSrcSet &&
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
type: "image/webp"
|
|
223
|
-
}
|
|
183
|
+
const webpSource = this.data.webpSrcSet && vue.h("source", {
|
|
184
|
+
srcset: this.data.webpSrcSet,
|
|
185
|
+
sizes: this.data.sizes,
|
|
186
|
+
type: "image/webp"
|
|
224
187
|
});
|
|
225
|
-
const regularSource = this.data.srcSet &&
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
sizes: this.data.sizes
|
|
229
|
-
}
|
|
188
|
+
const regularSource = this.data.srcSet && vue.h("source", {
|
|
189
|
+
srcset: this.data.srcSet,
|
|
190
|
+
sizes: this.data.sizes
|
|
230
191
|
});
|
|
231
192
|
const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms ${this.fadeInDuration || 500}ms` : void 0;
|
|
232
|
-
const placeholder =
|
|
233
|
-
style:
|
|
193
|
+
const placeholder = vue.h("div", {
|
|
194
|
+
style: __spreadValues$1({
|
|
234
195
|
backgroundImage: this.data.base64 ? `url(${this.data.base64})` : null,
|
|
235
196
|
backgroundColor: this.data.bgColor,
|
|
236
197
|
backgroundSize: "cover",
|
|
@@ -238,21 +199,19 @@ const Image = vueDemi.defineComponent({
|
|
|
238
199
|
transition
|
|
239
200
|
}, absolutePositioning)
|
|
240
201
|
});
|
|
241
|
-
const {width, aspectRatio} = this.data;
|
|
202
|
+
const { width, aspectRatio } = this.data;
|
|
242
203
|
const height = this.data.height || width / aspectRatio;
|
|
243
204
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"></svg>`;
|
|
244
|
-
const sizer =
|
|
205
|
+
const sizer = vue.h("img", {
|
|
245
206
|
class: this.pictureClass,
|
|
246
|
-
style:
|
|
207
|
+
style: __spreadValues$1({
|
|
247
208
|
display: "block",
|
|
248
209
|
width: this.explicitWidth ? `${width}px` : "100%"
|
|
249
210
|
}, this.pictureStyle),
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
role: "presentation"
|
|
253
|
-
}
|
|
211
|
+
src: `data:image/svg+xml;base64,${universalBtoa(svg)}`,
|
|
212
|
+
role: "presentation"
|
|
254
213
|
});
|
|
255
|
-
return
|
|
214
|
+
return vue.h("div", {
|
|
256
215
|
style: {
|
|
257
216
|
display: this.explicitWidth ? "inline-block" : "block",
|
|
258
217
|
overflow: "hidden",
|
|
@@ -262,47 +221,41 @@ const Image = vueDemi.defineComponent({
|
|
|
262
221
|
}, [
|
|
263
222
|
sizer,
|
|
264
223
|
placeholder,
|
|
265
|
-
addImage &&
|
|
224
|
+
addImage && vue.h("picture", null, [
|
|
266
225
|
webpSource,
|
|
267
226
|
regularSource,
|
|
268
|
-
this.data.src &&
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
on: {
|
|
275
|
-
load: this.handleLoad
|
|
276
|
-
},
|
|
227
|
+
this.data.src && vue.h("img", {
|
|
228
|
+
src: this.data.src,
|
|
229
|
+
alt: this.data.alt,
|
|
230
|
+
title: this.data.title,
|
|
231
|
+
onLoad: this.handleLoad,
|
|
277
232
|
class: this.pictureClass,
|
|
278
|
-
style:
|
|
233
|
+
style: __spreadProps$1(__spreadValues$1(__spreadValues$1({}, absolutePositioning), this.pictureStyle), {
|
|
279
234
|
opacity: showImage ? 1 : 0,
|
|
280
235
|
transition
|
|
281
236
|
})
|
|
282
237
|
})
|
|
283
238
|
]),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
this.data.webpSrcSet
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this.data.srcSet
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
])
|
|
305
|
-
}
|
|
239
|
+
vue.h("noscript", {
|
|
240
|
+
innerHTML: tag("picture", {}, [
|
|
241
|
+
this.data.webpSrcSet && tag("source", {
|
|
242
|
+
srcset: this.data.webpSrcSet,
|
|
243
|
+
sizes: this.data.sizes,
|
|
244
|
+
type: "image/webp"
|
|
245
|
+
}),
|
|
246
|
+
this.data.srcSet && tag("source", {
|
|
247
|
+
srcset: this.data.srcSet,
|
|
248
|
+
sizes: this.data.sizes
|
|
249
|
+
}),
|
|
250
|
+
tag("img", {
|
|
251
|
+
src: this.data.src,
|
|
252
|
+
alt: this.data.alt,
|
|
253
|
+
title: this.data.title,
|
|
254
|
+
class: this.pictureClass,
|
|
255
|
+
style: toCss(__spreadValues$1(__spreadValues$1({}, this.pictureStyle), absolutePositioning)),
|
|
256
|
+
loading: "lazy"
|
|
257
|
+
})
|
|
258
|
+
])
|
|
306
259
|
})
|
|
307
260
|
]);
|
|
308
261
|
}
|
|
@@ -311,28 +264,8 @@ const DatocmsImagePlugin = {
|
|
|
311
264
|
install: (Vue) => {
|
|
312
265
|
Vue.component("DatocmsImage", Image);
|
|
313
266
|
}
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
317
|
-
var __objRest = (source, exclude) => {
|
|
318
|
-
var target = {};
|
|
319
|
-
for (var prop in source)
|
|
320
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
321
|
-
target[prop] = source[prop];
|
|
322
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
323
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
324
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
325
|
-
target[prop] = source[prop];
|
|
326
|
-
}
|
|
327
|
-
return target;
|
|
328
|
-
};
|
|
329
|
-
const hAdapter = (tagName, props, childOrChildren) => {
|
|
330
|
-
let data = props;
|
|
331
|
-
if (props) {
|
|
332
|
-
const _a = props, {key} = _a, attrs = __objRest(_a, ["key"]);
|
|
333
|
-
data = {key, attrs};
|
|
334
|
-
}
|
|
335
|
-
return crossH(tagName, data, Array.isArray(childOrChildren) ? childOrChildren : [childOrChildren]);
|
|
267
|
+
};const hAdapter = (tagName, props, childOrChildren) => {
|
|
268
|
+
return vue.h(tagName, props, Array.isArray(childOrChildren) ? childOrChildren : [childOrChildren]);
|
|
336
269
|
};
|
|
337
270
|
const defaultAdapter = {
|
|
338
271
|
renderNode: hAdapter,
|
|
@@ -341,18 +274,12 @@ const defaultAdapter = {
|
|
|
341
274
|
renderText: (text, key) => text
|
|
342
275
|
};
|
|
343
276
|
function appendKeyToValidElement(element, key) {
|
|
344
|
-
if (
|
|
345
|
-
|
|
346
|
-
if (isVNode(element) && element.key === null) {
|
|
347
|
-
return cloneVNode(element, {key});
|
|
348
|
-
}
|
|
349
|
-
} else if (element && typeof element === "object" && (element.key === null || element.key === void 0)) {
|
|
350
|
-
element.key = key;
|
|
351
|
-
return element;
|
|
277
|
+
if (vue.isVNode(element) && element.key === null) {
|
|
278
|
+
return vue.cloneVNode(element, { key });
|
|
352
279
|
}
|
|
353
280
|
return element;
|
|
354
281
|
}
|
|
355
|
-
const StructuredText =
|
|
282
|
+
const StructuredText = vue.defineComponent({
|
|
356
283
|
name: "DatocmsStructuredText",
|
|
357
284
|
props: {
|
|
358
285
|
data: {
|
|
@@ -376,10 +303,10 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
376
303
|
renderBlock: {
|
|
377
304
|
type: Function
|
|
378
305
|
},
|
|
379
|
-
metaTransformer: {type: Function},
|
|
380
|
-
renderText: {type: Function},
|
|
381
|
-
renderNode: {type: Function},
|
|
382
|
-
renderFragment: {type: Function}
|
|
306
|
+
metaTransformer: { type: Function },
|
|
307
|
+
renderText: { type: Function },
|
|
308
|
+
renderNode: { type: Function },
|
|
309
|
+
renderFragment: { type: Function }
|
|
383
310
|
},
|
|
384
311
|
setup(props) {
|
|
385
312
|
return () => {
|
|
@@ -392,10 +319,10 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
392
319
|
metaTransformer: props.metaTransformer,
|
|
393
320
|
customMarkRules: props.customMarkRules,
|
|
394
321
|
customNodeRules: [
|
|
395
|
-
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isRoot, ({adapter: {renderNode}, key, children}) => {
|
|
396
|
-
return renderNode("div", {key}, children);
|
|
322
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isRoot, ({ adapter: { renderNode }, key, children }) => {
|
|
323
|
+
return renderNode("div", { key }, children);
|
|
397
324
|
}),
|
|
398
|
-
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isInlineItem, ({node, key}) => {
|
|
325
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isInlineItem, ({ node, key }) => {
|
|
399
326
|
if (!props.renderInlineRecord) {
|
|
400
327
|
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but no 'renderInlineRecord' prop is specified!`, node);
|
|
401
328
|
}
|
|
@@ -406,9 +333,9 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
406
333
|
if (!item) {
|
|
407
334
|
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
408
335
|
}
|
|
409
|
-
return appendKeyToValidElement(props.renderInlineRecord({record: item}), key);
|
|
336
|
+
return appendKeyToValidElement(props.renderInlineRecord({ record: item }), key);
|
|
410
337
|
}),
|
|
411
|
-
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isItemLink, ({node, key, children}) => {
|
|
338
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isItemLink, ({ node, key, children }) => {
|
|
412
339
|
if (!props.renderLinkToRecord) {
|
|
413
340
|
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but no 'renderLinkToRecord' prop is specified!`, node);
|
|
414
341
|
}
|
|
@@ -428,7 +355,7 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
428
355
|
}) : null
|
|
429
356
|
}), key);
|
|
430
357
|
}),
|
|
431
|
-
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isBlock, ({node, key}) => {
|
|
358
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isBlock, ({ node, key }) => {
|
|
432
359
|
if (!props.renderBlock) {
|
|
433
360
|
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but no 'renderBlock' prop is specified!`, node);
|
|
434
361
|
}
|
|
@@ -439,7 +366,7 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
439
366
|
if (!item) {
|
|
440
367
|
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`, node);
|
|
441
368
|
}
|
|
442
|
-
return appendKeyToValidElement(props.renderBlock({record: item}), key);
|
|
369
|
+
return appendKeyToValidElement(props.renderBlock({ record: item }), key);
|
|
443
370
|
}),
|
|
444
371
|
...props.customNodeRules || props.customRules || []
|
|
445
372
|
]
|
|
@@ -452,11 +379,13 @@ const DatocmsStructuredTextPlugin = {
|
|
|
452
379
|
Vue.component("DatocmsStructuredText", StructuredText);
|
|
453
380
|
}
|
|
454
381
|
};var __defProp = Object.defineProperty;
|
|
455
|
-
var
|
|
382
|
+
var __defProps = Object.defineProperties;
|
|
383
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
456
384
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
385
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
457
386
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
458
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
459
|
-
var
|
|
387
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
388
|
+
var __spreadValues = (a, b) => {
|
|
460
389
|
for (var prop in b || (b = {}))
|
|
461
390
|
if (__hasOwnProp.call(b, prop))
|
|
462
391
|
__defNormalProp(a, prop, b[prop]);
|
|
@@ -467,6 +396,7 @@ var __objSpread = (a, b) => {
|
|
|
467
396
|
}
|
|
468
397
|
return a;
|
|
469
398
|
};
|
|
399
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
470
400
|
const toHead = (...args) => {
|
|
471
401
|
const tags = [].concat(...args);
|
|
472
402
|
const titleTag = tags && tags.find((t) => t.tag === "title");
|
|
@@ -476,17 +406,17 @@ const toHead = (...args) => {
|
|
|
476
406
|
title: titleTag && titleTag.content,
|
|
477
407
|
meta: metaTags.map((tag) => {
|
|
478
408
|
var _a, _b, _c, _d;
|
|
479
|
-
return
|
|
409
|
+
return __spreadProps(__spreadValues({}, tag.attributes), {
|
|
480
410
|
hid: ((_a = tag.attributes) == null ? void 0 : _a.name) || ((_b = tag.attributes) == null ? void 0 : _b.property),
|
|
481
411
|
vmid: ((_c = tag.attributes) == null ? void 0 : _c.name) || ((_d = tag.attributes) == null ? void 0 : _d.property)
|
|
482
412
|
});
|
|
483
413
|
}),
|
|
484
414
|
link: linkTags.map((tag) => {
|
|
485
415
|
var _a, _b, _c, _d, _e, _f;
|
|
486
|
-
return
|
|
416
|
+
return __spreadProps(__spreadValues({}, tag.attributes), {
|
|
487
417
|
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}`,
|
|
488
418
|
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}`
|
|
489
419
|
});
|
|
490
420
|
})
|
|
491
421
|
};
|
|
492
|
-
};Object.defineProperty(exports,'renderMarkRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderMarkRule
|
|
422
|
+
};Object.defineProperty(exports,'renderMarkRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderMarkRule}});Object.defineProperty(exports,'renderNodeRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderNodeRule}});Object.defineProperty(exports,'renderRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderNodeRule}});Object.defineProperty(exports,'RenderError',{enumerable:true,get:function(){return datocmsStructuredTextUtils.RenderError}});exports.DatocmsImagePlugin=DatocmsImagePlugin;exports.DatocmsStructuredTextPlugin=DatocmsStructuredTextPlugin;exports.Image=Image;exports.StructuredText=StructuredText;exports.appendKeyToValidElement=appendKeyToValidElement;exports.defaultAdapter=defaultAdapter;exports.toHead=toHead;Object.defineProperty(exports,'__esModule',{value:true});return exports;})({},hypenateStyleName,vue,datocmsStructuredTextGenericHtmlRenderer,datocmsStructuredTextUtils);
|