@prismicio/vue 3.0.0 → 3.1.1

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 CHANGED
@@ -87,7 +87,10 @@ const usePrismicImage = (props) => {
87
87
  const pixelDensities = vue.unref(props.pixelDensities);
88
88
  if (widths) {
89
89
  if (!__PRODUCTION__ && pixelDensities) {
90
- console.warn("[PrismicImage] Only one of `widths` or `pixelDensities` props can be provided. You can resolve this warning by removing either the `widths` or `pixelDensities` prop. `widths` will be used in this case.", props);
90
+ console.warn(
91
+ "[PrismicImage] Only one of `widths` or `pixelDensities` props can be provided. You can resolve this warning by removing either the `widths` or `pixelDensities` prop. `widths` will be used in this case.",
92
+ props
93
+ );
91
94
  }
92
95
  return helpers.asImageWidthSrcSet(field, {
93
96
  ...imgixParams,
@@ -298,9 +301,17 @@ const PrismicLinkImpl = /* @__PURE__ */ vue.defineComponent({
298
301
  const { type, href, target, rel } = usePrismicLink(props);
299
302
  return () => {
300
303
  const parent = type.value === "a" ? "a" : simplyResolveComponent(type.value);
301
- const computedSlots = getSlots(parent, slots, vue.reactive({ href: href.value }));
304
+ const computedSlots = getSlots(
305
+ parent,
306
+ slots,
307
+ vue.reactive({ href: href.value })
308
+ );
302
309
  if (typeof parent === "string") {
303
- return vue.h(parent, { href: href.value, target: target.value, rel: rel.value }, computedSlots);
310
+ return vue.h(
311
+ parent,
312
+ { href: href.value, target: target.value, rel: rel.value },
313
+ computedSlots
314
+ );
304
315
  } else {
305
316
  return vue.h(parent, { to: href.value }, computedSlots);
306
317
  }
@@ -431,13 +442,19 @@ const PrismicRichTextImpl = /* @__PURE__ */ vue.defineComponent({
431
442
  }
432
443
  };
433
444
  const removeListeners = () => {
434
- links.forEach(({ element, listener }) => element.removeEventListener("click", listener));
445
+ links.forEach(
446
+ ({ element, listener }) => element.removeEventListener("click", listener)
447
+ );
435
448
  links = [];
436
449
  };
437
- vue.watch(html, () => {
438
- removeListeners();
439
- vue.nextTick(addListeners);
440
- }, { immediate: true });
450
+ vue.watch(
451
+ html,
452
+ () => {
453
+ removeListeners();
454
+ vue.nextTick(addListeners);
455
+ },
456
+ { immediate: true }
457
+ );
441
458
  vue.onBeforeUnmount(() => {
442
459
  removeListeners();
443
460
  });
@@ -474,15 +491,24 @@ const TODOSliceComponent = __PRODUCTION__ ? () => null : /* @__PURE__ */ vue.def
474
491
  name: "TODOSliceComponent",
475
492
  props: getSliceComponentProps(),
476
493
  setup(props) {
477
- const type = vue.computed(() => "slice_type" in props.slice ? props.slice.slice_type : props.slice.type);
494
+ const type = vue.computed(
495
+ () => "slice_type" in props.slice ? props.slice.slice_type : props.slice.type
496
+ );
478
497
  vue.watchEffect(() => {
479
- console.warn(`[SliceZone] Could not find a component for Slice type "${type.value}"`, props.slice);
498
+ console.warn(
499
+ `[SliceZone] Could not find a component for Slice type "${type.value}"`,
500
+ props.slice
501
+ );
480
502
  });
481
503
  return () => {
482
- return vue.h("section", {
483
- "data-slice-zone-todo-component": "",
484
- "data-slice-type": type.value
485
- }, [`Could not find a component for Slice type "${type.value}"`]);
504
+ return vue.h(
505
+ "section",
506
+ {
507
+ "data-slice-zone-todo-component": "",
508
+ "data-slice-type": type.value
509
+ },
510
+ [`Could not find a component for Slice type "${type.value}"`]
511
+ );
486
512
  };
487
513
  }
488
514
  });
@@ -491,7 +517,9 @@ const defineSliceZoneComponents = (components) => {
491
517
  let type;
492
518
  for (type in components) {
493
519
  const component = components[type];
494
- result[type] = typeof component === "string" ? component : vue.markRaw(component);
520
+ result[type] = typeof component === "string" ? component : vue.markRaw(
521
+ component
522
+ );
495
523
  }
496
524
  return result;
497
525
  };
@@ -548,8 +576,9 @@ const SliceZoneImpl = /* @__PURE__ */ vue.defineComponent({
548
576
  component = resolvedComponent;
549
577
  }
550
578
  }
579
+ const key = "id" in slice && slice.id ? slice.id : `${index}-${JSON.stringify(slice)}`;
551
580
  const p = {
552
- key: `${index}-${JSON.stringify(slice)}`,
581
+ key,
553
582
  slice,
554
583
  index,
555
584
  context: props.context,
@@ -600,7 +629,11 @@ const createPrismic = (options) => {
600
629
  const prismicHelpers = {
601
630
  asText: helpers.asText,
602
631
  asHTML: (richTextField, linkResolver, htmlSerializer) => {
603
- return helpers.asHTML(richTextField, linkResolver || options.linkResolver, htmlSerializer || options.htmlSerializer);
632
+ return helpers.asHTML(
633
+ richTextField,
634
+ linkResolver || options.linkResolver,
635
+ htmlSerializer || options.htmlSerializer
636
+ );
604
637
  },
605
638
  asLink: (linkField, linkResolver) => {
606
639
  return helpers.asLink(linkField, linkResolver || options.linkResolver);
@@ -644,7 +677,9 @@ const isParams = (value) => {
644
677
  };
645
678
  const useStatefulPrismicClientMethod = (methodName, args) => {
646
679
  const { client } = usePrismic();
647
- const state = vue.ref(PrismicClientComposableState.Idle);
680
+ const state = vue.ref(
681
+ PrismicClientComposableState.Idle
682
+ );
648
683
  const data = vue.shallowRef(null);
649
684
  const error = vue.ref(null);
650
685
  const refresh = async () => {
@@ -655,7 +690,10 @@ const useStatefulPrismicClientMethod = (methodName, args) => {
655
690
  data.value = null;
656
691
  error.value = null;
657
692
  try {
658
- data.value = await (vue.unref(explicitClient) || client)[methodName](...argsWithoutParams.map((arg) => vue.unref(arg)), params);
693
+ data.value = await (vue.unref(explicitClient) || client)[methodName](
694
+ ...argsWithoutParams.map((arg) => vue.unref(arg)),
695
+ params
696
+ );
659
697
  state.value = PrismicClientComposableState.Success;
660
698
  } catch (err) {
661
699
  state.value = PrismicClientComposableState.Error;