@prismicio/vue 6.1.3 → 6.1.4-pr.98.764fac2
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/PrismicImage.cjs.map +1 -1
- package/dist/PrismicImage.js.map +1 -1
- package/dist/PrismicImage.vue.d.cts +14 -11
- package/dist/PrismicImage.vue.d.cts.map +1 -1
- package/dist/PrismicImage.vue.d.ts +14 -11
- package/dist/PrismicImage.vue.d.ts.map +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicLink.cjs.map +1 -1
- package/dist/PrismicLink.js.map +1 -1
- package/dist/PrismicLink.vue.d.cts +17 -13
- package/dist/PrismicLink.vue.d.cts.map +1 -1
- package/dist/PrismicLink.vue.d.ts +17 -13
- package/dist/PrismicLink.vue.d.ts.map +1 -1
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +3 -3
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +8 -9
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts +7 -8
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.cjs +2 -2
- package/dist/PrismicRichText/getRichTextComponentProps.cjs.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts +3 -4
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.d.ts +2 -3
- package/dist/PrismicRichText/getRichTextComponentProps.d.ts.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.js +2 -2
- package/dist/PrismicRichText/getRichTextComponentProps.js.map +1 -1
- package/dist/PrismicRichText/index.d.cts +2 -1
- package/dist/PrismicRichText/index.d.ts +2 -1
- package/dist/PrismicRichText/types.d.cts +1 -2
- package/dist/PrismicRichText/types.d.cts.map +1 -1
- package/dist/PrismicRichText/types.d.ts +1 -2
- package/dist/PrismicRichText/types.d.ts.map +1 -1
- package/dist/PrismicTable/PrismicTable.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTable.js.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.cts +6 -6
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.ts +6 -6
- package/dist/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.cjs +6 -6
- package/dist/PrismicTable/getTableComponentProps.cjs.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.d.cts +8 -10
- package/dist/PrismicTable/getTableComponentProps.d.cts.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.d.ts +7 -9
- package/dist/PrismicTable/getTableComponentProps.d.ts.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.js +6 -6
- package/dist/PrismicTable/getTableComponentProps.js.map +1 -1
- package/dist/PrismicTable/index.d.cts +2 -1
- package/dist/PrismicTable/index.d.ts +2 -1
- package/dist/PrismicTable/types.d.cts +0 -1
- package/dist/PrismicTable/types.d.cts.map +1 -1
- package/dist/PrismicTable/types.d.ts +0 -1
- package/dist/PrismicTable/types.d.ts.map +1 -1
- package/dist/PrismicText.vue.d.cts +4 -5
- package/dist/PrismicText.vue.d.cts.map +1 -1
- package/dist/PrismicText.vue.d.ts +4 -5
- package/dist/PrismicText.vue.d.ts.map +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/SliceSimulator.vue.d.cts +14 -15
- package/dist/SliceSimulator.vue.d.cts.map +1 -1
- package/dist/SliceSimulator.vue.d.ts +14 -15
- package/dist/SliceSimulator.vue.d.ts.map +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.cts +9 -7
- package/dist/SliceZone/SliceZone.vue.d.cts.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.ts +9 -7
- package/dist/SliceZone/SliceZone.vue.d.ts.map +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.cjs.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.d.cts +0 -1
- package/dist/SliceZone/TODOSliceComponent.d.cts.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.d.ts +0 -1
- package/dist/SliceZone/TODOSliceComponent.d.ts.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.js.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.cjs +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.cjs.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.d.cts +1 -2
- package/dist/SliceZone/defineSliceZoneComponents.d.cts.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.d.ts +1 -2
- package/dist/SliceZone/defineSliceZoneComponents.d.ts.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.js +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.js.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.cjs +2 -2
- package/dist/SliceZone/getSliceComponentProps.cjs.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.d.cts +2 -3
- package/dist/SliceZone/getSliceComponentProps.d.cts.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.d.ts +2 -3
- package/dist/SliceZone/getSliceComponentProps.d.ts.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.js +2 -2
- package/dist/SliceZone/getSliceComponentProps.js.map +1 -1
- package/dist/SliceZone/index.d.cts +2 -1
- package/dist/SliceZone/index.d.ts +2 -1
- package/dist/SliceZone/types.d.cts +8 -5
- package/dist/SliceZone/types.d.cts.map +1 -1
- package/dist/SliceZone/types.d.ts +8 -5
- package/dist/SliceZone/types.d.ts.map +1 -1
- package/dist/createPrismic.cjs +1 -1
- package/dist/createPrismic.cjs.map +1 -1
- package/dist/createPrismic.d.cts +18 -9
- package/dist/createPrismic.d.cts.map +1 -1
- package/dist/createPrismic.d.ts +17 -8
- package/dist/createPrismic.d.ts.map +1 -1
- package/dist/createPrismic.js +1 -1
- package/dist/createPrismic.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/lib/devMsg.cjs +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +17 -17
- package/src/PrismicImage.vue +1 -1
- package/src/PrismicLink.vue +2 -2
- package/src/PrismicRichText/PrismicRichText.vue +1 -1
- package/src/PrismicRichText/getRichTextComponentProps.ts +2 -2
- package/src/PrismicTable/PrismicTable.vue +1 -1
- package/src/PrismicTable/getTableComponentProps.ts +6 -6
- package/src/SliceZone/defineSliceZoneComponents.ts +1 -1
- package/src/SliceZone/getSliceComponentProps.ts +2 -2
- package/src/createPrismic.ts +1 -1
- package/src/lib/devMsg.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.cjs","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PrismicImage.cjs","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn undefined\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":""}
|
package/dist/PrismicImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.js","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PrismicImage.js","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn undefined\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":""}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet } from "@prismicio/client";
|
|
3
|
-
|
|
4
2
|
//#region src/PrismicImage.vue.d.ts
|
|
5
3
|
/** Props for `<PrismicImage />`. */
|
|
6
4
|
type PrismicImageProps = {
|
|
7
|
-
/** The Prismic image field or thumbnail to render. */
|
|
5
|
+
/** The Prismic image field or thumbnail to render. */
|
|
6
|
+
field: ImageField | ImageField<string>;
|
|
8
7
|
/**
|
|
9
8
|
* An object of Imgix URL API parameters to transform the image.
|
|
10
9
|
*
|
|
@@ -58,8 +57,9 @@ type PrismicImageProps = {
|
|
|
58
57
|
*/
|
|
59
58
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
60
59
|
});
|
|
61
|
-
declare const __VLS_export:
|
|
62
|
-
/** The Prismic image field or thumbnail to render. */
|
|
60
|
+
declare const __VLS_export: import("vue").DefineComponent<({
|
|
61
|
+
/** The Prismic image field or thumbnail to render. */
|
|
62
|
+
field: ImageField | ImageField<string>;
|
|
63
63
|
/**
|
|
64
64
|
* An object of Imgix URL API parameters to transform the image.
|
|
65
65
|
*
|
|
@@ -104,7 +104,8 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
104
104
|
widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "thumbnails" | "defaults";
|
|
105
105
|
pixelDensities?: never;
|
|
106
106
|
}) | ({
|
|
107
|
-
/** The Prismic image field or thumbnail to render. */
|
|
107
|
+
/** The Prismic image field or thumbnail to render. */
|
|
108
|
+
field: ImageField | ImageField<string>;
|
|
108
109
|
/**
|
|
109
110
|
* An object of Imgix URL API parameters to transform the image.
|
|
110
111
|
*
|
|
@@ -145,8 +146,9 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
145
146
|
* used: 1, 2, 3.
|
|
146
147
|
*/
|
|
147
148
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
148
|
-
}), {}, {}, {}, {},
|
|
149
|
-
/** The Prismic image field or thumbnail to render. */
|
|
149
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<({
|
|
150
|
+
/** The Prismic image field or thumbnail to render. */
|
|
151
|
+
field: ImageField | ImageField<string>;
|
|
150
152
|
/**
|
|
151
153
|
* An object of Imgix URL API parameters to transform the image.
|
|
152
154
|
*
|
|
@@ -191,7 +193,8 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
191
193
|
widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "thumbnails" | "defaults";
|
|
192
194
|
pixelDensities?: never;
|
|
193
195
|
}) | ({
|
|
194
|
-
/** The Prismic image field or thumbnail to render. */
|
|
196
|
+
/** The Prismic image field or thumbnail to render. */
|
|
197
|
+
field: ImageField | ImageField<string>;
|
|
195
198
|
/**
|
|
196
199
|
* An object of Imgix URL API parameters to transform the image.
|
|
197
200
|
*
|
|
@@ -232,8 +235,8 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
232
235
|
* used: 1, 2, 3.
|
|
233
236
|
*/
|
|
234
237
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
235
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
238
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
236
239
|
declare const _default: typeof __VLS_export;
|
|
237
240
|
//#endregion
|
|
238
|
-
export { PrismicImageProps, _default };
|
|
241
|
+
export { PrismicImageProps, _default as default };
|
|
239
242
|
//# sourceMappingURL=PrismicImage.vue.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue.d.cts","names":[],"sources":["../src/PrismicImage.vue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue.d.cts","names":[],"sources":["../src/PrismicImage.vue"],"mappings":";;;KAgMY;;EAEX,OAAO,aAAa;;;;;;EAOpB,cAAc,kBAAkB;;;;;;EAOhC;;;;;;;EAQA;;;;;;EAOA;;;;;;EAOA;;;;;;;;;;;EAYE,SACG,YAAY,kBAAkB;EAGjC;;EAGA;;;;;;;EAOA,gBACG,YAAY,kBAAkB;;cA+H9B,4BAAY;;EA9LV,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;;;;;;;;;;EAaJ,SAAA,YAAY,kBAAkB;EAGhB;;;EApDZ,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;EAmBE;;;;;;;EAQN,gBAAA,YAAY,kBAAkB;;;EA/D5B,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;;;;;;;;;;EAaJ,SAAA,YAAY,kBAAkB;EAGhB;;;EApDZ,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;EAmBE;;;;;;;EAQN,gBAAA,YAAY,kBAAkB;MAiIlC,oDAAA;cACmB,iBAAO"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet } from "@prismicio/client";
|
|
3
|
-
|
|
4
2
|
//#region src/PrismicImage.vue.d.ts
|
|
5
3
|
/** Props for `<PrismicImage />`. */
|
|
6
4
|
type PrismicImageProps = {
|
|
7
|
-
/** The Prismic image field or thumbnail to render. */
|
|
5
|
+
/** The Prismic image field or thumbnail to render. */
|
|
6
|
+
field: ImageField | ImageField<string>;
|
|
8
7
|
/**
|
|
9
8
|
* An object of Imgix URL API parameters to transform the image.
|
|
10
9
|
*
|
|
@@ -58,8 +57,9 @@ type PrismicImageProps = {
|
|
|
58
57
|
*/
|
|
59
58
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
60
59
|
});
|
|
61
|
-
declare const __VLS_export:
|
|
62
|
-
/** The Prismic image field or thumbnail to render. */
|
|
60
|
+
declare const __VLS_export: import("vue").DefineComponent<({
|
|
61
|
+
/** The Prismic image field or thumbnail to render. */
|
|
62
|
+
field: ImageField | ImageField<string>;
|
|
63
63
|
/**
|
|
64
64
|
* An object of Imgix URL API parameters to transform the image.
|
|
65
65
|
*
|
|
@@ -104,7 +104,8 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
104
104
|
widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "thumbnails" | "defaults";
|
|
105
105
|
pixelDensities?: never;
|
|
106
106
|
}) | ({
|
|
107
|
-
/** The Prismic image field or thumbnail to render. */
|
|
107
|
+
/** The Prismic image field or thumbnail to render. */
|
|
108
|
+
field: ImageField | ImageField<string>;
|
|
108
109
|
/**
|
|
109
110
|
* An object of Imgix URL API parameters to transform the image.
|
|
110
111
|
*
|
|
@@ -145,8 +146,9 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
145
146
|
* used: 1, 2, 3.
|
|
146
147
|
*/
|
|
147
148
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
148
|
-
}), {}, {}, {}, {},
|
|
149
|
-
/** The Prismic image field or thumbnail to render. */
|
|
149
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<({
|
|
150
|
+
/** The Prismic image field or thumbnail to render. */
|
|
151
|
+
field: ImageField | ImageField<string>;
|
|
150
152
|
/**
|
|
151
153
|
* An object of Imgix URL API parameters to transform the image.
|
|
152
154
|
*
|
|
@@ -191,7 +193,8 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
191
193
|
widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "thumbnails" | "defaults";
|
|
192
194
|
pixelDensities?: never;
|
|
193
195
|
}) | ({
|
|
194
|
-
/** The Prismic image field or thumbnail to render. */
|
|
196
|
+
/** The Prismic image field or thumbnail to render. */
|
|
197
|
+
field: ImageField | ImageField<string>;
|
|
195
198
|
/**
|
|
196
199
|
* An object of Imgix URL API parameters to transform the image.
|
|
197
200
|
*
|
|
@@ -232,8 +235,8 @@ declare const __VLS_export: _$vue.DefineComponent<({
|
|
|
232
235
|
* used: 1, 2, 3.
|
|
233
236
|
*/
|
|
234
237
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
235
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
238
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
236
239
|
declare const _default: typeof __VLS_export;
|
|
237
240
|
//#endregion
|
|
238
|
-
export { PrismicImageProps, _default };
|
|
241
|
+
export { PrismicImageProps, _default as default };
|
|
239
242
|
//# sourceMappingURL=PrismicImage.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue.d.ts","names":[],"sources":["../src/PrismicImage.vue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue.d.ts","names":[],"sources":["../src/PrismicImage.vue"],"mappings":";;;KAgMY;;EAEX,OAAO,aAAa;;;;;;EAOpB,cAAc,kBAAkB;;;;;;EAOhC;;;;;;;EAQA;;;;;;EAOA;;;;;;EAOA;;;;;;;;;;;EAYE,SACG,YAAY,kBAAkB;EAGjC;;EAGA;;;;;;;EAOA,gBACG,YAAY,kBAAkB;;cA+H9B,4BAAY;;EA9LV,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;;;;;;;;;;EAaJ,SAAA,YAAY,kBAAkB;EAGhB;;;EApDZ,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;EAmBE;;;;;;;EAQN,gBAAA,YAAY,kBAAkB;;;EA/D5B,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;;;;;;;;;;EAaJ,SAAA,YAAY,kBAAkB;EAGhB;;;EApDZ,OAAA,aAAa;;;;;;EAON,cAAA,kBAAkB;;;;;;EAO1B;;;;;;;EAQQ;;;;;;EAON;;;;;;EAOC;;EAmBE;;;;;;;EAQN,gBAAA,YAAY,kBAAkB;MAiIlC,oDAAA;cACmB,iBAAO"}
|
|
@@ -10,7 +10,7 @@ const _hoisted_1 = [
|
|
|
10
10
|
"width",
|
|
11
11
|
"height"
|
|
12
12
|
];
|
|
13
|
-
var PrismicImage_vue_vue_type_script_setup_true_lang_default =
|
|
13
|
+
var PrismicImage_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
14
14
|
name: "PrismicImage",
|
|
15
15
|
__name: "PrismicImage",
|
|
16
16
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EA,MAAM,QAAQ;
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn undefined\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EA,MAAM,QAAQ;EAGd,IAAI,QAAA,KACH,CAAA,GAAA,IAAA,YAAA,OAAkB;GACjB,IAAI,OAAO,MAAM,QAAQ,YAAY,MAAM,QAAQ,IAClD,QAAQ,KACP,qQAAqQ,eAAA,OACpQ,6BACD,GACD;GAGD,IAAI,OAAO,MAAM,gBAAgB,YAAY,MAAM,gBAAgB,IAClE,QAAQ,KACP,qSAAqS,eAAA,OACpS,6BACD,GACD;GAGD,IAAI,MAAM,UAAU,MAAM,gBACzB,QAAQ,KACP,2MACD;EAEF,CAAC;EAGF,MAAM,WAAW,UAA2D;GAC3E,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aACjD,OAAO;QACD;IACN,MAAM,SAAS,OAAO,SAAS,KAAK;IAEpC,IAAI,OAAO,MAAM,MAAM,GACtB;SAEA,OAAO;GAET;EACD;EAEA,MAAM,SAAA,GAAQ,IAAA,SAAA,OAAe;GAC5B,IAAI,CAAC,kBAAA,SAAS,eAAe,MAAM,KAAK,GACvC;GAGD,IAAI;GACJ,IAAI;GACJ,IAAI,MAAM,UAAU,CAAC,MAAM,gBAAgB;IAC1C,MAAM,OAAA,GAAM,kBAAA,mBAAA,CAAmB,MAAM,OAAO;KAC3C,GAAG,MAAM;KACT,QAAQ,MAAM,WAAW,aAAa,KAAA,IAAY,MAAM;IACzD,CAAC;IAED,MAAM,IAAI;IACV,SAAS,IAAI;GACd,OAAO,IAAI,MAAM,gBAAgB;IAChC,MAAM,OAAA,GAAM,kBAAA,0BAAA,CAA0B,MAAM,OAAO;KAClD,GAAG,MAAM;KACT,gBAAgB,MAAM,mBAAmB,aAAa,KAAA,IAAY,MAAM;IACzE,CAAC;IAED,MAAM,IAAI;IACV,SAAS,IAAI;GACd;GAEA,MAAM,KAAK,MAAM,MAAM,WAAW,QAAQ,MAAM,MAAM,WAAW;GAEjE,MAAM,cAAc,QAAQ,MAAM,KAAK;GACvC,MAAM,eAAe,QAAQ,MAAM,MAAM;GAEzC,IAAI,gBAAgB,eAAe,MAAM,MAAM,WAAW;GAC1D,IAAI,iBAAiB,gBAAgB,MAAM,MAAM,WAAW;GAE5D,IAAI,eAAe,QAAQ,gBAAgB,MAC1C,iBAAiB,cAAc;QACzB,IAAI,eAAe,QAAQ,gBAAgB,MACjD,gBAAgB,eAAe;GAGhC,OAAO;IACN;IACA;IACA,KAAK,MAAM,QAAQ,MAAM,MAAM,OAAO,MAAM;IAC5C,OAAO,KAAK,MAAM,aAAa;IAC/B,QAAQ,KAAK,MAAM,cAAc;GAClC;EACD,CAAC;;GAKO,OAAA,MAAA,UAAA,GADP,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,mBAAA,CAOE,OAAA;;IALA,KAAK,MAAA,MAAM;IACX,QAAQ,MAAA,MAAM;IACd,KAAK,MAAA,MAAM;IACX,OAAO,MAAA,MAAM;IACb,QAAQ,MAAA,MAAM"}
|
|
@@ -10,7 +10,7 @@ const _hoisted_1 = [
|
|
|
10
10
|
"width",
|
|
11
11
|
"height"
|
|
12
12
|
];
|
|
13
|
-
var PrismicImage_vue_vue_type_script_setup_true_lang_default =
|
|
13
|
+
var PrismicImage_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
14
14
|
name: "PrismicImage",
|
|
15
15
|
__name: "PrismicImage",
|
|
16
16
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EA,MAAM,QAAQ;
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ImageField, asImageSrc } from \"@prismicio/client\"\nimport { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicImage />`. */\nexport type PrismicImageProps = {\n\t/** The Prismic image field or thumbnail to render. */\n\tfield: ImageField | ImageField<string>\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * See: https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: Parameters<typeof asImageSrc>[1]\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\"\n\n\t/**\n\t * Declare an image as decorative only if the image field does not have alternative text by\n\t * providing `fallbackAlt=\"\"`.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\"\n\n\t/**\n\t * The width attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width\n\t */\n\twidth?: number | string\n\n\t/**\n\t * The height attribute of the image element.\n\t *\n\t * See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height\n\t */\n\theight?: number | string\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Widths (in pixels) used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If omitted or set to `\"defaults\"`, the following widths will be used: 640, 750, 828, 1080,\n\t\t\t * 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can be used as a width\n\t\t\t * in the resulting `srcset` by passing `\"thumbnails\"` as the `widths` prop.\n\t\t\t */\n\t\t\twidths?:\n\t\t\t\t| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>[\"widths\"]\n\t\t\t\t| \"thumbnails\"\n\t\t\t\t| \"defaults\"\n\t\t\tpixelDensities?: never\n\t }\n\t| {\n\t\t\twidths?: never\n\t\t\t/**\n\t\t\t * Pixel densities used to build a `srcset` value for the image field.\n\t\t\t *\n\t\t\t * If a `pixelDensities` prop is passed `\"defaults\"`, the following pixel densities will be\n\t\t\t * used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>[\"pixelDensities\"]\n\t\t\t\t| \"defaults\"\n\t }\n)\n\nconst props = defineProps<PrismicImageProps>()\ndefineOptions({ name: \"PrismicImage\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.alt === \"string\" && props.alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (typeof props.fallbackAlt === \"string\" && props.fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (props.widths && props.pixelDensities) {\n\t\t\tconsole.warn(\n\t\t\t\t`[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.`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input\n\t} else {\n\t\tconst parsed = Number.parseInt(input)\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn parsed\n\t\t}\n\t}\n}\n\nconst image = computed(() => {\n\tif (!isFilled.imageThumbnail(props.field)) {\n\t\treturn undefined\n\t}\n\n\tlet src: string | undefined\n\tlet srcSet: string | undefined\n\tif (props.widths || !props.pixelDensities) {\n\t\tconst res = asImageWidthSrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\twidths: props.widths === \"defaults\" ? undefined : props.widths,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t} else if (props.pixelDensities) {\n\t\tconst res = asImagePixelDensitySrcSet(props.field, {\n\t\t\t...props.imgixParams,\n\t\t\tpixelDensities: props.pixelDensities === \"defaults\" ? undefined : props.pixelDensities,\n\t\t})\n\n\t\tsrc = res.src\n\t\tsrcSet = res.srcset\n\t}\n\n\tconst ar = props.field.dimensions.width / props.field.dimensions.height\n\n\tconst castedWidth = castInt(props.width)\n\tconst castedHeight = castInt(props.height)\n\n\tlet resolvedWidth = castedWidth ?? props.field.dimensions.width\n\tlet resolvedHeight = castedHeight ?? props.field.dimensions.height\n\n\tif (castedWidth != null && castedHeight == null) {\n\t\tresolvedHeight = castedWidth / ar\n\t} else if (castedWidth == null && castedHeight != null) {\n\t\tresolvedWidth = castedHeight * ar\n\t}\n\n\treturn {\n\t\tsrc,\n\t\tsrcSet,\n\t\talt: props.alt ?? (props.field.alt || props.fallbackAlt),\n\t\twidth: Math.round(resolvedWidth),\n\t\theight: Math.round(resolvedHeight),\n\t}\n})\n</script>\n\n<template>\n\t<img\n\t\tv-if=\"image\"\n\t\t:src=\"image.src\"\n\t\t:srcset=\"image.srcSet\"\n\t\t:alt=\"image.alt\"\n\t\t:width=\"image.width\"\n\t\t:height=\"image.height\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EA,MAAM,QAAQ;EAGd,IAAI,KACH,kBAAkB;GACjB,IAAI,OAAO,MAAM,QAAQ,YAAY,MAAM,QAAQ,IAClD,QAAQ,KACP,qQAAqQ,OACpQ,6BACD,GACD;GAGD,IAAI,OAAO,MAAM,gBAAgB,YAAY,MAAM,gBAAgB,IAClE,QAAQ,KACP,qSAAqS,OACpS,6BACD,GACD;GAGD,IAAI,MAAM,UAAU,MAAM,gBACzB,QAAQ,KACP,2MACD;EAEF,CAAC;EAGF,MAAM,WAAW,UAA2D;GAC3E,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aACjD,OAAO;QACD;IACN,MAAM,SAAS,OAAO,SAAS,KAAK;IAEpC,IAAI,OAAO,MAAM,MAAM,GACtB;SAEA,OAAO;GAET;EACD;EAEA,MAAM,QAAQ,eAAe;GAC5B,IAAI,CAAC,SAAS,eAAe,MAAM,KAAK,GACvC;GAGD,IAAI;GACJ,IAAI;GACJ,IAAI,MAAM,UAAU,CAAC,MAAM,gBAAgB;IAC1C,MAAM,MAAM,mBAAmB,MAAM,OAAO;KAC3C,GAAG,MAAM;KACT,QAAQ,MAAM,WAAW,aAAa,KAAA,IAAY,MAAM;IACzD,CAAC;IAED,MAAM,IAAI;IACV,SAAS,IAAI;GACd,OAAO,IAAI,MAAM,gBAAgB;IAChC,MAAM,MAAM,0BAA0B,MAAM,OAAO;KAClD,GAAG,MAAM;KACT,gBAAgB,MAAM,mBAAmB,aAAa,KAAA,IAAY,MAAM;IACzE,CAAC;IAED,MAAM,IAAI;IACV,SAAS,IAAI;GACd;GAEA,MAAM,KAAK,MAAM,MAAM,WAAW,QAAQ,MAAM,MAAM,WAAW;GAEjE,MAAM,cAAc,QAAQ,MAAM,KAAK;GACvC,MAAM,eAAe,QAAQ,MAAM,MAAM;GAEzC,IAAI,gBAAgB,eAAe,MAAM,MAAM,WAAW;GAC1D,IAAI,iBAAiB,gBAAgB,MAAM,MAAM,WAAW;GAE5D,IAAI,eAAe,QAAQ,gBAAgB,MAC1C,iBAAiB,cAAc;QACzB,IAAI,eAAe,QAAQ,gBAAgB,MACjD,gBAAgB,eAAe;GAGhC,OAAO;IACN;IACA;IACA,KAAK,MAAM,QAAQ,MAAM,MAAM,OAAO,MAAM;IAC5C,OAAO,KAAK,MAAM,aAAa;IAC/B,QAAQ,KAAK,MAAM,cAAc;GAClC;EACD,CAAC;;GAKO,OAAA,MAAA,SADP,UAAA,GAAA,mBAOE,OAAA;;IALA,KAAK,MAAA,MAAM;IACX,QAAQ,MAAA,MAAM;IACd,KAAK,MAAA,MAAM;IACX,OAAO,MAAA,MAAM;IACb,QAAQ,MAAA,MAAM"}
|
package/dist/PrismicLink.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.cjs","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport { usePrismic } from \"./createPrismic\"\nimport { isInternalURL } from \"./lib/isInternalURL\"\nimport type { ComponentOrTagName } from \"./types\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic repository's content, a link\n\t * resolver does not need to be provided.\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if the link's URL is\n\t * external. This prop can be provided a function to use the link's metadata to determine the\n\t * `rel` value.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link component, provide the Link\n\t * component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { linkResolver, components } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver ||
|
|
1
|
+
{"version":3,"file":"PrismicLink.cjs","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport { usePrismic } from \"./createPrismic\"\nimport { isInternalURL } from \"./lib/isInternalURL\"\nimport type { ComponentOrTagName } from \"./types\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic repository's content, a link\n\t * resolver does not need to be provided.\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if the link's URL is\n\t * external. This prop can be provided a function to use the link's metadata to determine the\n\t * `rel` value.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link component, provide the Link\n\t * component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { linkResolver: pluginLinkResolver, components } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || pluginLinkResolver,\n\t\trel(args) {\n\t\t\tif (props.rel) {\n\t\t\t\treturn typeof props.rel === \"function\" ? props.rel(args) : props.rel\n\t\t\t}\n\n\t\t\treturn args.isExternal ? defaultExternalRelAttribute : undefined\n\t\t},\n\t})\n})\n\nconst component = computed(() => {\n\treturn isInternalURL(rawAttrs.value.href || \"\")\n\t\t? props.internalComponent || components?.linkInternalComponent || defaultInternalComponent\n\t\t: props.externalComponent || components?.linkExternalComponent || defaultExternalComponent\n})\n\n// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.\nconst attrs = computed(() => {\n\treturn component.value === \"a\"\n\t\t? {\n\t\t\t\thref: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n\t\t: {\n\t\t\t\tto: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n})\n</script>\n\n<template>\n\t<component :is=\"component\" v-bind=\"attrs\">\n\t\t<slot>\n\t\t\t{{ props.field && \"text\" in props.field ? props.field.text : undefined }}\n\t\t</slot>\n\t</component>\n</template>\n"],"mappings":""}
|
package/dist/PrismicLink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.js","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport { usePrismic } from \"./createPrismic\"\nimport { isInternalURL } from \"./lib/isInternalURL\"\nimport type { ComponentOrTagName } from \"./types\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic repository's content, a link\n\t * resolver does not need to be provided.\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if the link's URL is\n\t * external. This prop can be provided a function to use the link's metadata to determine the\n\t * `rel` value.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link component, provide the Link\n\t * component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { linkResolver, components } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver ||
|
|
1
|
+
{"version":3,"file":"PrismicLink.js","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport { usePrismic } from \"./createPrismic\"\nimport { isInternalURL } from \"./lib/isInternalURL\"\nimport type { ComponentOrTagName } from \"./types\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic repository's content, a link\n\t * resolver does not need to be provided.\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if the link's URL is\n\t * external. This prop can be provided a function to use the link's metadata to determine the\n\t * `rel` value.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link component, provide the Link\n\t * component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { linkResolver: pluginLinkResolver, components } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || pluginLinkResolver,\n\t\trel(args) {\n\t\t\tif (props.rel) {\n\t\t\t\treturn typeof props.rel === \"function\" ? props.rel(args) : props.rel\n\t\t\t}\n\n\t\t\treturn args.isExternal ? defaultExternalRelAttribute : undefined\n\t\t},\n\t})\n})\n\nconst component = computed(() => {\n\treturn isInternalURL(rawAttrs.value.href || \"\")\n\t\t? props.internalComponent || components?.linkInternalComponent || defaultInternalComponent\n\t\t: props.externalComponent || components?.linkExternalComponent || defaultExternalComponent\n})\n\n// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.\nconst attrs = computed(() => {\n\treturn component.value === \"a\"\n\t\t? {\n\t\t\t\thref: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n\t\t: {\n\t\t\t\tto: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n})\n</script>\n\n<template>\n\t<component :is=\"component\" v-bind=\"attrs\">\n\t\t<slot>\n\t\t\t{{ props.field && \"text\" in props.field ? props.field.text : undefined }}\n\t\t</slot>\n\t</component>\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "./types.cjs";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
|
|
4
|
-
|
|
5
3
|
//#region src/PrismicLink.vue.d.ts
|
|
6
4
|
/** Props for `<PrismicLink />`. */
|
|
7
5
|
type PrismicLinkProps = {
|
|
@@ -36,17 +34,19 @@ type PrismicLinkProps = {
|
|
|
36
34
|
*/
|
|
37
35
|
externalComponent?: ComponentOrTagName;
|
|
38
36
|
} & ({
|
|
39
|
-
/** The Prismic link field to render. */
|
|
37
|
+
/** The Prismic link field to render. */
|
|
38
|
+
field: LinkField;
|
|
40
39
|
document?: never;
|
|
41
40
|
} | {
|
|
42
|
-
/** The Prismic document to render as a link. */
|
|
41
|
+
/** The Prismic document to render as a link. */
|
|
42
|
+
document: PrismicDocument;
|
|
43
43
|
field?: never;
|
|
44
44
|
});
|
|
45
45
|
declare var __VLS_8: {};
|
|
46
46
|
type __VLS_Slots = {} & {
|
|
47
47
|
default?: (props: typeof __VLS_8) => any;
|
|
48
48
|
};
|
|
49
|
-
declare const __VLS_base:
|
|
49
|
+
declare const __VLS_base: import("vue").DefineComponent<({
|
|
50
50
|
/**
|
|
51
51
|
* The link resolver used to resolve links.
|
|
52
52
|
*
|
|
@@ -78,7 +78,8 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
78
78
|
*/
|
|
79
79
|
externalComponent?: ComponentOrTagName;
|
|
80
80
|
} & {
|
|
81
|
-
/** The Prismic link field to render. */
|
|
81
|
+
/** The Prismic link field to render. */
|
|
82
|
+
field: LinkField;
|
|
82
83
|
document?: never;
|
|
83
84
|
}) | ({
|
|
84
85
|
/**
|
|
@@ -112,9 +113,10 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
112
113
|
*/
|
|
113
114
|
externalComponent?: ComponentOrTagName;
|
|
114
115
|
} & {
|
|
115
|
-
/** The Prismic document to render as a link. */
|
|
116
|
+
/** The Prismic document to render as a link. */
|
|
117
|
+
document: PrismicDocument;
|
|
116
118
|
field?: never;
|
|
117
|
-
}), {}, {}, {}, {},
|
|
119
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<({
|
|
118
120
|
/**
|
|
119
121
|
* The link resolver used to resolve links.
|
|
120
122
|
*
|
|
@@ -146,7 +148,8 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
146
148
|
*/
|
|
147
149
|
externalComponent?: ComponentOrTagName;
|
|
148
150
|
} & {
|
|
149
|
-
/** The Prismic link field to render. */
|
|
151
|
+
/** The Prismic link field to render. */
|
|
152
|
+
field: LinkField;
|
|
150
153
|
document?: never;
|
|
151
154
|
}) | ({
|
|
152
155
|
/**
|
|
@@ -180,16 +183,17 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
180
183
|
*/
|
|
181
184
|
externalComponent?: ComponentOrTagName;
|
|
182
185
|
} & {
|
|
183
|
-
/** The Prismic document to render as a link. */
|
|
186
|
+
/** The Prismic document to render as a link. */
|
|
187
|
+
document: PrismicDocument;
|
|
184
188
|
field?: never;
|
|
185
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
189
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
186
190
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
187
191
|
declare const _default: typeof __VLS_export;
|
|
188
192
|
type __VLS_WithSlots<T, S> = T & {
|
|
189
193
|
new (): {
|
|
190
194
|
$slots: S;
|
|
191
195
|
};
|
|
192
|
-
};
|
|
196
|
+
};
|
|
193
197
|
//#endregion
|
|
194
|
-
export { PrismicLinkProps, _default };
|
|
198
|
+
export { PrismicLinkProps, _default as default };
|
|
195
199
|
//# sourceMappingURL=PrismicLink.vue.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.vue.d.cts","names":[],"sources":["../src/PrismicLink.vue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrismicLink.vue.d.cts","names":[],"sources":["../src/PrismicLink.vue"],"mappings":";;;;KAgJY;;;;;;;;;EASX,eAAe;;;;;;EAOf,eAAe;;;;;;;;;EAUf,oBAAoB;;;;;;EAOpB,oBAAoB;;;EAIlB,OAAO;EACP;;;EAIA,UAAU;EACV;;YA+EC;KACC;EACD,WAAW,cAAc;;cAKvB,0BAAU;;;;;;;;;EAxHA,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EAIX,OAAA;EACI;;;;;;;;;;EA7BE,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EASR,UAAA;EACF;;;;;;;;;;EAlCK,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EAIX,OAAA;EACI;;;;;;;;;;EA7BE,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EASR,UAAA;EACF;MAwFT,oDAAA;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "./types.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
|
|
4
|
-
|
|
5
3
|
//#region src/PrismicLink.vue.d.ts
|
|
6
4
|
/** Props for `<PrismicLink />`. */
|
|
7
5
|
type PrismicLinkProps = {
|
|
@@ -36,17 +34,19 @@ type PrismicLinkProps = {
|
|
|
36
34
|
*/
|
|
37
35
|
externalComponent?: ComponentOrTagName;
|
|
38
36
|
} & ({
|
|
39
|
-
/** The Prismic link field to render. */
|
|
37
|
+
/** The Prismic link field to render. */
|
|
38
|
+
field: LinkField;
|
|
40
39
|
document?: never;
|
|
41
40
|
} | {
|
|
42
|
-
/** The Prismic document to render as a link. */
|
|
41
|
+
/** The Prismic document to render as a link. */
|
|
42
|
+
document: PrismicDocument;
|
|
43
43
|
field?: never;
|
|
44
44
|
});
|
|
45
45
|
declare var __VLS_8: {};
|
|
46
46
|
type __VLS_Slots = {} & {
|
|
47
47
|
default?: (props: typeof __VLS_8) => any;
|
|
48
48
|
};
|
|
49
|
-
declare const __VLS_base:
|
|
49
|
+
declare const __VLS_base: import("vue").DefineComponent<({
|
|
50
50
|
/**
|
|
51
51
|
* The link resolver used to resolve links.
|
|
52
52
|
*
|
|
@@ -78,7 +78,8 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
78
78
|
*/
|
|
79
79
|
externalComponent?: ComponentOrTagName;
|
|
80
80
|
} & {
|
|
81
|
-
/** The Prismic link field to render. */
|
|
81
|
+
/** The Prismic link field to render. */
|
|
82
|
+
field: LinkField;
|
|
82
83
|
document?: never;
|
|
83
84
|
}) | ({
|
|
84
85
|
/**
|
|
@@ -112,9 +113,10 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
112
113
|
*/
|
|
113
114
|
externalComponent?: ComponentOrTagName;
|
|
114
115
|
} & {
|
|
115
|
-
/** The Prismic document to render as a link. */
|
|
116
|
+
/** The Prismic document to render as a link. */
|
|
117
|
+
document: PrismicDocument;
|
|
116
118
|
field?: never;
|
|
117
|
-
}), {}, {}, {}, {},
|
|
119
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<({
|
|
118
120
|
/**
|
|
119
121
|
* The link resolver used to resolve links.
|
|
120
122
|
*
|
|
@@ -146,7 +148,8 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
146
148
|
*/
|
|
147
149
|
externalComponent?: ComponentOrTagName;
|
|
148
150
|
} & {
|
|
149
|
-
/** The Prismic link field to render. */
|
|
151
|
+
/** The Prismic link field to render. */
|
|
152
|
+
field: LinkField;
|
|
150
153
|
document?: never;
|
|
151
154
|
}) | ({
|
|
152
155
|
/**
|
|
@@ -180,16 +183,17 @@ declare const __VLS_base: _$vue.DefineComponent<({
|
|
|
180
183
|
*/
|
|
181
184
|
externalComponent?: ComponentOrTagName;
|
|
182
185
|
} & {
|
|
183
|
-
/** The Prismic document to render as a link. */
|
|
186
|
+
/** The Prismic document to render as a link. */
|
|
187
|
+
document: PrismicDocument;
|
|
184
188
|
field?: never;
|
|
185
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
189
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
186
190
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
187
191
|
declare const _default: typeof __VLS_export;
|
|
188
192
|
type __VLS_WithSlots<T, S> = T & {
|
|
189
193
|
new (): {
|
|
190
194
|
$slots: S;
|
|
191
195
|
};
|
|
192
|
-
};
|
|
196
|
+
};
|
|
193
197
|
//#endregion
|
|
194
|
-
export { PrismicLinkProps, _default };
|
|
198
|
+
export { PrismicLinkProps, _default as default };
|
|
195
199
|
//# sourceMappingURL=PrismicLink.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.vue.d.ts","names":[],"sources":["../src/PrismicLink.vue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrismicLink.vue.d.ts","names":[],"sources":["../src/PrismicLink.vue"],"mappings":";;;;KAgJY;;;;;;;;;EASX,eAAe;;;;;;EAOf,eAAe;;;;;;;;;EAUf,oBAAoB;;;;;;EAOpB,oBAAoB;;;EAIlB,OAAO;EACP;;;EAIA,UAAU;EACV;;YA+EC;KACC;EACD,WAAW,cAAc;;cAKvB,0BAAU;;;;;;;;;EAxHA,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EAIX,OAAA;EACI;;;;;;;;;;EA7BE,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EASR,UAAA;EACF;;;;;;;;;;EAlCK,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EAIX,OAAA;EACI;;;;;;;;;;EA7BE,eAAA;;;;;;EAOT,eAAS;;;;;;;;;EAUK,oBAAA;;;;;;EAOA,oBAAA;;;EASR,UAAA;EACF;MAwFT,oDAAA;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
|
|
@@ -9,7 +9,7 @@ const defaultInternalComponent = "router-link";
|
|
|
9
9
|
const defaultExternalComponent = "a";
|
|
10
10
|
/** The default rel attribute rendered for external URLs. */
|
|
11
11
|
const defaultExternalRelAttribute = "noreferrer";
|
|
12
|
-
var PrismicLink_vue_vue_type_script_setup_true_lang_default =
|
|
12
|
+
var PrismicLink_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
13
13
|
name: "PrismicLink",
|
|
14
14
|
__name: "PrismicLink",
|
|
15
15
|
props: {
|
|
@@ -40,10 +40,10 @@ var PrismicLink_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
40
40
|
},
|
|
41
41
|
setup(__props) {
|
|
42
42
|
const props = __props;
|
|
43
|
-
const { linkResolver, components } = require_createPrismic.usePrismic();
|
|
43
|
+
const { linkResolver: pluginLinkResolver, components } = require_createPrismic.usePrismic();
|
|
44
44
|
const rawAttrs = (0, vue.computed)(() => {
|
|
45
45
|
return (0, _prismicio_client.asLinkAttrs)(props.field || props.document, {
|
|
46
|
-
linkResolver: props.linkResolver ||
|
|
46
|
+
linkResolver: props.linkResolver || pluginLinkResolver,
|
|
47
47
|
rel(args) {
|
|
48
48
|
if (props.rel) return typeof props.rel === "function" ? props.rel(args) : props.rel;
|
|
49
49
|
return args.isExternal ? defaultExternalRelAttribute : void 0;
|