@prismicio/vue 6.1.3 → 6.1.4-pr.98.764fac2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PrismicImage.cjs.map +1 -1
- package/dist/PrismicImage.js.map +1 -1
- package/dist/PrismicImage.vue.d.cts +14 -11
- package/dist/PrismicImage.vue.d.cts.map +1 -1
- package/dist/PrismicImage.vue.d.ts +14 -11
- package/dist/PrismicImage.vue.d.ts.map +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicLink.cjs.map +1 -1
- package/dist/PrismicLink.js.map +1 -1
- package/dist/PrismicLink.vue.d.cts +17 -13
- package/dist/PrismicLink.vue.d.cts.map +1 -1
- package/dist/PrismicLink.vue.d.ts +17 -13
- package/dist/PrismicLink.vue.d.ts.map +1 -1
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +3 -3
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +8 -9
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts +7 -8
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.cjs +2 -2
- package/dist/PrismicRichText/getRichTextComponentProps.cjs.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts +3 -4
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.d.ts +2 -3
- package/dist/PrismicRichText/getRichTextComponentProps.d.ts.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.js +2 -2
- package/dist/PrismicRichText/getRichTextComponentProps.js.map +1 -1
- package/dist/PrismicRichText/index.d.cts +2 -1
- package/dist/PrismicRichText/index.d.ts +2 -1
- package/dist/PrismicRichText/types.d.cts +1 -2
- package/dist/PrismicRichText/types.d.cts.map +1 -1
- package/dist/PrismicRichText/types.d.ts +1 -2
- package/dist/PrismicRichText/types.d.ts.map +1 -1
- package/dist/PrismicTable/PrismicTable.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTable.js.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.cts +6 -6
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.ts +6 -6
- package/dist/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.cjs +6 -6
- package/dist/PrismicTable/getTableComponentProps.cjs.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.d.cts +8 -10
- package/dist/PrismicTable/getTableComponentProps.d.cts.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.d.ts +7 -9
- package/dist/PrismicTable/getTableComponentProps.d.ts.map +1 -1
- package/dist/PrismicTable/getTableComponentProps.js +6 -6
- package/dist/PrismicTable/getTableComponentProps.js.map +1 -1
- package/dist/PrismicTable/index.d.cts +2 -1
- package/dist/PrismicTable/index.d.ts +2 -1
- package/dist/PrismicTable/types.d.cts +0 -1
- package/dist/PrismicTable/types.d.cts.map +1 -1
- package/dist/PrismicTable/types.d.ts +0 -1
- package/dist/PrismicTable/types.d.ts.map +1 -1
- package/dist/PrismicText.vue.d.cts +4 -5
- package/dist/PrismicText.vue.d.cts.map +1 -1
- package/dist/PrismicText.vue.d.ts +4 -5
- package/dist/PrismicText.vue.d.ts.map +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/SliceSimulator.vue.d.cts +14 -15
- package/dist/SliceSimulator.vue.d.cts.map +1 -1
- package/dist/SliceSimulator.vue.d.ts +14 -15
- package/dist/SliceSimulator.vue.d.ts.map +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/SliceSimulator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.cts +9 -7
- package/dist/SliceZone/SliceZone.vue.d.cts.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.ts +9 -7
- package/dist/SliceZone/SliceZone.vue.d.ts.map +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.cjs.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.d.cts +0 -1
- package/dist/SliceZone/TODOSliceComponent.d.cts.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.d.ts +0 -1
- package/dist/SliceZone/TODOSliceComponent.d.ts.map +1 -1
- package/dist/SliceZone/TODOSliceComponent.js.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.cjs +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.cjs.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.d.cts +1 -2
- package/dist/SliceZone/defineSliceZoneComponents.d.cts.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.d.ts +1 -2
- package/dist/SliceZone/defineSliceZoneComponents.d.ts.map +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.js +1 -1
- package/dist/SliceZone/defineSliceZoneComponents.js.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.cjs +2 -2
- package/dist/SliceZone/getSliceComponentProps.cjs.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.d.cts +2 -3
- package/dist/SliceZone/getSliceComponentProps.d.cts.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.d.ts +2 -3
- package/dist/SliceZone/getSliceComponentProps.d.ts.map +1 -1
- package/dist/SliceZone/getSliceComponentProps.js +2 -2
- package/dist/SliceZone/getSliceComponentProps.js.map +1 -1
- package/dist/SliceZone/index.d.cts +2 -1
- package/dist/SliceZone/index.d.ts +2 -1
- package/dist/SliceZone/types.d.cts +8 -5
- package/dist/SliceZone/types.d.cts.map +1 -1
- package/dist/SliceZone/types.d.ts +8 -5
- package/dist/SliceZone/types.d.ts.map +1 -1
- package/dist/createPrismic.cjs +1 -1
- package/dist/createPrismic.cjs.map +1 -1
- package/dist/createPrismic.d.cts +18 -9
- package/dist/createPrismic.d.cts.map +1 -1
- package/dist/createPrismic.d.ts +17 -8
- package/dist/createPrismic.d.ts.map +1 -1
- package/dist/createPrismic.js +1 -1
- package/dist/createPrismic.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/lib/devMsg.cjs +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +17 -17
- package/src/PrismicImage.vue +1 -1
- package/src/PrismicLink.vue +2 -2
- package/src/PrismicRichText/PrismicRichText.vue +1 -1
- package/src/PrismicRichText/getRichTextComponentProps.ts +2 -2
- package/src/PrismicTable/PrismicTable.vue +1 -1
- package/src/PrismicTable/getTableComponentProps.ts +6 -6
- package/src/SliceZone/defineSliceZoneComponents.ts +1 -1
- package/src/SliceZone/getSliceComponentProps.ts +2 -2
- package/src/createPrismic.ts +1 -1
- package/src/lib/devMsg.ts +1 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from "./types.cjs";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
|
-
|
|
4
2
|
//#region src/SliceZone/SliceZone.vue.d.ts
|
|
5
3
|
/**
|
|
6
4
|
* Props for `<SliceZone />`.
|
|
@@ -8,14 +6,18 @@ import * as _$vue from "vue";
|
|
|
8
6
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
9
7
|
*/
|
|
10
8
|
type SliceZoneProps<TContext = unknown> = {
|
|
11
|
-
/** List of slice data from the slice zone. */
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/** List of slice data from the slice zone. */
|
|
10
|
+
slices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>;
|
|
11
|
+
/** A record mapping slice types to React components. */
|
|
12
|
+
components?: SliceZoneComponents;
|
|
13
|
+
/** The Vue component rendered if a component mapping from the `components` prop cannot be found. */
|
|
14
|
+
defaultComponent?: SliceComponentType<any, TContext>;
|
|
15
|
+
/** Arbitrary data made available to all slice components. */
|
|
14
16
|
context?: TContext;
|
|
15
17
|
};
|
|
16
18
|
type __VLS_Props = SliceZoneProps;
|
|
17
|
-
declare const __VLS_export:
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
20
|
declare const _default: typeof __VLS_export;
|
|
19
21
|
//#endregion
|
|
20
|
-
export { SliceZoneProps, _default };
|
|
22
|
+
export { SliceZoneProps, _default as default };
|
|
21
23
|
//# sourceMappingURL=SliceZone.vue.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceZone.vue.d.cts","names":[],"sources":["../../src/SliceZone/SliceZone.vue"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"SliceZone.vue.d.cts","names":[],"sources":["../../src/SliceZone/SliceZone.vue"],"mappings":";;;;;;;KA6FY,eAAe;;EAE1B,QAAQ,cAAc,aAAa,YAAY;;EAG/C,aAAa;;EAIb,mBAAmB,wBAAwB;;EAG3C,UAAU;;KAGN,cAAc;cA6Eb,4BAAY,gBAAA,2CAAA,qCAAA,iDAAA,aAAA,SAAA,eAAA,oDAAA;cAGG,iBAAO"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from "./types.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
|
-
|
|
4
2
|
//#region src/SliceZone/SliceZone.vue.d.ts
|
|
5
3
|
/**
|
|
6
4
|
* Props for `<SliceZone />`.
|
|
@@ -8,14 +6,18 @@ import * as _$vue from "vue";
|
|
|
8
6
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
9
7
|
*/
|
|
10
8
|
type SliceZoneProps<TContext = unknown> = {
|
|
11
|
-
/** List of slice data from the slice zone. */
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/** List of slice data from the slice zone. */
|
|
10
|
+
slices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>;
|
|
11
|
+
/** A record mapping slice types to React components. */
|
|
12
|
+
components?: SliceZoneComponents;
|
|
13
|
+
/** The Vue component rendered if a component mapping from the `components` prop cannot be found. */
|
|
14
|
+
defaultComponent?: SliceComponentType<any, TContext>;
|
|
15
|
+
/** Arbitrary data made available to all slice components. */
|
|
14
16
|
context?: TContext;
|
|
15
17
|
};
|
|
16
18
|
type __VLS_Props = SliceZoneProps;
|
|
17
|
-
declare const __VLS_export:
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
20
|
declare const _default: typeof __VLS_export;
|
|
19
21
|
//#endregion
|
|
20
|
-
export { SliceZoneProps, _default };
|
|
22
|
+
export { SliceZoneProps, _default as default };
|
|
21
23
|
//# sourceMappingURL=SliceZone.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceZone.vue.d.ts","names":[],"sources":["../../src/SliceZone/SliceZone.vue"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"SliceZone.vue.d.ts","names":[],"sources":["../../src/SliceZone/SliceZone.vue"],"mappings":";;;;;;;KA6FY,eAAe;;EAE1B,QAAQ,cAAc,aAAa,YAAY;;EAG/C,aAAa;;EAIb,mBAAmB,wBAAwB;;EAG3C,UAAU;;KAGN,cAAc;cA6Eb,4BAAY,gBAAA,2CAAA,qCAAA,iDAAA,aAAA,SAAA,eAAA,oDAAA;cAGG,iBAAO"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_TODOSliceComponent = require("./TODOSliceComponent.cjs");
|
|
2
2
|
let vue = require("vue");
|
|
3
3
|
//#region src/SliceZone/SliceZone.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var SliceZone_vue_vue_type_script_setup_true_lang_default =
|
|
4
|
+
var SliceZone_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
5
5
|
name: "SliceZone",
|
|
6
6
|
__name: "SliceZone",
|
|
7
7
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName } from \"../types\"\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\nimport type { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from \"./types\"\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/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/** The Vue component rendered if a component mapping from the `components` prop cannot be found. */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed<\n\t{\n\t\tis: ComponentOrTagName\n\t\tkey: string\n\t\tprops: Record<string, unknown>\n\t}[]\n>(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type = \"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\" ? slice.id : `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\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<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;EAGd,MAAM,kBAAA,
|
|
1
|
+
{"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName } from \"../types\"\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\nimport type { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from \"./types\"\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/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/** The Vue component rendered if a component mapping from the `components` prop cannot be found. */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed<\n\t{\n\t\tis: ComponentOrTagName\n\t\tkey: string\n\t\tprops: Record<string, unknown>\n\t}[]\n>(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type = \"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\" ? slice.id : `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\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<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;EAGd,MAAM,kBAAA,GAAiB,IAAA,SAAA,OAMf;GACP,IAAI,CAAC,MAAM,QAAQ,OAAO,CAAC;GAE3B,OAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OAAO,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE1E,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,MAAM,GAAG,KAAK,UAAU,KAAK;IAE5F,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM;IAE7C,IAAI,CAAC,IACJ,OAAO;KAAE,IAAI,2BAAA;KAAoB;KAAK,OAAO,EAAE,MAAM;IAAE;IAGxD,IAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;KAErC,OAAO;MAAE;MAAI;MAAK,OAAO;KAAY;IACtC;IAEA,OAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;KACf;IACD;GACD,CAAC;EACF,CAAC;;GAIA,QAAA,GAAA,IAAA,UAAA,CAAA,IAAA,IAAA,GAAA,IAAA,mBAAA,CAKE,IAAA,UAAA,OAAA,GAAA,IAAA,WAAA,CAJuB,eAAA,QAAjB,kBAAa;IADrB,QAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,EAAA,GAKE,IAAA,wBAAA,CAHI,cAAc,EAAE,IAAA,GAFtB,IAAA,WAAA,CAKE,EAFA,KAAK,cAAc,IACZ,GAAA,EAAA,SAAA,KAAA,GAAA,cAAc,KAAK,GAAA,MAAA,EAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TODOSliceComponent } from "./TODOSliceComponent.js";
|
|
2
2
|
import { Fragment, computed, createBlock, createElementBlock, defineComponent, mergeProps, openBlock, renderList, resolveDynamicComponent } from "vue";
|
|
3
3
|
//#region src/SliceZone/SliceZone.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var SliceZone_vue_vue_type_script_setup_true_lang_default =
|
|
4
|
+
var SliceZone_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
5
5
|
name: "SliceZone",
|
|
6
6
|
__name: "SliceZone",
|
|
7
7
|
props: {
|
|
@@ -1 +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 type { ComponentOrTagName } from \"../types\"\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\nimport type { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from \"./types\"\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/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/** The Vue component rendered if a component mapping from the `components` prop cannot be found. */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed<\n\t{\n\t\tis: ComponentOrTagName\n\t\tkey: string\n\t\tprops: Record<string, unknown>\n\t}[]\n>(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type = \"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\" ? slice.id : `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\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<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;EAGd,MAAM,iBAAiB,eAMf;
|
|
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 type { ComponentOrTagName } from \"../types\"\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\nimport type { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from \"./types\"\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/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/** The Vue component rendered if a component mapping from the `components` prop cannot be found. */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed<\n\t{\n\t\tis: ComponentOrTagName\n\t\tkey: string\n\t\tprops: Record<string, unknown>\n\t}[]\n>(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type = \"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\" ? slice.id : `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\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<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;EAGd,MAAM,iBAAiB,eAMf;GACP,IAAI,CAAC,MAAM,QAAQ,OAAO,CAAC;GAE3B,OAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OAAO,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE1E,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,MAAM,GAAG,KAAK,UAAU,KAAK;IAE5F,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM;IAE7C,IAAI,CAAC,IACJ,OAAO;KAAE,IAAI;KAAoB;KAAK,OAAO,EAAE,MAAM;IAAE;IAGxD,IAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;KAErC,OAAO;MAAE;MAAI;MAAK,OAAO;KAAY;IACtC;IAEA,OAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;KACf;IACD;GACD,CAAC;EACF,CAAC;;GAIA,OAAA,UAAA,IAAA,GAAA,mBAKE,UAAA,MAAA,WAJuB,eAAA,QAAjB,kBAAa;IADrB,OAAA,UAAA,GAAA,YAKE,wBAHI,cAAc,EAAE,GAFtB,WAKE,EAFA,KAAK,cAAc,IACZ,GAAA,EAAA,SAAA,KAAA,GAAA,cAAc,KAAK,GAAA,MAAA,EAAA"}
|
|
@@ -1 +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 implementation.\n *\n * This is also the default Vue component rendered when a component mapping cannot be found in\n * `<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 ? props.slice.slice_type : 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":";;;;;;;;AAaA,MAAa,
|
|
1
|
+
{"version":3,"file":"TODOSliceComponent.cjs","names":["DEV","computed","h"],"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 implementation.\n *\n * This is also the default Vue component rendered when a component mapping cannot be found in\n * `<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 ? props.slice.slice_type : 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":";;;;;;;;AAaA,MAAa,sCAAqBA,CAAAA,CAAAA,MAChB,iBAAA,GAAA,IAAA,gBAAA,CAAgB;CAC/B,MAAM;CACN,OAAO,EACN,OAAO;EACN,MAAM;EACN,UAAU;CACX,EACD;CACA,MAAM,OAAO;EACZ,MAAM,QAAA,GAAOC,IAAAA,SAAAA,OAAe;GAC3B,OAAO,gBAAgB,MAAM,QAAQ,MAAM,MAAM,aAAa,MAAM,MAAM;EAC3E,CAAC;EAED,CAAA,GAAA,IAAA,YAAA,OAAkB;GACjB,QAAQ,KACP,0DAA0D,KAAK,MAAM,IACrE,MAAM,KACP;EACD,CAAC;EAED,aAAa;GACZ,QAAA,GAAOC,IAAAA,EAAAA,CACN,WACA;IACC,kCAAkC;IAClC,mBAAmB,KAAK;GACzB,GACA,CAAC,8CAA8C,KAAK,MAAM,EAAE,CAC7D;EACD;CACD;AACD,CAAC,WACQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TODOSliceComponent.d.cts","names":[],"sources":["../../src/SliceZone/TODOSliceComponent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TODOSliceComponent.d.cts","names":[],"sources":["../../src/SliceZone/TODOSliceComponent.ts"],"mappings":";;;;;;;;cAaa,oBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TODOSliceComponent.d.ts","names":[],"sources":["../../src/SliceZone/TODOSliceComponent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TODOSliceComponent.d.ts","names":[],"sources":["../../src/SliceZone/TODOSliceComponent.ts"],"mappings":";;;;;;;;cAaa,oBAAkB"}
|
|
@@ -1 +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 implementation.\n *\n * This is also the default Vue component rendered when a component mapping cannot be found in\n * `<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 ? props.slice.slice_type : 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":";;;;;;;;;AAaA,MAAa,qBAAqB,MAChB,gCAAgB;CAC/B,MAAM;CACN,OAAO,EACN,OAAO;EACN,MAAM;EACN,UAAU;
|
|
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 implementation.\n *\n * This is also the default Vue component rendered when a component mapping cannot be found in\n * `<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 ? props.slice.slice_type : 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":";;;;;;;;;AAaA,MAAa,qBAAqB,MAChB,gCAAgB;CAC/B,MAAM;CACN,OAAO,EACN,OAAO;EACN,MAAM;EACN,UAAU;CACX,EACD;CACA,MAAM,OAAO;EACZ,MAAM,OAAO,eAAe;GAC3B,OAAO,gBAAgB,MAAM,QAAQ,MAAM,MAAM,aAAa,MAAM,MAAM;EAC3E,CAAC;EAED,kBAAkB;GACjB,QAAQ,KACP,0DAA0D,KAAK,MAAM,IACrE,MAAM,KACP;EACD,CAAC;EAED,aAAa;GACZ,OAAO,EACN,WACA;IACC,kCAAkC;IAClC,mBAAmB,KAAK;GACzB,GACA,CAAC,8CAA8C,KAAK,MAAM,EAAE,CAC7D;EACD;CACD;AACD,CAAC,WACQ"}
|
|
@@ -8,7 +8,7 @@ let vue = require("vue");
|
|
|
8
8
|
* This is essentially an helper function to ensure {@link markRaw} is correctly applied on each
|
|
9
9
|
* components, improving performances.
|
|
10
10
|
* @example
|
|
11
|
-
*
|
|
11
|
+
* ```javascript
|
|
12
12
|
* // Defining a slice components
|
|
13
13
|
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSliceZoneComponents.cjs","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":["import { markRaw } from \"vue\"\n\nimport type { SliceComponentType, SliceLike, SliceZoneComponents } from \"./types\"\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each components will be\n * rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly applied on each\n * components, improving performances.\n * @example\n * \t
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.cjs","names":["markRaw"],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":["import { markRaw } from \"vue\"\n\nimport type { SliceComponentType, SliceLike, SliceZoneComponents } from \"./types\"\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each components will be\n * rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly applied on each\n * components, improving performances.\n * @example\n * \t```javascript\n * \t// Defining a slice components\n * \timport { defineSliceZoneComponents } from \"@prismicio/vue\";\n *\n * \texport default {\n * \tdata() {\n * \tcomponents: defineSliceZoneComponents({\n * \tfoo: Foo,\n * \tbar: defineAsyncComponent(\n * \t() => new Promise((res) => res(Bar)),\n * \t),\n * \tbaz: \"Baz\",\n * \t}),\n * \t}\n * \t};\n * \t```\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 * @param components - {@link SliceZoneComponents}\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<Extract<TSlice, SliceLike<typeof type>>, TContext>,\n\t\t\t\t\t)\n\t}\n\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,6BAKZ,eAC2C;CAC3C,MAAM,SAAS,CAAC;CAEhB,IAAI;CACJ,KAAK,QAAQ,YAAY;EACxB,MAAM,YAAY,WAAW;EAC7B,OAAO,QACN,OAAO,cAAc,WAClB,aAAA,GACAA,IAAAA,QAAAA,CACA,SACD;CACJ;CAEA,OAAO;AACR"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SliceLike, SliceZoneComponents } from "./types.cjs";
|
|
2
|
-
|
|
3
2
|
//#region src/SliceZone/defineSliceZoneComponents.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Gets an optimized record of Slice types mapped to Vue components. Each components will be
|
|
@@ -9,7 +8,7 @@ import { SliceLike, SliceZoneComponents } from "./types.cjs";
|
|
|
9
8
|
* This is essentially an helper function to ensure {@link markRaw} is correctly applied on each
|
|
10
9
|
* components, improving performances.
|
|
11
10
|
* @example
|
|
12
|
-
*
|
|
11
|
+
* ```javascript
|
|
13
12
|
* // Defining a slice components
|
|
14
13
|
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
15
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSliceZoneComponents.d.cts","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.d.cts","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkCa,4BAEZ,eAAe,iBACf,oBAEA,YAAY,oBAAoB,QAAQ,cACtC,oBAAoB,QAAQ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SliceLike, SliceZoneComponents } from "./types.js";
|
|
2
|
-
|
|
3
2
|
//#region src/SliceZone/defineSliceZoneComponents.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Gets an optimized record of Slice types mapped to Vue components. Each components will be
|
|
@@ -9,7 +8,7 @@ import { SliceLike, SliceZoneComponents } from "./types.js";
|
|
|
9
8
|
* This is essentially an helper function to ensure {@link markRaw} is correctly applied on each
|
|
10
9
|
* components, improving performances.
|
|
11
10
|
* @example
|
|
12
|
-
*
|
|
11
|
+
* ```javascript
|
|
13
12
|
* // Defining a slice components
|
|
14
13
|
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
15
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSliceZoneComponents.d.ts","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.d.ts","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkCa,4BAEZ,eAAe,iBACf,oBAEA,YAAY,oBAAoB,QAAQ,cACtC,oBAAoB,QAAQ"}
|
|
@@ -8,7 +8,7 @@ import { markRaw } from "vue";
|
|
|
8
8
|
* This is essentially an helper function to ensure {@link markRaw} is correctly applied on each
|
|
9
9
|
* components, improving performances.
|
|
10
10
|
* @example
|
|
11
|
-
*
|
|
11
|
+
* ```javascript
|
|
12
12
|
* // Defining a slice components
|
|
13
13
|
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSliceZoneComponents.js","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":["import { markRaw } from \"vue\"\n\nimport type { SliceComponentType, SliceLike, SliceZoneComponents } from \"./types\"\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each components will be\n * rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly applied on each\n * components, improving performances.\n * @example\n * \t
|
|
1
|
+
{"version":3,"file":"defineSliceZoneComponents.js","names":[],"sources":["../../src/SliceZone/defineSliceZoneComponents.ts"],"sourcesContent":["import { markRaw } from \"vue\"\n\nimport type { SliceComponentType, SliceLike, SliceZoneComponents } from \"./types\"\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each components will be\n * rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly applied on each\n * components, improving performances.\n * @example\n * \t```javascript\n * \t// Defining a slice components\n * \timport { defineSliceZoneComponents } from \"@prismicio/vue\";\n *\n * \texport default {\n * \tdata() {\n * \tcomponents: defineSliceZoneComponents({\n * \tfoo: Foo,\n * \tbar: defineAsyncComponent(\n * \t() => new Promise((res) => res(Bar)),\n * \t),\n * \tbaz: \"Baz\",\n * \t}),\n * \t}\n * \t};\n * \t```\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 * @param components - {@link SliceZoneComponents}\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<Extract<TSlice, SliceLike<typeof type>>, TContext>,\n\t\t\t\t\t)\n\t}\n\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,6BAKZ,eAC2C;CAC3C,MAAM,SAAS,CAAC;CAEhB,IAAI;CACJ,KAAK,QAAQ,YAAY;EACxB,MAAM,YAAY,WAAW;EAC7B,OAAO,QACN,OAAO,cAAc,WAClB,YACA,QACA,SACD;CACJ;CAEA,OAAO;AACR"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Props are: `["slice", "index", "slices", "context"]`
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
*
|
|
9
|
+
* ```typescript
|
|
10
10
|
* // Defining a new slice component
|
|
11
11
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
*
|
|
17
|
+
* ```typescript
|
|
18
18
|
* // Defining a new slice component with visual hint
|
|
19
19
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
20
20
|
*
|
|
@@ -1 +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 the `<SliceZone />`\n * component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made available to all Slice\n * 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 using the\n * `<SliceZone />` component.\n *\n * Props are: `[\"slice\", \"index\", \"slices\", \"context\"]`\n *\n * @example\n * \t
|
|
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 the `<SliceZone />`\n * component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made available to all Slice\n * 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 using the\n * `<SliceZone />` component.\n *\n * Props are: `[\"slice\", \"index\", \"slices\", \"context\"]`\n *\n * @example\n * \t```typescript\n * \t// Defining a new slice component\n * \timport { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * \tdefineProps(getSliceComponentProps())\n * \t```\n *\n * @example\n * \t```typescript\n * \t// Defining a new slice component with visual hint\n * \timport { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * \tdefineProps(getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]))\n * \t```\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made available to all Slice\n * components\n * @param propsHint - An optional array of prop names used for the sole purpose of having a visual\n * hint of which props are made available to the slice, this parameters doesn't have any effect\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<SliceComponentProps<TSlice, TContext>[\"context\"]>,\n\t\trequired: true,\n\t},\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAa,0BAMZ,eAC2D;CAC3D,OAAO;EACN,MAAM;EACN,UAAU;CACX;CACA,OAAO;EACN,MAAM;EACN,UAAU;CACX;CACA,QAAQ;EACP,MAAM;EACN,UAAU;CACX;CACA,SAAS;EACR,MAAM;EACN,UAAU;CACX;AACD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SliceComponentProps, SliceLike } from "./types.cjs";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
|
-
|
|
4
3
|
//#region src/SliceZone/getSliceComponentProps.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Native Vue props for a component rendering content from a Prismic Slice using the `<SliceZone />`
|
|
@@ -35,7 +34,7 @@ type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext
|
|
|
35
34
|
* Props are: `["slice", "index", "slices", "context"]`
|
|
36
35
|
*
|
|
37
36
|
* @example
|
|
38
|
-
*
|
|
37
|
+
* ```typescript
|
|
39
38
|
* // Defining a new slice component
|
|
40
39
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
41
40
|
*
|
|
@@ -43,7 +42,7 @@ type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext
|
|
|
43
42
|
* ```
|
|
44
43
|
*
|
|
45
44
|
* @example
|
|
46
|
-
*
|
|
45
|
+
* ```typescript
|
|
47
46
|
* // Defining a new slice component with visual hint
|
|
48
47
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
49
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSliceComponentProps.d.cts","names":[],"sources":["../../src/SliceZone/getSliceComponentProps.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getSliceComponentProps.d.cts","names":[],"sources":["../../src/SliceZone/getSliceComponentProps.ts"],"mappings":";;;;;;;;;;;KAYK,mCAEJ,eAAe,iBACf;EAEA;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;EAED;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;EAED;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;EAED;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCW,yBAEZ,eAAe,iBACf,oBAGA,wDACE,mCAAmC,QAAQ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SliceComponentProps, SliceLike } from "./types.js";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
|
-
|
|
4
3
|
//#region src/SliceZone/getSliceComponentProps.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Native Vue props for a component rendering content from a Prismic Slice using the `<SliceZone />`
|
|
@@ -35,7 +34,7 @@ type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext
|
|
|
35
34
|
* Props are: `["slice", "index", "slices", "context"]`
|
|
36
35
|
*
|
|
37
36
|
* @example
|
|
38
|
-
*
|
|
37
|
+
* ```typescript
|
|
39
38
|
* // Defining a new slice component
|
|
40
39
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
41
40
|
*
|
|
@@ -43,7 +42,7 @@ type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext
|
|
|
43
42
|
* ```
|
|
44
43
|
*
|
|
45
44
|
* @example
|
|
46
|
-
*
|
|
45
|
+
* ```typescript
|
|
47
46
|
* // Defining a new slice component with visual hint
|
|
48
47
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
49
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSliceComponentProps.d.ts","names":[],"sources":["../../src/SliceZone/getSliceComponentProps.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getSliceComponentProps.d.ts","names":[],"sources":["../../src/SliceZone/getSliceComponentProps.ts"],"mappings":";;;;;;;;;;;KAYK,mCAEJ,eAAe,iBACf;EAEA;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;EAED;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;EAED;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;EAED;IACC,MAAM,SAAS,oBAAoB,QAAQ;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCW,yBAEZ,eAAe,iBACf,oBAGA,wDACE,mCAAmC,QAAQ"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Props are: `["slice", "index", "slices", "context"]`
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
*
|
|
9
|
+
* ```typescript
|
|
10
10
|
* // Defining a new slice component
|
|
11
11
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
*
|
|
17
|
+
* ```typescript
|
|
18
18
|
* // Defining a new slice component with visual hint
|
|
19
19
|
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
20
20
|
*
|
|
@@ -1 +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 the `<SliceZone />`\n * component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made available to all Slice\n * 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 using the\n * `<SliceZone />` component.\n *\n * Props are: `[\"slice\", \"index\", \"slices\", \"context\"]`\n *\n * @example\n * \t
|
|
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 the `<SliceZone />`\n * component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made available to all Slice\n * 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 using the\n * `<SliceZone />` component.\n *\n * Props are: `[\"slice\", \"index\", \"slices\", \"context\"]`\n *\n * @example\n * \t```typescript\n * \t// Defining a new slice component\n * \timport { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * \tdefineProps(getSliceComponentProps())\n * \t```\n *\n * @example\n * \t```typescript\n * \t// Defining a new slice component with visual hint\n * \timport { getSliceComponentProps } from \"@prismicio/vue\"\n *\n * \tdefineProps(getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]))\n * \t```\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made available to all Slice\n * components\n * @param propsHint - An optional array of prop names used for the sole purpose of having a visual\n * hint of which props are made available to the slice, this parameters doesn't have any effect\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<SliceComponentProps<TSlice, TContext>[\"context\"]>,\n\t\trequired: true,\n\t},\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAa,0BAMZ,eAC2D;CAC3D,OAAO;EACN,MAAM;EACN,UAAU;CACX;CACA,OAAO;EACN,MAAM;EACN,UAAU;CACX;CACA,QAAQ;EACP,MAAM;EACN,UAAU;CACX;CACA,SAAS;EACR,MAAM;EACN,UAAU;CACX;AACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZoneComponents, SliceZoneLike } from "./types.cjs";
|
|
2
2
|
import { TODOSliceComponent } from "./TODOSliceComponent.cjs";
|
|
3
3
|
import { getSliceComponentProps } from "./getSliceComponentProps.cjs";
|
|
4
|
-
import { defineSliceZoneComponents } from "./defineSliceZoneComponents.cjs";
|
|
4
|
+
import { defineSliceZoneComponents } from "./defineSliceZoneComponents.cjs";
|
|
5
|
+
export { type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, type SliceZoneComponents, type SliceZoneLike, TODOSliceComponent, defineSliceZoneComponents, getSliceComponentProps };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZoneComponents, SliceZoneLike } from "./types.js";
|
|
2
2
|
import { TODOSliceComponent } from "./TODOSliceComponent.js";
|
|
3
3
|
import { getSliceComponentProps } from "./getSliceComponentProps.js";
|
|
4
|
-
import { defineSliceZoneComponents } from "./defineSliceZoneComponents.js";
|
|
4
|
+
import { defineSliceZoneComponents } from "./defineSliceZoneComponents.js";
|
|
5
|
+
export { type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, type SliceZoneComponents, type SliceZoneLike, TODOSliceComponent, defineSliceZoneComponents, getSliceComponentProps };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component } from "../types.cjs";
|
|
2
2
|
import { Slice } from "@prismicio/client";
|
|
3
|
-
|
|
4
3
|
//#region src/SliceZone/types.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Returns the type of a `SliceLike` type.
|
|
@@ -59,9 +58,13 @@ type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
|
|
|
59
58
|
* components
|
|
60
59
|
*/
|
|
61
60
|
type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
62
|
-
/** Slice data for this component. */
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
/** Slice data for this component. */
|
|
62
|
+
slice: TSlice;
|
|
63
|
+
/** The index of the Slice in the Slice Zone. */
|
|
64
|
+
index: number;
|
|
65
|
+
/** All Slices from the Slice Zone to which the Slice belongs. */
|
|
66
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
|
|
67
|
+
/** Arbitrary data passed to `<SliceZone />` and made available to all Slice components. */
|
|
65
68
|
context: TContext;
|
|
66
69
|
};
|
|
67
70
|
/**
|
|
@@ -78,7 +81,7 @@ type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> = Co
|
|
|
78
81
|
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
79
82
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
80
83
|
*/
|
|
81
|
-
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 };
|
|
84
|
+
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; };
|
|
82
85
|
//#endregion
|
|
83
86
|
export { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZoneComponents, SliceZoneLike };
|
|
84
87
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/SliceZone/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/SliceZone/types.ts"],"mappings":";;;;;;;;KASK,iBAAiB,eAAe,aAAa,eAAe,kBAC9D,uBACA,eAAe,mBACd;;;;;;;KASQ,gBAAgB,sCAAsC,KACjE,MAAM;;;;;;;KAUK,iBAAiB;EAC5B,MAAM,MAAM;;;;;;;;;;KAWD,UAAU,uCACnB,gBAAgB,cAChB,iBAAiB;;;;;;;EAQnB;;;;;;;;;;KAWW,cAAc,eAAe,YAAY,sBAAsB;;;;;;;;;KAU/D,oBAAoB,eAAe,YAAY,WAAW;;EAErE,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;;;;;;KASE,mBAEX,eAAe,iBACf,sBACG,UAAU,oBAAoB,QAAQ;;;;;;;;KAS9B,oBAAoB,eAAe,YAAY,WAAW,yBAWnE,aAAa,iBAAiB,UAC5B,mBACA,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component } from "../types.js";
|
|
2
2
|
import { Slice } from "@prismicio/client";
|
|
3
|
-
|
|
4
3
|
//#region src/SliceZone/types.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Returns the type of a `SliceLike` type.
|
|
@@ -59,9 +58,13 @@ type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
|
|
|
59
58
|
* components
|
|
60
59
|
*/
|
|
61
60
|
type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
62
|
-
/** Slice data for this component. */
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
/** Slice data for this component. */
|
|
62
|
+
slice: TSlice;
|
|
63
|
+
/** The index of the Slice in the Slice Zone. */
|
|
64
|
+
index: number;
|
|
65
|
+
/** All Slices from the Slice Zone to which the Slice belongs. */
|
|
66
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
|
|
67
|
+
/** Arbitrary data passed to `<SliceZone />` and made available to all Slice components. */
|
|
65
68
|
context: TContext;
|
|
66
69
|
};
|
|
67
70
|
/**
|
|
@@ -78,7 +81,7 @@ type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> = Co
|
|
|
78
81
|
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
79
82
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
80
83
|
*/
|
|
81
|
-
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 };
|
|
84
|
+
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; };
|
|
82
85
|
//#endregion
|
|
83
86
|
export { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZoneComponents, SliceZoneLike };
|
|
84
87
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/SliceZone/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/SliceZone/types.ts"],"mappings":";;;;;;;;KASK,iBAAiB,eAAe,aAAa,eAAe,kBAC9D,uBACA,eAAe,mBACd;;;;;;;KASQ,gBAAgB,sCAAsC,KACjE,MAAM;;;;;;;KAUK,iBAAiB;EAC5B,MAAM,MAAM;;;;;;;;;;KAWD,UAAU,uCACnB,gBAAgB,cAChB,iBAAiB;;;;;;;EAQnB;;;;;;;;;;KAWW,cAAc,eAAe,YAAY,sBAAsB;;;;;;;;;KAU/D,oBAAoB,eAAe,YAAY,WAAW;;EAErE,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;;;;;;KASE,mBAEX,eAAe,iBACf,sBACG,UAAU,oBAAoB,QAAQ;;;;;;;;KAS9B,oBAAoB,eAAe,YAAY,WAAW,yBAWnE,aAAa,iBAAiB,UAC5B,mBACA,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B"}
|
package/dist/createPrismic.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPrismic.cjs","names":[],"sources":["../src/createPrismic.ts"],"sourcesContent":["import type { CreateClient, LinkResolverFunction } from \"@prismicio/client\"\nimport { isFilled } from \"@prismicio/client\"\nimport type { App, InjectionKey } from \"vue\"\nimport { inject } from \"vue\"\n\nimport type { RichTextComponents } from \"./PrismicRichText\"\nimport type { TableComponents } from \"./PrismicTable\"\nimport type { ComponentOrTagName } from \"./types\"\n\nconst prismicKey = Symbol.for(\"@prismicio/vue/plugin\") as InjectionKey<PrismicPlugin>\n\n/** Components configuration. */\ntype ComponentsConfig = {\n\t/** The default component rendered for internal URLs. */\n\tlinkInternalComponent?: ComponentOrTagName\n\n\t/** The default component rendered for external URLs. */\n\tlinkExternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The default components or shorthand definitions for rich text and table components.\n\t *\n\t * @see {@link https://prismic.io/docs/fields/rich-text}\n\t * @see {@link https://prismic.io/docs/fields/table}\n\t */\n\trichTextComponents?: RichTextComponents & TableComponents\n}\n\n/** Prismic Vue plugin configuration. */\nexport type PrismicPluginConfig = {\n\t/** A Prismic client instance to inject into the Vue app. */\n\tclient: ReturnType<CreateClient>\n\n\t/**\n\t * A default link resolver used to resolve links when route resolvers cannot be used.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/** Components configuration. */\n\tcomponents?: ComponentsConfig\n}\n\n/** Prismic Vue plugin interface accessible through `usePrismic()` and `$prismic`. */\nexport type PrismicPlugin = {\n\t/** A Prismic client that can be used to query content from a repository. */\n\tclient: ReturnType<CreateClient>\n\n\t/** Helpers to determine if a field is filled. */\n\tisFilled: typeof isFilled\n\n\t/**\n\t * The default link resolver used to resolve links when route resolvers cannot be used.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/** @internal */\n\treadonly components: ComponentsConfig\n\n\t/** @internal */\n\tinstall: (app: App) => void\n}\n\n/** Creates a Prismic Vue plugin instance that can be used by a Vue app. */\nexport const createPrismic = (config: PrismicPluginConfig): PrismicPlugin => {\n\treturn {\n\t\t...config,\n\t\tcomponents: config.components || {},\n\t\tisFilled,\n\t\tinstall(app: App): void {\n\t\t\tapp.provide(prismicKey, this)\n\t\t\tapp.config.globalProperties.$prismic = this\n\t\t},\n\t}\n}\n\n/**\n * Access the Prismic Vue plugin interface.\n *\n * @example\n * \t
|
|
1
|
+
{"version":3,"file":"createPrismic.cjs","names":["inject"],"sources":["../src/createPrismic.ts"],"sourcesContent":["import type { CreateClient, LinkResolverFunction } from \"@prismicio/client\"\nimport { isFilled } from \"@prismicio/client\"\nimport type { App, InjectionKey } from \"vue\"\nimport { inject } from \"vue\"\n\nimport type { RichTextComponents } from \"./PrismicRichText\"\nimport type { TableComponents } from \"./PrismicTable\"\nimport type { ComponentOrTagName } from \"./types\"\n\nconst prismicKey = Symbol.for(\"@prismicio/vue/plugin\") as InjectionKey<PrismicPlugin>\n\n/** Components configuration. */\ntype ComponentsConfig = {\n\t/** The default component rendered for internal URLs. */\n\tlinkInternalComponent?: ComponentOrTagName\n\n\t/** The default component rendered for external URLs. */\n\tlinkExternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The default components or shorthand definitions for rich text and table components.\n\t *\n\t * @see {@link https://prismic.io/docs/fields/rich-text}\n\t * @see {@link https://prismic.io/docs/fields/table}\n\t */\n\trichTextComponents?: RichTextComponents & TableComponents\n}\n\n/** Prismic Vue plugin configuration. */\nexport type PrismicPluginConfig = {\n\t/** A Prismic client instance to inject into the Vue app. */\n\tclient: ReturnType<CreateClient>\n\n\t/**\n\t * A default link resolver used to resolve links when route resolvers cannot be used.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/** Components configuration. */\n\tcomponents?: ComponentsConfig\n}\n\n/** Prismic Vue plugin interface accessible through `usePrismic()` and `$prismic`. */\nexport type PrismicPlugin = {\n\t/** A Prismic client that can be used to query content from a repository. */\n\tclient: ReturnType<CreateClient>\n\n\t/** Helpers to determine if a field is filled. */\n\tisFilled: typeof isFilled\n\n\t/**\n\t * The default link resolver used to resolve links when route resolvers cannot be used.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/** @internal */\n\treadonly components: ComponentsConfig\n\n\t/** @internal */\n\tinstall: (app: App) => void\n}\n\n/** Creates a Prismic Vue plugin instance that can be used by a Vue app. */\nexport const createPrismic = (config: PrismicPluginConfig): PrismicPlugin => {\n\treturn {\n\t\t...config,\n\t\tcomponents: config.components || {},\n\t\tisFilled,\n\t\tinstall(app: App): void {\n\t\t\tapp.provide(prismicKey, this)\n\t\t\tapp.config.globalProperties.$prismic = this\n\t\t},\n\t}\n}\n\n/**\n * Access the Prismic Vue plugin interface.\n *\n * @example\n * \t```typescript\n * \tconst { client, isFilled } = usePrismic()\n * \t```\n */\nexport const usePrismic = (): PrismicPlugin => {\n\treturn inject(prismicKey, { components: {} } as PrismicPlugin)\n}\n\ndeclare module \"vue\" {\n\texport interface ComponentCustomProperties {\n\t\t/** The Prismic Vue plugin interface. */\n\t\t$prismic: PrismicPlugin\n\t}\n}\n"],"mappings":";;;AASA,MAAM,aAAa,OAAO,IAAI,uBAAuB;;AA0DrD,MAAa,iBAAiB,WAA+C;CAC5E,OAAO;EACN,GAAG;EACH,YAAY,OAAO,cAAc,CAAC;EAClC,UAAA,kBAAA;EACA,QAAQ,KAAgB;GACvB,IAAI,QAAQ,YAAY,IAAI;GAC5B,IAAI,OAAO,iBAAiB,WAAW;EACxC;CACD;AACD;;;;;;;;;AAUA,MAAa,mBAAkC;CAC9C,QAAA,GAAOA,IAAAA,OAAAA,CAAO,YAAY,EAAE,YAAY,CAAC,EAAE,CAAkB;AAC9D"}
|