@prismicio/vue 5.2.1 → 5.3.0-pr.85.0e554a8
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/README.md +3 -15
- package/dist/PrismicEmbed.vue.d.cts +25 -0
- package/dist/PrismicEmbed.vue.d.cts.map +1 -0
- package/dist/PrismicImage.vue.d.cts +301 -0
- package/dist/PrismicImage.vue.d.cts.map +1 -0
- package/dist/PrismicLink.vue.d.cts +282 -0
- package/dist/PrismicLink.vue.d.cts.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +102 -0
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -0
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts +54 -0
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts.map +1 -0
- package/dist/PrismicRichText/types.d.cts +27 -0
- package/dist/PrismicRichText/types.d.cts.map +1 -0
- package/dist/PrismicTable/PrismicTable.vue.d.cts +38 -0
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -0
- package/dist/PrismicTable/getTableComponentProps.d.cts +136 -0
- package/dist/PrismicTable/getTableComponentProps.d.cts.map +1 -0
- package/dist/PrismicTable/types.d.cts +35 -0
- package/dist/PrismicTable/types.d.cts.map +1 -0
- package/dist/PrismicText.vue.d.cts +37 -0
- package/dist/PrismicText.vue.d.cts.map +1 -0
- package/dist/SliceZone/SliceZone.vue.d.cts +48 -0
- package/dist/SliceZone/SliceZone.vue.d.cts.map +1 -0
- package/dist/SliceZone/TODOSliceComponent.d.cts +15 -0
- package/dist/SliceZone/TODOSliceComponent.d.cts.map +1 -0
- package/dist/SliceZone/defineSliceZoneComponents.d.cts +42 -0
- package/dist/SliceZone/defineSliceZoneComponents.d.cts.map +1 -0
- package/dist/SliceZone/getSliceComponentProps.d.cts +71 -0
- package/dist/SliceZone/getSliceComponentProps.d.cts.map +1 -0
- package/dist/SliceZone/types.d.cts +100 -0
- package/dist/SliceZone/types.d.cts.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +19 -0
- package/dist/_virtual/rolldown_runtime.js +18 -0
- package/dist/createPrismic.d.cts +29 -0
- package/dist/createPrismic.d.cts.map +1 -0
- package/dist/index.cjs +35 -32
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +21 -23
- package/dist/index.js +16 -32
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.js +6 -0
- package/dist/package.js.map +1 -0
- package/dist/src/PrismicEmbed.cjs +8 -0
- package/dist/src/PrismicEmbed.cjs.map +1 -0
- package/dist/src/PrismicEmbed.js +8 -0
- package/dist/src/PrismicEmbed.js.map +1 -0
- package/dist/src/PrismicEmbed.vue.d.ts +25 -0
- package/dist/src/PrismicEmbed.vue.d.ts.map +1 -0
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.cjs +42 -0
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicImage.cjs +8 -0
- package/dist/src/PrismicImage.cjs.map +1 -0
- package/dist/src/PrismicImage.js +8 -0
- package/dist/src/PrismicImage.js.map +1 -0
- package/dist/src/PrismicImage.vue.d.ts +301 -0
- package/dist/src/PrismicImage.vue.d.ts.map +1 -0
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs +117 -0
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicLink.cjs +8 -0
- package/dist/src/PrismicLink.cjs.map +1 -0
- package/dist/src/PrismicLink.js +8 -0
- package/dist/src/PrismicLink.js.map +1 -0
- package/dist/src/PrismicLink.vue.d.ts +282 -0
- package/dist/src/PrismicLink.vue.d.ts.map +1 -0
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +86 -0
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.cjs +8 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.cjs.map +1 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.js +8 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.js.map +1 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.cjs +92 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichText.cjs +8 -0
- package/dist/src/PrismicRichText/PrismicRichText.cjs.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichText.js +8 -0
- package/dist/src/PrismicRichText/PrismicRichText.js.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts +102 -0
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +88 -0
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs +8 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js +8 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +103 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs +8 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.js +8 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.js.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +60 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicRichText/getRichTextComponentProps.cjs +40 -0
- package/dist/src/PrismicRichText/getRichTextComponentProps.cjs.map +1 -0
- package/dist/{PrismicRichText → src/PrismicRichText}/getRichTextComponentProps.d.ts +15 -10
- package/dist/src/PrismicRichText/getRichTextComponentProps.d.ts.map +1 -0
- package/dist/src/PrismicRichText/getRichTextComponentProps.js +39 -0
- package/dist/src/PrismicRichText/getRichTextComponentProps.js.map +1 -0
- package/dist/src/PrismicRichText/index.d.ts +2 -0
- package/dist/{PrismicRichText → src/PrismicRichText}/types.d.ts +11 -6
- package/dist/src/PrismicRichText/types.d.ts.map +1 -0
- package/dist/src/PrismicTable/PrismicTable.cjs +8 -0
- package/dist/src/PrismicTable/PrismicTable.cjs.map +1 -0
- package/dist/src/PrismicTable/PrismicTable.js +8 -0
- package/dist/src/PrismicTable/PrismicTable.js.map +1 -0
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts +39 -0
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -0
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +65 -0
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs +46 -0
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -0
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js +46 -0
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +1 -0
- package/dist/src/PrismicTable/PrismicTableRow.cjs +8 -0
- package/dist/src/PrismicTable/PrismicTableRow.cjs.map +1 -0
- package/dist/src/PrismicTable/PrismicTableRow.js +8 -0
- package/dist/src/PrismicTable/PrismicTableRow.js.map +1 -0
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs +51 -0
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/PrismicTable/getTableComponentProps.cjs +140 -0
- package/dist/src/PrismicTable/getTableComponentProps.cjs.map +1 -0
- package/dist/{PrismicTable → src/PrismicTable}/getTableComponentProps.d.ts +40 -32
- package/dist/src/PrismicTable/getTableComponentProps.d.ts.map +1 -0
- package/dist/src/PrismicTable/getTableComponentProps.js +129 -0
- package/dist/src/PrismicTable/getTableComponentProps.js.map +1 -0
- package/dist/src/PrismicTable/index.d.ts +1 -0
- package/dist/src/PrismicTable/types.d.ts +35 -0
- package/dist/src/PrismicTable/types.d.ts.map +1 -0
- package/dist/src/PrismicText.cjs +8 -0
- package/dist/src/PrismicText.cjs.map +1 -0
- package/dist/src/PrismicText.js +8 -0
- package/dist/src/PrismicText.js.map +1 -0
- package/dist/src/PrismicText.vue.d.ts +37 -0
- package/dist/src/PrismicText.vue.d.ts.map +1 -0
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs +48 -0
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/SliceZone/SliceZone.cjs +8 -0
- package/dist/src/SliceZone/SliceZone.cjs.map +1 -0
- package/dist/src/SliceZone/SliceZone.js +8 -0
- package/dist/src/SliceZone/SliceZone.js.map +1 -0
- package/dist/src/SliceZone/SliceZone.vue.d.ts +48 -0
- package/dist/src/SliceZone/SliceZone.vue.d.ts.map +1 -0
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs +82 -0
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/SliceZone/TODOSliceComponent.cjs +36 -0
- package/dist/src/SliceZone/TODOSliceComponent.cjs.map +1 -0
- package/dist/src/SliceZone/TODOSliceComponent.d.ts +15 -0
- package/dist/src/SliceZone/TODOSliceComponent.d.ts.map +1 -0
- package/dist/src/SliceZone/TODOSliceComponent.js +36 -0
- package/dist/src/SliceZone/TODOSliceComponent.js.map +1 -0
- package/dist/src/SliceZone/defineSliceZoneComponents.cjs +50 -0
- package/dist/src/SliceZone/defineSliceZoneComponents.cjs.map +1 -0
- package/dist/{SliceZone → src/SliceZone}/defineSliceZoneComponents.d.ts +8 -2
- package/dist/src/SliceZone/defineSliceZoneComponents.d.ts.map +1 -0
- package/dist/src/SliceZone/defineSliceZoneComponents.js +50 -0
- package/dist/src/SliceZone/defineSliceZoneComponents.js.map +1 -0
- package/dist/src/SliceZone/getSliceComponentProps.cjs +60 -0
- package/dist/src/SliceZone/getSliceComponentProps.cjs.map +1 -0
- package/dist/{SliceZone → src/SliceZone}/getSliceComponentProps.d.ts +25 -20
- package/dist/src/SliceZone/getSliceComponentProps.d.ts.map +1 -0
- package/dist/src/SliceZone/getSliceComponentProps.js +59 -0
- package/dist/src/SliceZone/getSliceComponentProps.js.map +1 -0
- package/dist/src/SliceZone/index.d.ts +4 -0
- package/dist/{SliceZone → src/SliceZone}/types.d.ts +40 -37
- package/dist/src/SliceZone/types.d.ts.map +1 -0
- package/dist/src/createPrismic.cjs +85 -0
- package/dist/src/createPrismic.cjs.map +1 -0
- package/dist/src/createPrismic.d.ts +29 -0
- package/dist/src/createPrismic.d.ts.map +1 -0
- package/dist/src/createPrismic.js +85 -0
- package/dist/src/createPrismic.js.map +1 -0
- package/dist/src/lib/Wrapper.cjs +8 -0
- package/dist/src/lib/Wrapper.cjs.map +1 -0
- package/dist/src/lib/Wrapper.js +8 -0
- package/dist/src/lib/Wrapper.js.map +1 -0
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.cjs +22 -0
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.js +22 -0
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/src/lib/devMsg.cjs +25 -0
- package/dist/src/lib/devMsg.cjs.map +1 -0
- package/dist/src/lib/devMsg.js +25 -0
- package/dist/src/lib/devMsg.js.map +1 -0
- package/dist/src/lib/isInternalURL.cjs +24 -0
- package/dist/src/lib/isInternalURL.cjs.map +1 -0
- package/dist/src/lib/isInternalURL.js +23 -0
- package/dist/src/lib/isInternalURL.js.map +1 -0
- package/dist/src/types.d.ts +357 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/usePrismic.cjs +38 -0
- package/dist/src/usePrismic.cjs.map +1 -0
- package/dist/{usePrismic.d.ts → src/usePrismic.d.ts} +10 -4
- package/dist/src/usePrismic.d.ts.map +1 -0
- package/dist/src/usePrismic.js +37 -0
- package/dist/src/usePrismic.js.map +1 -0
- package/dist/types.d.cts +357 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/usePrismic.d.cts +36 -0
- package/dist/usePrismic.d.cts.map +1 -0
- package/package.json +29 -53
- package/src/PrismicImage.vue +54 -1
- package/src/SliceZone/TODOSliceComponent.ts +2 -1
- package/src/index.ts +7 -17
- package/dist/PrismicEmbed.vue.cjs +0 -25
- package/dist/PrismicEmbed.vue.cjs.map +0 -1
- package/dist/PrismicEmbed.vue.d.ts +0 -19
- package/dist/PrismicEmbed.vue.js +0 -26
- package/dist/PrismicEmbed.vue.js.map +0 -1
- package/dist/PrismicEmbed.vue2.cjs +0 -4
- package/dist/PrismicEmbed.vue2.cjs.map +0 -1
- package/dist/PrismicEmbed.vue2.js +0 -5
- package/dist/PrismicEmbed.vue2.js.map +0 -1
- package/dist/PrismicImage.vue.cjs +0 -84
- package/dist/PrismicImage.vue.cjs.map +0 -1
- package/dist/PrismicImage.vue.d.ts +0 -224
- package/dist/PrismicImage.vue.js +0 -85
- package/dist/PrismicImage.vue.js.map +0 -1
- package/dist/PrismicImage.vue2.cjs +0 -4
- package/dist/PrismicImage.vue2.cjs.map +0 -1
- package/dist/PrismicImage.vue2.js +0 -5
- package/dist/PrismicImage.vue2.js.map +0 -1
- package/dist/PrismicLink.vue.cjs +0 -64
- package/dist/PrismicLink.vue.cjs.map +0 -1
- package/dist/PrismicLink.vue.d.ts +0 -279
- package/dist/PrismicLink.vue.js +0 -65
- package/dist/PrismicLink.vue.js.map +0 -1
- package/dist/PrismicLink.vue2.cjs +0 -4
- package/dist/PrismicLink.vue2.cjs.map +0 -1
- package/dist/PrismicLink.vue2.js +0 -5
- package/dist/PrismicLink.vue2.js.map +0 -1
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.cjs +0 -100
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.cjs.map +0 -1
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.d.ts +0 -38
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.js +0 -101
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.js.map +0 -1
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.cjs +0 -4
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.cjs.map +0 -1
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.js +0 -5
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.js.map +0 -1
- package/dist/PrismicRichText/PrismicRichText.vue.cjs +0 -97
- package/dist/PrismicRichText/PrismicRichText.vue.cjs.map +0 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts +0 -96
- package/dist/PrismicRichText/PrismicRichText.vue.js +0 -98
- package/dist/PrismicRichText/PrismicRichText.vue.js.map +0 -1
- package/dist/PrismicRichText/PrismicRichText.vue2.cjs +0 -4
- package/dist/PrismicRichText/PrismicRichText.vue2.cjs.map +0 -1
- package/dist/PrismicRichText/PrismicRichText.vue2.js +0 -5
- package/dist/PrismicRichText/PrismicRichText.vue2.js.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.cjs +0 -133
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.cjs.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.d.ts +0 -37
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.js +0 -134
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.js.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.cjs +0 -4
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.cjs.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.js +0 -5
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.js.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.cjs +0 -47
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.cjs.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.d.ts +0 -10
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.js +0 -48
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.js.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.cjs +0 -4
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.cjs.map +0 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.js +0 -5
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.js.map +0 -1
- package/dist/PrismicRichText/getRichTextComponentProps.cjs +0 -10
- package/dist/PrismicRichText/getRichTextComponentProps.cjs.map +0 -1
- package/dist/PrismicRichText/getRichTextComponentProps.js +0 -10
- package/dist/PrismicRichText/getRichTextComponentProps.js.map +0 -1
- package/dist/PrismicRichText/index.d.ts +0 -2
- package/dist/PrismicTable/PrismicTable.vue.cjs +0 -62
- package/dist/PrismicTable/PrismicTable.vue.cjs.map +0 -1
- package/dist/PrismicTable/PrismicTable.vue.d.ts +0 -32
- package/dist/PrismicTable/PrismicTable.vue.js +0 -63
- package/dist/PrismicTable/PrismicTable.vue.js.map +0 -1
- package/dist/PrismicTable/PrismicTable.vue2.cjs +0 -4
- package/dist/PrismicTable/PrismicTable.vue2.cjs.map +0 -1
- package/dist/PrismicTable/PrismicTable.vue2.js +0 -5
- package/dist/PrismicTable/PrismicTable.vue2.js.map +0 -1
- package/dist/PrismicTable/PrismicTableDefaultComponents.cjs +0 -44
- package/dist/PrismicTable/PrismicTableDefaultComponents.cjs.map +0 -1
- package/dist/PrismicTable/PrismicTableDefaultComponents.d.ts +0 -2
- package/dist/PrismicTable/PrismicTableDefaultComponents.js +0 -44
- package/dist/PrismicTable/PrismicTableDefaultComponents.js.map +0 -1
- package/dist/PrismicTable/PrismicTableRow.vue.cjs +0 -52
- package/dist/PrismicTable/PrismicTableRow.vue.cjs.map +0 -1
- package/dist/PrismicTable/PrismicTableRow.vue.d.ts +0 -26
- package/dist/PrismicTable/PrismicTableRow.vue.js +0 -53
- package/dist/PrismicTable/PrismicTableRow.vue.js.map +0 -1
- package/dist/PrismicTable/PrismicTableRow.vue2.cjs +0 -4
- package/dist/PrismicTable/PrismicTableRow.vue2.cjs.map +0 -1
- package/dist/PrismicTable/PrismicTableRow.vue2.js +0 -5
- package/dist/PrismicTable/PrismicTableRow.vue2.js.map +0 -1
- package/dist/PrismicTable/getTableComponentProps.cjs +0 -30
- package/dist/PrismicTable/getTableComponentProps.cjs.map +0 -1
- package/dist/PrismicTable/getTableComponentProps.js +0 -30
- package/dist/PrismicTable/getTableComponentProps.js.map +0 -1
- package/dist/PrismicTable/index.d.ts +0 -1
- package/dist/PrismicTable/types.d.ts +0 -30
- package/dist/PrismicText.vue.cjs +0 -43
- package/dist/PrismicText.vue.cjs.map +0 -1
- package/dist/PrismicText.vue.d.ts +0 -31
- package/dist/PrismicText.vue.js +0 -44
- package/dist/PrismicText.vue.js.map +0 -1
- package/dist/PrismicText.vue2.cjs +0 -4
- package/dist/PrismicText.vue2.cjs.map +0 -1
- package/dist/PrismicText.vue2.js +0 -5
- package/dist/PrismicText.vue2.js.map +0 -1
- package/dist/SliceZone/SliceZone.vue.cjs +0 -63
- package/dist/SliceZone/SliceZone.vue.cjs.map +0 -1
- package/dist/SliceZone/SliceZone.vue.d.ts +0 -41
- package/dist/SliceZone/SliceZone.vue.js +0 -64
- package/dist/SliceZone/SliceZone.vue.js.map +0 -1
- package/dist/SliceZone/SliceZone.vue2.cjs +0 -4
- package/dist/SliceZone/SliceZone.vue2.cjs.map +0 -1
- package/dist/SliceZone/SliceZone.vue2.js +0 -5
- package/dist/SliceZone/SliceZone.vue2.js.map +0 -1
- package/dist/SliceZone/TODOSliceComponent.cjs +0 -29
- package/dist/SliceZone/TODOSliceComponent.cjs.map +0 -1
- package/dist/SliceZone/TODOSliceComponent.d.ts +0 -9
- package/dist/SliceZone/TODOSliceComponent.js +0 -29
- package/dist/SliceZone/TODOSliceComponent.js.map +0 -1
- package/dist/SliceZone/defineSliceZoneComponents.cjs +0 -14
- package/dist/SliceZone/defineSliceZoneComponents.cjs.map +0 -1
- package/dist/SliceZone/defineSliceZoneComponents.js +0 -14
- package/dist/SliceZone/defineSliceZoneComponents.js.map +0 -1
- package/dist/SliceZone/getSliceComponentProps.cjs +0 -22
- package/dist/SliceZone/getSliceComponentProps.cjs.map +0 -1
- package/dist/SliceZone/getSliceComponentProps.js +0 -22
- package/dist/SliceZone/getSliceComponentProps.js.map +0 -1
- package/dist/SliceZone/index.d.ts +0 -4
- package/dist/createPrismic.cjs +0 -81
- package/dist/createPrismic.cjs.map +0 -1
- package/dist/createPrismic.d.ts +0 -22
- package/dist/createPrismic.js +0 -81
- package/dist/createPrismic.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/Wrapper.vue.cjs +0 -20
- package/dist/lib/Wrapper.vue.cjs.map +0 -1
- package/dist/lib/Wrapper.vue.d.ts +0 -28
- package/dist/lib/Wrapper.vue.js +0 -21
- package/dist/lib/Wrapper.vue.js.map +0 -1
- package/dist/lib/Wrapper.vue2.cjs +0 -4
- package/dist/lib/Wrapper.vue2.cjs.map +0 -1
- package/dist/lib/Wrapper.vue2.js +0 -5
- package/dist/lib/Wrapper.vue2.js.map +0 -1
- package/dist/lib/devMsg.cjs +0 -8
- package/dist/lib/devMsg.cjs.map +0 -1
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/devMsg.js +0 -8
- package/dist/lib/devMsg.js.map +0 -1
- package/dist/lib/isInternalURL.cjs +0 -9
- package/dist/lib/isInternalURL.cjs.map +0 -1
- package/dist/lib/isInternalURL.d.ts +0 -8
- package/dist/lib/isInternalURL.js +0 -9
- package/dist/lib/isInternalURL.js.map +0 -1
- package/dist/package.json.cjs +0 -5
- package/dist/package.json.cjs.map +0 -1
- package/dist/package.json.js +0 -5
- package/dist/package.json.js.map +0 -1
- package/dist/types.d.ts +0 -369
- package/dist/usePrismic.cjs +0 -10
- package/dist/usePrismic.cjs.map +0 -1
- package/dist/usePrismic.js +0 -10
- package/dist/usePrismic.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport Wrapper from \"../lib/Wrapper.vue\"\n\nimport type { ComponentOrTagName } from \"../types\"\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { usePrismic } from \"../usePrismic\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/**\n\t * A record mapping Slice types to Vue components.\n\t */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t *\n\t * @remarks\n\t * Components will be rendered using the {@link SliceComponentProps} interface.\n\t *\n\t * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === \"production\"` else {@link TODOSliceComponent}.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext\n\n\t/**\n\t * An HTML tag name or a component used to wrap the output. `<SliceZone />` is\n\t * not wrapped by default.\n\t *\n\t * @defaultValue `\"template\"` (no wrapper)\n\t */\n\twrapper?: ComponentOrTagName\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst { options } = usePrismic()\n\nconst renderedSlices = computed(() => {\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is =\n\t\t\tprops.components?.[type] ||\n\t\t\tprops.defaultComponent ||\n\t\t\toptions.components?.sliceZoneDefaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<Wrapper v-if=\"slices\" :wrapper=\"wrapper\">\n\t\t<component\n\t\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t\t:is=\"renderedSlice.is\"\n\t\t\t:key=\"renderedSlice.key\"\n\t\t\tv-bind=\"renderedSlice.props\"\n\t\t/>\n\t</Wrapper>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DA,MAAM,QAAQ;EAGd,MAAM,EAAE,YAAY,YAAW;EAE/B,MAAM,iBAAiB,eAAe;AACrC,UAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OACL,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE9D,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAClC,MAAM,KACN,GAAG,MAAM,GAAG,KAAK,UAAU,MAAM;IAErC,MAAM,KACL,MAAM,aAAa,SACnB,MAAM,oBACN,QAAQ,YAAY;AAErB,QAAI,CAAC,GACJ,QAAO;KAAE,IAAI;KAAoB;KAAK,OAAO,EAAE,OAAO;KAAC;AAGxD,QAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;AAErC,YAAO;MAAE;MAAI;MAAK,OAAO;MAAY;;AAGtC,WAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;MACd;KACF;KACA;IACD;;UAIe,QAAA,uBAAf,YAOU,iBAAA;;IAPc,SAAS,QAAA;;2BAEQ,mBADxC,mBAKE,UAAA,MAAA,WAJuB,eAAA,QAAjB,kBAAa;yBADrB,YAKE,wBAHI,cAAc,GAAE,EAFtB,WAKE,EAFA,KAAK,cAAc,0BACZ,cAAc,MAAK,EAAA,MAAA,GAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
let vue = require("vue");
|
|
2
|
+
let esm_env = require("esm-env");
|
|
3
|
+
|
|
4
|
+
//#region src/SliceZone/TODOSliceComponent.ts
|
|
5
|
+
/**
|
|
6
|
+
* This Slice component can be used as a reminder to provide a proper
|
|
7
|
+
* implementation.
|
|
8
|
+
*
|
|
9
|
+
* This is also the default Vue component rendered when a component mapping
|
|
10
|
+
* cannot be found in `<SliceZone />`.
|
|
11
|
+
*/
|
|
12
|
+
const TODOSliceComponent = esm_env.DEV ? /* @__PURE__ */ (0, vue.defineComponent)({
|
|
13
|
+
name: "TODOSliceComponent",
|
|
14
|
+
props: { slice: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
} },
|
|
18
|
+
setup(props) {
|
|
19
|
+
const type = (0, vue.computed)(() => {
|
|
20
|
+
return "slice_type" in props.slice ? props.slice.slice_type : props.slice.type;
|
|
21
|
+
});
|
|
22
|
+
(0, vue.watchEffect)(() => {
|
|
23
|
+
console.warn(`[SliceZone] Could not find a component for Slice type "${type.value}"`, props.slice);
|
|
24
|
+
});
|
|
25
|
+
return () => {
|
|
26
|
+
return (0, vue.h)("section", {
|
|
27
|
+
"data-slice-zone-todo-component": "",
|
|
28
|
+
"data-slice-type": type.value
|
|
29
|
+
}, [`Could not find a component for Slice type "${type.value}"`]);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}) : (() => null);
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.TODOSliceComponent = TODOSliceComponent;
|
|
36
|
+
//# sourceMappingURL=TODOSliceComponent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TODOSliceComponent.cjs","names":["DEV"],"sources":["../../../src/SliceZone/TODOSliceComponent.ts"],"sourcesContent":["import { DEV } from \"esm-env\"\nimport { computed, defineComponent, h, watchEffect } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport type { SliceComponentType, SliceLike } from \"./types\"\n\n/**\n * This Slice component can be used as a reminder to provide a proper\n * implementation.\n *\n * This is also the default Vue component rendered when a component mapping\n * cannot be found in `<SliceZone />`.\n */\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const TODOSliceComponent = DEV\n\t? /*#__PURE__*/ (defineComponent({\n\t\t\tname: \"TODOSliceComponent\",\n\t\t\tprops: {\n\t\t\t\tslice: {\n\t\t\t\t\ttype: Object as PropType<SliceLike>,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetup(props) {\n\t\t\t\tconst type = computed(() => {\n\t\t\t\t\treturn \"slice_type\" in props.slice\n\t\t\t\t\t\t? props.slice.slice_type\n\t\t\t\t\t\t: props.slice.type\n\t\t\t\t})\n\n\t\t\t\twatchEffect(() => {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[SliceZone] Could not find a component for Slice type \"${type.value}\"`,\n\t\t\t\t\t\tprops.slice,\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\treturn () => {\n\t\t\t\t\treturn h(\n\t\t\t\t\t\t\"section\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"data-slice-zone-todo-component\": \"\",\n\t\t\t\t\t\t\t\"data-slice-type\": type.value,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[`Could not find a component for Slice type \"${type.value}\"`],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t}) as SliceComponentType)\n\t: ((() => null) as SliceComponentType)\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,qBAAqBA,cAChB,yCAAgB;CAC/B,MAAM;CACN,OAAO,EACN,OAAO;EACN,MAAM;EACN,UAAU;EACV,EACD;CACD,MAAM,OAAO;EACZ,MAAM,+BAAsB;AAC3B,UAAO,gBAAgB,MAAM,QAC1B,MAAM,MAAM,aACZ,MAAM,MAAM;IACd;AAEF,6BAAkB;AACjB,WAAQ,KACP,0DAA0D,KAAK,MAAM,IACrE,MAAM,MACN;IACA;AAEF,eAAa;AACZ,qBACC,WACA;IACC,kCAAkC;IAClC,mBAAmB,KAAK;IACxB,EACD,CAAC,8CAA8C,KAAK,MAAM,GAAG,CAC7D;;;CAGH,CAAC,UACO"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SliceComponentType } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/SliceZone/TODOSliceComponent.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This Slice component can be used as a reminder to provide a proper
|
|
7
|
+
* implementation.
|
|
8
|
+
*
|
|
9
|
+
* This is also the default Vue component rendered when a component mapping
|
|
10
|
+
* cannot be found in `<SliceZone />`.
|
|
11
|
+
*/
|
|
12
|
+
declare const TODOSliceComponent: SliceComponentType;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TODOSliceComponent };
|
|
15
|
+
//# sourceMappingURL=TODOSliceComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TODOSliceComponent.d.ts","names":[],"sources":["../../../src/SliceZone/TODOSliceComponent.ts"],"sourcesContent":[],"mappings":";;;;;;AAcA;;;;;cAAa,oBAAkB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { computed, defineComponent, h, watchEffect } from "vue";
|
|
2
|
+
import { DEV } from "esm-env";
|
|
3
|
+
|
|
4
|
+
//#region src/SliceZone/TODOSliceComponent.ts
|
|
5
|
+
/**
|
|
6
|
+
* This Slice component can be used as a reminder to provide a proper
|
|
7
|
+
* implementation.
|
|
8
|
+
*
|
|
9
|
+
* This is also the default Vue component rendered when a component mapping
|
|
10
|
+
* cannot be found in `<SliceZone />`.
|
|
11
|
+
*/
|
|
12
|
+
const TODOSliceComponent = DEV ? /* @__PURE__ */ defineComponent({
|
|
13
|
+
name: "TODOSliceComponent",
|
|
14
|
+
props: { slice: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
} },
|
|
18
|
+
setup(props) {
|
|
19
|
+
const type = computed(() => {
|
|
20
|
+
return "slice_type" in props.slice ? props.slice.slice_type : props.slice.type;
|
|
21
|
+
});
|
|
22
|
+
watchEffect(() => {
|
|
23
|
+
console.warn(`[SliceZone] Could not find a component for Slice type "${type.value}"`, props.slice);
|
|
24
|
+
});
|
|
25
|
+
return () => {
|
|
26
|
+
return h("section", {
|
|
27
|
+
"data-slice-zone-todo-component": "",
|
|
28
|
+
"data-slice-type": type.value
|
|
29
|
+
}, [`Could not find a component for Slice type "${type.value}"`]);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}) : (() => null);
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { TODOSliceComponent };
|
|
36
|
+
//# sourceMappingURL=TODOSliceComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TODOSliceComponent.js","names":[],"sources":["../../../src/SliceZone/TODOSliceComponent.ts"],"sourcesContent":["import { DEV } from \"esm-env\"\nimport { computed, defineComponent, h, watchEffect } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport type { SliceComponentType, SliceLike } from \"./types\"\n\n/**\n * This Slice component can be used as a reminder to provide a proper\n * implementation.\n *\n * This is also the default Vue component rendered when a component mapping\n * cannot be found in `<SliceZone />`.\n */\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const TODOSliceComponent = DEV\n\t? /*#__PURE__*/ (defineComponent({\n\t\t\tname: \"TODOSliceComponent\",\n\t\t\tprops: {\n\t\t\t\tslice: {\n\t\t\t\t\ttype: Object as PropType<SliceLike>,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tsetup(props) {\n\t\t\t\tconst type = computed(() => {\n\t\t\t\t\treturn \"slice_type\" in props.slice\n\t\t\t\t\t\t? props.slice.slice_type\n\t\t\t\t\t\t: props.slice.type\n\t\t\t\t})\n\n\t\t\t\twatchEffect(() => {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[SliceZone] Could not find a component for Slice type \"${type.value}\"`,\n\t\t\t\t\t\tprops.slice,\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\treturn () => {\n\t\t\t\t\treturn h(\n\t\t\t\t\t\t\"section\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"data-slice-zone-todo-component\": \"\",\n\t\t\t\t\t\t\t\"data-slice-type\": type.value,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[`Could not find a component for Slice type \"${type.value}\"`],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t}) as SliceComponentType)\n\t: ((() => null) as SliceComponentType)\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,qBAAqB,MAChB,gCAAgB;CAC/B,MAAM;CACN,OAAO,EACN,OAAO;EACN,MAAM;EACN,UAAU;EACV,EACD;CACD,MAAM,OAAO;EACZ,MAAM,OAAO,eAAe;AAC3B,UAAO,gBAAgB,MAAM,QAC1B,MAAM,MAAM,aACZ,MAAM,MAAM;IACd;AAEF,oBAAkB;AACjB,WAAQ,KACP,0DAA0D,KAAK,MAAM,IACrE,MAAM,MACN;IACA;AAEF,eAAa;AACZ,UAAO,EACN,WACA;IACC,kCAAkC;IAClC,mBAAmB,KAAK;IACxB,EACD,CAAC,8CAA8C,KAAK,MAAM,GAAG,CAC7D;;;CAGH,CAAC,UACO"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
let vue = require("vue");
|
|
2
|
+
|
|
3
|
+
//#region src/SliceZone/defineSliceZoneComponents.ts
|
|
4
|
+
/**
|
|
5
|
+
* Gets an optimized record of Slice types mapped to Vue components. Each
|
|
6
|
+
* components will be rendered for each instance of their Slice type.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This is essentially an helper function to ensure {@link markRaw} is correctly
|
|
10
|
+
* applied on each components, improving performances.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```javascript
|
|
15
|
+
* // Defining a slice components
|
|
16
|
+
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
17
|
+
*
|
|
18
|
+
* export default {
|
|
19
|
+
* data() {
|
|
20
|
+
* components: defineSliceZoneComponents({
|
|
21
|
+
* foo: Foo,
|
|
22
|
+
* bar: defineAsyncComponent(
|
|
23
|
+
* () => new Promise((res) => res(Bar)),
|
|
24
|
+
* ),
|
|
25
|
+
* baz: "Baz",
|
|
26
|
+
* }),
|
|
27
|
+
* }
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
32
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
33
|
+
*
|
|
34
|
+
* @param components - {@link SliceZoneComponents}
|
|
35
|
+
*
|
|
36
|
+
* @returns A new optimized record of {@link SliceZoneComponents}
|
|
37
|
+
*/
|
|
38
|
+
const defineSliceZoneComponents = (components) => {
|
|
39
|
+
const result = {};
|
|
40
|
+
let type;
|
|
41
|
+
for (type in components) {
|
|
42
|
+
const component = components[type];
|
|
43
|
+
result[type] = typeof component === "string" ? component : (0, vue.markRaw)(component);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.defineSliceZoneComponents = defineSliceZoneComponents;
|
|
50
|
+
//# sourceMappingURL=defineSliceZoneComponents.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.cjs","names":["type: keyof typeof components"],"sources":["../../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":["import { markRaw } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n} from \"./types\"\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each\n * components will be rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly\n * applied on each components, improving performances.\n *\n * @example\n *\n * ```javascript\n * // Defining a slice components\n * import { defineSliceZoneComponents } from \"@prismicio/vue\";\n *\n * export default {\n * data() {\n * components: defineSliceZoneComponents({\n * foo: Foo,\n * bar: defineAsyncComponent(\n * () => new Promise((res) => res(Bar)),\n * ),\n * baz: \"Baz\",\n * }),\n * }\n * };\n * ```\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\n * @typeParam TContext - Arbitrary data made available to all Slice components\n *\n * @param components - {@link SliceZoneComponents}\n *\n * @returns A new optimized record of {@link SliceZoneComponents}\n */\nexport const defineSliceZoneComponents = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\tcomponents: SliceZoneComponents<TSlice, TContext>,\n): SliceZoneComponents<TSlice, TContext> => {\n\tconst result = {} as SliceZoneComponents<TSlice, TContext>\n\n\tlet type: keyof typeof components\n\tfor (type in components) {\n\t\tconst component = components[type]\n\t\tresult[type] =\n\t\t\ttypeof component === \"string\"\n\t\t\t\t? component\n\t\t\t\t: markRaw(\n\t\t\t\t\t\tcomponent as SliceComponentType<\n\t\t\t\t\t\t\tExtract<TSlice, SliceLike<typeof type>>,\n\t\t\t\t\t\t\tTContext\n\t\t\t\t\t\t>,\n\t\t\t\t\t)\n\t}\n\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,6BAKZ,eAC2C;CAC3C,MAAM,SAAS,EAAE;CAEjB,IAAIA;AACJ,MAAK,QAAQ,YAAY;EACxB,MAAM,YAAY,WAAW;AAC7B,SAAO,QACN,OAAO,cAAc,WAClB,6BAEA,UAIA;;AAGL,QAAO"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SliceLike, SliceZoneComponents } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/SliceZone/defineSliceZoneComponents.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Gets an optimized record of Slice types mapped to Vue components. Each
|
|
4
7
|
* components will be rendered for each instance of their Slice type.
|
|
@@ -33,4 +36,7 @@ import type { SliceLike, SliceZoneComponents } from "./types";
|
|
|
33
36
|
*
|
|
34
37
|
* @returns A new optimized record of {@link SliceZoneComponents}
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
declare const defineSliceZoneComponents: <TSlice extends SliceLike = any, TContext = unknown>(components: SliceZoneComponents<TSlice, TContext>) => SliceZoneComponents<TSlice, TContext>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { defineSliceZoneComponents };
|
|
42
|
+
//# sourceMappingURL=defineSliceZoneComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.d.ts","names":[],"sources":["../../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":[],"mappings":";;;;;;AA0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,2CAEG,iDAGH,oBAAoB,QAAQ,cACtC,oBAAoB,QAAQ"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { markRaw } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/SliceZone/defineSliceZoneComponents.ts
|
|
4
|
+
/**
|
|
5
|
+
* Gets an optimized record of Slice types mapped to Vue components. Each
|
|
6
|
+
* components will be rendered for each instance of their Slice type.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This is essentially an helper function to ensure {@link markRaw} is correctly
|
|
10
|
+
* applied on each components, improving performances.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```javascript
|
|
15
|
+
* // Defining a slice components
|
|
16
|
+
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
17
|
+
*
|
|
18
|
+
* export default {
|
|
19
|
+
* data() {
|
|
20
|
+
* components: defineSliceZoneComponents({
|
|
21
|
+
* foo: Foo,
|
|
22
|
+
* bar: defineAsyncComponent(
|
|
23
|
+
* () => new Promise((res) => res(Bar)),
|
|
24
|
+
* ),
|
|
25
|
+
* baz: "Baz",
|
|
26
|
+
* }),
|
|
27
|
+
* }
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
32
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
33
|
+
*
|
|
34
|
+
* @param components - {@link SliceZoneComponents}
|
|
35
|
+
*
|
|
36
|
+
* @returns A new optimized record of {@link SliceZoneComponents}
|
|
37
|
+
*/
|
|
38
|
+
const defineSliceZoneComponents = (components) => {
|
|
39
|
+
const result = {};
|
|
40
|
+
let type;
|
|
41
|
+
for (type in components) {
|
|
42
|
+
const component = components[type];
|
|
43
|
+
result[type] = typeof component === "string" ? component : markRaw(component);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { defineSliceZoneComponents };
|
|
50
|
+
//# sourceMappingURL=defineSliceZoneComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.js","names":["type: keyof typeof components"],"sources":["../../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":["import { markRaw } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n} from \"./types\"\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each\n * components will be rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly\n * applied on each components, improving performances.\n *\n * @example\n *\n * ```javascript\n * // Defining a slice components\n * import { defineSliceZoneComponents } from \"@prismicio/vue\";\n *\n * export default {\n * data() {\n * components: defineSliceZoneComponents({\n * foo: Foo,\n * bar: defineAsyncComponent(\n * () => new Promise((res) => res(Bar)),\n * ),\n * baz: \"Baz\",\n * }),\n * }\n * };\n * ```\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\n * @typeParam TContext - Arbitrary data made available to all Slice components\n *\n * @param components - {@link SliceZoneComponents}\n *\n * @returns A new optimized record of {@link SliceZoneComponents}\n */\nexport const defineSliceZoneComponents = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\tcomponents: SliceZoneComponents<TSlice, TContext>,\n): SliceZoneComponents<TSlice, TContext> => {\n\tconst result = {} as SliceZoneComponents<TSlice, TContext>\n\n\tlet type: keyof typeof components\n\tfor (type in components) {\n\t\tconst component = components[type]\n\t\tresult[type] =\n\t\t\ttypeof component === \"string\"\n\t\t\t\t? component\n\t\t\t\t: markRaw(\n\t\t\t\t\t\tcomponent as SliceComponentType<\n\t\t\t\t\t\t\tExtract<TSlice, SliceLike<typeof type>>,\n\t\t\t\t\t\t\tTContext\n\t\t\t\t\t\t>,\n\t\t\t\t\t)\n\t}\n\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,6BAKZ,eAC2C;CAC3C,MAAM,SAAS,EAAE;CAEjB,IAAIA;AACJ,MAAK,QAAQ,YAAY;EACxB,MAAM,YAAY,WAAW;AAC7B,SAAO,QACN,OAAO,cAAc,WAClB,YACA,QACA,UAIA;;AAGL,QAAO"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/SliceZone/getSliceComponentProps.ts
|
|
3
|
+
/**
|
|
4
|
+
* Gets native Vue props for a component rendering content from a Prismic Slice
|
|
5
|
+
* using the `<SliceZone />` component.
|
|
6
|
+
*
|
|
7
|
+
* Props are: `["slice", "index", "slices", "context"]`
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Defining a new slice component
|
|
13
|
+
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
14
|
+
*
|
|
15
|
+
* defineProps(getSliceComponentProps())
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Defining a new slice component with visual hint
|
|
22
|
+
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
23
|
+
*
|
|
24
|
+
* defineProps(
|
|
25
|
+
* getSliceComponentProps(["slice", "index", "slices", "context"]),
|
|
26
|
+
* )
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @typeParam TSlice - The Slice type
|
|
30
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
31
|
+
* available to all Slice components
|
|
32
|
+
*
|
|
33
|
+
* @param propsHint - An optional array of prop names used for the sole purpose
|
|
34
|
+
* of having a visual hint of which props are made available to the slice,
|
|
35
|
+
* this parameters doesn't have any effect
|
|
36
|
+
*
|
|
37
|
+
* @returns Props object to use with `defineProps()`
|
|
38
|
+
*/
|
|
39
|
+
const getSliceComponentProps = (propsHint) => ({
|
|
40
|
+
slice: {
|
|
41
|
+
type: Object,
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
index: {
|
|
45
|
+
type: Number,
|
|
46
|
+
required: true
|
|
47
|
+
},
|
|
48
|
+
slices: {
|
|
49
|
+
type: Array,
|
|
50
|
+
required: true
|
|
51
|
+
},
|
|
52
|
+
context: {
|
|
53
|
+
type: null,
|
|
54
|
+
required: true
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.getSliceComponentProps = getSliceComponentProps;
|
|
60
|
+
//# sourceMappingURL=getSliceComponentProps.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSliceComponentProps.cjs","names":[],"sources":["../../../src/SliceZone/getSliceComponentProps.ts"],"sourcesContent":["import type { PropType } from \"vue\"\n\nimport type { SliceComponentProps, SliceLike } from \"./types\"\n\n/**\n * Native Vue props for a component rendering content from a Prismic Slice using\n * the `<SliceZone />` component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n */\ntype DefineComponentSliceComponentProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n> = {\n\tslice: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>\n\t\trequired: true\n\t}\n\tindex: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>\n\t\trequired: true\n\t}\n\tslices: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>\n\t\trequired: true\n\t}\n\tcontext: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"context\"]>\n\t\trequired: true\n\t}\n}\n\n/**\n * Gets native Vue props for a component rendering content from a Prismic Slice\n * using the `<SliceZone />` component.\n *\n * Props are: `[\"slice\", \"index\", \"slices\", \"context\"]`\n *\n * @example\n *\n * ```typescript\n * // Defining a new slice component\n * import { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(getSliceComponentProps())\n * ```\n *\n * @example\n *\n * ```typescript\n * // Defining a new slice component with visual hint\n * import { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(\n * \tgetSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]),\n * )\n * ```\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n *\n * @param propsHint - An optional array of prop names used for the sole purpose\n * of having a visual hint of which props are made available to the slice,\n * this parameters doesn't have any effect\n *\n * @returns Props object to use with `defineProps()`\n */\nexport const getSliceComponentProps = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tpropsHint?: [\"slice\", \"index\", \"slices\", \"context\"],\n): DefineComponentSliceComponentProps<TSlice, TContext> => ({\n\tslice: {\n\t\ttype: Object as PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>,\n\t\trequired: true,\n\t},\n\tindex: {\n\t\ttype: Number as PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>,\n\t\trequired: true,\n\t},\n\tslices: {\n\t\ttype: Array as PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>,\n\t\trequired: true,\n\t},\n\tcontext: {\n\t\ttype: null as unknown as PropType<\n\t\t\tSliceComponentProps<TSlice, TContext>[\"context\"]\n\t\t>,\n\t\trequired: true,\n\t},\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAa,0BAMZ,eAC2D;CAC3D,OAAO;EACN,MAAM;EACN,UAAU;EACV;CACD,OAAO;EACN,MAAM;EACN,UAAU;EACV;CACD,QAAQ;EACP,MAAM;EACN,UAAU;EACV;CACD,SAAS;EACR,MAAM;EAGN,UAAU;EACV;CACD"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { SliceComponentProps, SliceLike } from "./types.js";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/SliceZone/getSliceComponentProps.d.ts
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
7
|
* Native Vue props for a component rendering content from a Prismic Slice using
|
|
5
8
|
* the `<SliceZone />` component.
|
|
@@ -9,22 +12,22 @@ import type { SliceComponentProps, SliceLike } from "./types";
|
|
|
9
12
|
* available to all Slice components
|
|
10
13
|
*/
|
|
11
14
|
type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext = unknown> = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
slice: {
|
|
16
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["slice"]>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
index: {
|
|
20
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["index"]>;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
slices: {
|
|
24
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["slices"]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
context: {
|
|
28
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["context"]>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
28
31
|
};
|
|
29
32
|
/**
|
|
30
33
|
* Gets native Vue props for a component rendering content from a Prismic Slice
|
|
@@ -62,5 +65,7 @@ type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext
|
|
|
62
65
|
*
|
|
63
66
|
* @returns Props object to use with `defineProps()`
|
|
64
67
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
declare const getSliceComponentProps: <TSlice extends SliceLike = any, TContext = unknown>(propsHint?: ["slice", "index", "slices", "context"]) => DefineComponentSliceComponentProps<TSlice, TContext>;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { getSliceComponentProps };
|
|
71
|
+
//# sourceMappingURL=getSliceComponentProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSliceComponentProps.d.ts","names":[],"sources":["../../../src/SliceZone/getSliceComponentProps.ts"],"sourcesContent":[],"mappings":";;;;;;;AAE6D;;;;;;KAUxD,kCAUgC,CAAA,eARrB,SAQqB,GAAA,GAAA,EAAA,WAAA,OAAA,CAAA,GAAA;EAAQ,KAAA,EAAA;IAA5B,IAAA,EAJT,QAIS,CAJA,mBAIA,CAJoB,MAIpB,EAJ4B,QAI5B,CAAA,CAAA,OAAA,CAAA,CAAA;IAAT,QAAA,EAAA,IAAA;EAI6B,CAAA;EAAQ,KAAA,EAAA;IAA5B,IAAA,EAJT,QAIS,CAJA,mBAIA,CAJoB,MAIpB,EAJ4B,QAI5B,CAAA,CAAA,OAAA,CAAA,CAAA;IAAT,QAAA,EAAA,IAAA;EAI6B,CAAA;EAAQ,MAAA,EAAA;IAA5B,IAAA,EAJT,QAIS,CAJA,mBAIA,CAJoB,MAIpB,EAJ4B,QAI5B,CAAA,CAAA,QAAA,CAAA,CAAA;IAAT,QAAA,EAAA,IAAA;EAAQ,CAAA;EAyCH,OAAA,EAAA;IAEG,IAAA,EA3CR,QA2CQ,CA3CC,mBA2CD,CA3CqB,MA2CrB,EA3C6B,QA2C7B,CAAA,CAAA,SAAA,CAAA,CAAA;IAKsB,QAAA,EAAA,IAAA;EAAQ,CAAA;CAA3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAPU,wCAEG,6FAKb,mCAAmC,QAAQ"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/SliceZone/getSliceComponentProps.ts
|
|
2
|
+
/**
|
|
3
|
+
* Gets native Vue props for a component rendering content from a Prismic Slice
|
|
4
|
+
* using the `<SliceZone />` component.
|
|
5
|
+
*
|
|
6
|
+
* Props are: `["slice", "index", "slices", "context"]`
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Defining a new slice component
|
|
12
|
+
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
13
|
+
*
|
|
14
|
+
* defineProps(getSliceComponentProps())
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Defining a new slice component with visual hint
|
|
21
|
+
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
22
|
+
*
|
|
23
|
+
* defineProps(
|
|
24
|
+
* getSliceComponentProps(["slice", "index", "slices", "context"]),
|
|
25
|
+
* )
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @typeParam TSlice - The Slice type
|
|
29
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
30
|
+
* available to all Slice components
|
|
31
|
+
*
|
|
32
|
+
* @param propsHint - An optional array of prop names used for the sole purpose
|
|
33
|
+
* of having a visual hint of which props are made available to the slice,
|
|
34
|
+
* this parameters doesn't have any effect
|
|
35
|
+
*
|
|
36
|
+
* @returns Props object to use with `defineProps()`
|
|
37
|
+
*/
|
|
38
|
+
const getSliceComponentProps = (propsHint) => ({
|
|
39
|
+
slice: {
|
|
40
|
+
type: Object,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
index: {
|
|
44
|
+
type: Number,
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
slices: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
context: {
|
|
52
|
+
type: null,
|
|
53
|
+
required: true
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { getSliceComponentProps };
|
|
59
|
+
//# sourceMappingURL=getSliceComponentProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSliceComponentProps.js","names":[],"sources":["../../../src/SliceZone/getSliceComponentProps.ts"],"sourcesContent":["import type { PropType } from \"vue\"\n\nimport type { SliceComponentProps, SliceLike } from \"./types\"\n\n/**\n * Native Vue props for a component rendering content from a Prismic Slice using\n * the `<SliceZone />` component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n */\ntype DefineComponentSliceComponentProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n> = {\n\tslice: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>\n\t\trequired: true\n\t}\n\tindex: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>\n\t\trequired: true\n\t}\n\tslices: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>\n\t\trequired: true\n\t}\n\tcontext: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"context\"]>\n\t\trequired: true\n\t}\n}\n\n/**\n * Gets native Vue props for a component rendering content from a Prismic Slice\n * using the `<SliceZone />` component.\n *\n * Props are: `[\"slice\", \"index\", \"slices\", \"context\"]`\n *\n * @example\n *\n * ```typescript\n * // Defining a new slice component\n * import { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(getSliceComponentProps())\n * ```\n *\n * @example\n *\n * ```typescript\n * // Defining a new slice component with visual hint\n * import { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(\n * \tgetSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]),\n * )\n * ```\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n *\n * @param propsHint - An optional array of prop names used for the sole purpose\n * of having a visual hint of which props are made available to the slice,\n * this parameters doesn't have any effect\n *\n * @returns Props object to use with `defineProps()`\n */\nexport const getSliceComponentProps = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tpropsHint?: [\"slice\", \"index\", \"slices\", \"context\"],\n): DefineComponentSliceComponentProps<TSlice, TContext> => ({\n\tslice: {\n\t\ttype: Object as PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>,\n\t\trequired: true,\n\t},\n\tindex: {\n\t\ttype: Number as PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>,\n\t\trequired: true,\n\t},\n\tslices: {\n\t\ttype: Array as PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>,\n\t\trequired: true,\n\t},\n\tcontext: {\n\t\ttype: null as unknown as PropType<\n\t\t\tSliceComponentProps<TSlice, TContext>[\"context\"]\n\t\t>,\n\t\trequired: true,\n\t},\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAa,0BAMZ,eAC2D;CAC3D,OAAO;EACN,MAAM;EACN,UAAU;EACV;CACD,OAAO;EACN,MAAM;EACN,UAAU;EACV;CACD,QAAQ;EACP,MAAM;EACN,UAAU;EACV;CACD,SAAS;EACR,MAAM;EAGN,UAAU;EACV;CACD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZoneComponents, SliceZoneLike } from "./types.js";
|
|
2
|
+
import { TODOSliceComponent } from "./TODOSliceComponent.js";
|
|
3
|
+
import { getSliceComponentProps } from "./getSliceComponentProps.js";
|
|
4
|
+
import { defineSliceZoneComponents } from "./defineSliceZoneComponents.js";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { DefineComponent, FunctionalComponent, defineAsyncComponent } from "vue";
|
|
2
|
+
import { Slice } from "@prismicio/client";
|
|
3
|
+
|
|
4
|
+
//#region src/SliceZone/types.d.ts
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
7
|
* Returns the type of a `SliceLike` type.
|
|
5
8
|
*
|
|
@@ -12,15 +15,15 @@ type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2
|
|
|
12
15
|
*
|
|
13
16
|
* @typeParam SliceType - Type name of the Slice.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
type SliceLikeRestV2<TSliceType extends string = string> = Pick<Slice<TSliceType>, "id" | "slice_type">;
|
|
16
19
|
/**
|
|
17
20
|
* The minimum required properties to represent a Prismic Slice from the Prismic
|
|
18
21
|
* GraphQL API for the `unstable_mapSliceZone()` helper.
|
|
19
22
|
*
|
|
20
23
|
* @typeParam SliceType - Type name of the Slice.
|
|
21
24
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
type SliceLikeGraphQL<TSliceType extends string = string> = {
|
|
26
|
+
type: Slice<TSliceType>["slice_type"];
|
|
24
27
|
};
|
|
25
28
|
/**
|
|
26
29
|
* The minimum required properties to represent a Prismic Slice for the
|
|
@@ -31,14 +34,14 @@ export type SliceLikeGraphQL<TSliceType extends string = string> = {
|
|
|
31
34
|
*
|
|
32
35
|
* @typeParam TSliceType - Type name of the Slice
|
|
33
36
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
type SliceLike<TSliceType extends string = string> = (SliceLikeRestV2<TSliceType> | SliceLikeGraphQL<TSliceType>) & {
|
|
38
|
+
/**
|
|
39
|
+
* If `true`, this Slice has been modified from its original value using a
|
|
40
|
+
* mapper and `@prismicio/client`'s `mapSliceZone()`.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
__mapped?: true;
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
44
47
|
* A looser version of the `SliceZone` type from `@prismicio/client` using
|
|
@@ -49,7 +52,7 @@ export type SliceLike<TSliceType extends string = string> = (SliceLikeRestV2<TSl
|
|
|
49
52
|
*
|
|
50
53
|
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
51
54
|
*/
|
|
52
|
-
|
|
55
|
+
type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
|
|
53
56
|
/**
|
|
54
57
|
* Vue props for a component rendering content from a Prismic Slice using the
|
|
55
58
|
* `<SliceZone />` component.
|
|
@@ -58,24 +61,24 @@ export type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlic
|
|
|
58
61
|
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
59
62
|
* available to all Slice components
|
|
60
63
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
64
|
+
type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
65
|
+
/**
|
|
66
|
+
* Slice data for this component.
|
|
67
|
+
*/
|
|
68
|
+
slice: TSlice;
|
|
69
|
+
/**
|
|
70
|
+
* The index of the Slice in the Slice Zone.
|
|
71
|
+
*/
|
|
72
|
+
index: number;
|
|
73
|
+
/**
|
|
74
|
+
* All Slices from the Slice Zone to which the Slice belongs.
|
|
75
|
+
*/
|
|
76
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
|
|
77
|
+
/**
|
|
78
|
+
* Arbitrary data passed to `<SliceZone />` and made available to all Slice
|
|
79
|
+
* components.
|
|
80
|
+
*/
|
|
81
|
+
context: TContext;
|
|
79
82
|
};
|
|
80
83
|
/**
|
|
81
84
|
* A Vue component to be rendered for each instance of its Slice.
|
|
@@ -83,7 +86,7 @@ export type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext =
|
|
|
83
86
|
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
84
87
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
85
88
|
*/
|
|
86
|
-
|
|
89
|
+
type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<SliceComponentProps<TSlice, TContext>> | FunctionalComponent;
|
|
87
90
|
/**
|
|
88
91
|
* A record of Slice types mapped to Vue components. Each components will be
|
|
89
92
|
* rendered for each instance of their Slice type.
|
|
@@ -91,7 +94,7 @@ export type SliceComponentType<TSlice extends SliceLike = any, TContext = unknow
|
|
|
91
94
|
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
92
95
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
93
96
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
|
|
97
|
+
type SliceZoneComponents<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [SliceType in ExtractSliceType<TSlice>]: SliceComponentType<Extract<TSlice, SliceLike<SliceType>> extends never ? SliceLike : Extract<TSlice, SliceLike<SliceType>>, TContext> | string };
|
|
98
|
+
//#endregion
|
|
99
|
+
export { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZoneComponents, SliceZoneLike };
|
|
100
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/SliceZone/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAKY;;;KAOP,gBAA4D,CAAA,eAA5B,SAA4B,CAAA,GAAf,MAAe,SAAA,eAAA,GAC9D,MAD8D,CAAA,YAAA,CAAA,GAE9D,MAF8D,SAE/C,gBAF+C,GAG7D,MAH6D,CAAA,MAAA,CAAA,GAAA,KAAA;;;;;;AAYjE;AACO,KADK,eACL,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAD2D,IAC3D,CAAN,KAAM,CAAA,UAAA,CAAA,EAAA,IAAA,GAAA,YAAA,CAAA;;;;AAUP;AAaA;;AACG,KAdS,gBAcT,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA;EACiB,IAAA,EAdb,KAca,CAdP,UAcO,CAAA,CAAA,YAAA,CAAA;CAAjB;;AAoBH;;;;;AAWA;;;AAOQ,KAxCI,SAwCJ,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA,CAvCL,eAuCK,CAvCW,UAuCX,CAAA,GAtCL,gBAsCK,CAtCY,UAsCZ,CAAA,CAAA,GAAA;EAeN;;;;;;EAOgB,QAAA,CAAA,EAAA,IAAA;AASlB,CAAA;;;;;;;;;;AAWsB,KA5DV,aA4DU,CAAA,eA5DmB,SA4DnB,GA5D+B,SA4D/B,CAAA,GAAA,SA3DZ,MA2DY,EAAA;AAStB;;;;;;;;AAgBK,KA1EO,mBA0EP,CAAA,eAzEW,SAyEX,GAzEuB,SAyEvB,EAAA,WAAA,OAAA,CAAA,GAAA;EACG;;;EACgB,KAAA,EArEhB,MAqEgB;EAAhB;;;EAHe,KAAA,EAAA,MAAA;;;;UApDd,cACP,eAAe,mBAAmB,mBAAmB;;;;;WAO7C;;;;;;;;KASE,kCAEI,uCAKb,+BAEA,kBAAkB,wBAClB,gBAAgB,oBAAoB,QAAQ,aAC5C;;;;;;;;KASS,mCACI,YAAY,iDAaZ,iBAAiB,UAC5B,mBACA,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B"}
|