@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.js CHANGED
@@ -65,7 +65,10 @@ const usePrismicImage = (props) => {
65
65
  const pixelDensities = unref(props.pixelDensities);
66
66
  if (widths) {
67
67
  if (!__PRODUCTION__ && pixelDensities) {
68
- 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);
68
+ console.warn(
69
+ "[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.",
70
+ props
71
+ );
69
72
  }
70
73
  return asImageWidthSrcSet(field, {
71
74
  ...imgixParams,
@@ -276,9 +279,17 @@ const PrismicLinkImpl = /* @__PURE__ */ defineComponent({
276
279
  const { type, href, target, rel } = usePrismicLink(props);
277
280
  return () => {
278
281
  const parent = type.value === "a" ? "a" : simplyResolveComponent(type.value);
279
- const computedSlots = getSlots(parent, slots, reactive({ href: href.value }));
282
+ const computedSlots = getSlots(
283
+ parent,
284
+ slots,
285
+ reactive({ href: href.value })
286
+ );
280
287
  if (typeof parent === "string") {
281
- return h(parent, { href: href.value, target: target.value, rel: rel.value }, computedSlots);
288
+ return h(
289
+ parent,
290
+ { href: href.value, target: target.value, rel: rel.value },
291
+ computedSlots
292
+ );
282
293
  } else {
283
294
  return h(parent, { to: href.value }, computedSlots);
284
295
  }
@@ -409,13 +420,19 @@ const PrismicRichTextImpl = /* @__PURE__ */ defineComponent({
409
420
  }
410
421
  };
411
422
  const removeListeners = () => {
412
- links.forEach(({ element, listener }) => element.removeEventListener("click", listener));
423
+ links.forEach(
424
+ ({ element, listener }) => element.removeEventListener("click", listener)
425
+ );
413
426
  links = [];
414
427
  };
415
- watch(html, () => {
416
- removeListeners();
417
- nextTick(addListeners);
418
- }, { immediate: true });
428
+ watch(
429
+ html,
430
+ () => {
431
+ removeListeners();
432
+ nextTick(addListeners);
433
+ },
434
+ { immediate: true }
435
+ );
419
436
  onBeforeUnmount(() => {
420
437
  removeListeners();
421
438
  });
@@ -452,15 +469,24 @@ const TODOSliceComponent = __PRODUCTION__ ? () => null : /* @__PURE__ */ defineC
452
469
  name: "TODOSliceComponent",
453
470
  props: getSliceComponentProps(),
454
471
  setup(props) {
455
- const type = computed(() => "slice_type" in props.slice ? props.slice.slice_type : props.slice.type);
472
+ const type = computed(
473
+ () => "slice_type" in props.slice ? props.slice.slice_type : props.slice.type
474
+ );
456
475
  watchEffect(() => {
457
- console.warn(`[SliceZone] Could not find a component for Slice type "${type.value}"`, props.slice);
476
+ console.warn(
477
+ `[SliceZone] Could not find a component for Slice type "${type.value}"`,
478
+ props.slice
479
+ );
458
480
  });
459
481
  return () => {
460
- return h("section", {
461
- "data-slice-zone-todo-component": "",
462
- "data-slice-type": type.value
463
- }, [`Could not find a component for Slice type "${type.value}"`]);
482
+ return h(
483
+ "section",
484
+ {
485
+ "data-slice-zone-todo-component": "",
486
+ "data-slice-type": type.value
487
+ },
488
+ [`Could not find a component for Slice type "${type.value}"`]
489
+ );
464
490
  };
465
491
  }
466
492
  });
@@ -469,7 +495,9 @@ const defineSliceZoneComponents = (components) => {
469
495
  let type;
470
496
  for (type in components) {
471
497
  const component = components[type];
472
- result[type] = typeof component === "string" ? component : markRaw(component);
498
+ result[type] = typeof component === "string" ? component : markRaw(
499
+ component
500
+ );
473
501
  }
474
502
  return result;
475
503
  };
@@ -526,8 +554,9 @@ const SliceZoneImpl = /* @__PURE__ */ defineComponent({
526
554
  component = resolvedComponent;
527
555
  }
528
556
  }
557
+ const key = "id" in slice && slice.id ? slice.id : `${index}-${JSON.stringify(slice)}`;
529
558
  const p = {
530
- key: `${index}-${JSON.stringify(slice)}`,
559
+ key,
531
560
  slice,
532
561
  index,
533
562
  context: props.context,
@@ -578,7 +607,11 @@ const createPrismic = (options) => {
578
607
  const prismicHelpers = {
579
608
  asText,
580
609
  asHTML: (richTextField, linkResolver, htmlSerializer) => {
581
- return asHTML(richTextField, linkResolver || options.linkResolver, htmlSerializer || options.htmlSerializer);
610
+ return asHTML(
611
+ richTextField,
612
+ linkResolver || options.linkResolver,
613
+ htmlSerializer || options.htmlSerializer
614
+ );
582
615
  },
583
616
  asLink: (linkField, linkResolver) => {
584
617
  return asLink(linkField, linkResolver || options.linkResolver);
@@ -622,7 +655,9 @@ const isParams = (value) => {
622
655
  };
623
656
  const useStatefulPrismicClientMethod = (methodName, args) => {
624
657
  const { client } = usePrismic();
625
- const state = ref(PrismicClientComposableState.Idle);
658
+ const state = ref(
659
+ PrismicClientComposableState.Idle
660
+ );
626
661
  const data = shallowRef(null);
627
662
  const error = ref(null);
628
663
  const refresh = async () => {
@@ -633,7 +668,10 @@ const useStatefulPrismicClientMethod = (methodName, args) => {
633
668
  data.value = null;
634
669
  error.value = null;
635
670
  try {
636
- data.value = await (unref(explicitClient) || client)[methodName](...argsWithoutParams.map((arg) => unref(arg)), params);
671
+ data.value = await (unref(explicitClient) || client)[methodName](
672
+ ...argsWithoutParams.map((arg) => unref(arg)),
673
+ params
674
+ );
637
675
  state.value = PrismicClientComposableState.Success;
638
676
  } catch (err) {
639
677
  state.value = PrismicClientComposableState.Error;