@prismicio/vue 5.3.0-canary.5d9ea4c → 5.3.0-canary.87748cc
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.vue.d.cts +30 -58
- package/dist/PrismicImage.vue.d.cts.map +1 -1
- package/dist/PrismicLink.vue.d.cts +65 -137
- package/dist/PrismicLink.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +25 -53
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/types.d.cts +18 -5
- package/dist/PrismicRichText/types.d.cts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.cts +10 -10
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/PrismicTable/types.d.cts +8 -8
- package/dist/PrismicTable/types.d.cts.map +1 -1
- package/dist/PrismicText.vue.d.cts +3 -13
- package/dist/PrismicText.vue.d.cts.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.cts +5 -24
- package/dist/SliceZone/SliceZone.vue.d.cts.map +1 -1
- package/dist/index.cjs +3 -10
- package/dist/index.d.cts +9 -13
- package/dist/index.d.ts +11 -15
- package/dist/index.js +3 -6
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/dist/src/PrismicImage.cjs.map +1 -1
- package/dist/src/PrismicImage.js.map +1 -1
- package/dist/src/PrismicImage.vue.d.ts +26 -54
- package/dist/src/PrismicImage.vue.d.ts.map +1 -1
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs +2 -4
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js +2 -4
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicLink.cjs.map +1 -1
- package/dist/src/PrismicLink.js.map +1 -1
- package/dist/src/PrismicLink.vue.d.ts +61 -133
- package/dist/src/PrismicLink.vue.d.ts.map +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +3 -6
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js +3 -6
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts +25 -53
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +41 -57
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +42 -58
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +53 -33
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +54 -34
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +9 -29
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +10 -30
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/types.d.ts +18 -5
- package/dist/src/PrismicRichText/types.d.ts.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts +13 -13
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +47 -19
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +48 -20
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs +36 -18
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js +36 -18
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs +13 -10
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js +14 -11
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/types.d.ts +8 -8
- package/dist/src/PrismicTable/types.d.ts.map +1 -1
- package/dist/src/PrismicText.cjs.map +1 -1
- package/dist/src/PrismicText.js.map +1 -1
- package/dist/src/PrismicText.vue.d.ts +1 -11
- package/dist/src/PrismicText.vue.d.ts.map +1 -1
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs +1 -12
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js +3 -14
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/SliceZone/SliceZone.cjs.map +1 -1
- package/dist/src/SliceZone/SliceZone.js.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue.d.ts +5 -24
- package/dist/src/SliceZone/SliceZone.vue.d.ts.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs +5 -17
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js +6 -18
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/types.cjs +9 -0
- package/dist/src/types.cjs.map +1 -0
- package/dist/src/types.d.ts +3 -352
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/dist/types.d.cts +3 -352
- package/dist/types.d.cts.map +1 -1
- package/package.json +6 -5
- package/src/PrismicImage.vue +10 -27
- package/src/PrismicLink.vue +18 -43
- package/src/PrismicRichText/PrismicRichText.vue +68 -118
- package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +61 -19
- package/src/PrismicRichText/PrismicRichTextSerialize.vue +5 -30
- package/src/PrismicRichText/types.ts +33 -14
- package/src/PrismicTable/PrismicTable.vue +50 -23
- package/src/PrismicTable/PrismicTableDefaultComponents.ts +45 -20
- package/src/PrismicTable/PrismicTableRow.vue +17 -24
- package/src/PrismicTable/types.ts +28 -15
- package/src/PrismicText.vue +3 -18
- package/src/SliceZone/SliceZone.vue +12 -41
- package/src/index.ts +13 -21
- package/src/types.ts +30 -438
- package/dist/PrismicEmbed.vue.d.cts +0 -25
- package/dist/PrismicEmbed.vue.d.cts.map +0 -1
- package/dist/createPrismic.d.cts +0 -29
- package/dist/createPrismic.d.cts.map +0 -1
- package/dist/src/PrismicEmbed.cjs +0 -8
- package/dist/src/PrismicEmbed.cjs.map +0 -1
- package/dist/src/PrismicEmbed.js +0 -8
- package/dist/src/PrismicEmbed.js.map +0 -1
- package/dist/src/PrismicEmbed.vue.d.ts +0 -25
- package/dist/src/PrismicEmbed.vue.d.ts.map +0 -1
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.cjs +0 -42
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.js +0 -42
- package/dist/src/PrismicEmbed.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.cjs +0 -8
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.cjs.map +0 -1
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.js +0 -8
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.js.map +0 -1
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.cjs +0 -92
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.js +0 -92
- package/dist/src/PrismicRichText/DeprecatedPrismicRichText.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/createPrismic.cjs +0 -85
- package/dist/src/createPrismic.cjs.map +0 -1
- package/dist/src/createPrismic.d.ts +0 -29
- package/dist/src/createPrismic.d.ts.map +0 -1
- package/dist/src/createPrismic.js +0 -85
- package/dist/src/createPrismic.js.map +0 -1
- package/dist/src/lib/Wrapper.cjs +0 -8
- package/dist/src/lib/Wrapper.cjs.map +0 -1
- package/dist/src/lib/Wrapper.js +0 -8
- package/dist/src/lib/Wrapper.js.map +0 -1
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.cjs +0 -22
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.cjs.map +0 -1
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.js +0 -22
- package/dist/src/lib/Wrapper.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/src/usePrismic.cjs +0 -38
- package/dist/src/usePrismic.cjs.map +0 -1
- package/dist/src/usePrismic.d.ts +0 -36
- package/dist/src/usePrismic.d.ts.map +0 -1
- package/dist/src/usePrismic.js +0 -37
- package/dist/src/usePrismic.js.map +0 -1
- package/dist/usePrismic.d.cts +0 -36
- package/dist/usePrismic.d.cts.map +0 -1
- package/src/PrismicEmbed.vue +0 -42
- package/src/PrismicRichText/DeprecatedPrismicRichText.vue +0 -146
- package/src/createPrismic.ts +0 -154
- package/src/lib/Wrapper.vue +0 -22
- package/src/usePrismic.ts +0 -36
package/dist/types.d.cts
CHANGED
|
@@ -1,357 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SliceComponentType } from "./SliceZone/types.cjs";
|
|
3
|
-
import { App, ConcreteComponent, DefineComponent, Raw } from "vue";
|
|
4
|
-
import { AsLinkAttrsConfig, ClientConfig, CreateClient, HTMLRichTextFunctionSerializer, HTMLRichTextMapSerializer, LinkResolverFunction, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, cookie, documentToLinkField, filter, isFilled } from "@prismicio/client";
|
|
1
|
+
import { ConcreteComponent, DefineComponent, FunctionalComponent, Raw, defineAsyncComponent } from "vue";
|
|
5
2
|
|
|
6
3
|
//#region src/types.d.ts
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Options used by `@prismicio/vue` components.
|
|
10
|
-
*/
|
|
11
|
-
type PrismicPluginComponentsOptions = {
|
|
12
|
-
/**
|
|
13
|
-
* The `rel` attribute to apply on links. This prop can be provided a function
|
|
14
|
-
* to use the link's metadata to determine the `rel` value.
|
|
15
|
-
*
|
|
16
|
-
* @defaultValue `"noreferrer"` for external links.
|
|
17
|
-
*/
|
|
18
|
-
linkRel?: AsLinkAttrsConfig["rel"];
|
|
19
|
-
/**
|
|
20
|
-
* An HTML tag name or a component used to render internal links.
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
24
|
-
* `target`, and `rel` attributes).
|
|
25
|
-
* @remarks
|
|
26
|
-
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
27
|
-
* (`to` props).
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue {@link RouterLink}
|
|
30
|
-
*/
|
|
31
|
-
linkInternalComponent?: ComponentOrTagName;
|
|
32
|
-
/**
|
|
33
|
-
* An HTML tag name or a component used to render external links.
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
37
|
-
* `target`, and `rel` attributes).
|
|
38
|
-
* @remarks
|
|
39
|
-
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
40
|
-
* (`to` props).
|
|
41
|
-
*
|
|
42
|
-
* @defaultValue `"a"`
|
|
43
|
-
*/
|
|
44
|
-
linkExternalComponent?: ComponentOrTagName;
|
|
45
|
-
/**
|
|
46
|
-
* Default widths to use when rendering an image with `widths="defaults"`
|
|
47
|
-
*
|
|
48
|
-
* @remarks
|
|
49
|
-
* Consider configuring image widths within your content type definition and
|
|
50
|
-
* using `widths="auto"` instead to give content writers the ability to crop
|
|
51
|
-
* images in the editor.
|
|
52
|
-
*
|
|
53
|
-
* @defaultValue `@prismicio/client` defaults
|
|
54
|
-
*/
|
|
55
|
-
imageWidthSrcSetDefaults?: number[];
|
|
56
|
-
/**
|
|
57
|
-
* Default pixel densities to use when rendering an image with
|
|
58
|
-
* `pixel-densities="defaults"`
|
|
59
|
-
*
|
|
60
|
-
* @defaultValue `@prismicio/client` defaults
|
|
61
|
-
*/
|
|
62
|
-
imagePixelDensitySrcSetDefaults?: number[];
|
|
63
|
-
/**
|
|
64
|
-
* An optional map of Rich Text block types to Vue Components. It is used to
|
|
65
|
-
* render rich text or title fields.
|
|
66
|
-
*
|
|
67
|
-
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
|
|
68
|
-
*/
|
|
69
|
-
richTextComponents?: VueRichTextSerializer;
|
|
70
|
-
/**
|
|
71
|
-
* A component or a functional component rendered if a component mapping from
|
|
72
|
-
* the `components` prop cannot be found.
|
|
73
|
-
*
|
|
74
|
-
* @remarks
|
|
75
|
-
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
76
|
-
*
|
|
77
|
-
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
78
|
-
*/
|
|
79
|
-
sliceZoneDefaultComponent?: SliceComponentType;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Common options supported by `@prismicio/vue` plugin.
|
|
83
|
-
*/
|
|
84
|
-
type PrismicPluginOptionsBase = {
|
|
85
|
-
/**
|
|
86
|
-
* An optional link resolver function used to resolve links to Prismic
|
|
87
|
-
* documents when not using the route resolver parameter with
|
|
88
|
-
* `@prismicio/client`.
|
|
89
|
-
*
|
|
90
|
-
* @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
|
|
91
|
-
*/
|
|
92
|
-
linkResolver?: LinkResolverFunction;
|
|
93
|
-
/**
|
|
94
|
-
* An optional HTML serializer to customize the way rich text fields are
|
|
95
|
-
* rendered.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* To provide global components for the `<PrismicRichText />` component, use
|
|
99
|
-
* the `components.richTextComponents` option instead.
|
|
100
|
-
*
|
|
101
|
-
* @deprecated Use `components.richTextComponents` instead.
|
|
102
|
-
*
|
|
103
|
-
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
104
|
-
*/
|
|
105
|
-
richTextSerializer?: HTMLRichTextFunctionSerializer | HTMLRichTextMapSerializer;
|
|
106
|
-
/**
|
|
107
|
-
* Whether or not to inject components globally.
|
|
108
|
-
*
|
|
109
|
-
* @defaultValue `true`
|
|
110
|
-
*/
|
|
111
|
-
injectComponents?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Options used by Prismic Vue components.
|
|
114
|
-
*
|
|
115
|
-
* @see Components options {@link PrismicPluginComponentsOptions}
|
|
116
|
-
*/
|
|
117
|
-
components?: PrismicPluginComponentsOptions;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Options to init `@prismicio/vue` plugin with a client instance.
|
|
121
|
-
*
|
|
122
|
-
* @see {@link PrismicPluginOptionsBase} for shared options
|
|
123
|
-
*/
|
|
124
|
-
type PrismicPluginOptionsWithClient = PrismicPluginOptionsBase & {
|
|
125
|
-
/**
|
|
126
|
-
* A `@prismicio/client` instance used to fetch content from a Prismic
|
|
127
|
-
* repository to configure the plugin with.
|
|
128
|
-
*
|
|
129
|
-
* @remarks
|
|
130
|
-
* The client will be used by `@prismicio/vue` composables, such as
|
|
131
|
-
* {@link usePrismicDocuments} and exposed through `this.$prismic.client` and
|
|
132
|
-
* `usePrismic().client`.
|
|
133
|
-
*
|
|
134
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
135
|
-
*/
|
|
136
|
-
client: ReturnType<CreateClient>;
|
|
137
|
-
/**
|
|
138
|
-
* Ensures type union is a strict or.
|
|
139
|
-
*
|
|
140
|
-
* @internal
|
|
141
|
-
*/
|
|
142
|
-
endpoint?: never;
|
|
143
|
-
/**
|
|
144
|
-
* Ensures type union is a strict or.
|
|
145
|
-
*
|
|
146
|
-
* @internal
|
|
147
|
-
*/
|
|
148
|
-
clientConfig?: never;
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* Options to init `@prismicio/vue` plugin with a repository ID or API endpoint.
|
|
152
|
-
*
|
|
153
|
-
* @see {@link PrismicPluginOptionsBase} for shared options
|
|
154
|
-
*/
|
|
155
|
-
type PrismicPluginOptionsWithEndpoint = PrismicPluginOptionsBase & {
|
|
156
|
-
/**
|
|
157
|
-
* A Prismic repository endpoint to init the plugin's `@prismicio/client`
|
|
158
|
-
* instance used to fetch content from a Prismic repository with.
|
|
159
|
-
*
|
|
160
|
-
* @remarks
|
|
161
|
-
* Said client will be used by `@prismicio/vue` composables, such as
|
|
162
|
-
* {@link usePrismicDocuments} and exposed through `this.$prismic.client` and
|
|
163
|
-
* `usePrismic().client`.
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
*
|
|
167
|
-
* ```javascript
|
|
168
|
-
* // A repository ID
|
|
169
|
-
* "my-repo"
|
|
170
|
-
*
|
|
171
|
-
* //A full repository endpoint
|
|
172
|
-
* "https://my-repo.cdn.prismic.io/api/v2"
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
176
|
-
*/
|
|
177
|
-
endpoint: string;
|
|
178
|
-
/**
|
|
179
|
-
* An optional object to configure `@prismicio/client` instance further.
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
*
|
|
183
|
-
* ```javascript
|
|
184
|
-
* // Accessing a private private repository
|
|
185
|
-
* {
|
|
186
|
-
* "accessToken": "abc"
|
|
187
|
-
* }
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
*
|
|
192
|
-
* ```javascript
|
|
193
|
-
* // Using a route resolver
|
|
194
|
-
* {
|
|
195
|
-
* "defaultParams": {
|
|
196
|
-
* "routes": [
|
|
197
|
-
* {
|
|
198
|
-
* "type": "page",
|
|
199
|
-
* "path": "/:uid"
|
|
200
|
-
* },
|
|
201
|
-
* {
|
|
202
|
-
* "type": "post",
|
|
203
|
-
* "path": "/blog/:uid"
|
|
204
|
-
* }
|
|
205
|
-
* ]
|
|
206
|
-
* }
|
|
207
|
-
* }
|
|
208
|
-
* ```
|
|
209
|
-
*
|
|
210
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
211
|
-
* @see Route resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
|
|
212
|
-
*/
|
|
213
|
-
clientConfig?: ClientConfig;
|
|
214
|
-
/**
|
|
215
|
-
* Ensures type union is a strict or.
|
|
216
|
-
*
|
|
217
|
-
* @internal
|
|
218
|
-
*/
|
|
219
|
-
client?: never;
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* `@prismicio/vue` plugin options.
|
|
223
|
-
*
|
|
224
|
-
* @see Prismic Official Vue.js documentation: {@link https://prismic.io/docs/technologies/vuejs}
|
|
225
|
-
* @see Plugin repository: {@link https://github.com/prismicio/prismic-vue}
|
|
226
|
-
*/
|
|
227
|
-
type PrismicPluginOptions = PrismicPluginOptionsWithClient | PrismicPluginOptionsWithEndpoint;
|
|
228
|
-
/**
|
|
229
|
-
* `@prismicio/client` related methods and properties exposed by
|
|
230
|
-
* `@prismicio/vue` plugin and accessible through `this.$prismic` and
|
|
231
|
-
* `usePrismic()`.
|
|
232
|
-
*/
|
|
233
|
-
type PrismicPluginClient = {
|
|
234
|
-
/**
|
|
235
|
-
* A `@prismicio/client` instance.
|
|
236
|
-
*/
|
|
237
|
-
client: ReturnType<CreateClient>;
|
|
238
|
-
/**
|
|
239
|
-
* Query filters from `@prismicio/client`.
|
|
240
|
-
*/
|
|
241
|
-
filter: typeof filter;
|
|
242
|
-
/**
|
|
243
|
-
* Prismic cookies from `@prismicio/client`.
|
|
244
|
-
*/
|
|
245
|
-
cookie: typeof cookie;
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* `@prismicio/client` related methods exposed by `@prismicio/vue` plugin and
|
|
249
|
-
* accessible through `this.$prismic` and `usePrismic()`.
|
|
250
|
-
*/
|
|
251
|
-
type PrismicPluginHelpers = {
|
|
252
|
-
/**
|
|
253
|
-
* Serializes a rich text or title field to a plain text string. This is
|
|
254
|
-
* `@prismicio/client` {@link asText} function.
|
|
255
|
-
*
|
|
256
|
-
* @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}
|
|
257
|
-
*/
|
|
258
|
-
asText: typeof asText;
|
|
259
|
-
/**
|
|
260
|
-
* Serializes a rich text or title field to an HTML string. This is
|
|
261
|
-
* `@prismicio/client` {@link asHTML} function.
|
|
262
|
-
*
|
|
263
|
-
* @remarks
|
|
264
|
-
* If no `linkResolver` is provided the function will use the one provided to
|
|
265
|
-
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
266
|
-
* @remarks
|
|
267
|
-
* If no `htmlSerializer` is provided the function will use the one provided
|
|
268
|
-
* to the plugin at {@link PrismicPluginOptions.htmlSerializer} if available.
|
|
269
|
-
*
|
|
270
|
-
* @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}
|
|
271
|
-
*/
|
|
272
|
-
asHTML: typeof asHTML;
|
|
273
|
-
/**
|
|
274
|
-
* Resolves any type of link field or document to a URL. This is
|
|
275
|
-
* `@prismicio/client` {@link asLink} function.
|
|
276
|
-
*
|
|
277
|
-
* @remarks
|
|
278
|
-
* If no `linkResolver` is provided the function will use the one provided to
|
|
279
|
-
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
280
|
-
*
|
|
281
|
-
* @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}
|
|
282
|
-
*/
|
|
283
|
-
asLink: typeof asLink;
|
|
284
|
-
/**
|
|
285
|
-
* Resolves any type of link field or document to a set of link attributes.
|
|
286
|
-
* This is `@prismicio/client` {@link asLinkAttrs} function.
|
|
287
|
-
*
|
|
288
|
-
* @remarks
|
|
289
|
-
* If no `linkResolver` is provided the function will use the one provided to
|
|
290
|
-
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
291
|
-
*
|
|
292
|
-
* @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}
|
|
293
|
-
*/
|
|
294
|
-
asLinkAttrs: typeof asLinkAttrs;
|
|
295
|
-
/**
|
|
296
|
-
* Transforms a date or timestamp field into a JavaScript Date object. This is
|
|
297
|
-
* `@prismicio/client` {@link asDate} function.
|
|
298
|
-
*/
|
|
299
|
-
asDate: typeof asDate;
|
|
300
|
-
/**
|
|
301
|
-
* Returns the URL of an image field with optional image transformations (via
|
|
302
|
-
* Imgix URL parameters). This is `@prismicio/client` {@link asImageSrc}
|
|
303
|
-
* function.
|
|
304
|
-
*/
|
|
305
|
-
asImageSrc: typeof asImageSrc;
|
|
306
|
-
/**
|
|
307
|
-
* Creates a width-based `srcset` from an image field with optional image
|
|
308
|
-
* transformations (via Imgix URL parameters). This is `@prismicio/client`
|
|
309
|
-
* {@link asImageWidthSrcSet} function.
|
|
310
|
-
*/
|
|
311
|
-
asImageWidthSrcSet: typeof asImageWidthSrcSet;
|
|
312
|
-
/**
|
|
313
|
-
* Creates a pixel-density-based `srcset` from an image field with optional
|
|
314
|
-
* image transformations (via Imgix URL parameters). This is
|
|
315
|
-
* `@prismicio/client` {@link asImagePixelDensitySrcSet} function.
|
|
316
|
-
*/
|
|
317
|
-
asImagePixelDensitySrcSet: typeof asImagePixelDensitySrcSet;
|
|
318
|
-
/**
|
|
319
|
-
* Helpers to determine if a field is filled. This is `@prismicio/client`
|
|
320
|
-
* {@link isFilled} object.
|
|
321
|
-
*/
|
|
322
|
-
isFilled: typeof isFilled;
|
|
323
|
-
/**
|
|
324
|
-
* Converts a document into a link field. This is `@prismicio/client`
|
|
325
|
-
* {@link documentToLinkField} function.
|
|
326
|
-
*
|
|
327
|
-
* @internal
|
|
328
|
-
*/
|
|
329
|
-
documentToLinkField: typeof documentToLinkField;
|
|
330
|
-
};
|
|
331
|
-
/**
|
|
332
|
-
* Methods and properties exposed by `@prismicio/vue` plugin and accessible
|
|
333
|
-
* through `this.$prismic` and `usePrismic()`.
|
|
334
|
-
*/
|
|
335
|
-
type PrismicPlugin = {
|
|
336
|
-
/**
|
|
337
|
-
* Options uses to initialize the plugin.
|
|
338
|
-
*
|
|
339
|
-
* @see `@prismicio/vue` plugin options {@link PrismicPluginOptions}
|
|
340
|
-
*/
|
|
341
|
-
readonly options: PrismicPluginOptions;
|
|
342
|
-
/**
|
|
343
|
-
* `@prismicio/vue` plugin install function used by Vue.
|
|
344
|
-
*
|
|
345
|
-
* @internal
|
|
346
|
-
*/
|
|
347
|
-
install: (app: App) => void;
|
|
348
|
-
} & PrismicPluginClient & PrismicPluginHelpers;
|
|
349
|
-
/**
|
|
350
|
-
* A component or a tag name to be used as props.
|
|
351
|
-
*
|
|
352
|
-
* @internal
|
|
353
|
-
*/
|
|
354
4
|
type ComponentOrTagName = string | ConcreteComponent | Raw<DefineComponent>;
|
|
5
|
+
type VueComponent<TProps> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<TProps> | FunctionalComponent<TProps>;
|
|
355
6
|
//#endregion
|
|
356
|
-
export { ComponentOrTagName,
|
|
7
|
+
export { ComponentOrTagName, VueComponent };
|
|
357
8
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/vue",
|
|
3
|
-
"version": "5.3.0-canary.
|
|
3
|
+
"version": "5.3.0-canary.87748cc",
|
|
4
4
|
"description": "Vue plugin, components, and composables to fetch and present Prismic content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -44,11 +44,10 @@
|
|
|
44
44
|
"test": "npm run lint && npm run types && npm run unit && npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"
|
|
48
|
-
"esm-env": "^1.2.2",
|
|
49
|
-
"vue-router": "^4.6.3"
|
|
47
|
+
"esm-env": "^1.2.2"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
50
|
+
"@prismicio/client": "^7.21.0",
|
|
52
51
|
"@prismicio/mock": "^0.7.1",
|
|
53
52
|
"@trivago/prettier-plugin-sort-imports": "^6.0.0",
|
|
54
53
|
"@types/jsdom-global": "^3.0.7",
|
|
@@ -65,10 +64,12 @@
|
|
|
65
64
|
"vite": "^7.2.7",
|
|
66
65
|
"vitest": "^4.0.15",
|
|
67
66
|
"vue": "^3.5.25",
|
|
67
|
+
"vue-router": "^4.6.3",
|
|
68
68
|
"vue-tsc": "^3.1.8"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"
|
|
71
|
+
"@prismicio/client": "^7",
|
|
72
|
+
"vue": "^3"
|
|
72
73
|
},
|
|
73
74
|
"engines": {
|
|
74
75
|
"node": ">=20"
|
package/src/PrismicImage.vue
CHANGED
|
@@ -10,15 +10,11 @@ import { computed, watchEffect } from "vue"
|
|
|
10
10
|
|
|
11
11
|
import { devMsg } from "./lib/devMsg"
|
|
12
12
|
|
|
13
|
-
import { usePrismic } from "./usePrismic"
|
|
14
|
-
|
|
15
13
|
/**
|
|
16
14
|
* Props for `<PrismicImage />`.
|
|
17
15
|
*/
|
|
18
16
|
export type PrismicImageProps = {
|
|
19
|
-
/**
|
|
20
|
-
* The Prismic image field or thumbnail to render.
|
|
21
|
-
*/
|
|
17
|
+
/** The Prismic image field or thumbnail to render. */
|
|
22
18
|
field: ImageField | ImageField<string>
|
|
23
19
|
|
|
24
20
|
/**
|
|
@@ -63,29 +59,23 @@ export type PrismicImageProps = {
|
|
|
63
59
|
} & (
|
|
64
60
|
| {
|
|
65
61
|
/**
|
|
66
|
-
* Widths used to build a `srcset` value for the image
|
|
62
|
+
* Widths (in pixels) used to build a `srcset` value for the image
|
|
63
|
+
* field.
|
|
67
64
|
*
|
|
68
|
-
* If
|
|
69
|
-
*
|
|
70
|
-
* 3840.
|
|
65
|
+
* If omitted or set to `"defaults"`, the following widths will be used:
|
|
66
|
+
* 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
|
|
71
67
|
*
|
|
72
|
-
* If the image field contains responsive views, each responsive view
|
|
73
|
-
* be used as a width in the resulting `srcset` by passing
|
|
74
|
-
* as the `widths` prop.
|
|
68
|
+
* If the image field contains responsive views, each responsive view
|
|
69
|
+
* can be used as a width in the resulting `srcset` by passing
|
|
70
|
+
* `"thumbnails"` as the `widths` prop.
|
|
75
71
|
*/
|
|
76
72
|
widths?:
|
|
77
73
|
| NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"]
|
|
78
74
|
| "thumbnails"
|
|
79
75
|
| "defaults"
|
|
80
|
-
/**
|
|
81
|
-
* Not used when the `widths` prop is used.
|
|
82
|
-
*/
|
|
83
76
|
pixelDensities?: never
|
|
84
77
|
}
|
|
85
78
|
| {
|
|
86
|
-
/**
|
|
87
|
-
* Not used when the `widths` prop is used.
|
|
88
|
-
*/
|
|
89
79
|
widths?: never
|
|
90
80
|
/**
|
|
91
81
|
* Pixel densities used to build a `srcset` value for the image field.
|
|
@@ -104,8 +94,6 @@ export type PrismicImageProps = {
|
|
|
104
94
|
const props = defineProps<PrismicImageProps>()
|
|
105
95
|
defineOptions({ name: "PrismicImage" })
|
|
106
96
|
|
|
107
|
-
const { options } = usePrismic()
|
|
108
|
-
|
|
109
97
|
if (DEV) {
|
|
110
98
|
watchEffect(() => {
|
|
111
99
|
if (typeof props.alt === "string" && props.alt !== "") {
|
|
@@ -156,10 +144,7 @@ const image = computed(() => {
|
|
|
156
144
|
if (props.widths || !props.pixelDensities) {
|
|
157
145
|
const res = asImageWidthSrcSet(props.field, {
|
|
158
146
|
...props.imgixParams,
|
|
159
|
-
widths:
|
|
160
|
-
props.widths === "defaults"
|
|
161
|
-
? options.components?.imageWidthSrcSetDefaults
|
|
162
|
-
: props.widths,
|
|
147
|
+
widths: props.widths === "defaults" ? undefined : props.widths,
|
|
163
148
|
})
|
|
164
149
|
|
|
165
150
|
src = res.src
|
|
@@ -168,9 +153,7 @@ const image = computed(() => {
|
|
|
168
153
|
const res = asImagePixelDensitySrcSet(props.field, {
|
|
169
154
|
...props.imgixParams,
|
|
170
155
|
pixelDensities:
|
|
171
|
-
props.pixelDensities === "defaults"
|
|
172
|
-
? options.components?.imagePixelDensitySrcSetDefaults
|
|
173
|
-
: props.pixelDensities,
|
|
156
|
+
props.pixelDensities === "defaults" ? undefined : props.pixelDensities,
|
|
174
157
|
})
|
|
175
158
|
|
|
176
159
|
src = res.src
|
package/src/PrismicLink.vue
CHANGED
|
@@ -12,8 +12,6 @@ import { isInternalURL } from "./lib/isInternalURL"
|
|
|
12
12
|
|
|
13
13
|
import type { ComponentOrTagName } from "./types"
|
|
14
14
|
|
|
15
|
-
import { usePrismic } from "./usePrismic"
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* The default component rendered for internal URLs.
|
|
19
17
|
*/
|
|
@@ -34,12 +32,13 @@ const defaultExternalRelAttribute = "noreferrer"
|
|
|
34
32
|
*/
|
|
35
33
|
export type PrismicLinkProps = {
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
38
|
-
* resolver parameter with `@prismicio/client`.
|
|
35
|
+
* The link resolver used to resolve links.
|
|
39
36
|
*
|
|
40
|
-
* @
|
|
37
|
+
* @remarks
|
|
38
|
+
* If your app uses route resolvers when querying for your Prismic
|
|
39
|
+
* repository's content, a link resolver does not need to be provided.
|
|
41
40
|
*
|
|
42
|
-
* @see
|
|
41
|
+
* @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}
|
|
43
42
|
*/
|
|
44
43
|
linkResolver?: LinkResolverFunction
|
|
45
44
|
|
|
@@ -47,50 +46,33 @@ export type PrismicLinkProps = {
|
|
|
47
46
|
* The `rel` attribute for the link. By default, `"noreferrer"` is provided if
|
|
48
47
|
* the link's URL is external. This prop can be provided a function to use the
|
|
49
48
|
* link's metadata to determine the `rel` value.
|
|
50
|
-
*
|
|
51
|
-
* @defaultValue The one provided to `@prismicio/vue` plugin if configured.
|
|
52
49
|
*/
|
|
53
50
|
rel?: string | AsLinkAttrsConfig["rel"]
|
|
54
51
|
|
|
55
52
|
/**
|
|
56
|
-
*
|
|
53
|
+
* The component rendered for internal URLs.
|
|
57
54
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* `target`, and `rel` attributes).
|
|
61
|
-
* @remarks
|
|
62
|
-
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
63
|
-
* (`to` props).
|
|
55
|
+
* If your app uses a client-side router that requires a special Link
|
|
56
|
+
* component, provide the Link component to this prop.
|
|
64
57
|
*
|
|
65
|
-
* @defaultValue
|
|
58
|
+
* @defaultValue `<RouterLink>`
|
|
66
59
|
*/
|
|
67
60
|
internalComponent?: ComponentOrTagName
|
|
68
61
|
|
|
69
62
|
/**
|
|
70
|
-
*
|
|
63
|
+
* The component rendered for external URLs.
|
|
71
64
|
*
|
|
72
|
-
* @
|
|
73
|
-
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
74
|
-
* `target`, and `rel` attributes).
|
|
75
|
-
* @remarks
|
|
76
|
-
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
77
|
-
* (`to` props).
|
|
78
|
-
*
|
|
79
|
-
* @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"a"` otherwise.
|
|
65
|
+
* @defaultValue `<a>`
|
|
80
66
|
*/
|
|
81
67
|
externalComponent?: ComponentOrTagName
|
|
82
68
|
} & (
|
|
83
69
|
| {
|
|
84
|
-
/**
|
|
85
|
-
* The Prismic link field to render.
|
|
86
|
-
*/
|
|
70
|
+
/** The Prismic link field to render. */
|
|
87
71
|
field: LinkField
|
|
88
72
|
document?: never
|
|
89
73
|
}
|
|
90
74
|
| {
|
|
91
|
-
/**
|
|
92
|
-
* The Prismic document to render as a link.
|
|
93
|
-
*/
|
|
75
|
+
/** The Prismic document to render as a link. */
|
|
94
76
|
document: PrismicDocument
|
|
95
77
|
field?: never
|
|
96
78
|
}
|
|
@@ -99,15 +81,12 @@ export type PrismicLinkProps = {
|
|
|
99
81
|
const props = defineProps<PrismicLinkProps>()
|
|
100
82
|
defineOptions({ name: "PrismicLink" })
|
|
101
83
|
|
|
102
|
-
const { options } = usePrismic()
|
|
103
|
-
|
|
104
84
|
const rawAttrs = computed(() => {
|
|
105
85
|
return asLinkAttrs(props.field || props.document, {
|
|
106
|
-
linkResolver: props.linkResolver
|
|
86
|
+
linkResolver: props.linkResolver,
|
|
107
87
|
rel(args) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return typeof maybeRel === "function" ? maybeRel(args) : maybeRel
|
|
88
|
+
if (props.rel) {
|
|
89
|
+
return typeof props.rel === "function" ? props.rel(args) : props.rel
|
|
111
90
|
}
|
|
112
91
|
|
|
113
92
|
return args.isExternal ? defaultExternalRelAttribute : undefined
|
|
@@ -117,12 +96,8 @@ const rawAttrs = computed(() => {
|
|
|
117
96
|
|
|
118
97
|
const component = computed(() => {
|
|
119
98
|
return isInternalURL(rawAttrs.value.href || "")
|
|
120
|
-
? props.internalComponent ||
|
|
121
|
-
|
|
122
|
-
defaultInternalComponent
|
|
123
|
-
: props.externalComponent ||
|
|
124
|
-
options.components?.linkExternalComponent ||
|
|
125
|
-
defaultExternalComponent
|
|
99
|
+
? props.internalComponent || defaultInternalComponent
|
|
100
|
+
: props.externalComponent || defaultExternalComponent
|
|
126
101
|
})
|
|
127
102
|
|
|
128
103
|
// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.
|