@prismicio/next 2.2.2 → 2.2.3-pr.136.19d76d2
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/PrismicNextImage.cjs +16 -20
- package/dist/PrismicNextImage.cjs.map +1 -1
- package/dist/PrismicNextImage.d.cts +14 -23
- package/dist/PrismicNextImage.d.cts.map +1 -0
- package/dist/PrismicNextImage.d.ts +14 -23
- package/dist/PrismicNextImage.d.ts.map +1 -0
- package/dist/PrismicNextImage.js +11 -15
- package/dist/PrismicNextImage.js.map +1 -1
- package/dist/PrismicNextLink.cjs +7 -8
- package/dist/PrismicNextLink.cjs.map +1 -1
- package/dist/PrismicNextLink.d.cts +10 -10
- package/dist/PrismicNextLink.d.cts.map +1 -0
- package/dist/PrismicNextLink.d.ts +10 -10
- package/dist/PrismicNextLink.d.ts.map +1 -0
- package/dist/PrismicNextLink.js +3 -4
- package/dist/PrismicNextLink.js.map +1 -1
- package/dist/PrismicPreview.cjs +13 -15
- package/dist/PrismicPreview.cjs.map +1 -1
- package/dist/PrismicPreview.d.cts +12 -14
- package/dist/PrismicPreview.d.cts.map +1 -0
- package/dist/PrismicPreview.d.ts +12 -14
- package/dist/PrismicPreview.d.ts.map +1 -0
- package/dist/PrismicPreview.js +8 -10
- package/dist/PrismicPreview.js.map +1 -1
- package/dist/PrismicPreviewClient.cjs +5 -9
- package/dist/PrismicPreviewClient.cjs.map +1 -1
- package/dist/PrismicPreviewClient.js +6 -10
- package/dist/PrismicPreviewClient.js.map +1 -1
- package/dist/SliceSimulator.cjs +6 -8
- package/dist/SliceSimulator.cjs.map +1 -1
- package/dist/SliceSimulator.d.cts +3 -6
- package/dist/SliceSimulator.d.cts.map +1 -0
- package/dist/SliceSimulator.d.ts +3 -6
- package/dist/SliceSimulator.d.ts.map +1 -0
- package/dist/SliceSimulator.js +4 -6
- package/dist/SliceSimulator.js.map +1 -1
- package/dist/SliceSimulatorWrapper.cjs +3 -7
- package/dist/SliceSimulatorWrapper.cjs.map +1 -1
- package/dist/SliceSimulatorWrapper.js +2 -6
- package/dist/SliceSimulatorWrapper.js.map +1 -1
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +8 -14
- package/dist/createLocaleRedirect.cjs +2 -3
- package/dist/createLocaleRedirect.cjs.map +1 -1
- package/dist/createLocaleRedirect.d.cts.map +1 -0
- package/dist/createLocaleRedirect.d.ts.map +1 -0
- package/dist/createLocaleRedirect.js +1 -2
- package/dist/createLocaleRedirect.js.map +1 -1
- package/dist/enableAutoPreviews.cjs +4 -6
- package/dist/enableAutoPreviews.cjs.map +1 -1
- package/dist/enableAutoPreviews.d.cts +2 -4
- package/dist/enableAutoPreviews.d.cts.map +1 -0
- package/dist/enableAutoPreviews.d.ts +2 -4
- package/dist/enableAutoPreviews.d.ts.map +1 -0
- package/dist/enableAutoPreviews.js +3 -5
- package/dist/enableAutoPreviews.js.map +1 -1
- package/dist/exitPreview.cjs +11 -13
- package/dist/exitPreview.cjs.map +1 -1
- package/dist/exitPreview.d.cts +9 -10
- package/dist/exitPreview.d.cts.map +1 -0
- package/dist/exitPreview.d.ts +9 -10
- package/dist/exitPreview.d.ts.map +1 -0
- package/dist/exitPreview.js +11 -12
- package/dist/exitPreview.js.map +1 -1
- package/dist/getSlices.cjs +2 -3
- package/dist/getSlices.cjs.map +1 -1
- package/dist/getSlices.d.cts.map +1 -0
- package/dist/getSlices.d.ts.map +1 -0
- package/dist/getSlices.js +1 -2
- package/dist/getSlices.js.map +1 -1
- package/dist/imgixLoader.cjs +4 -5
- package/dist/imgixLoader.cjs.map +1 -1
- package/dist/imgixLoader.d.cts +3 -4
- package/dist/imgixLoader.d.cts.map +1 -0
- package/dist/imgixLoader.d.ts +3 -4
- package/dist/imgixLoader.d.ts.map +1 -0
- package/dist/imgixLoader.js +3 -4
- package/dist/imgixLoader.js.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.js +1 -2
- package/dist/lib/devMsg.cjs +8 -11
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +7 -10
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/resolveDefaultExport.cjs +9 -14
- package/dist/lib/resolveDefaultExport.cjs.map +1 -1
- package/dist/lib/resolveDefaultExport.js +9 -13
- package/dist/lib/resolveDefaultExport.js.map +1 -1
- package/dist/package.cjs +7 -8
- package/dist/package.js +2 -2
- package/dist/pages/PrismicPreview.cjs +12 -14
- package/dist/pages/PrismicPreview.cjs.map +1 -1
- package/dist/pages/PrismicPreview.d.cts +12 -14
- package/dist/pages/PrismicPreview.d.cts.map +1 -0
- package/dist/pages/PrismicPreview.d.ts +12 -14
- package/dist/pages/PrismicPreview.d.ts.map +1 -0
- package/dist/pages/PrismicPreview.js +8 -10
- package/dist/pages/PrismicPreview.js.map +1 -1
- package/dist/pages/SliceSimulator.cjs +5 -6
- package/dist/pages/SliceSimulator.cjs.map +1 -1
- package/dist/pages/SliceSimulator.d.cts +10 -13
- package/dist/pages/SliceSimulator.d.cts.map +1 -0
- package/dist/pages/SliceSimulator.d.ts +10 -13
- package/dist/pages/SliceSimulator.d.ts.map +1 -0
- package/dist/pages/SliceSimulator.js +3 -4
- package/dist/pages/SliceSimulator.js.map +1 -1
- package/dist/pages/enableAutoPreviews.cjs +4 -5
- package/dist/pages/enableAutoPreviews.cjs.map +1 -1
- package/dist/pages/enableAutoPreviews.d.cts +6 -8
- package/dist/pages/enableAutoPreviews.d.cts.map +1 -0
- package/dist/pages/enableAutoPreviews.d.ts +6 -8
- package/dist/pages/enableAutoPreviews.d.ts.map +1 -0
- package/dist/pages/enableAutoPreviews.js +4 -4
- package/dist/pages/enableAutoPreviews.js.map +1 -1
- package/dist/pages/exitPreview.cjs +10 -12
- package/dist/pages/exitPreview.cjs.map +1 -1
- package/dist/pages/exitPreview.d.cts +9 -10
- package/dist/pages/exitPreview.d.cts.map +1 -0
- package/dist/pages/exitPreview.d.ts +9 -10
- package/dist/pages/exitPreview.d.ts.map +1 -0
- package/dist/pages/exitPreview.js +10 -11
- package/dist/pages/exitPreview.js.map +1 -1
- package/dist/pages/redirectToPreviewURL.cjs +1 -2
- package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
- package/dist/pages/redirectToPreviewURL.d.cts +8 -11
- package/dist/pages/redirectToPreviewURL.d.cts.map +1 -0
- package/dist/pages/redirectToPreviewURL.d.ts +8 -11
- package/dist/pages/redirectToPreviewURL.d.ts.map +1 -0
- package/dist/pages/redirectToPreviewURL.js +1 -1
- package/dist/pages/redirectToPreviewURL.js.map +1 -1
- package/dist/pages/setPreviewData.cjs +2 -3
- package/dist/pages/setPreviewData.cjs.map +1 -1
- package/dist/pages/setPreviewData.d.cts.map +1 -0
- package/dist/pages/setPreviewData.d.ts.map +1 -0
- package/dist/pages/setPreviewData.js +1 -2
- package/dist/pages/setPreviewData.js.map +1 -1
- package/dist/pages/types.d.cts +3 -9
- package/dist/pages/types.d.cts.map +1 -0
- package/dist/pages/types.d.ts +3 -9
- package/dist/pages/types.d.ts.map +1 -0
- package/dist/pages.cjs +12 -12
- package/dist/pages.js +1 -2
- package/dist/redirectToPreviewURL.cjs +3 -4
- package/dist/redirectToPreviewURL.cjs.map +1 -1
- package/dist/redirectToPreviewURL.d.cts +4 -7
- package/dist/redirectToPreviewURL.d.cts.map +1 -0
- package/dist/redirectToPreviewURL.d.ts +4 -7
- package/dist/redirectToPreviewURL.d.ts.map +1 -0
- package/dist/redirectToPreviewURL.js +2 -3
- package/dist/redirectToPreviewURL.js.map +1 -1
- package/dist/types.d.cts +1 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -0
- package/package.json +34 -36
- package/src/PrismicNextImage.tsx +113 -134
- package/src/PrismicNextLink.tsx +43 -45
- package/src/PrismicPreview.tsx +28 -29
- package/src/PrismicPreviewClient.tsx +42 -44
- package/src/SliceSimulator.tsx +38 -43
- package/src/SliceSimulatorWrapper.tsx +15 -25
- package/src/createLocaleRedirect.ts +3 -3
- package/src/enableAutoPreviews.ts +15 -16
- package/src/exitPreview.ts +12 -13
- package/src/getSlices.ts +6 -10
- package/src/imgixLoader.ts +10 -10
- package/src/index.ts +18 -21
- package/src/lib/devMsg.ts +9 -11
- package/src/lib/resolveDefaultExport.ts +9 -13
- package/src/pages/PrismicPreview.tsx +47 -51
- package/src/pages/SliceSimulator.tsx +35 -37
- package/src/pages/enableAutoPreviews.ts +17 -17
- package/src/pages/exitPreview.ts +17 -18
- package/src/pages/index.ts +20 -23
- package/src/pages/redirectToPreviewURL.ts +22 -33
- package/src/pages/setPreviewData.ts +7 -7
- package/src/pages/types.ts +16 -20
- package/src/redirectToPreviewURL.ts +21 -30
- package/src/types.ts +12 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulatorWrapper.js","names":[],"sources":["../src/SliceSimulatorWrapper.tsx"],"sourcesContent":["import {\n\tdisableEventHandler,\n\tgetDefaultProps,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/simulator/kit\"
|
|
1
|
+
{"version":3,"file":"SliceSimulatorWrapper.js","names":[],"sources":["../src/SliceSimulatorWrapper.tsx"],"sourcesContent":["import {\n\tdisableEventHandler,\n\tgetDefaultProps,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/simulator/kit\"\nimport type { SliceSimulatorProps } from \"@prismicio/simulator/kit\"\nimport type { FC, ReactNode } from \"react\"\n\ntype SliceSimulatorWrapperProps = SliceSimulatorProps & {\n\tchildren: ReactNode\n\tclassName?: string\n\tmessage?: string\n\thasSlices: boolean\n}\n\n/** A wrapper for the slice simulator that isolates the given children from the page's layout. */\nexport const SliceSimulatorWrapper: FC<SliceSimulatorWrapperProps> = ({\n\tclassName,\n\tchildren,\n\tzIndex,\n\tbackground,\n\tmessage,\n\thasSlices,\n}) => {\n\tconst defaultProps = getDefaultProps()\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[simulatorClass, className].filter(Boolean).join(\" \")}\n\t\t\tstyle={{\n\t\t\t\tzIndex: typeof zIndex === \"undefined\" ? defaultProps.zIndex : (zIndex ?? undefined),\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100vh\",\n\t\t\t\toverflow: \"auto\",\n\t\t\t\tbackground:\n\t\t\t\t\ttypeof background === \"undefined\" ? defaultProps.background : (background ?? undefined),\n\t\t\t}}\n\t\t>\n\t\t\t{message ? (\n\t\t\t\t<article dangerouslySetInnerHTML={{ __html: message }} />\n\t\t\t) : hasSlices ? (\n\t\t\t\t<div\n\t\t\t\t\tid=\"root\"\n\t\t\t\t\tclassName={simulatorRootClass}\n\t\t\t\t\tonClickCapture={onClickHandler as unknown as React.MouseEventHandler}\n\t\t\t\t\tonSubmitCapture={disableEventHandler as unknown as React.FormEventHandler}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;AAkBA,MAAa,yBAAyD,EACrE,WACA,UACA,QACA,YACA,SACA,gBACK;CACL,MAAM,eAAe,iBAAiB;AAEtC,QACC,oBAAC,OAAD;EACC,WAAW,CAAC,gBAAgB,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;EAChE,OAAO;GACN,QAAQ,OAAO,WAAW,cAAc,aAAa,SAAU,UAAU,KAAA;GACzE,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,UAAU;GACV,YACC,OAAO,eAAe,cAAc,aAAa,aAAc,cAAc,KAAA;GAC9E;YAEA,UACA,oBAAC,WAAD,EAAS,yBAAyB,EAAE,QAAQ,SAAS,EAAI,CAAA,GACtD,YACH,oBAAC,OAAD;GACC,IAAG;GACH,WAAW;GACX,gBAAgB;GAChB,iBAAiB;GAEhB;GACI,CAAA,GACH;EACC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,16 +6,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
19
15
|
}
|
|
20
16
|
return to;
|
|
21
17
|
};
|
|
@@ -23,7 +19,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
19
|
value: mod,
|
|
24
20
|
enumerable: true
|
|
25
21
|
}) : target, mod));
|
|
26
|
-
|
|
27
22
|
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_devMsg = require(
|
|
2
|
-
|
|
1
|
+
const require_devMsg = require("./lib/devMsg.cjs");
|
|
3
2
|
//#region src/createLocaleRedirect.ts
|
|
4
3
|
/**
|
|
5
4
|
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
@@ -8,7 +7,7 @@ const require_devMsg = require('./lib/devMsg.cjs');
|
|
|
8
7
|
function createLocaleRedirect() {
|
|
9
8
|
throw new Error(`createLocaleRedirect() has been removed due to performance issues. See ${require_devMsg.devMsg("replace-createLocaleRedirect")} for more details.`);
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
11
|
exports.createLocaleRedirect = createLocaleRedirect;
|
|
12
|
+
|
|
14
13
|
//# sourceMappingURL=createLocaleRedirect.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLocaleRedirect.cjs","names":["devMsg"],"sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\"
|
|
1
|
+
{"version":3,"file":"createLocaleRedirect.cjs","names":["devMsg"],"sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\"\n\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport function createLocaleRedirect(): never {\n\tthrow new Error(\n\t\t`createLocaleRedirect() has been removed due to performance issues. See ${devMsg(\n\t\t\t\"replace-createLocaleRedirect\",\n\t\t)} for more details.`,\n\t)\n}\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport type CreateLocaleRedirectConfig = never\n"],"mappings":";;;;;;AAMA,SAAgB,uBAA8B;AAC7C,OAAM,IAAI,MACT,0EAA0EA,eAAAA,OACzE,+BACA,CAAC,oBACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocaleRedirect.d.cts","names":[],"sources":["../src/createLocaleRedirect.ts"],"mappings":";;AAMA;;;iBAAgB,oBAAA,CAAA;;AAWhB;;;KAAY,0BAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocaleRedirect.d.ts","names":[],"sources":["../src/createLocaleRedirect.ts"],"mappings":";;AAMA;;;iBAAgB,oBAAA,CAAA;;AAWhB;;;KAAY,0BAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { devMsg } from "./lib/devMsg.js";
|
|
2
|
-
|
|
3
2
|
//#region src/createLocaleRedirect.ts
|
|
4
3
|
/**
|
|
5
4
|
* @deprecated `createLocaleRedirect()` has been removed due to performance
|
|
@@ -8,7 +7,7 @@ import { devMsg } from "./lib/devMsg.js";
|
|
|
8
7
|
function createLocaleRedirect() {
|
|
9
8
|
throw new Error(`createLocaleRedirect() has been removed due to performance issues. See ${devMsg("replace-createLocaleRedirect")} for more details.`);
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
11
|
export { createLocaleRedirect };
|
|
12
|
+
|
|
14
13
|
//# sourceMappingURL=createLocaleRedirect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLocaleRedirect.js","names":[],"sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\"
|
|
1
|
+
{"version":3,"file":"createLocaleRedirect.js","names":[],"sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\"\n\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport function createLocaleRedirect(): never {\n\tthrow new Error(\n\t\t`createLocaleRedirect() has been removed due to performance issues. See ${devMsg(\n\t\t\t\"replace-createLocaleRedirect\",\n\t\t)} for more details.`,\n\t)\n}\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport type CreateLocaleRedirectConfig = never\n"],"mappings":";;;;;;AAMA,SAAgB,uBAA8B;AAC7C,OAAM,IAAI,MACT,0EAA0E,OACzE,+BACA,CAAC,oBACF"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let _prismicio_client = require("@prismicio/client");
|
|
3
|
-
|
|
4
3
|
//#region src/enableAutoPreviews.ts
|
|
5
4
|
/**
|
|
6
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
7
|
-
* preview session.
|
|
5
|
+
* Configures a Prismic client to automatically query draft content during a preview session.
|
|
8
6
|
*
|
|
9
7
|
* @param config - Configuration for the function.
|
|
10
8
|
*/
|
|
11
9
|
function enableAutoPreviews(config) {
|
|
12
10
|
config.client.queryContentFromRef(async () => {
|
|
13
|
-
const { cookies, draftMode } = await import("next/headers");
|
|
11
|
+
const { cookies, draftMode } = await import("next/headers.js");
|
|
14
12
|
let isDraftModeEnabled = false;
|
|
15
13
|
try {
|
|
16
14
|
isDraftModeEnabled = (await draftMode()).isEnabled;
|
|
@@ -24,7 +22,7 @@ function enableAutoPreviews(config) {
|
|
|
24
22
|
return cookie;
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
//#endregion
|
|
29
26
|
exports.enableAutoPreviews = enableAutoPreviews;
|
|
27
|
+
|
|
30
28
|
//# sourceMappingURL=enableAutoPreviews.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableAutoPreviews.cjs","names":["prismicCookie"],"sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\"
|
|
1
|
+
{"version":3,"file":"enableAutoPreviews.cjs","names":["prismicCookie"],"sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\"\n\n/** Configuration for `enableAutoPreviews`. */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">\n}\n\n/**\n * Configures a Prismic client to automatically query draft content during a preview session.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\t// We use a function value so the cookie is checked on every\n\t// request. We don't have a static value to read from.\n\tconfig.client.queryContentFromRef(async () => {\n\t\t// Need this to avoid the following Next.js build-time error:\n\t\t// You're importing a component that needs next/headers. That only works\n\t\t// in a Server Component which is not supported in the pages/ directory.\n\t\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t\tlet isDraftModeEnabled = false\n\t\ttry {\n\t\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t\t} catch {\n\t\t\t// `draftMode()` may have been called in a palce that\n\t\t\t// does not have access to its async storage. This\n\t\t\t// occurs in places like `generateStaticParams()`. We\n\t\t\t// can ignore this case.\n\t\t\treturn\n\t\t}\n\t\tif (!isDraftModeEnabled) {\n\t\t\treturn\n\t\t}\n\n\t\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\t\tif (!cookie) {\n\t\t\treturn\n\t\t}\n\n\t\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\")\n\t\tif (!isActiveCookie) {\n\t\t\treturn\n\t\t}\n\n\t\treturn cookie\n\t})\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,mBAAmB,QAAwC;AAG1E,QAAO,OAAO,oBAAoB,YAAY;EAI7C,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;EAE5C,IAAI,qBAAqB;AACzB,MAAI;AACH,yBAAsB,MAAM,WAAW,EAAE;UAClC;AAKP;;AAED,MAAI,CAAC,mBACJ;EAGD,MAAM,UAAU,MAAM,SAAS,EAAE,IAAIA,kBAAAA,OAAc,QAAQ,EAAE;AAC7D,MAAI,CAAC,OACJ;AAID,MAAI,CADmB,OAAO,SAAS,oBAAoB,CAE1D;AAGD,SAAO;GACN"}
|
|
@@ -3,12 +3,10 @@ import { Client } from "@prismicio/client";
|
|
|
3
3
|
//#region src/enableAutoPreviews.d.ts
|
|
4
4
|
/** Configuration for `enableAutoPreviews`. */
|
|
5
5
|
type EnableAutoPreviewsConfig = {
|
|
6
|
-
/** Prismic client with which automatic previews will be enabled. */
|
|
7
|
-
client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
6
|
+
/** Prismic client with which automatic previews will be enabled. */client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
11
|
-
* preview session.
|
|
9
|
+
* Configures a Prismic client to automatically query draft content during a preview session.
|
|
12
10
|
*
|
|
13
11
|
* @param config - Configuration for the function.
|
|
14
12
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableAutoPreviews.d.cts","names":[],"sources":["../src/enableAutoPreviews.ts"],"mappings":";;;;KAGY,wBAAA;EAAA,oEAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;AAAA;;;;;;iBAQE,kBAAA,CAAmB,MAAA,EAAQ,wBAAA"}
|
|
@@ -3,12 +3,10 @@ import { Client } from "@prismicio/client";
|
|
|
3
3
|
//#region src/enableAutoPreviews.d.ts
|
|
4
4
|
/** Configuration for `enableAutoPreviews`. */
|
|
5
5
|
type EnableAutoPreviewsConfig = {
|
|
6
|
-
/** Prismic client with which automatic previews will be enabled. */
|
|
7
|
-
client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
6
|
+
/** Prismic client with which automatic previews will be enabled. */client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
11
|
-
* preview session.
|
|
9
|
+
* Configures a Prismic client to automatically query draft content during a preview session.
|
|
12
10
|
*
|
|
13
11
|
* @param config - Configuration for the function.
|
|
14
12
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableAutoPreviews.d.ts","names":[],"sources":["../src/enableAutoPreviews.ts"],"mappings":";;;;KAGY,wBAAA;EAAA,oEAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;AAAA;;;;;;iBAQE,kBAAA,CAAmB,MAAA,EAAQ,wBAAA"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { cookie } from "@prismicio/client";
|
|
2
|
-
|
|
3
2
|
//#region src/enableAutoPreviews.ts
|
|
4
3
|
/**
|
|
5
|
-
* Configures a Prismic client to automatically query draft content during a
|
|
6
|
-
* preview session.
|
|
4
|
+
* Configures a Prismic client to automatically query draft content during a preview session.
|
|
7
5
|
*
|
|
8
6
|
* @param config - Configuration for the function.
|
|
9
7
|
*/
|
|
10
8
|
function enableAutoPreviews(config) {
|
|
11
9
|
config.client.queryContentFromRef(async () => {
|
|
12
|
-
const { cookies, draftMode } = await import("next/headers");
|
|
10
|
+
const { cookies, draftMode } = await import("next/headers.js");
|
|
13
11
|
let isDraftModeEnabled = false;
|
|
14
12
|
try {
|
|
15
13
|
isDraftModeEnabled = (await draftMode()).isEnabled;
|
|
@@ -23,7 +21,7 @@ function enableAutoPreviews(config) {
|
|
|
23
21
|
return cookie$1;
|
|
24
22
|
});
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
//#endregion
|
|
28
25
|
export { enableAutoPreviews };
|
|
26
|
+
|
|
29
27
|
//# sourceMappingURL=enableAutoPreviews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableAutoPreviews.js","names":["cookie","prismicCookie"],"sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\"
|
|
1
|
+
{"version":3,"file":"enableAutoPreviews.js","names":["cookie","prismicCookie"],"sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\"\n\n/** Configuration for `enableAutoPreviews`. */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">\n}\n\n/**\n * Configures a Prismic client to automatically query draft content during a preview session.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\t// We use a function value so the cookie is checked on every\n\t// request. We don't have a static value to read from.\n\tconfig.client.queryContentFromRef(async () => {\n\t\t// Need this to avoid the following Next.js build-time error:\n\t\t// You're importing a component that needs next/headers. That only works\n\t\t// in a Server Component which is not supported in the pages/ directory.\n\t\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t\tlet isDraftModeEnabled = false\n\t\ttry {\n\t\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t\t} catch {\n\t\t\t// `draftMode()` may have been called in a palce that\n\t\t\t// does not have access to its async storage. This\n\t\t\t// occurs in places like `generateStaticParams()`. We\n\t\t\t// can ignore this case.\n\t\t\treturn\n\t\t}\n\t\tif (!isDraftModeEnabled) {\n\t\t\treturn\n\t\t}\n\n\t\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\t\tif (!cookie) {\n\t\t\treturn\n\t\t}\n\n\t\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\")\n\t\tif (!isActiveCookie) {\n\t\t\treturn\n\t\t}\n\n\t\treturn cookie\n\t})\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,mBAAmB,QAAwC;AAG1E,QAAO,OAAO,oBAAoB,YAAY;EAI7C,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;EAE5C,IAAI,qBAAqB;AACzB,MAAI;AACH,yBAAsB,MAAM,WAAW,EAAE;UAClC;AAKP;;AAED,MAAI,CAAC,mBACJ;EAGD,MAAMA,YAAU,MAAM,SAAS,EAAE,IAAIC,OAAc,QAAQ,EAAE;AAC7D,MAAI,CAACD,SACJ;AAID,MAAI,CADmBA,SAAO,SAAS,oBAAoB,CAE1D;AAGD,SAAOA;GACN"}
|
package/dist/exitPreview.cjs
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/exitPreview.ts
|
|
3
2
|
/**
|
|
4
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
5
|
-
*
|
|
3
|
+
* Ends a Prismic preview session within a Next.js app. This function should be used in a Router
|
|
4
|
+
* Handler.
|
|
6
5
|
*
|
|
7
6
|
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // src/app/api/exit-preview/route.js
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
* // src/app/api/exit-preview/route.js
|
|
11
|
-
*
|
|
12
|
-
* import { exitPreview } from "@prismicio/next";
|
|
10
|
+
* import { exitPreview } from "@prismicio/next"
|
|
13
11
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* export async function GET() {
|
|
13
|
+
* return await exitPreview()
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
18
16
|
*/
|
|
19
17
|
async function exitPreview() {
|
|
20
|
-
const { draftMode } = await import("next/headers");
|
|
18
|
+
const { draftMode } = await import("next/headers.js");
|
|
21
19
|
(await draftMode()).disable();
|
|
22
20
|
return new Response(JSON.stringify({ success: true }), { headers: { "Cache-Control": "no-store" } });
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
//#endregion
|
|
26
23
|
exports.exitPreview = exitPreview;
|
|
24
|
+
|
|
27
25
|
//# sourceMappingURL=exitPreview.cjs.map
|
package/dist/exitPreview.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitPreview.cjs","names":[],"sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be
|
|
1
|
+
{"version":3,"file":"exitPreview.cjs","names":[],"sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in a Router\n * Handler.\n *\n * @example\n * \t```typescript\n * \t// src/app/api/exit-preview/route.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport async function GET() {\n * \t\treturn await exitPreview()\n * \t}\n * \t```\n */\nexport async function exitPreview(): Promise<Response> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { draftMode } = await import(\"next/headers\")\n\n\t;(await draftMode()).disable()\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,eAAsB,cAAiC;CAItD,MAAM,EAAE,cAAc,MAAM,OAAO;AAElC,EAAC,MAAM,WAAW,EAAE,SAAS;AAG9B,QAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,MAAM,CAAC,EAAE,EACtD,SAAS,EACR,iBAAiB,YACjB,EACD,CAAC"}
|
package/dist/exitPreview.d.cts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
//#region src/exitPreview.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
4
|
-
*
|
|
3
|
+
* Ends a Prismic preview session within a Next.js app. This function should be used in a Router
|
|
4
|
+
* Handler.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // src/app/api/exit-preview/route.js
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
* // src/app/api/exit-preview/route.js
|
|
10
|
+
* import { exitPreview } from "@prismicio/next"
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
12
|
+
* export async function GET() {
|
|
13
|
+
* return await exitPreview()
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
17
16
|
*/
|
|
18
17
|
declare function exitPreview(): Promise<Response>;
|
|
19
18
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exitPreview.d.cts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;AAeA;;;;;;;;;;;;;;iBAAsB,WAAA,CAAA,GAAe,OAAA,CAAQ,QAAA"}
|
package/dist/exitPreview.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
//#region src/exitPreview.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
4
|
-
*
|
|
3
|
+
* Ends a Prismic preview session within a Next.js app. This function should be used in a Router
|
|
4
|
+
* Handler.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // src/app/api/exit-preview/route.js
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
* // src/app/api/exit-preview/route.js
|
|
10
|
+
* import { exitPreview } from "@prismicio/next"
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
12
|
+
* export async function GET() {
|
|
13
|
+
* return await exitPreview()
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
17
16
|
*/
|
|
18
17
|
declare function exitPreview(): Promise<Response>;
|
|
19
18
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exitPreview.d.ts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;AAeA;;;;;;;;;;;;;;iBAAsB,WAAA,CAAA,GAAe,OAAA,CAAQ,QAAA"}
|
package/dist/exitPreview.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
//#region src/exitPreview.ts
|
|
2
2
|
/**
|
|
3
|
-
* Ends a Prismic preview session within a Next.js app. This function should be
|
|
4
|
-
*
|
|
3
|
+
* Ends a Prismic preview session within a Next.js app. This function should be used in a Router
|
|
4
|
+
* Handler.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // src/app/api/exit-preview/route.js
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
* // src/app/api/exit-preview/route.js
|
|
10
|
+
* import { exitPreview } from "@prismicio/next"
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
12
|
+
* export async function GET() {
|
|
13
|
+
* return await exitPreview()
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
17
16
|
*/
|
|
18
17
|
async function exitPreview() {
|
|
19
|
-
const { draftMode } = await import("next/headers");
|
|
18
|
+
const { draftMode } = await import("next/headers.js");
|
|
20
19
|
(await draftMode()).disable();
|
|
21
20
|
return new Response(JSON.stringify({ success: true }), { headers: { "Cache-Control": "no-store" } });
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
23
|
export { exitPreview };
|
|
24
|
+
|
|
26
25
|
//# sourceMappingURL=exitPreview.js.map
|
package/dist/exitPreview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitPreview.js","names":[],"sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be
|
|
1
|
+
{"version":3,"file":"exitPreview.js","names":[],"sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in a Router\n * Handler.\n *\n * @example\n * \t```typescript\n * \t// src/app/api/exit-preview/route.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport async function GET() {\n * \t\treturn await exitPreview()\n * \t}\n * \t```\n */\nexport async function exitPreview(): Promise<Response> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { draftMode } = await import(\"next/headers\")\n\n\t;(await draftMode()).disable()\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,eAAsB,cAAiC;CAItD,MAAM,EAAE,cAAc,MAAM,OAAO;AAElC,EAAC,MAAM,WAAW,EAAE,SAAS;AAG9B,QAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,MAAM,CAAC,EAAE,EACtD,SAAS,EACR,iBAAiB,YACjB,EACD,CAAC"}
|
package/dist/getSlices.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
|
|
3
3
|
let lz_string = require("lz-string");
|
|
4
|
-
|
|
5
4
|
//#region src/getSlices.ts
|
|
6
5
|
const getSlices = (state) => {
|
|
7
6
|
return state ? JSON.parse((0, lz_string.decompressFromEncodedURIComponent)(state)) : (0, _prismicio_simulator_kit.getDefaultSlices)();
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
9
|
exports.getSlices = getSlices;
|
|
10
|
+
|
|
12
11
|
//# sourceMappingURL=getSlices.cjs.map
|
package/dist/getSlices.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSlices.cjs","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"
|
|
1
|
+
{"version":3,"file":"getSlices.cjs","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport { decompressFromEncodedURIComponent } from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,OAAA,GAAA,UAAA,mCAAwC,MAAM,CAAC,IAAA,GAAA,yBAAA,mBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSlices.d.cts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSlices.d.ts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
|
package/dist/getSlices.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { getDefaultSlices } from "@prismicio/simulator/kit";
|
|
2
2
|
import { decompressFromEncodedURIComponent } from "lz-string";
|
|
3
|
-
|
|
4
3
|
//#region src/getSlices.ts
|
|
5
4
|
const getSlices = (state) => {
|
|
6
5
|
return state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices();
|
|
7
6
|
};
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
8
|
export { getSlices };
|
|
9
|
+
|
|
11
10
|
//# sourceMappingURL=getSlices.js.map
|
package/dist/getSlices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSlices.js","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"
|
|
1
|
+
{"version":3,"file":"getSlices.js","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport { decompressFromEncodedURIComponent } from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,MAAM,kCAAkC,MAAM,CAAC,GAAG,kBAAkB"}
|
package/dist/imgixLoader.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let imgix_url_builder = require("imgix-url-builder");
|
|
3
|
-
|
|
4
3
|
//#region src/imgixLoader.ts
|
|
5
4
|
/**
|
|
6
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
7
|
-
*
|
|
5
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
6
|
+
* parameters.
|
|
8
7
|
*
|
|
9
8
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
10
9
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
@@ -18,7 +17,7 @@ const imgixLoader = (args) => {
|
|
|
18
17
|
if (args.quality) params.q = args.quality;
|
|
19
18
|
return (0, imgix_url_builder.buildURL)(args.src, params);
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
21
|
exports.imgixLoader = imgixLoader;
|
|
22
|
+
|
|
24
23
|
//# sourceMappingURL=imgixLoader.cjs.map
|
package/dist/imgixLoader.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAHW,IAAI,IAAI,KAAK,IAAI,CAGlB,aAAa,IAAI,MAAM,IAA8B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,SAAA,GAAA,kBAAA,UAAgB,KAAK,KAAK,OAAO"}
|
package/dist/imgixLoader.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ImageLoaderProps } from "next/image";
|
|
1
|
+
import { ImageLoaderProps } from "next/image.js";
|
|
2
2
|
|
|
3
3
|
//#region src/imgixLoader.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
7
|
-
*
|
|
5
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
6
|
+
* parameters.
|
|
8
7
|
*
|
|
9
8
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
10
9
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgixLoader.d.cts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
|
package/dist/imgixLoader.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ImageLoaderProps } from "next/image";
|
|
1
|
+
import { ImageLoaderProps } from "next/image.js";
|
|
2
2
|
|
|
3
3
|
//#region src/imgixLoader.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
7
|
-
*
|
|
5
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
6
|
+
* parameters.
|
|
8
7
|
*
|
|
9
8
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
10
9
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgixLoader.d.ts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
|
package/dist/imgixLoader.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { buildURL } from "imgix-url-builder";
|
|
2
|
-
|
|
3
2
|
//#region src/imgixLoader.ts
|
|
4
3
|
/**
|
|
5
|
-
* A `next/image` loader for Imgix, which Prismic uses, with an optional
|
|
6
|
-
*
|
|
4
|
+
* A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
|
|
5
|
+
* parameters.
|
|
7
6
|
*
|
|
8
7
|
* @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
|
|
9
8
|
* @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
|
|
@@ -17,7 +16,7 @@ const imgixLoader = (args) => {
|
|
|
17
16
|
if (args.quality) params.q = args.quality;
|
|
18
17
|
return buildURL(args.src, params);
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
//#endregion
|
|
22
20
|
export { imgixLoader };
|
|
21
|
+
|
|
23
22
|
//# sourceMappingURL=imgixLoader.js.map
|
package/dist/imgixLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAHW,IAAI,IAAI,KAAK,IAAI,CAGlB,aAAa,IAAI,MAAM,IAA8B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,QAAO,SAAS,KAAK,KAAK,OAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_exitPreview = require("./exitPreview.cjs");
|
|
3
|
+
const require_PrismicPreview = require("./PrismicPreview.cjs");
|
|
4
|
+
const require_PrismicNextLink = require("./PrismicNextLink.cjs");
|
|
5
|
+
const require_enableAutoPreviews = require("./enableAutoPreviews.cjs");
|
|
6
|
+
const require_redirectToPreviewURL = require("./redirectToPreviewURL.cjs");
|
|
7
|
+
const require_imgixLoader = require("./imgixLoader.cjs");
|
|
8
|
+
const require_PrismicNextImage = require("./PrismicNextImage.cjs");
|
|
9
|
+
const require_getSlices = require("./getSlices.cjs");
|
|
10
|
+
const require_SliceSimulator = require("./SliceSimulator.cjs");
|
|
11
|
+
const require_createLocaleRedirect = require("./createLocaleRedirect.cjs");
|
|
12
12
|
exports.PrismicNextImage = require_PrismicNextImage.PrismicNextImage;
|
|
13
13
|
exports.PrismicNextLink = require_PrismicNextLink.PrismicNextLink;
|
|
14
14
|
exports.PrismicPreview = require_PrismicPreview.PrismicPreview;
|
|
@@ -18,4 +18,4 @@ exports.enableAutoPreviews = require_enableAutoPreviews.enableAutoPreviews;
|
|
|
18
18
|
exports.exitPreview = require_exitPreview.exitPreview;
|
|
19
19
|
exports.getSlices = require_getSlices.getSlices;
|
|
20
20
|
exports.imgixLoader = require_imgixLoader.imgixLoader;
|
|
21
|
-
exports.redirectToPreviewURL = require_redirectToPreviewURL.redirectToPreviewURL;
|
|
21
|
+
exports.redirectToPreviewURL = require_redirectToPreviewURL.redirectToPreviewURL;
|
package/dist/index.js
CHANGED
|
@@ -8,5 +8,4 @@ import { PrismicNextImage } from "./PrismicNextImage.js";
|
|
|
8
8
|
import { getSlices } from "./getSlices.js";
|
|
9
9
|
import { SliceSimulator } from "./SliceSimulator.js";
|
|
10
10
|
import { createLocaleRedirect } from "./createLocaleRedirect.js";
|
|
11
|
-
|
|
12
|
-
export { PrismicNextImage, PrismicNextLink, PrismicPreview, SliceSimulator, createLocaleRedirect, enableAutoPreviews, exitPreview, getSlices, imgixLoader, redirectToPreviewURL };
|
|
11
|
+
export { PrismicNextImage, PrismicNextLink, PrismicPreview, SliceSimulator, createLocaleRedirect, enableAutoPreviews, exitPreview, getSlices, imgixLoader, redirectToPreviewURL };
|