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