@prismicio/vue 5.3.0-pr.89.ff3a515 → 6.0.0-canary.331d154
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 -0
- package/dist/PrismicImage.js.map +1 -0
- package/dist/PrismicImage.vue.d.cts +4 -4
- package/dist/PrismicImage.vue.d.cts.map +1 -1
- package/dist/{src/PrismicImage.vue.d.ts → PrismicImage.vue.d.ts} +4 -4
- package/dist/PrismicImage.vue.d.ts.map +1 -0
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/PrismicLink.cjs.map +1 -0
- package/dist/PrismicLink.js.map +1 -0
- package/dist/PrismicLink.vue.d.cts +9 -9
- package/dist/PrismicLink.vue.d.cts.map +1 -1
- package/dist/{src/PrismicLink.vue.d.ts → PrismicLink.vue.d.ts} +9 -9
- package/dist/PrismicLink.vue.d.ts.map +1 -0
- package/dist/{src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs → PrismicLink.vue_vue_type_script_setup_true_lang.cjs} +2 -2
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/{src/PrismicLink.vue_vue_type_script_setup_true_lang.js → PrismicLink.vue_vue_type_script_setup_true_lang.js} +2 -2
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.js.map +1 -0
- package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichText.vue.d.ts +4 -4
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -0
- package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichText.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/PrismicRichText/getRichTextComponentProps.cjs.map +1 -0
- package/dist/PrismicRichText/getRichTextComponentProps.d.ts.map +1 -0
- package/dist/PrismicRichText/getRichTextComponentProps.js.map +1 -0
- package/dist/PrismicRichText/types.d.ts.map +1 -0
- package/dist/{src/PrismicTable/PrismicTable.js.map → PrismicTable/PrismicTable.cjs.map} +1 -1
- package/dist/PrismicTable/PrismicTable.js.map +1 -0
- package/dist/PrismicTable/PrismicTable.vue.d.cts +2 -2
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/{src/PrismicTable → PrismicTable}/PrismicTable.vue.d.ts +2 -2
- package/dist/PrismicTable/PrismicTable.vue.d.ts.map +1 -0
- package/dist/{src/PrismicTable → PrismicTable}/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/{src/PrismicTable → PrismicTable}/PrismicTable.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -0
- package/dist/PrismicTable/PrismicTableDefaultComponents.js.map +1 -0
- package/dist/PrismicTable/PrismicTableRow.cjs.map +1 -0
- package/dist/PrismicTable/PrismicTableRow.js.map +1 -0
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/{src/PrismicTable → PrismicTable}/getTableComponentProps.cjs +2 -2
- package/dist/PrismicTable/getTableComponentProps.cjs.map +1 -0
- package/dist/PrismicTable/getTableComponentProps.d.ts.map +1 -0
- package/dist/{src/PrismicTable → PrismicTable}/getTableComponentProps.js +2 -2
- package/dist/PrismicTable/getTableComponentProps.js.map +1 -0
- package/dist/PrismicTable/types.d.ts.map +1 -0
- package/dist/PrismicText.cjs.map +1 -0
- package/dist/PrismicText.js.map +1 -0
- package/dist/PrismicText.vue.d.cts +2 -2
- package/dist/{src/PrismicText.vue.d.ts → PrismicText.vue.d.ts} +2 -2
- package/dist/PrismicText.vue.d.ts.map +1 -0
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/SliceSimulator.cjs +8 -0
- package/dist/SliceSimulator.cjs.map +1 -0
- package/dist/SliceSimulator.js +8 -0
- package/dist/SliceSimulator.js.map +1 -0
- package/dist/SliceSimulator.vue.d.cts +57 -0
- package/dist/SliceSimulator.vue.d.cts.map +1 -0
- package/dist/SliceSimulator.vue.d.ts +57 -0
- package/dist/SliceSimulator.vue.d.ts.map +1 -0
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.cjs +66 -0
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/SliceZone/SliceZone.cjs.map +1 -0
- package/dist/SliceZone/SliceZone.js.map +1 -0
- package/dist/SliceZone/SliceZone.vue.d.cts +2 -2
- package/dist/{src/SliceZone → SliceZone}/SliceZone.vue.d.ts +2 -2
- package/dist/SliceZone/SliceZone.vue.d.ts.map +1 -0
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/SliceZone/TODOSliceComponent.cjs.map +1 -0
- package/dist/SliceZone/TODOSliceComponent.d.ts.map +1 -0
- package/dist/SliceZone/TODOSliceComponent.js.map +1 -0
- package/dist/SliceZone/defineSliceZoneComponents.cjs.map +1 -0
- package/dist/SliceZone/defineSliceZoneComponents.d.ts.map +1 -0
- package/dist/SliceZone/defineSliceZoneComponents.js.map +1 -0
- package/dist/SliceZone/getSliceComponentProps.cjs.map +1 -0
- package/dist/SliceZone/getSliceComponentProps.d.ts.map +1 -0
- package/dist/SliceZone/getSliceComponentProps.js.map +1 -0
- package/dist/SliceZone/types.d.ts.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +2 -2
- package/dist/_virtual/rolldown_runtime.js +2 -2
- package/dist/createPrismic.cjs.map +1 -0
- package/dist/createPrismic.d.cts +13 -7
- package/dist/createPrismic.d.cts.map +1 -1
- package/dist/{src/createPrismic.d.ts → createPrismic.d.ts} +13 -7
- package/dist/createPrismic.d.ts.map +1 -0
- package/dist/createPrismic.js.map +1 -0
- package/dist/index.cjs +14 -12
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +20 -19
- package/dist/index.js +14 -13
- package/dist/{src/lib → lib}/devMsg.cjs +1 -1
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/{src/lib → lib}/devMsg.js +1 -1
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +11 -10
- package/src/PrismicLink.vue +3 -3
- package/src/PrismicRichText/PrismicRichText.vue +2 -2
- package/src/PrismicTable/PrismicTable.vue +2 -2
- package/src/SliceSimulator.vue +78 -0
- package/src/createPrismic.ts +15 -8
- package/src/index.ts +3 -0
- package/dist/src/PrismicImage.cjs.map +0 -1
- package/dist/src/PrismicImage.js.map +0 -1
- package/dist/src/PrismicImage.vue.d.ts.map +0 -1
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicLink.cjs.map +0 -1
- package/dist/src/PrismicLink.js.map +0 -1
- package/dist/src/PrismicLink.vue.d.ts.map +0 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichText.cjs.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichText.js.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.js.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicRichText/getRichTextComponentProps.cjs.map +0 -1
- package/dist/src/PrismicRichText/getRichTextComponentProps.d.ts.map +0 -1
- package/dist/src/PrismicRichText/getRichTextComponentProps.js.map +0 -1
- package/dist/src/PrismicRichText/types.d.ts.map +0 -1
- package/dist/src/PrismicTable/PrismicTable.cjs.map +0 -1
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +0 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +0 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +0 -1
- package/dist/src/PrismicTable/PrismicTableRow.cjs.map +0 -1
- package/dist/src/PrismicTable/PrismicTableRow.js.map +0 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicTable/getTableComponentProps.cjs.map +0 -1
- package/dist/src/PrismicTable/getTableComponentProps.d.ts.map +0 -1
- package/dist/src/PrismicTable/getTableComponentProps.js.map +0 -1
- package/dist/src/PrismicTable/types.d.ts.map +0 -1
- package/dist/src/PrismicText.cjs.map +0 -1
- package/dist/src/PrismicText.js.map +0 -1
- package/dist/src/PrismicText.vue.d.ts.map +0 -1
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/SliceZone/SliceZone.cjs.map +0 -1
- package/dist/src/SliceZone/SliceZone.js.map +0 -1
- package/dist/src/SliceZone/SliceZone.vue.d.ts.map +0 -1
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/SliceZone/TODOSliceComponent.cjs.map +0 -1
- package/dist/src/SliceZone/TODOSliceComponent.d.ts.map +0 -1
- package/dist/src/SliceZone/TODOSliceComponent.js.map +0 -1
- package/dist/src/SliceZone/defineSliceZoneComponents.cjs.map +0 -1
- package/dist/src/SliceZone/defineSliceZoneComponents.d.ts.map +0 -1
- package/dist/src/SliceZone/defineSliceZoneComponents.js.map +0 -1
- package/dist/src/SliceZone/getSliceComponentProps.cjs.map +0 -1
- package/dist/src/SliceZone/getSliceComponentProps.d.ts.map +0 -1
- package/dist/src/SliceZone/getSliceComponentProps.js.map +0 -1
- package/dist/src/SliceZone/types.d.ts.map +0 -1
- package/dist/src/createPrismic.cjs.map +0 -1
- package/dist/src/createPrismic.d.ts.map +0 -1
- package/dist/src/createPrismic.js.map +0 -1
- package/dist/src/lib/devMsg.cjs.map +0 -1
- package/dist/src/lib/devMsg.js.map +0 -1
- package/dist/src/lib/isInternalURL.cjs.map +0 -1
- package/dist/src/lib/isInternalURL.js.map +0 -1
- package/dist/src/types.cjs.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js.map +0 -1
- /package/dist/{src/PrismicImage.cjs → PrismicImage.cjs} +0 -0
- /package/dist/{src/PrismicImage.js → PrismicImage.js} +0 -0
- /package/dist/{src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs → PrismicImage.vue_vue_type_script_setup_true_lang.cjs} +0 -0
- /package/dist/{src/PrismicImage.vue_vue_type_script_setup_true_lang.js → PrismicImage.vue_vue_type_script_setup_true_lang.js} +0 -0
- /package/dist/{src/PrismicLink.cjs → PrismicLink.cjs} +0 -0
- /package/dist/{src/PrismicLink.js → PrismicLink.js} +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichText.cjs +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichText.js +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextDefaultComponent.cjs +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextDefaultComponent.js +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextSerialize.cjs +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextSerialize.js +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/getRichTextComponentProps.cjs +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/getRichTextComponentProps.d.ts +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/getRichTextComponentProps.js +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/index.d.ts +0 -0
- /package/dist/{src/PrismicRichText → PrismicRichText}/types.d.ts +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTable.cjs +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTable.js +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTableDefaultComponents.cjs +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTableDefaultComponents.js +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTableRow.cjs +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTableRow.js +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/PrismicTableRow.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/getTableComponentProps.d.ts +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/index.d.ts +0 -0
- /package/dist/{src/PrismicTable → PrismicTable}/types.d.ts +0 -0
- /package/dist/{src/PrismicText.cjs → PrismicText.cjs} +0 -0
- /package/dist/{src/PrismicText.js → PrismicText.js} +0 -0
- /package/dist/{src/PrismicText.vue_vue_type_script_setup_true_lang.cjs → PrismicText.vue_vue_type_script_setup_true_lang.cjs} +0 -0
- /package/dist/{src/PrismicText.vue_vue_type_script_setup_true_lang.js → PrismicText.vue_vue_type_script_setup_true_lang.js} +0 -0
- /package/dist/{src/SliceZone → SliceZone}/SliceZone.cjs +0 -0
- /package/dist/{src/SliceZone → SliceZone}/SliceZone.js +0 -0
- /package/dist/{src/SliceZone → SliceZone}/SliceZone.vue_vue_type_script_setup_true_lang.cjs +0 -0
- /package/dist/{src/SliceZone → SliceZone}/SliceZone.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{src/SliceZone → SliceZone}/TODOSliceComponent.cjs +0 -0
- /package/dist/{src/SliceZone → SliceZone}/TODOSliceComponent.d.ts +0 -0
- /package/dist/{src/SliceZone → SliceZone}/TODOSliceComponent.js +0 -0
- /package/dist/{src/SliceZone → SliceZone}/defineSliceZoneComponents.cjs +0 -0
- /package/dist/{src/SliceZone → SliceZone}/defineSliceZoneComponents.d.ts +0 -0
- /package/dist/{src/SliceZone → SliceZone}/defineSliceZoneComponents.js +0 -0
- /package/dist/{src/SliceZone → SliceZone}/getSliceComponentProps.cjs +0 -0
- /package/dist/{src/SliceZone → SliceZone}/getSliceComponentProps.d.ts +0 -0
- /package/dist/{src/SliceZone → SliceZone}/getSliceComponentProps.js +0 -0
- /package/dist/{src/SliceZone → SliceZone}/index.d.ts +0 -0
- /package/dist/{src/SliceZone → SliceZone}/types.d.ts +0 -0
- /package/dist/{src/createPrismic.cjs → createPrismic.cjs} +0 -0
- /package/dist/{src/createPrismic.js → createPrismic.js} +0 -0
- /package/dist/{src/lib → lib}/isInternalURL.cjs +0 -0
- /package/dist/{src/lib → lib}/isInternalURL.js +0 -0
- /package/dist/{src/types.cjs → types.cjs} +0 -0
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{src/types.js → types.js} +0 -0
|
@@ -0,0 +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 {\n\tasImagePixelDensitySrcSet,\n\tasImageWidthSrcSet,\n\tisFilled,\n} 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:\n\t * 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\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * 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:\n\t * 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:\n\t * 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:\n\t\t\t * 640, 750, 828, 1080, 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can\n\t\t\t * be used as a width in the resulting `srcset` by passing `\"thumbnails\"`\n\t\t\t * 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\n\t\t\t * densities will be used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<\n\t\t\t\t\t\tParameters<typeof asImagePixelDensitySrcSet>[1]\n\t\t\t\t >[\"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:\n\t\t\t\tprops.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":""}
|
|
@@ -0,0 +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 {\n\tasImagePixelDensitySrcSet,\n\tasImageWidthSrcSet,\n\tisFilled,\n} 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:\n\t * 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\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * 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:\n\t * 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:\n\t * 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:\n\t\t\t * 640, 750, 828, 1080, 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can\n\t\t\t * be used as a width in the resulting `srcset` by passing `\"thumbnails\"`\n\t\t\t * 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\n\t\t\t * densities will be used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<\n\t\t\t\t\t\tParameters<typeof asImagePixelDensitySrcSet>[1]\n\t\t\t\t >[\"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:\n\t\t\t\tprops.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,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue31 from "vue";
|
|
2
2
|
import { ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicImage.vue.d.ts
|
|
@@ -64,7 +64,7 @@ type PrismicImageProps = {
|
|
|
64
64
|
*/
|
|
65
65
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
66
66
|
});
|
|
67
|
-
declare const __VLS_export:
|
|
67
|
+
declare const __VLS_export: vue31.DefineComponent<({
|
|
68
68
|
/** The Prismic image field or thumbnail to render. */
|
|
69
69
|
field: ImageField | ImageField<string>;
|
|
70
70
|
/**
|
|
@@ -162,7 +162,7 @@ declare const __VLS_export: vue11.DefineComponent<({
|
|
|
162
162
|
* densities will be used: 1, 2, 3.
|
|
163
163
|
*/
|
|
164
164
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
165
|
-
}), {}, {}, {}, {},
|
|
165
|
+
}), {}, {}, {}, {}, vue31.ComponentOptionsMixin, vue31.ComponentOptionsMixin, {}, string, vue31.PublicProps, Readonly<({
|
|
166
166
|
/** The Prismic image field or thumbnail to render. */
|
|
167
167
|
field: ImageField | ImageField<string>;
|
|
168
168
|
/**
|
|
@@ -260,7 +260,7 @@ declare const __VLS_export: vue11.DefineComponent<({
|
|
|
260
260
|
* densities will be used: 1, 2, 3.
|
|
261
261
|
*/
|
|
262
262
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
263
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
263
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue31.ComponentProvideOptions, false, {}, any>;
|
|
264
264
|
declare const _default: typeof __VLS_export;
|
|
265
265
|
//#endregion
|
|
266
266
|
export { PrismicImageProps, _default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue.d.cts","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue.d.cts","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,KAAA;;;;;;;;;kBArIlC,YACA,kBAAkB;;cAiIlB,oBAAY;;SAtMV,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;oBADP,KAAA,CAAA,qBAAA;;SApET,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;;cAiIN,iBAGU"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
import { ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicImage.vue.d.ts
|
|
@@ -64,7 +64,7 @@ type PrismicImageProps = {
|
|
|
64
64
|
*/
|
|
65
65
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
66
66
|
});
|
|
67
|
-
declare const __VLS_export:
|
|
67
|
+
declare const __VLS_export: vue0.DefineComponent<({
|
|
68
68
|
/** The Prismic image field or thumbnail to render. */
|
|
69
69
|
field: ImageField | ImageField<string>;
|
|
70
70
|
/**
|
|
@@ -162,7 +162,7 @@ declare const __VLS_export: vue11.DefineComponent<({
|
|
|
162
162
|
* densities will be used: 1, 2, 3.
|
|
163
163
|
*/
|
|
164
164
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
165
|
-
}), {}, {}, {}, {},
|
|
165
|
+
}), {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<({
|
|
166
166
|
/** The Prismic image field or thumbnail to render. */
|
|
167
167
|
field: ImageField | ImageField<string>;
|
|
168
168
|
/**
|
|
@@ -260,7 +260,7 @@ declare const __VLS_export: vue11.DefineComponent<({
|
|
|
260
260
|
* densities will be used: 1, 2, 3.
|
|
261
261
|
*/
|
|
262
262
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
263
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
263
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
264
264
|
declare const _default: typeof __VLS_export;
|
|
265
265
|
//#endregion
|
|
266
266
|
export { PrismicImageProps, _default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue.d.ts","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,KAAZ;;;;;;;;;kBArItB,YACA,kBAAkB;;cAiIlB,mBAAY;;SAtMV,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;oBADP,IAAA,CAAA,qBAAA;;SApET,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;;cAiIN,iBAGU"}
|
|
@@ -0,0 +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 {\n\tasImagePixelDensitySrcSet,\n\tasImageWidthSrcSet,\n\tisFilled,\n} 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:\n\t * 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\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * 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:\n\t * 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:\n\t * 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:\n\t\t\t * 640, 750, 828, 1080, 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can\n\t\t\t * be used as a width in the resulting `srcset` by passing `\"thumbnails\"`\n\t\t\t * 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\n\t\t\t * densities will be used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<\n\t\t\t\t\t\tParameters<typeof asImagePixelDensitySrcSet>[1]\n\t\t\t\t >[\"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:\n\t\t\t\tprops.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0FA,MAAM,QAAQ;AAGd,MAAI,YACH,4BAAkB;AACjB,OAAI,OAAO,MAAM,QAAQ,YAAY,MAAM,QAAQ,GAClD,SAAQ,KACP,qQAAqQ,sBACpQ,8BACA,GACF;AAGD,OAAI,OAAO,MAAM,gBAAgB,YAAY,MAAM,gBAAgB,GAClE,SAAQ,KACP,qSAAqS,sBACpS,8BACA,GACF;AAGD,OAAI,MAAM,UAAU,MAAM,eACzB,SAAQ,KACP,4MACD;IAED;EAGF,MAAM,WAAW,UAA2D;AAC3E,OAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YACjD,QAAO;QACD;IACN,MAAM,SAAS,OAAO,SAAS,MAAK;AAEpC,QAAI,OAAO,MAAM,OAAO,CACvB;QAEA,QAAO;;;EAKV,MAAM,gCAAuB;AAC5B,OAAI,CAAC,2BAAS,eAAe,MAAM,MAAM,CACxC;GAGD,IAAI;GACJ,IAAI;AACJ,OAAI,MAAM,UAAU,CAAC,MAAM,gBAAgB;IAC1C,MAAM,gDAAyB,MAAM,OAAO;KAC3C,GAAG,MAAM;KACT,QAAQ,MAAM,WAAW,aAAa,SAAY,MAAM;KACxD,CAAA;AAED,UAAM,IAAI;AACV,aAAS,IAAI;cACH,MAAM,gBAAgB;IAChC,MAAM,uDAAgC,MAAM,OAAO;KAClD,GAAG,MAAM;KACT,gBACC,MAAM,mBAAmB,aAAa,SAAY,MAAM;KACzD,CAAA;AAED,UAAM,IAAI;AACV,aAAS,IAAI;;GAGd,MAAM,KAAK,MAAM,MAAM,WAAW,QAAQ,MAAM,MAAM,WAAW;GAEjE,MAAM,cAAc,QAAQ,MAAM,MAAK;GACvC,MAAM,eAAe,QAAQ,MAAM,OAAM;GAEzC,IAAI,gBAAgB,eAAe,MAAM,MAAM,WAAW;GAC1D,IAAI,iBAAiB,gBAAgB,MAAM,MAAM,WAAW;AAE5D,OAAI,eAAe,QAAQ,gBAAgB,KAC1C,kBAAiB,cAAc;YACrB,eAAe,QAAQ,gBAAgB,KACjD,iBAAgB,eAAe;AAGhC,UAAO;IACN;IACA;IACA,KAAK,MAAM,QAAQ,MAAM,MAAM,OAAO,MAAM;IAC5C,OAAO,KAAK,MAAM,cAAc;IAChC,QAAQ,KAAK,MAAM,eAAe;IACnC;IACA;;UAKO,MAAA,2DAML,OAAA;;IALA,KAAK,MAAA,MAAM;IACX,QAAQ,MAAA,MAAM;IACd,KAAK,MAAA,MAAM;IACX,OAAO,MAAA,MAAM;IACb,QAAQ,MAAA,MAAM"}
|
|
@@ -0,0 +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 {\n\tasImagePixelDensitySrcSet,\n\tasImageWidthSrcSet,\n\tisFilled,\n} 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:\n\t * 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\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * 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:\n\t * 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:\n\t * 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:\n\t\t\t * 640, 750, 828, 1080, 1200, 1920, 2048, 3840.\n\t\t\t *\n\t\t\t * If the image field contains responsive views, each responsive view can\n\t\t\t * be used as a width in the resulting `srcset` by passing `\"thumbnails\"`\n\t\t\t * 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\n\t\t\t * densities will be used: 1, 2, 3.\n\t\t\t */\n\t\t\tpixelDensities:\n\t\t\t\t| NonNullable<\n\t\t\t\t\t\tParameters<typeof asImagePixelDensitySrcSet>[1]\n\t\t\t\t >[\"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:\n\t\t\t\tprops.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0FA,MAAM,QAAQ;AAGd,MAAI,IACH,mBAAkB;AACjB,OAAI,OAAO,MAAM,QAAQ,YAAY,MAAM,QAAQ,GAClD,SAAQ,KACP,qQAAqQ,OACpQ,8BACA,GACF;AAGD,OAAI,OAAO,MAAM,gBAAgB,YAAY,MAAM,gBAAgB,GAClE,SAAQ,KACP,qSAAqS,OACpS,8BACA,GACF;AAGD,OAAI,MAAM,UAAU,MAAM,eACzB,SAAQ,KACP,4MACD;IAED;EAGF,MAAM,WAAW,UAA2D;AAC3E,OAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YACjD,QAAO;QACD;IACN,MAAM,SAAS,OAAO,SAAS,MAAK;AAEpC,QAAI,OAAO,MAAM,OAAO,CACvB;QAEA,QAAO;;;EAKV,MAAM,QAAQ,eAAe;AAC5B,OAAI,CAAC,SAAS,eAAe,MAAM,MAAM,CACxC;GAGD,IAAI;GACJ,IAAI;AACJ,OAAI,MAAM,UAAU,CAAC,MAAM,gBAAgB;IAC1C,MAAM,MAAM,mBAAmB,MAAM,OAAO;KAC3C,GAAG,MAAM;KACT,QAAQ,MAAM,WAAW,aAAa,SAAY,MAAM;KACxD,CAAA;AAED,UAAM,IAAI;AACV,aAAS,IAAI;cACH,MAAM,gBAAgB;IAChC,MAAM,MAAM,0BAA0B,MAAM,OAAO;KAClD,GAAG,MAAM;KACT,gBACC,MAAM,mBAAmB,aAAa,SAAY,MAAM;KACzD,CAAA;AAED,UAAM,IAAI;AACV,aAAS,IAAI;;GAGd,MAAM,KAAK,MAAM,MAAM,WAAW,QAAQ,MAAM,MAAM,WAAW;GAEjE,MAAM,cAAc,QAAQ,MAAM,MAAK;GACvC,MAAM,eAAe,QAAQ,MAAM,OAAM;GAEzC,IAAI,gBAAgB,eAAe,MAAM,MAAM,WAAW;GAC1D,IAAI,iBAAiB,gBAAgB,MAAM,MAAM,WAAW;AAE5D,OAAI,eAAe,QAAQ,gBAAgB,KAC1C,kBAAiB,cAAc;YACrB,eAAe,QAAQ,gBAAgB,KACjD,iBAAgB,eAAe;AAGhC,UAAO;IACN;IACA;IACA,KAAK,MAAM,QAAQ,MAAM,MAAM,OAAO,MAAM;IAC5C,OAAO,KAAK,MAAM,cAAc;IAChC,QAAQ,KAAK,MAAM,eAAe;IACnC;IACA;;UAKO,MAAA,sBADP,mBAOE,OAAA;;IALA,KAAK,MAAA,MAAM;IACX,QAAQ,MAAA,MAAM;IACd,KAAK,MAAA,MAAM;IACX,OAAO,MAAA,MAAM;IACb,QAAQ,MAAA,MAAM"}
|
|
@@ -0,0 +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 { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./createPrismic\"\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\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\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `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\n\t * component, provide the Link 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 || linkResolver,\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 ||\n\t\t\t\tcomponents?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponents?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\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":""}
|
|
@@ -0,0 +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 { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./createPrismic\"\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\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\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `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\n\t * component, provide the Link 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 || linkResolver,\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 ||\n\t\t\t\tcomponents?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponents?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\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,5 +1,5 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue6 from "vue";
|
|
3
3
|
import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
|
|
4
4
|
|
|
5
5
|
//#region src/PrismicLink.vue.d.ts
|
|
@@ -12,7 +12,7 @@ type PrismicLinkProps = {
|
|
|
12
12
|
* If your app uses route resolvers when querying for your Prismic
|
|
13
13
|
* repository's content, a link resolver does not need to be provided.
|
|
14
14
|
*
|
|
15
|
-
* @see
|
|
15
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
16
16
|
*/
|
|
17
17
|
linkResolver?: LinkResolverFunction;
|
|
18
18
|
/**
|
|
@@ -49,7 +49,7 @@ declare var __VLS_8: {};
|
|
|
49
49
|
type __VLS_Slots = {} & {
|
|
50
50
|
default?: (props: typeof __VLS_8) => any;
|
|
51
51
|
};
|
|
52
|
-
declare const __VLS_base:
|
|
52
|
+
declare const __VLS_base: vue6.DefineComponent<({
|
|
53
53
|
/**
|
|
54
54
|
* The link resolver used to resolve links.
|
|
55
55
|
*
|
|
@@ -57,7 +57,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
57
57
|
* If your app uses route resolvers when querying for your Prismic
|
|
58
58
|
* repository's content, a link resolver does not need to be provided.
|
|
59
59
|
*
|
|
60
|
-
* @see
|
|
60
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
61
61
|
*/
|
|
62
62
|
linkResolver?: LinkResolverFunction;
|
|
63
63
|
/**
|
|
@@ -93,7 +93,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
93
93
|
* If your app uses route resolvers when querying for your Prismic
|
|
94
94
|
* repository's content, a link resolver does not need to be provided.
|
|
95
95
|
*
|
|
96
|
-
* @see
|
|
96
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
97
97
|
*/
|
|
98
98
|
linkResolver?: LinkResolverFunction;
|
|
99
99
|
/**
|
|
@@ -121,7 +121,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
121
121
|
/** The Prismic document to render as a link. */
|
|
122
122
|
document: PrismicDocument;
|
|
123
123
|
field?: never;
|
|
124
|
-
}), {}, {}, {}, {},
|
|
124
|
+
}), {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<({
|
|
125
125
|
/**
|
|
126
126
|
* The link resolver used to resolve links.
|
|
127
127
|
*
|
|
@@ -129,7 +129,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
129
129
|
* If your app uses route resolvers when querying for your Prismic
|
|
130
130
|
* repository's content, a link resolver does not need to be provided.
|
|
131
131
|
*
|
|
132
|
-
* @see
|
|
132
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
133
133
|
*/
|
|
134
134
|
linkResolver?: LinkResolverFunction;
|
|
135
135
|
/**
|
|
@@ -165,7 +165,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
165
165
|
* If your app uses route resolvers when querying for your Prismic
|
|
166
166
|
* repository's content, a link resolver does not need to be provided.
|
|
167
167
|
*
|
|
168
|
-
* @see
|
|
168
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
169
169
|
*/
|
|
170
170
|
linkResolver?: LinkResolverFunction;
|
|
171
171
|
/**
|
|
@@ -193,7 +193,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
193
193
|
/** The Prismic document to render as a link. */
|
|
194
194
|
document: PrismicDocument;
|
|
195
195
|
field?: never;
|
|
196
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
196
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
|
|
197
197
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
198
198
|
declare const _default: typeof __VLS_export;
|
|
199
199
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.vue.d.cts","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":[],"mappings":";;;;;;KAyJY,gBAAA;EAAA;;;;;;;;AA8CX;EAkFI,YAAA,CAAA,EAtHW,oBAuHoB;EAK9B;;;;;EAhGI,GAAA,CAAA,EAAA,MAAA,GArBM,iBAqBN,CAAA,KAAA,CAAA;EA5BM;;;;;;;;EAAA,iBAAA,CAAA,EAiBK,kBAjBL;EAOA;;;;;EAAA,iBAAA,CAAA,EAiBK,kBAjBL;CAUK,GAAA,CAAA;EAOA;EASR,KAAA,EALH,SAKG;;;;UA2FG,EA3FH,eA2FG;EAAA,KAAA,CAAA,EAAA,KAAA;AAAA,CAAA,CAAA;YAPZ,OAU8C,EAAA,CAAA,CAAA;KAT7C,WAAA,GASyD,CAAA,CAAA,GAAA;EAAnC,OAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OARE,OAQF,EAAA,GAAA,GAAA;CAAe;AAAA,cAHpC,UAIkC,
|
|
1
|
+
{"version":3,"file":"PrismicLink.vue.d.cts","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":[],"mappings":";;;;;;KAyJY,gBAAA;EAAA;;;;;;;;AA8CX;EAkFI,YAAA,CAAA,EAtHW,oBAuHoB;EAK9B;;;;;EAhGI,GAAA,CAAA,EAAA,MAAA,GArBM,iBAqBN,CAAA,KAAA,CAAA;EA5BM;;;;;;;;EAAA,iBAAA,CAAA,EAiBK,kBAjBL;EAOA;;;;;EAAA,iBAAA,CAAA,EAiBK,kBAjBL;CAUK,GAAA,CAAA;EAOA;EASR,KAAA,EALH,SAKG;;;;UA2FG,EA3FH,eA2FG;EAAA,KAAA,CAAA,EAAA,KAAA;AAAA,CAAA,CAAA;YAPZ,OAU8C,EAAA,CAAA,CAAA;KAT7C,WAAA,GASyD,CAAA,CAAA,GAAA;EAAnC,OAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OARE,OAQF,EAAA,GAAA,GAAA;CAAe;AAAA,cAHpC,UAIkC,OAJxB,eAIwB,CAAA,CAAA;EACnC;;;;;;;;;iBAjIW;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;SAIX;;;;;;;;;;;;iBA5BM;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;YASR;;oBAAe,IAAA,CAAA,qBAAA;;;;;;;;;;iBAjCZ;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;SAIX;;;;;;;;;;;;iBA5BM;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;YASR;;;cA8FP,cAAqB,uBAAuB,YAAY;cAApB,iBACd;KACvB,wBAAwB;;YAEnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue4 from "vue";
|
|
3
3
|
import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
|
|
4
4
|
|
|
5
5
|
//#region src/PrismicLink.vue.d.ts
|
|
@@ -12,7 +12,7 @@ type PrismicLinkProps = {
|
|
|
12
12
|
* If your app uses route resolvers when querying for your Prismic
|
|
13
13
|
* repository's content, a link resolver does not need to be provided.
|
|
14
14
|
*
|
|
15
|
-
* @see
|
|
15
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
16
16
|
*/
|
|
17
17
|
linkResolver?: LinkResolverFunction;
|
|
18
18
|
/**
|
|
@@ -49,7 +49,7 @@ declare var __VLS_8: {};
|
|
|
49
49
|
type __VLS_Slots = {} & {
|
|
50
50
|
default?: (props: typeof __VLS_8) => any;
|
|
51
51
|
};
|
|
52
|
-
declare const __VLS_base:
|
|
52
|
+
declare const __VLS_base: vue4.DefineComponent<({
|
|
53
53
|
/**
|
|
54
54
|
* The link resolver used to resolve links.
|
|
55
55
|
*
|
|
@@ -57,7 +57,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
57
57
|
* If your app uses route resolvers when querying for your Prismic
|
|
58
58
|
* repository's content, a link resolver does not need to be provided.
|
|
59
59
|
*
|
|
60
|
-
* @see
|
|
60
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
61
61
|
*/
|
|
62
62
|
linkResolver?: LinkResolverFunction;
|
|
63
63
|
/**
|
|
@@ -93,7 +93,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
93
93
|
* If your app uses route resolvers when querying for your Prismic
|
|
94
94
|
* repository's content, a link resolver does not need to be provided.
|
|
95
95
|
*
|
|
96
|
-
* @see
|
|
96
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
97
97
|
*/
|
|
98
98
|
linkResolver?: LinkResolverFunction;
|
|
99
99
|
/**
|
|
@@ -121,7 +121,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
121
121
|
/** The Prismic document to render as a link. */
|
|
122
122
|
document: PrismicDocument;
|
|
123
123
|
field?: never;
|
|
124
|
-
}), {}, {}, {}, {},
|
|
124
|
+
}), {}, {}, {}, {}, vue4.ComponentOptionsMixin, vue4.ComponentOptionsMixin, {}, string, vue4.PublicProps, Readonly<({
|
|
125
125
|
/**
|
|
126
126
|
* The link resolver used to resolve links.
|
|
127
127
|
*
|
|
@@ -129,7 +129,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
129
129
|
* If your app uses route resolvers when querying for your Prismic
|
|
130
130
|
* repository's content, a link resolver does not need to be provided.
|
|
131
131
|
*
|
|
132
|
-
* @see
|
|
132
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
133
133
|
*/
|
|
134
134
|
linkResolver?: LinkResolverFunction;
|
|
135
135
|
/**
|
|
@@ -165,7 +165,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
165
165
|
* If your app uses route resolvers when querying for your Prismic
|
|
166
166
|
* repository's content, a link resolver does not need to be provided.
|
|
167
167
|
*
|
|
168
|
-
* @see
|
|
168
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
169
169
|
*/
|
|
170
170
|
linkResolver?: LinkResolverFunction;
|
|
171
171
|
/**
|
|
@@ -193,7 +193,7 @@ declare const __VLS_base: vue16.DefineComponent<({
|
|
|
193
193
|
/** The Prismic document to render as a link. */
|
|
194
194
|
document: PrismicDocument;
|
|
195
195
|
field?: never;
|
|
196
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
196
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue4.ComponentProvideOptions, false, {}, any>;
|
|
197
197
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
198
198
|
declare const _default: typeof __VLS_export;
|
|
199
199
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicLink.vue.d.ts","names":[],"sources":["../src/PrismicLink.vue"],"sourcesContent":[],"mappings":";;;;;;KAyJY,gBAAA;EAAA;;;;;;;;AA8CX;EAkFI,YAAA,CAAA,EAtHW,oBAuHoB;EAK9B;;;;;EAhGI,GAAA,CAAA,EAAA,MAAA,GArBM,iBAqBN,CAAA,KAAA,CAAA;EA5BM;;;;;;;;EAAA,iBAAA,CAAA,EAiBK,kBAjBL;EAOA;;;;;EAAA,iBAAA,CAAA,EAiBK,kBAjBL;CAUK,GAAA,CAAA;EAOA;EASR,KAAA,EALH,SAKG;;;;UA2FG,EA3FH,eA2FG;EAAA,KAAA,CAAA,EAAA,KAAA;AAAA,CAAA,CAAA;YAPZ,OAU8C,EAAA,CAAA,CAAA;KAT7C,WAAA,GASyD,CAAA,CAAA,GAAA;EAAnC,OAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OARE,OAQF,EAAA,GAAA,GAAA;CAAe;AAAA,cAHpC,UAIkC,OAJxB,eAIwB,CAAA,CAAA;EACnC;;;;;;;;;iBAjIW;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;SAIX;;;;;;;;;;;;iBA5BM;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;YASR;;oBAAe,IAAA,CAAA,qBAAA;;;;;;;;;;iBAjCZ;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;SAIX;;;;;;;;;;;;iBA5BM;;;;;;iBAOA;;;;;;;;;sBAUK;;;;;;sBAOA;;;YASR;;;cA8FP,cAAqB,uBAAuB,YAAY;cAApB,iBACd;KACvB,wBAAwB;;YAEnB"}
|
|
@@ -41,10 +41,10 @@ var PrismicLink_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
|
|
|
41
41
|
},
|
|
42
42
|
setup(__props) {
|
|
43
43
|
const props = __props;
|
|
44
|
-
const { components } = require_createPrismic.usePrismic();
|
|
44
|
+
const { linkResolver, components } = require_createPrismic.usePrismic();
|
|
45
45
|
const rawAttrs = (0, vue.computed)(() => {
|
|
46
46
|
return (0, _prismicio_client.asLinkAttrs)(props.field || props.document, {
|
|
47
|
-
linkResolver: props.linkResolver ||
|
|
47
|
+
linkResolver: props.linkResolver || linkResolver,
|
|
48
48
|
rel(args) {
|
|
49
49
|
if (props.rel) return typeof props.rel === "function" ? props.rel(args) : props.rel;
|
|
50
50
|
return args.isExternal ? defaultExternalRelAttribute : void 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicLink.vue_vue_type_script_setup_true_lang.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 { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./createPrismic\"\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\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\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `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\n\t * component, provide the Link 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 || linkResolver,\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 ||\n\t\t\t\tcomponents?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponents?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\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":";;;;;;;AAiBA,MAAM,2BAA2B;;AAGjC,MAAM,2BAA2B;;AAGjC,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDpC,MAAM,QAAQ;EAGd,MAAM,EAAE,cAAc,eAAe,kCAAW;EAEhD,MAAM,mCAA0B;AAC/B,6CAAmB,MAAM,SAAS,MAAM,UAAU;IACjD,cAAc,MAAM,gBAAgB;IACpC,IAAI,MAAM;AACT,SAAI,MAAM,IACT,QAAO,OAAO,MAAM,QAAQ,aAAa,MAAM,IAAI,KAAK,GAAG,MAAM;AAGlE,YAAO,KAAK,aAAa,8BAA8B;;IAExD,CAAA;IACD;EAED,MAAM,oCAA2B;AAChC,UAAO,oCAAc,SAAS,MAAM,QAAQ,GAAE,GAC3C,MAAM,qBACN,YAAY,yBACZ,2BACA,MAAM,qBACN,YAAY,yBACZ;IACH;EAGD,MAAM,gCAAuB;AAC5B,UAAO,UAAU,UAAU,MACxB;IACA,MAAM,SAAS,MAAM;IACrB,QAAQ,SAAS,MAAM;IACvB,KAAK,SAAS,MAAM;IACrB,GACC;IACA,IAAI,SAAS,MAAM;IACnB,QAAQ,SAAS,MAAM;IACvB,KAAK,SAAS,MAAM;IACrB;IACF;;sFAIgB,UAAA,MAAS,sDAAU,MAAA,MAAK,CAAA,EAAA;oCAGhC,qBAAA,KAAA,QAAA,WAAA,EAAA,QAAA,mDADH,MAAM,SAAK,UAAc,MAAM,QAAQ,MAAM,MAAM,OAAO,OAAS,EAAA,EAAA"}
|
|
@@ -41,10 +41,10 @@ var PrismicLink_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
41
41
|
},
|
|
42
42
|
setup(__props) {
|
|
43
43
|
const props = __props;
|
|
44
|
-
const { components } = usePrismic();
|
|
44
|
+
const { linkResolver, components } = usePrismic();
|
|
45
45
|
const rawAttrs = computed(() => {
|
|
46
46
|
return asLinkAttrs(props.field || props.document, {
|
|
47
|
-
linkResolver: props.linkResolver ||
|
|
47
|
+
linkResolver: props.linkResolver || linkResolver,
|
|
48
48
|
rel(args) {
|
|
49
49
|
if (props.rel) return typeof props.rel === "function" ? props.rel(args) : props.rel;
|
|
50
50
|
return args.isExternal ? defaultExternalRelAttribute : void 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicLink.vue_vue_type_script_setup_true_lang.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 { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./createPrismic\"\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\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\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `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\n\t * component, provide the Link 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 || linkResolver,\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 ||\n\t\t\t\tcomponents?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponents?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\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":";;;;;;;AAiBA,MAAM,2BAA2B;;AAGjC,MAAM,2BAA2B;;AAGjC,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDpC,MAAM,QAAQ;EAGd,MAAM,EAAE,cAAc,eAAe,YAAW;EAEhD,MAAM,WAAW,eAAe;AAC/B,UAAO,YAAY,MAAM,SAAS,MAAM,UAAU;IACjD,cAAc,MAAM,gBAAgB;IACpC,IAAI,MAAM;AACT,SAAI,MAAM,IACT,QAAO,OAAO,MAAM,QAAQ,aAAa,MAAM,IAAI,KAAK,GAAG,MAAM;AAGlE,YAAO,KAAK,aAAa,8BAA8B;;IAExD,CAAA;IACD;EAED,MAAM,YAAY,eAAe;AAChC,UAAO,cAAc,SAAS,MAAM,QAAQ,GAAE,GAC3C,MAAM,qBACN,YAAY,yBACZ,2BACA,MAAM,qBACN,YAAY,yBACZ;IACH;EAGD,MAAM,QAAQ,eAAe;AAC5B,UAAO,UAAU,UAAU,MACxB;IACA,MAAM,SAAS,MAAM;IACrB,QAAQ,SAAS,MAAM;IACvB,KAAK,SAAS,MAAM;IACrB,GACC;IACA,IAAI,SAAS,MAAM;IACnB,QAAQ,SAAS,MAAM;IACvB,KAAK,SAAS,MAAM;IACrB;IACF;;uBAIA,YAIY,wBAJI,UAAA,MAAS,EAAA,eAAA,mBAAU,MAAA,MAAK,CAAA,EAAA;2BAGhC,CAFP,WAEO,KAAA,QAAA,WAAA,EAAA,QAAA,iCADH,MAAM,SAAK,UAAc,MAAM,QAAQ,MAAM,MAAM,OAAO,OAAS,EAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichText.cjs","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, ComponentShorthand } from \"../types\"\nimport { isComponent } from \"../types\"\nimport type {\n\tInternalRichTextComponents,\n\tRichTextComponent,\n\tRichTextComponents,\n} from \"./types\"\n\nimport { usePrismic } from \"../createPrismic\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/** Props for `<PrismicRichText />`. */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a\n\t * shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: RichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst { components: { richTextComponents } } = usePrismic()\n\nconst resolvedComponents = computed<RichTextComponents>(() => {\n\treturn { ...richTextComponents, ...props.components }\n})\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type] as\n\t\t| RichTextComponent\n\t\t| ComponentShorthand\n\t\t| undefined\n\n\tif (isComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tlinkResolver: props.linkResolver,\n\t\tshorthand: maybeComponentOrShorthand,\n\t}\n}\n\nconst internalComponents = computed<InternalRichTextComponents>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichText.js","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, ComponentShorthand } from \"../types\"\nimport { isComponent } from \"../types\"\nimport type {\n\tInternalRichTextComponents,\n\tRichTextComponent,\n\tRichTextComponents,\n} from \"./types\"\n\nimport { usePrismic } from \"../createPrismic\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/** Props for `<PrismicRichText />`. */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a\n\t * shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: RichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst { components: { richTextComponents } } = usePrismic()\n\nconst resolvedComponents = computed<RichTextComponents>(() => {\n\treturn { ...richTextComponents, ...props.components }\n})\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type] as\n\t\t| RichTextComponent\n\t\t| ComponentShorthand\n\t\t| undefined\n\n\tif (isComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tlinkResolver: props.linkResolver,\n\t\tshorthand: maybeComponentOrShorthand,\n\t}\n}\n\nconst internalComponents = computed<InternalRichTextComponents>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "../types.js";
|
|
2
2
|
import { RichTextComponents } from "./types.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as vue24 from "vue";
|
|
4
4
|
import { PropType } from "vue";
|
|
5
5
|
import { LinkResolverFunction, RichTextField } from "@prismicio/client";
|
|
6
6
|
|
|
@@ -40,7 +40,7 @@ type PrismicRichTextProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
fallback?: ComponentOrTagName;
|
|
42
42
|
};
|
|
43
|
-
declare const __VLS_export:
|
|
43
|
+
declare const __VLS_export: vue24.DefineComponent<vue24.ExtractPropTypes<{
|
|
44
44
|
field: {
|
|
45
45
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
46
46
|
};
|
|
@@ -53,7 +53,7 @@ declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
|
53
53
|
fallback: {
|
|
54
54
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
55
55
|
};
|
|
56
|
-
}>, {}, {}, {}, {},
|
|
56
|
+
}>, {}, {}, {}, {}, vue24.ComponentOptionsMixin, vue24.ComponentOptionsMixin, {}, string, vue24.PublicProps, Readonly<vue24.ExtractPropTypes<{
|
|
57
57
|
field: {
|
|
58
58
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
59
59
|
};
|
|
@@ -66,7 +66,7 @@ declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
|
66
66
|
fallback: {
|
|
67
67
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
68
68
|
};
|
|
69
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
69
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue24.ComponentProvideOptions, true, {}, any>;
|
|
70
70
|
declare const _default: typeof __VLS_export;
|
|
71
71
|
//#endregion
|
|
72
72
|
export { PrismicRichTextProps, _default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue.d.ts","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;KAwKY,oBAAA;;EAAA,KAAA,EAEJ,aAFI,GAAoB,IAAA,GAAA,SAAA;EAExB;;;;;AAkCP;;;;EA6HmB,YAAA,CAAA,EApJJ,oBAoJI;EAGO;;;;;;;;;;;;;;EAIxB,UAAA,CAAA,EA3IW,kBA2IX;EADmC;;;;aApI1B;;cAwHN,YAAY,QAAA,eAAA,CAY4B,KAAA,CAZ5B,gBAAA,CAAA;EAAA,KAAA,EAAA;UAGU,SAAS;;;UAGjB,SAAS;;;UAGX,SAAS;;;UAGW,SACnC;;oBAbe,KAAA,CAAA,qBAAA,uEAY4B,KAAA,CAAA;;UATlB,SAAS;;;UAGjB,SAAS;;;UAGX,SAAS;;;UAGW,SACnC;;;cAbe,iBAkBU"}
|
|
@@ -21,10 +21,10 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
21
21
|
},
|
|
22
22
|
setup(__props) {
|
|
23
23
|
const props = __props;
|
|
24
|
-
const { components: {
|
|
24
|
+
const { components: { richTextComponents } } = require_createPrismic.usePrismic();
|
|
25
25
|
const resolvedComponents = (0, vue.computed)(() => {
|
|
26
26
|
return {
|
|
27
|
-
...
|
|
27
|
+
...richTextComponents,
|
|
28
28
|
...props.components
|
|
29
29
|
};
|
|
30
30
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, ComponentShorthand } from \"../types\"\nimport { isComponent } from \"../types\"\nimport type {\n\tInternalRichTextComponents,\n\tRichTextComponent,\n\tRichTextComponents,\n} from \"./types\"\n\nimport { usePrismic } from \"../createPrismic\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/** Props for `<PrismicRichText />`. */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a\n\t * shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: RichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst { components: { richTextComponents } } = usePrismic()\n\nconst resolvedComponents = computed<RichTextComponents>(() => {\n\treturn { ...richTextComponents, ...props.components }\n})\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type] as\n\t\t| RichTextComponent\n\t\t| ComponentShorthand\n\t\t| undefined\n\n\tif (isComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tlinkResolver: props.linkResolver,\n\t\tshorthand: maybeComponentOrShorthand,\n\t}\n}\n\nconst internalComponents = computed<InternalRichTextComponents>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAgEA,MAAM,QAAQ;EAkBd,MAAM,EAAE,YAAY,EAAE,yBAAyB,kCAAW;EAE1D,MAAM,6CAAwD;AAC7D,UAAO;IAAE,GAAG;IAAoB,GAAG,MAAM;IAAW;IACpD;EAED,MAAM,mCAA0B;AAC/B,iDAAc,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,mBAAmB,QAAQ;AAK7D,OAAI,0BAAY,0BAA0B,CACzC,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,cAAc,MAAM;IACpB,WAAW;IACZ;;EAGD,MAAM,6CAAgE;AACrE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,qDAGd,0CAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,wFAAe,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
|
|
@@ -21,10 +21,10 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
21
21
|
},
|
|
22
22
|
setup(__props) {
|
|
23
23
|
const props = __props;
|
|
24
|
-
const { components: {
|
|
24
|
+
const { components: { richTextComponents } } = usePrismic();
|
|
25
25
|
const resolvedComponents = computed(() => {
|
|
26
26
|
return {
|
|
27
|
-
...
|
|
27
|
+
...richTextComponents,
|
|
28
28
|
...props.components
|
|
29
29
|
};
|
|
30
30
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, ComponentShorthand } from \"../types\"\nimport { isComponent } from \"../types\"\nimport type {\n\tInternalRichTextComponents,\n\tRichTextComponent,\n\tRichTextComponents,\n} from \"./types\"\n\nimport { usePrismic } from \"../createPrismic\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/** Props for `<PrismicRichText />`. */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\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\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a\n\t * shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: RichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst { components: { richTextComponents } } = usePrismic()\n\nconst resolvedComponents = computed<RichTextComponents>(() => {\n\treturn { ...richTextComponents, ...props.components }\n})\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type] as\n\t\t| RichTextComponent\n\t\t| ComponentShorthand\n\t\t| undefined\n\n\tif (isComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tlinkResolver: props.linkResolver,\n\t\tshorthand: maybeComponentOrShorthand,\n\t}\n}\n\nconst internalComponents = computed<InternalRichTextComponents>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAgEA,MAAM,QAAQ;EAkBd,MAAM,EAAE,YAAY,EAAE,yBAAyB,YAAW;EAE1D,MAAM,qBAAqB,eAAmC;AAC7D,UAAO;IAAE,GAAG;IAAoB,GAAG,MAAM;IAAW;IACpD;EAED,MAAM,WAAW,eAAe;AAC/B,UAAO,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,mBAAmB,QAAQ;AAK7D,OAAI,YAAY,0BAA0B,CACzC,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,cAAc,MAAM;IACpB,WAAW;IACZ;;EAGD,MAAM,qBAAqB,eAA2C;AACrE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,uBADhB,YAIE,kCAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,yBAAtB,YAAiD,wBAAZ,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichTextDefaultComponent.cjs","names":[],"sources":["../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { ComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: ComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\n\nconst dir = computed(() => {\n\treturn \"direction\" in props.node && props.node.direction === \"rtl\"\n\t\t? \"rtl\"\n\t\t: undefined\n})\n</script>\n\n<template>\n\t<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ol>\n\t<p class=\"block-img\" v-else-if=\"node.type === 'image'\">\n\t\t<PrismicLink v-if=\"node.linkTo\" :field=\"node.linkTo\"\n\t\t\t><PrismicImage :field=\"node\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\n\t<PrismicLink\n\t\tv-else-if=\"node.type === 'hyperlink'\"\n\t\t:field=\"node.data\"\n\t\t:link-resolver=\"linkResolver\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></span>\n\t<template v-else v-for=\"(line, index) in node.text.split('\\n')\" :key=\"line\"\n\t\t><br v-if=\"index > 0\" />{{ line }}</template\n\t>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichTextDefaultComponent.js","names":[],"sources":["../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { ComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: ComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\n\nconst dir = computed(() => {\n\treturn \"direction\" in props.node && props.node.direction === \"rtl\"\n\t\t? \"rtl\"\n\t\t: undefined\n})\n</script>\n\n<template>\n\t<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ol>\n\t<p class=\"block-img\" v-else-if=\"node.type === 'image'\">\n\t\t<PrismicLink v-if=\"node.linkTo\" :field=\"node.linkTo\"\n\t\t\t><PrismicImage :field=\"node\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\n\t<PrismicLink\n\t\tv-else-if=\"node.type === 'hyperlink'\"\n\t\t:field=\"node.data\"\n\t\t:link-resolver=\"linkResolver\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></span>\n\t<template v-else v-for=\"(line, index) in node.text.split('\\n')\" :key=\"line\"\n\t\t><br v-if=\"index > 0\" />{{ line }}</template\n\t>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { ComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: ComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\n\nconst dir = computed(() => {\n\treturn \"direction\" in props.node && props.node.direction === \"rtl\"\n\t\t? \"rtl\"\n\t\t: undefined\n})\n</script>\n\n<template>\n\t<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ol>\n\t<p class=\"block-img\" v-else-if=\"node.type === 'image'\">\n\t\t<PrismicLink v-if=\"node.linkTo\" :field=\"node.linkTo\"\n\t\t\t><PrismicImage :field=\"node\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\n\t<PrismicLink\n\t\tv-else-if=\"node.type === 'hyperlink'\"\n\t\t:field=\"node.data\"\n\t\t:link-resolver=\"linkResolver\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></span>\n\t<template v-else v-for=\"(line, index) in node.text.split('\\n')\" :key=\"line\"\n\t\t><br v-if=\"index > 0\" />{{ line }}</template\n\t>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EAQd,MAAM,6BAAoB;AACzB,UAAO,MAAM,KAAK,SAAS,WAC1B,MAAM,KAAK,SAAS,eACpB,MAAM,KAAK,SAAS,WACpB,MAAM,KAAK,SAAS,SAClB,MAAM,WAAW,KACjB;IACH;EAED,MAAM,gCAAuB;GAC5B,MAAM,EAAE,UAAI,GAAG,YAAU,MAAM,aAAa,EAAC;AAE7C,UAAO;IACP;EAED,MAAM,8BAAqB;AAC1B,UAAO,eAAe,MAAM,QAAQ,MAAM,KAAK,cAAc,QAC1D,QACA;IACH;;UAIiB,GAAA,qFAAS,GAAA,MAAE,sBAAgD;;IAA7C,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA;oCAAU,qBAAA,KAAA,QAAA,UAAA;;sBACjD,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEK,QAAA,KAAK,SAAI,iEAEnB,yBAAA;;IAFsC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEO,QAAA,KAAK,SAAI,oEAAkD,mDAAA,EAAA,KAAA,GAAA,EAArB,MAAA,MAAK,CAAA,EAAA,qBAAU,KAAA,QAAA,UAAA,UAClD,QAAA,KAAK,SAAI,8DAA+C,sDAAA,EAAA,KAAA,GAAA,EAAxB,MAAA,MAAK,CAAA,EAAA,qBAAU,KAAA,QAAA,UAAA,UACnD,QAAA,KAAK,SAAI,0DAAuC,kDAAA,EAAA,KAAA,IAAA,EAApB,MAAA,MAAK,CAAA,EAAA,qBAAU,KAAA,QAAA,UAAA,UAC3C,QAAA,KAAK,SAAI,iEAEnB,0BAAA;;IAFsC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACzD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,mEAEnB,0BAAA;;IAFwC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBAC3D,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,uEAEnB,kDAAA,EAAA,KAAA,IAAA,EAFmD,MAAA,MAAK,CAAA,EAAA,qBACpD,KAAA,QAAA,UAAA,UAEM,QAAA,KAAK,SAAI,yEAEnB,kDAAA,EAAA,KAAA,IAAA,EAFqD,MAAA,MAAK,CAAA,EAAA,qBACtD,KAAA,QAAA,UAAA,UAEuB,QAAA,KAAK,SAAI,6DAKrC,KALJ,aAKI,CAJgB,QAAA,KAAK,qDAER,6BAAA;;IAFiB,OAAO,QAAA,KAAK;;oCAE3C,sBAAA,kDAAA,EADe,OAAO,QAAA,MAAI,EAAU,MAAA,MAAK,EAAA,MAAA,IAAA,CAAA,QAAA,CAAA;;mEAES,kDAAA;;IAA9B,OAAO,QAAA;MAAc,MAAA,MAAK,EAAA,MAAA,IAAA,CAAA,QAAA,CAAA,OAGrC,QAAA,KAAK,SAAI,6DAMnB,2BAAA;;IALA,eAAa,QAAA,KAAK,OAAO;IACzB,oBAAkB,QAAA,KAAK,OAAO;IAC9B,wBAAsB,QAAA,KAAK,OAAO;IACnC,WAAQ,QAAA,KAAK,OAAO;MACZ,MAAA,MAAK,EAAA,MAAA,IAAA,YAAA,IAGF,QAAA,KAAK,SAAI,0DAKL,iDAAA;;IAJd,OAAO,QAAA,KAAK;IACZ,iBAAe,QAAA;MACR,MAAA,MAAK,EAAA;oCAEZ,qBAAA,KAAA,QAAA,UAAA;;yCAEU,QAAA,KAAK,SAAI,6DAIZ,4BAAA;;IAHP,OAAO,QAAA,KAAK,KAAK;MACV,MAAA,MAAK,EAAA,qBAEZ,KAAA,QAAA,UAAA,iEAGD,cAAA,EAAA,KAAA,IAAA,sBAFwC,QAAA,KAAK,KAAK,MAAK,KAAA,GAA/B,MAAM,UAAK;kFAAkC,MAAI,EAAA,CAC9D,QAAK,uDAAQ,MAAA,YAAA,iGAAG,KAAI,EAAA,EAAA"}
|