@prismicio/next 2.2.0-pr.125.afe01f5 → 2.2.0-pr.127.38739f7

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.
Files changed (98) hide show
  1. package/dist/{PrismicNextImage.js → PrismicNextImage.cjs} +18 -16
  2. package/dist/PrismicNextImage.cjs.map +1 -0
  3. package/dist/{PrismicNextImage.d.ts → PrismicNextImage.d.cts} +2 -2
  4. package/dist/PrismicNextLink.cjs +31 -0
  5. package/dist/PrismicNextLink.cjs.map +1 -0
  6. package/dist/{PrismicNextLink.d.ts → PrismicNextLink.d.cts} +2 -2
  7. package/dist/PrismicPreview.cjs +41 -0
  8. package/dist/PrismicPreview.cjs.map +1 -0
  9. package/dist/{PrismicPreview.d.ts → PrismicPreview.d.cts} +1 -1
  10. package/dist/{PrismicPreviewClient.js → PrismicPreviewClient.cjs} +13 -12
  11. package/dist/PrismicPreviewClient.cjs.map +1 -0
  12. package/dist/SliceSimulator.cjs +49 -0
  13. package/dist/SliceSimulator.cjs.map +1 -0
  14. package/dist/{SliceSimulator.d.ts → SliceSimulator.d.cts} +1 -1
  15. package/dist/SliceSimulatorWrapper.cjs +36 -0
  16. package/dist/SliceSimulatorWrapper.cjs.map +1 -0
  17. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  18. package/dist/createLocaleRedirect.cjs +14 -0
  19. package/dist/createLocaleRedirect.cjs.map +1 -0
  20. package/dist/{createLocaleRedirect.d.ts → createLocaleRedirect.d.cts} +1 -1
  21. package/dist/{enableAutoPreviews.js → enableAutoPreviews.cjs} +8 -7
  22. package/dist/enableAutoPreviews.cjs.map +1 -0
  23. package/dist/{enableAutoPreviews.d.ts → enableAutoPreviews.d.cts} +1 -1
  24. package/dist/{exitPreview.js → exitPreview.cjs} +3 -2
  25. package/dist/exitPreview.cjs.map +1 -0
  26. package/dist/{exitPreview.d.ts → exitPreview.d.cts} +1 -1
  27. package/dist/getSlices.cjs +12 -0
  28. package/dist/getSlices.cjs.map +1 -0
  29. package/dist/{getSlices.d.ts → getSlices.d.cts} +1 -1
  30. package/dist/{imgixLoader.js → imgixLoader.cjs} +5 -4
  31. package/dist/imgixLoader.cjs.map +1 -0
  32. package/dist/{imgixLoader.d.ts → imgixLoader.d.cts} +1 -1
  33. package/dist/index.cjs +21 -0
  34. package/dist/{index.d.ts → index.d.cts} +11 -11
  35. package/dist/lib/{devMsg.js → devMsg.cjs} +4 -4
  36. package/dist/lib/devMsg.cjs.map +1 -0
  37. package/dist/lib/{resolveDefaultExport.js → resolveDefaultExport.cjs} +3 -2
  38. package/dist/lib/resolveDefaultExport.cjs.map +1 -0
  39. package/dist/package.cjs +12 -0
  40. package/dist/package.cjs.map +1 -0
  41. package/dist/pages/{PrismicPreview.js → PrismicPreview.cjs} +15 -13
  42. package/dist/pages/PrismicPreview.cjs.map +1 -0
  43. package/dist/pages/{PrismicPreview.d.ts → PrismicPreview.d.cts} +1 -1
  44. package/dist/pages/SliceSimulator.cjs +41 -0
  45. package/dist/pages/SliceSimulator.cjs.map +1 -0
  46. package/dist/pages/{SliceSimulator.d.ts → SliceSimulator.d.cts} +1 -1
  47. package/dist/pages/{enableAutoPreviews.js → enableAutoPreviews.cjs} +3 -2
  48. package/dist/pages/enableAutoPreviews.cjs.map +1 -0
  49. package/dist/pages/{enableAutoPreviews.d.ts → enableAutoPreviews.d.cts} +2 -2
  50. package/dist/pages/{exitPreview.js → exitPreview.cjs} +3 -2
  51. package/dist/pages/exitPreview.cjs.map +1 -0
  52. package/dist/pages/{exitPreview.d.ts → exitPreview.d.cts} +2 -2
  53. package/dist/pages/{redirectToPreviewURL.js → redirectToPreviewURL.cjs} +3 -2
  54. package/dist/pages/redirectToPreviewURL.cjs.map +1 -0
  55. package/dist/pages/{redirectToPreviewURL.d.ts → redirectToPreviewURL.d.cts} +2 -2
  56. package/dist/pages/setPreviewData.cjs +13 -0
  57. package/dist/pages/setPreviewData.cjs.map +1 -0
  58. package/dist/pages/{setPreviewData.d.ts → setPreviewData.d.cts} +2 -2
  59. package/dist/pages/{types.d.ts → types.d.cts} +2 -2
  60. package/dist/pages.cjs +21 -0
  61. package/dist/{pages.d.ts → pages.d.cts} +11 -11
  62. package/dist/{redirectToPreviewURL.js → redirectToPreviewURL.cjs} +7 -6
  63. package/dist/redirectToPreviewURL.cjs.map +1 -0
  64. package/dist/{redirectToPreviewURL.d.ts → redirectToPreviewURL.d.cts} +2 -2
  65. package/dist/{types.d.ts → types.d.cts} +1 -1
  66. package/package.json +16 -4
  67. package/dist/PrismicNextImage.js.map +0 -1
  68. package/dist/PrismicNextLink.js +0 -29
  69. package/dist/PrismicNextLink.js.map +0 -1
  70. package/dist/PrismicPreview.js +0 -39
  71. package/dist/PrismicPreview.js.map +0 -1
  72. package/dist/PrismicPreviewClient.js.map +0 -1
  73. package/dist/SliceSimulator.js +0 -48
  74. package/dist/SliceSimulator.js.map +0 -1
  75. package/dist/SliceSimulatorWrapper.js +0 -35
  76. package/dist/SliceSimulatorWrapper.js.map +0 -1
  77. package/dist/createLocaleRedirect.js +0 -14
  78. package/dist/createLocaleRedirect.js.map +0 -1
  79. package/dist/enableAutoPreviews.js.map +0 -1
  80. package/dist/exitPreview.js.map +0 -1
  81. package/dist/getSlices.js +0 -11
  82. package/dist/getSlices.js.map +0 -1
  83. package/dist/imgixLoader.js.map +0 -1
  84. package/dist/index.js +0 -12
  85. package/dist/lib/devMsg.js.map +0 -1
  86. package/dist/lib/resolveDefaultExport.js.map +0 -1
  87. package/dist/package.js +0 -6
  88. package/dist/package.js.map +0 -1
  89. package/dist/pages/PrismicPreview.js.map +0 -1
  90. package/dist/pages/SliceSimulator.js +0 -40
  91. package/dist/pages/SliceSimulator.js.map +0 -1
  92. package/dist/pages/enableAutoPreviews.js.map +0 -1
  93. package/dist/pages/exitPreview.js.map +0 -1
  94. package/dist/pages/redirectToPreviewURL.js.map +0 -1
  95. package/dist/pages/setPreviewData.js +0 -12
  96. package/dist/pages/setPreviewData.js.map +0 -1
  97. package/dist/pages.js +0 -12
  98. package/dist/redirectToPreviewURL.js.map +0 -1
@@ -1,13 +1,15 @@
1
1
  "use client";
2
2
 
3
- import { resolveDefaultExport } from "./lib/resolveDefaultExport.js";
4
- import { devMsg } from "./lib/devMsg.js";
5
- import { imgixLoader } from "./imgixLoader.js";
6
- import { isFilled } from "@prismicio/client";
7
- import { forwardRef } from "react";
8
- import { Fragment, jsx } from "react/jsx-runtime";
9
- import Image from "next/image";
10
- import { buildURL } from "imgix-url-builder";
3
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
4
+ const require_resolveDefaultExport = require('./lib/resolveDefaultExport.cjs');
5
+ const require_devMsg = require('./lib/devMsg.cjs');
6
+ const require_imgixLoader = require('./imgixLoader.cjs');
7
+ let _prismicio_client = require("@prismicio/client");
8
+ let react = require("react");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let next_image = require("next/image");
11
+ next_image = require_rolldown_runtime.__toESM(next_image);
12
+ let imgix_url_builder = require("imgix-url-builder");
11
13
 
12
14
  //#region src/PrismicNextImage.tsx
13
15
  const castInt = (input) => {
@@ -34,15 +36,15 @@ const castInt = (input) => {
34
36
  *
35
37
  * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image
36
38
  */
37
- const PrismicNextImage = forwardRef(function PrismicNextImage$1({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, loader = imgixLoader, ...restProps }, ref) {
39
+ const PrismicNextImage = (0, react.forwardRef)(function PrismicNextImage$1({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, loader = require_imgixLoader.imgixLoader, ...restProps }, ref) {
38
40
  if (process.env.NODE_ENV === "development") {
39
- if (typeof alt === "string" && alt !== "") console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
40
- if (typeof fallbackAlt === "string" && fallbackAlt !== "") console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
41
+ if (typeof alt === "string" && alt !== "") console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${require_devMsg.devMsg("alt-must-be-an-empty-string")}`);
42
+ if (typeof fallbackAlt === "string" && fallbackAlt !== "") console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${require_devMsg.devMsg("alt-must-be-an-empty-string")}`);
41
43
  }
42
- if (!isFilled.imageThumbnail(field)) return /* @__PURE__ */ jsx(Fragment, { children: fallback });
44
+ if (!_prismicio_client.isFilled.imageThumbnail(field)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: fallback });
43
45
  const resolvedImgixParams = imgixParams;
44
46
  for (const x in imgixParams) if (resolvedImgixParams[x] === null) resolvedImgixParams[x] = void 0;
45
- const src = buildURL(field.url, imgixParams);
47
+ const src = (0, imgix_url_builder.buildURL)(field.url, imgixParams);
46
48
  const ar = field.dimensions.width / field.dimensions.height;
47
49
  const castedWidth = castInt(width);
48
50
  const castedHeight = castInt(height);
@@ -52,7 +54,7 @@ const PrismicNextImage = forwardRef(function PrismicNextImage$1({ field, imgixPa
52
54
  else if (castedWidth == null && castedHeight != null) resolvedWidth = castedHeight * ar;
53
55
  const resolvedAlt = alt ?? (field.alt || fallbackAlt);
54
56
  if (process.env.NODE_ENV === "development" && typeof resolvedAlt !== "string") console.error(`[PrismicNextImage] The following image is missing an "alt" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \`alt=""\` or \`fallbackAlt=""\`.`, src);
55
- return /* @__PURE__ */ jsx(resolveDefaultExport(Image), {
57
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_resolveDefaultExport.resolveDefaultExport(next_image.default), {
56
58
  ref,
57
59
  src,
58
60
  width: fill ? void 0 : resolvedWidth,
@@ -65,5 +67,5 @@ const PrismicNextImage = forwardRef(function PrismicNextImage$1({ field, imgixPa
65
67
  });
66
68
 
67
69
  //#endregion
68
- export { PrismicNextImage };
69
- //# sourceMappingURL=PrismicNextImage.js.map
70
+ exports.PrismicNextImage = PrismicNextImage;
71
+ //# sourceMappingURL=PrismicNextImage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicNextImage.cjs","names":["PrismicNextImage","imgixLoader","devMsg","isFilled","resolveDefaultExport","Image"],"sources":["../src/PrismicNextImage.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n\tForwardRefExoticComponent,\n\tPropsWithoutRef,\n\tRefAttributes} from \"react\";\nimport {\n\tforwardRef\n} from \"react\";\nimport type { ImageProps } from \"next/image\";\nimport Image from \"next/image\";\nimport type { ImgixURLParams } from \"imgix-url-builder\";\nimport { buildURL } from \"imgix-url-builder\";\nimport type { ImageFieldImage} from \"@prismicio/client\";\nimport { isFilled } from \"@prismicio/client\";\n\nimport { devMsg } from \"./lib/devMsg\";\nimport { resolveDefaultExport } from \"./lib/resolveDefaultExport\";\n\nimport { imgixLoader } from \"./imgixLoader\";\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input;\n\t} else {\n\t\tconst parsed = Number.parseInt(input);\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn parsed;\n\t\t}\n\t}\n};\n\nexport type PrismicNextImageProps = Omit<\n\tImageProps,\n\t\"src\" | \"alt\" | \"loader\"\n> & {\n\t/** The Prismic Image field or thumbnail to render. */\n\tfield: ImageFieldImage | null | undefined;\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * @see https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: { [P in keyof ImgixURLParams]: ImgixURLParams[P] | null };\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\";\n\n\t/**\n\t * Declare an image as decorative only if the Image field does not have\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\";\n\n\t/**\n\t * Rendered when the field is empty. If a fallback is not given, `null` will\n\t * be rendered.\n\t */\n\tfallback?: React.ReactNode;\n\n\tloader?: ImageProps[\"loader\"] | null;\n};\n\n/**\n * React component that renders an image from a Prismic Image field or one of\n * its thumbnails using `next/image`. It will automatically set the `alt`\n * attribute using the Image field's `alt` property.\n *\n * It uses an Imgix URL-based loader by default. A custom loader can be provided\n * with the `loader` prop. If you would like to use the Next.js Image\n * Optimization API instead, set `loader={undefined}`.\n *\n * @param props - Props for the component.\n *\n * @returns A responsive image component using `next/image` for the given Image\n * field.\n *\n * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image\n */\n// The type annotation is necessary to avoid a type reference issue.\nexport const PrismicNextImage: ForwardRefExoticComponent<\n\tPropsWithoutRef<PrismicNextImageProps> & RefAttributes<HTMLImageElement>\n> = forwardRef<HTMLImageElement, PrismicNextImageProps>(\n\tfunction PrismicNextImage(\n\t\t{\n\t\t\tfield,\n\t\t\timgixParams = {},\n\t\t\talt,\n\t\t\tfallbackAlt,\n\t\t\tfill,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tfallback = null,\n\t\t\tloader = imgixLoader,\n\t\t\t...restProps\n\t\t},\n\t\tref,\n\t) {\n\t\tif (process.env.NODE_ENV === \"development\") {\n\t\t\tif (typeof alt === \"string\" && alt !== \"\") {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicNextImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof fallbackAlt === \"string\" && fallbackAlt !== \"\") {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicNextImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!isFilled.imageThumbnail(field)) {\n\t\t\treturn <>{fallback}</>;\n\t\t}\n\n\t\tconst resolvedImgixParams = imgixParams;\n\t\tfor (const x in imgixParams) {\n\t\t\tif (resolvedImgixParams[x as keyof typeof resolvedImgixParams] === null) {\n\t\t\t\tresolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst src = buildURL(field.url, imgixParams as ImgixURLParams);\n\n\t\tconst ar = field.dimensions.width / field.dimensions.height;\n\n\t\tconst castedWidth = castInt(width);\n\t\tconst castedHeight = castInt(height);\n\n\t\tlet resolvedWidth = castedWidth ?? field.dimensions.width;\n\t\tlet resolvedHeight = castedHeight ?? field.dimensions.height;\n\n\t\tif (castedWidth != null && castedHeight == null) {\n\t\t\tresolvedHeight = castedWidth / ar;\n\t\t} else if (castedWidth == null && castedHeight != null) {\n\t\t\tresolvedWidth = castedHeight * ar;\n\t\t}\n\n\t\t// A non-null assertion is required since we can't statically\n\t\t// know if an alt attribute is available.\n\t\tconst resolvedAlt = (alt ?? (field.alt || fallbackAlt))!;\n\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\ttypeof resolvedAlt !== \"string\"\n\t\t) {\n\t\t\tconsole.error(\n\t\t\t\t`[PrismicNextImage] The following image is missing an \"alt\" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \\`alt=\"\"\\` or \\`fallbackAlt=\"\"\\`.`,\n\t\t\t\tsrc,\n\t\t\t);\n\t\t}\n\n\t\tconst ResolvedImage = resolveDefaultExport(Image);\n\n\t\treturn (\n\t\t\t<ResolvedImage\n\t\t\t\tref={ref}\n\t\t\t\tsrc={src}\n\t\t\t\twidth={fill ? undefined : resolvedWidth}\n\t\t\t\theight={fill ? undefined : resolvedHeight}\n\t\t\t\talt={resolvedAlt}\n\t\t\t\tfill={fill}\n\t\t\t\tloader={loader === null ? undefined : loader}\n\t\t\t\t{...restProps}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,WAAW,UAA2D;AAC3E,KAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YACjD,QAAO;MACD;EACN,MAAM,SAAS,OAAO,SAAS,MAAM;AAErC,MAAI,OAAO,MAAM,OAAO,CACvB;MAEA,QAAO;;;;;;;;;;;;;;;;;;;AA8DV,MAAa,yCAGZ,SAASA,mBACR,EACC,OACA,cAAc,EAAE,EAChB,KACA,aACA,MACA,OACA,QACA,WAAW,MACX,SAASC,iCACT,GAAG,aAEJ,KACC;AACD,KAAI,QAAQ,IAAI,aAAa,eAAe;AAC3C,MAAI,OAAO,QAAQ,YAAY,QAAQ,GACtC,SAAQ,KACP,yQAAyQC,sBACxQ,8BACA,GACD;AAGF,MAAI,OAAO,gBAAgB,YAAY,gBAAgB,GACtD,SAAQ,KACP,ySAAySA,sBACxS,8BACA,GACD;;AAIH,KAAI,CAACC,2BAAS,eAAe,MAAM,CAClC,QAAO,mFAAG,WAAY;CAGvB,MAAM,sBAAsB;AAC5B,MAAK,MAAM,KAAK,YACf,KAAI,oBAAoB,OAA2C,KAClE,qBAAoB,KAAyC;CAI/D,MAAM,sCAAe,MAAM,KAAK,YAA8B;CAE9D,MAAM,KAAK,MAAM,WAAW,QAAQ,MAAM,WAAW;CAErD,MAAM,cAAc,QAAQ,MAAM;CAClC,MAAM,eAAe,QAAQ,OAAO;CAEpC,IAAI,gBAAgB,eAAe,MAAM,WAAW;CACpD,IAAI,iBAAiB,gBAAgB,MAAM,WAAW;AAEtD,KAAI,eAAe,QAAQ,gBAAgB,KAC1C,kBAAiB,cAAc;UACrB,eAAe,QAAQ,gBAAgB,KACjD,iBAAgB,eAAe;CAKhC,MAAM,cAAe,QAAQ,MAAM,OAAO;AAE1C,KACC,QAAQ,IAAI,aAAa,iBACzB,OAAO,gBAAgB,SAEvB,SAAQ,MACP,mNACA,IACA;AAKF,QACC,2CAHqBC,kDAAqBC,mBAAM;EAI1C;EACA;EACL,OAAO,OAAO,SAAY;EAC1B,QAAQ,OAAO,SAAY;EAC3B,KAAK;EACC;EACN,QAAQ,WAAW,OAAO,SAAY;EACtC,GAAI;GACH;EAGJ"}
@@ -1,5 +1,5 @@
1
- import { ImageFieldImage } from "@prismicio/client";
2
1
  import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
2
+ import { ImageFieldImage } from "@prismicio/client";
3
3
  import { ImageProps } from "next/image";
4
4
  import { ImgixURLParams } from "imgix-url-builder";
5
5
 
@@ -54,4 +54,4 @@ type PrismicNextImageProps = Omit<ImageProps, "src" | "alt" | "loader"> & {
54
54
  declare const PrismicNextImage: ForwardRefExoticComponent<PropsWithoutRef<PrismicNextImageProps> & RefAttributes<HTMLImageElement>>;
55
55
  //#endregion
56
56
  export { PrismicNextImage, PrismicNextImageProps };
57
- //# sourceMappingURL=PrismicNextImage.d.ts.map
57
+ //# sourceMappingURL=PrismicNextImage.d.cts.map
@@ -0,0 +1,31 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_resolveDefaultExport = require('./lib/resolveDefaultExport.cjs');
3
+ let _prismicio_client = require("@prismicio/client");
4
+ let react = require("react");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ let next_link = require("next/link");
7
+ next_link = require_rolldown_runtime.__toESM(next_link);
8
+
9
+ //#region src/PrismicNextLink.tsx
10
+ const PrismicNextLink = (0, react.forwardRef)(function PrismicNextLink$1(props, ref) {
11
+ const { field, document, linkResolver, children, ...restProps } = props;
12
+ const { href: computedHref, rel: computedRel, ...attrs } = (0, _prismicio_client.asLinkAttrs)(field ?? document, {
13
+ linkResolver,
14
+ rel: typeof restProps.rel === "function" ? restProps.rel : void 0
15
+ });
16
+ const href = ("href" in restProps ? restProps.href : computedHref) || "";
17
+ let rel = computedRel;
18
+ if ("rel" in restProps && typeof restProps.rel !== "function") rel = restProps.rel;
19
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_resolveDefaultExport.resolveDefaultExport(next_link.default), {
20
+ ref,
21
+ ...attrs,
22
+ ...restProps,
23
+ href,
24
+ rel,
25
+ children: "children" in props ? children : field?.text
26
+ });
27
+ });
28
+
29
+ //#endregion
30
+ exports.PrismicNextLink = PrismicNextLink;
31
+ //# sourceMappingURL=PrismicNextLink.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicNextLink.cjs","names":["PrismicNextLink","resolveDefaultExport","Link"],"sources":["../src/PrismicNextLink.tsx"],"sourcesContent":["import type { ComponentProps} from \"react\";\nimport { forwardRef } from \"react\";\nimport Link from \"next/link\";\nimport type {\n\tAsLinkAttrsConfig,\n\tLinkField,\n\tLinkResolverFunction,\n\tPrismicDocument} from \"@prismicio/client\";\nimport {\n\tasLinkAttrs,\n} from \"@prismicio/client\";\n\nimport { resolveDefaultExport } from \"./lib/resolveDefaultExport\";\n\nexport type PrismicNextLinkProps = Omit<\n\tComponentProps<typeof Link>,\n\t\"field\" | \"document\" | \"href\" | \"rel\"\n> & {\n\tlinkResolver?: LinkResolverFunction;\n\trel?: string | AsLinkAttrsConfig[\"rel\"];\n} & (\n\t\t| {\n\t\t\t\tfield: LinkField | null | undefined;\n\t\t\t\tdocument?: never;\n\t\t\t\thref?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield?: never;\n\t\t\t\tdocument: PrismicDocument | null | undefined;\n\t\t\t\thref?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield?: never;\n\t\t\t\tdocument?: never;\n\t\t\t\thref: ComponentProps<typeof Link>[\"href\"];\n\t\t }\n\t);\n\nexport const PrismicNextLink = forwardRef<\n\tHTMLAnchorElement,\n\tPrismicNextLinkProps\n>(function PrismicNextLink(props, ref) {\n\tconst { field, document, linkResolver, children, ...restProps } = props;\n\tconst {\n\t\thref: computedHref,\n\t\trel: computedRel,\n\t\t...attrs\n\t} = asLinkAttrs(field ?? document, {\n\t\tlinkResolver,\n\t\trel: typeof restProps.rel === \"function\" ? restProps.rel : undefined,\n\t});\n\n\tconst href = (\"href\" in restProps ? restProps.href : computedHref) || \"\";\n\n\tlet rel = computedRel;\n\tif (\"rel\" in restProps && typeof restProps.rel !== \"function\") {\n\t\trel = restProps.rel;\n\t}\n\n\tconst ResolvedLink = resolveDefaultExport(Link);\n\n\treturn (\n\t\t<ResolvedLink ref={ref} {...attrs} {...restProps} href={href} rel={rel}>\n\t\t\t{\"children\" in props ? children : field?.text}\n\t\t</ResolvedLink>\n\t);\n});\n"],"mappings":";;;;;;;;;AAsCA,MAAa,wCAGX,SAASA,kBAAgB,OAAO,KAAK;CACtC,MAAM,EAAE,OAAO,UAAU,cAAc,UAAU,GAAG,cAAc;CAClE,MAAM,EACL,MAAM,cACN,KAAK,aACL,GAAG,6CACY,SAAS,UAAU;EAClC;EACA,KAAK,OAAO,UAAU,QAAQ,aAAa,UAAU,MAAM;EAC3D,CAAC;CAEF,MAAM,QAAQ,UAAU,YAAY,UAAU,OAAO,iBAAiB;CAEtE,IAAI,MAAM;AACV,KAAI,SAAS,aAAa,OAAO,UAAU,QAAQ,WAClD,OAAM,UAAU;AAKjB,QACC,2CAHoBC,kDAAqBC,kBAAK;EAG3B;EAAK,GAAI;EAAO,GAAI;EAAiB;EAAW;YACjE,cAAc,QAAQ,WAAW,OAAO;GAC3B;EAEf"}
@@ -1,8 +1,8 @@
1
- import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
2
1
  import * as react0 from "react";
3
2
  import { ComponentProps } from "react";
4
3
  import * as next_link0 from "next/link";
5
4
  import Link from "next/link";
5
+ import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
6
6
 
7
7
  //#region src/PrismicNextLink.d.ts
8
8
  type PrismicNextLinkProps = Omit<ComponentProps<typeof Link>, "field" | "document" | "href" | "rel"> & {
@@ -51,4 +51,4 @@ declare const PrismicNextLink: react0.ForwardRefExoticComponent<(Omit<Omit<Omit<
51
51
  }, "ref">) & react0.RefAttributes<HTMLAnchorElement>>;
52
52
  //#endregion
53
53
  export { PrismicNextLink, PrismicNextLinkProps };
54
- //# sourceMappingURL=PrismicNextLink.d.ts.map
54
+ //# sourceMappingURL=PrismicNextLink.d.cts.map
@@ -0,0 +1,41 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_resolveDefaultExport = require('./lib/resolveDefaultExport.cjs');
3
+ const require_PrismicPreviewClient = require('./PrismicPreviewClient.cjs');
4
+ let next_script = require("next/script");
5
+ next_script = require_rolldown_runtime.__toESM(next_script);
6
+ let _prismicio_client = require("@prismicio/client");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+
9
+ //#region src/PrismicPreview.tsx
10
+ /**
11
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When
12
+ * the Prismic Toolbar send events to the browser, such as on preview updates
13
+ * and exiting, this component will automatically refresh the page with the
14
+ * changes.
15
+ *
16
+ * This component can be wrapped around your app or added anywhere in your app's
17
+ * tree. It must be rendered on every page.
18
+ */
19
+ const PrismicPreview = async (props) => {
20
+ const { repositoryName, children, ...otherProps } = props;
21
+ const { draftMode } = await import("next/headers");
22
+ const toolbarSrc = (0, _prismicio_client.getToolbarSrc)(repositoryName);
23
+ const isDraftMode = (await draftMode()).isEnabled;
24
+ const ResolvedScript = require_resolveDefaultExport.resolveDefaultExport(next_script.default);
25
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
26
+ children,
27
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PrismicPreviewClient.PrismicPreviewClient, {
28
+ repositoryName,
29
+ isDraftMode,
30
+ ...otherProps
31
+ }),
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResolvedScript, {
33
+ src: toolbarSrc,
34
+ strategy: "lazyOnload"
35
+ })
36
+ ] });
37
+ };
38
+
39
+ //#endregion
40
+ exports.PrismicPreview = PrismicPreview;
41
+ //# sourceMappingURL=PrismicPreview.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreview.cjs","names":["resolveDefaultExport","Script","PrismicPreviewClient"],"sources":["../src/PrismicPreview.tsx"],"sourcesContent":["import type { FC, ReactNode } from \"react\";\nimport Script from \"next/script\";\nimport { getToolbarSrc } from \"@prismicio/client\";\n\nimport { resolveDefaultExport } from \"./lib/resolveDefaultExport\";\nimport { PrismicPreviewClient } from \"./PrismicPreviewClient\";\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\texitPreviewURL?: string;\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically refresh the page with the\n * changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = async (props) => {\n\tconst { repositoryName, children, ...otherProps } = props;\n\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\tconst toolbarSrc = getToolbarSrc(repositoryName);\n\tconst isDraftMode = (await draftMode()).isEnabled;\n\n\tconst ResolvedScript = resolveDefaultExport(Script);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<PrismicPreviewClient\n\t\t\t\trepositoryName={repositoryName}\n\t\t\t\tisDraftMode={isDraftMode}\n\t\t\t\t{...otherProps}\n\t\t\t/>\n\t\t\t<ResolvedScript src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,MAAa,iBAA0C,OAAO,UAAU;CACvE,MAAM,EAAE,gBAAgB,UAAU,GAAG,eAAe;CAKpD,MAAM,EAAE,cAAc,MAAM,OAAO;CAEnC,MAAM,kDAA2B,eAAe;CAChD,MAAM,eAAe,MAAM,WAAW,EAAE;CAExC,MAAM,iBAAiBA,kDAAqBC,oBAAO;AAEnD,QACC;EACE;EACD,2CAACC;GACgB;GACH;GACb,GAAI;IACH;EACF,2CAAC;GAAe,KAAK;GAAY,UAAS;IAAe;KACvD"}
@@ -33,4 +33,4 @@ type PrismicPreviewProps = {
33
33
  declare const PrismicPreview: FC<PrismicPreviewProps>;
34
34
  //#endregion
35
35
  export { PrismicPreview, PrismicPreviewProps };
36
- //# sourceMappingURL=PrismicPreview.d.ts.map
36
+ //# sourceMappingURL=PrismicPreview.d.cts.map
@@ -1,19 +1,20 @@
1
1
  "use client";
2
2
 
3
- import { cookie } from "@prismicio/client";
4
- import { useRouter } from "next/navigation";
5
- import { useEffect } from "react";
3
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
4
+ let _prismicio_client = require("@prismicio/client");
5
+ let next_navigation = require("next/navigation");
6
+ let react = require("react");
6
7
 
7
8
  //#region src/PrismicPreviewClient.tsx
8
9
  const PrismicPreviewClient = (props) => {
9
10
  const { repositoryName, isDraftMode, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" } = props;
10
- const { refresh } = useRouter();
11
- useEffect(() => {
11
+ const { refresh } = (0, next_navigation.useRouter)();
12
+ (0, react.useEffect)(() => {
12
13
  const controller = new AbortController();
13
14
  window.addEventListener("prismicPreviewUpdate", onUpdate, { signal: controller.signal });
14
15
  window.addEventListener("prismicPreviewEnd", onEnd, { signal: controller.signal });
15
- const cookie$1 = getPrismicPreviewCookie(window.document.cookie);
16
- if ((cookie$1 ? (decodeURIComponent(cookie$1).match(/"([^"]+)\.prismic\.io"/) || [])[1] : void 0) === repositoryName && !isDraftMode) globalThis.fetch(updatePreviewURL, {
16
+ const cookie = getPrismicPreviewCookie(window.document.cookie);
17
+ if ((cookie ? (decodeURIComponent(cookie).match(/"([^"]+)\.prismic\.io"/) || [])[1] : void 0) === repositoryName && !isDraftMode) globalThis.fetch(updatePreviewURL, {
17
18
  redirect: "manual",
18
19
  signal: controller.signal
19
20
  }).then((res) => {
@@ -61,9 +62,9 @@ function getPrismicPreviewCookie(cookieJar) {
61
62
  }
62
63
  const cookies = cookieJar.split("; ");
63
64
  let value;
64
- for (const cookie$1 of cookies) {
65
- const parts = cookie$1.split("=");
66
- if (readValue(parts[0]).replace(/%3D/g, "=") === cookie.preview) {
65
+ for (const cookie of cookies) {
66
+ const parts = cookie.split("=");
67
+ if (readValue(parts[0]).replace(/%3D/g, "=") === _prismicio_client.cookie.preview) {
67
68
  value = readValue(parts.slice(1).join("="));
68
69
  continue;
69
70
  }
@@ -72,5 +73,5 @@ function getPrismicPreviewCookie(cookieJar) {
72
73
  }
73
74
 
74
75
  //#endregion
75
- export { PrismicPreviewClient };
76
- //# sourceMappingURL=PrismicPreviewClient.js.map
76
+ exports.PrismicPreviewClient = PrismicPreviewClient;
77
+ //# sourceMappingURL=PrismicPreviewClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreviewClient.cjs","names":["value","prismicCookie"],"sources":["../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/navigation\";\nimport type { FC } from \"react\";\nimport { useEffect } from \"react\";\n\ntype PrismicPreviewClientProps = {\n\trepositoryName: string;\n\tisDraftMode: boolean;\n\tupdatePreviewURL?: string;\n\texitPreviewURL?: string;\n};\n\nexport const PrismicPreviewClient: FC<PrismicPreviewClientProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tisDraftMode,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t} = props;\n\n\tconst { refresh } = useRouter();\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\n\t\tconst cookie = getPrismicPreviewCookie(window.document.cookie);\n\t\tconst cookieRepositoryName = cookie\n\t\t\t? (decodeURIComponent(cookie).match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n\t\t\t: undefined;\n\t\tconst hasCookieForRepository = cookieRepositoryName === repositoryName;\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\tif (hasCookieForRepository && !isDraftMode) {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and draft mode\n\t\t\t// is active.\n\t\t\tglobalThis\n\t\t\t\t.fetch(updatePreviewURL, {\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tglobalThis\n\t\t\t\t.fetch(exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [repositoryName, isDraftMode, updatePreviewURL, exitPreviewURL, refresh]);\n\n\treturn null;\n};\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the\n * cookie.\n *\n * @returns The value of the cookie, if it exists.\n */\nfunction getPrismicPreviewCookie(cookieJar: string): string | undefined {\n\tfunction readValue(value: string): string {\n\t\treturn value.replace(/%3B/g, \";\");\n\t}\n\n\tconst cookies = cookieJar.split(\"; \");\n\n\tlet value: string | undefined;\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\");\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\");\n\n\t\tif (name === prismicCookie.preview) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"));\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn value;\n}\n"],"mappings":";;;;;;;;AAcA,MAAa,wBAAuD,UAAU;CAC7E,MAAM,EACL,gBACA,aACA,mBAAmB,gBACnB,iBAAiB,wBACd;CAEJ,MAAM,EAAE,4CAAuB;AAE/B,4BAAgB;EACf,MAAM,aAAa,IAAI,iBAAiB;AAExC,SAAO,iBAAiB,wBAAwB,UAAU,EACzD,QAAQ,WAAW,QACnB,CAAC;AACF,SAAO,iBAAiB,qBAAqB,OAAO,EACnD,QAAQ,WAAW,QACnB,CAAC;EAEF,MAAM,SAAS,wBAAwB,OAAO,SAAS,OAAO;AAS9D,OAR6B,UACzB,mBAAmB,OAAO,CAAC,MAAM,yBAAyB,IAAI,EAAE,EAAE,KACnE,YACqD,kBAK1B,CAAC,YAK9B,YACE,MAAM,kBAAkB;GACxB,UAAU;GACV,QAAQ,WAAW;GACnB,CAAC,CACD,MAAM,QAAQ;AACd,OAAI,IAAI,SAAS,kBAAkB;AAClC,YAAQ,MACP,yDAAyD,iBAAiB,mBAC1E;AAED;;AAGD,YAAS;IACR,CACD,YAAY,GAEX;EAGJ,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,YAAS;;EAGV,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,cACE,MAAM,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpD,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAEX;;AAGJ,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAa;EAAkB;EAAgB;EAAQ,CAAC;AAE5E,QAAO;;;;;;;;;;AAWR,SAAS,wBAAwB,WAAuC;CACvE,SAAS,UAAU,SAAuB;AACzC,SAAOA,QAAM,QAAQ,QAAQ,IAAI;;CAGlC,MAAM,UAAU,UAAU,MAAM,KAAK;CAErC,IAAI;AAEJ,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,IAAI;AAG/B,MAFa,UAAU,MAAM,GAAG,CAAC,QAAQ,QAAQ,IAAI,KAExCC,yBAAc,SAAS;AACnC,WAAQ,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C;;;AAIF,QAAO"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+
3
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
4
+ const require_SliceSimulatorWrapper = require('./SliceSimulatorWrapper.cjs');
5
+ const require_getSlices = require('./getSlices.cjs');
6
+ let next_navigation = require("next/navigation");
7
+ let react = require("react");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
10
+ let lz_string = require("lz-string");
11
+
12
+ //#region src/SliceSimulator.tsx
13
+ const STATE_PARAMS_KEY = "state";
14
+ const simulatorManager = new _prismicio_simulator_kit.SimulatorManager();
15
+ /**
16
+ * Simulate slices in isolation. The slice simulator enables live slice
17
+ * development in Slice Machine and live previews in the Page Builder.
18
+ */
19
+ const SliceSimulator = ({ children, background, zIndex, className }) => {
20
+ const [message, setMessage] = (0, react.useState)(() => (0, _prismicio_simulator_kit.getDefaultMessage)());
21
+ const router = (0, next_navigation.useRouter)();
22
+ const hasSlices = require_getSlices.getSlices(typeof window !== "undefined" ? new URL(window.location.href).searchParams.get(STATE_PARAMS_KEY) : void 0).length > 0;
23
+ (0, react.useEffect)(() => {
24
+ simulatorManager.state.on(_prismicio_simulator_kit.StateEventType.Slices, (newSlices) => {
25
+ const url = new URL(window.location.href);
26
+ url.searchParams.set(STATE_PARAMS_KEY, (0, lz_string.compressToEncodedURIComponent)(JSON.stringify(newSlices)));
27
+ window.history.replaceState(null, "", url);
28
+ setTimeout(() => router.refresh(), 0);
29
+ }, "simulator-slices");
30
+ simulatorManager.state.on(_prismicio_simulator_kit.StateEventType.Message, (newMessage) => setMessage(newMessage), "simulator-message");
31
+ simulatorManager.init();
32
+ return () => {
33
+ simulatorManager.state.off(_prismicio_simulator_kit.StateEventType.Slices, "simulator-slices");
34
+ simulatorManager.state.off(_prismicio_simulator_kit.StateEventType.Message, "simulator-message");
35
+ };
36
+ }, [router]);
37
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliceSimulatorWrapper.SliceSimulatorWrapper, {
38
+ message,
39
+ hasSlices,
40
+ background,
41
+ zIndex,
42
+ className,
43
+ children
44
+ });
45
+ };
46
+
47
+ //#endregion
48
+ exports.SliceSimulator = SliceSimulator;
49
+ //# sourceMappingURL=SliceSimulator.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceSimulator.cjs","names":["SimulatorManager","getSlices","StateEventType","SliceSimulatorWrapper"],"sources":["../src/SliceSimulator.tsx"],"sourcesContent":["\"use client\";\n\nimport { SliceSimulatorWrapper } from \"./SliceSimulatorWrapper\";\nimport { getSlices } from \"./getSlices\";\nimport {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n} from \"@prismicio/simulator/kit\";\nimport type { SliceSimulatorProps as BaseSliceSimulatorProps } from \"@prismicio/simulator/kit\";\nimport { compressToEncodedURIComponent } from \"lz-string\";\nimport { useRouter } from \"next/navigation\";\nimport { useEffect, useState } from \"react\";\nimport type { FC, ReactNode } from \"react\";\n\nconst STATE_PARAMS_KEY = \"state\";\n\nconst simulatorManager = new SimulatorManager();\n\n/**\n * Parameters provided to the Slice Simulator page.\n */\nexport type SliceSimulatorParams = {\n\tsearchParams: Promise<{\n\t\tstate?: string;\n\t}>;\n};\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\tchildren: ReactNode;\n\tclassName?: string;\n};\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice\n * development in Slice Machine and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tchildren,\n\tbackground,\n\tzIndex,\n\tclassName,\n}) => {\n\tconst [message, setMessage] = useState(() => getDefaultMessage());\n\tconst router = useRouter();\n\n\tconst state =\n\t\ttypeof window !== \"undefined\"\n\t\t\t? new URL(window.location.href).searchParams.get(STATE_PARAMS_KEY)\n\t\t\t: undefined;\n\tconst hasSlices = getSlices(state).length > 0;\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(newSlices) => {\n\t\t\t\tconst url = new URL(window.location.href);\n\t\t\t\turl.searchParams.set(\n\t\t\t\t\tSTATE_PARAMS_KEY,\n\t\t\t\t\tcompressToEncodedURIComponent(JSON.stringify(newSlices)),\n\t\t\t\t);\n\n\t\t\t\twindow.history.replaceState(null, \"\", url);\n\t\t\t\t// Wait until the next tick to prevent URL state race conditions.\n\t\t\t\tsetTimeout(() => router.refresh(), 0);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(newMessage) => setMessage(newMessage),\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tsimulatorManager.init();\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\");\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\");\n\t\t};\n\t}, [router]);\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={hasSlices}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{children}\n\t\t</SliceSimulatorWrapper>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB,IAAIA,2CAAkB;;;;;AAoB/C,MAAa,kBAA2C,EACvD,UACA,YACA,QACA,gBACK;CACL,MAAM,CAAC,SAAS,yFAAgD,CAAC;CACjE,MAAM,yCAAoB;CAM1B,MAAM,YAAYC,4BAHjB,OAAO,WAAW,cACf,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,aAAa,IAAI,iBAAiB,GAChE,OAC8B,CAAC,SAAS;AAE5C,4BAAgB;AACf,mBAAiB,MAAM,GACtBC,wCAAe,SACd,cAAc;GACd,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,KAAK;AACzC,OAAI,aAAa,IAChB,+DAC8B,KAAK,UAAU,UAAU,CAAC,CACxD;AAED,UAAO,QAAQ,aAAa,MAAM,IAAI,IAAI;AAE1C,oBAAiB,OAAO,SAAS,EAAE,EAAE;KAEtC,mBACA;AACD,mBAAiB,MAAM,GACtBA,wCAAe,UACd,eAAe,WAAW,WAAW,EACtC,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAIA,wCAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAIA,wCAAe,SAAS,oBAAoB;;IAEtE,CAAC,OAAO,CAAC;AAEZ,QACC,2CAACC;EACS;EACE;EACC;EACJ;EACG;EAEV;GACsB"}
@@ -22,4 +22,4 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
22
22
  declare const SliceSimulator: FC<SliceSimulatorProps$1>;
23
23
  //#endregion
24
24
  export { SliceSimulator, SliceSimulatorParams, SliceSimulatorProps$1 as SliceSimulatorProps };
25
- //# sourceMappingURL=SliceSimulator.d.ts.map
25
+ //# sourceMappingURL=SliceSimulator.d.cts.map
@@ -0,0 +1,36 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
4
+
5
+ //#region src/SliceSimulatorWrapper.tsx
6
+ /**
7
+ * A wrapper for the slice simulator that isolates the given children from the
8
+ * page's layout.
9
+ */
10
+ const SliceSimulatorWrapper = ({ className, children, zIndex, background, message, hasSlices }) => {
11
+ const defaultProps = (0, _prismicio_simulator_kit.getDefaultProps)();
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
13
+ className: [_prismicio_simulator_kit.simulatorClass, className].filter(Boolean).join(" "),
14
+ style: {
15
+ zIndex: typeof zIndex === "undefined" ? defaultProps.zIndex : zIndex ?? void 0,
16
+ position: "fixed",
17
+ top: 0,
18
+ left: 0,
19
+ width: "100%",
20
+ height: "100vh",
21
+ overflow: "auto",
22
+ background: typeof background === "undefined" ? defaultProps.background : background ?? void 0
23
+ },
24
+ children: message ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("article", { dangerouslySetInnerHTML: { __html: message } }) : hasSlices ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
25
+ id: "root",
26
+ className: _prismicio_simulator_kit.simulatorRootClass,
27
+ onClickCapture: _prismicio_simulator_kit.onClickHandler,
28
+ onSubmitCapture: _prismicio_simulator_kit.disableEventHandler,
29
+ children
30
+ }) : null
31
+ });
32
+ };
33
+
34
+ //#endregion
35
+ exports.SliceSimulatorWrapper = SliceSimulatorWrapper;
36
+ //# sourceMappingURL=SliceSimulatorWrapper.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceSimulatorWrapper.cjs","names":["simulatorClass","simulatorRootClass","onClickHandler","disableEventHandler"],"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/**\n * A wrapper for the slice simulator that isolates the given children from the\n * page's layout.\n */\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:\n\t\t\t\t\ttypeof zIndex === \"undefined\"\n\t\t\t\t\t\t? defaultProps.zIndex\n\t\t\t\t\t\t: (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\"\n\t\t\t\t\t\t? defaultProps.background\n\t\t\t\t\t\t: (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={\n\t\t\t\t\t\tdisableEventHandler as unknown as React.FormEventHandler\n\t\t\t\t\t}\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":";;;;;;;;;AAqBA,MAAa,yBAAyD,EACrE,WACA,UACA,QACA,YACA,SACA,gBACK;CACL,MAAM,8DAAgC;AAEtC,QACC,2CAAC;EACA,WAAW,CAACA,yCAAgB,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;EAChE,OAAO;GACN,QACC,OAAO,WAAW,cACf,aAAa,SACZ,UAAU;GACf,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,UAAU;GACV,YACC,OAAO,eAAe,cACnB,aAAa,aACZ,cAAc;GACnB;YAEA,UACA,2CAAC,aAAQ,yBAAyB,EAAE,QAAQ,SAAS,GAAI,GACtD,YACH,2CAAC;GACA,IAAG;GACH,WAAWC;GACX,gBAAgBC;GAChB,iBACCC;GAGA;IACI,GACH;GACC"}
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -0,0 +1,14 @@
1
+ const require_devMsg = require('./lib/devMsg.cjs');
2
+
3
+ //#region src/createLocaleRedirect.ts
4
+ /**
5
+ * @deprecated `createLocaleRedirect()` has been removed due to performance
6
+ * issues.
7
+ */
8
+ function createLocaleRedirect() {
9
+ throw new Error(`createLocaleRedirect() has been removed due to performance issues. See ${require_devMsg.devMsg("replace-createLocaleRedirect")} for more details.`);
10
+ }
11
+
12
+ //#endregion
13
+ exports.createLocaleRedirect = createLocaleRedirect;
14
+ //# sourceMappingURL=createLocaleRedirect.cjs.map
@@ -0,0 +1 @@
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,sBACzE,+BACA,CAAC,oBACF"}
@@ -11,4 +11,4 @@ declare function createLocaleRedirect(): never;
11
11
  type CreateLocaleRedirectConfig = never;
12
12
  //#endregion
13
13
  export { CreateLocaleRedirectConfig, createLocaleRedirect };
14
- //# sourceMappingURL=createLocaleRedirect.d.ts.map
14
+ //# sourceMappingURL=createLocaleRedirect.d.cts.map
@@ -1,4 +1,5 @@
1
- import { cookie } from "@prismicio/client";
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let _prismicio_client = require("@prismicio/client");
2
3
 
3
4
  //#region src/enableAutoPreviews.ts
4
5
  /**
@@ -17,13 +18,13 @@ function enableAutoPreviews(config) {
17
18
  return;
18
19
  }
19
20
  if (!isDraftModeEnabled) return;
20
- const cookie$1 = (await cookies()).get(cookie.preview)?.value;
21
- if (!cookie$1) return;
22
- if (!cookie$1.includes("websitePreviewId=")) return;
23
- return cookie$1;
21
+ const cookie = (await cookies()).get(_prismicio_client.cookie.preview)?.value;
22
+ if (!cookie) return;
23
+ if (!cookie.includes("websitePreviewId=")) return;
24
+ return cookie;
24
25
  });
25
26
  }
26
27
 
27
28
  //#endregion
28
- export { enableAutoPreviews };
29
- //# sourceMappingURL=enableAutoPreviews.js.map
29
+ exports.enableAutoPreviews = enableAutoPreviews;
30
+ //# sourceMappingURL=enableAutoPreviews.cjs.map
@@ -0,0 +1 @@
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\n * 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":";;;;;;;;;;AAiBA,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,yBAAc,QAAQ,EAAE;AAC7D,MAAI,CAAC,OACJ;AAID,MAAI,CADmB,OAAO,SAAS,oBAAoB,CAE1D;AAGD,SAAO;GACN"}
@@ -15,4 +15,4 @@ type EnableAutoPreviewsConfig = {
15
15
  declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
16
16
  //#endregion
17
17
  export { EnableAutoPreviewsConfig, enableAutoPreviews };
18
- //# sourceMappingURL=enableAutoPreviews.d.ts.map
18
+ //# sourceMappingURL=enableAutoPreviews.d.cts.map
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/exitPreview.ts
2
3
  /**
3
4
  * Ends a Prismic preview session within a Next.js app. This function should be
@@ -22,5 +23,5 @@ async function exitPreview() {
22
23
  }
23
24
 
24
25
  //#endregion
25
- export { exitPreview };
26
- //# sourceMappingURL=exitPreview.js.map
26
+ exports.exitPreview = exitPreview;
27
+ //# sourceMappingURL=exitPreview.cjs.map
@@ -0,0 +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\n * used in a Router Handler.\n *\n * @example\n *\n * ```typescript\n * // src/app/api/exit-preview/route.js\n *\n * import { exitPreview } from \"@prismicio/next\";\n *\n * export async function GET() {\n * \treturn await exitPreview();\n * }\n * ```\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":";;;;;;;;;;;;;;;;;;AAgBA,eAAsB,cAAiC;CAItD,MAAM,EAAE,cAAc,MAAM,OAAO;AAEnC,EAAC,MAAM,WAAW,EAAE,SAAS;AAG7B,QAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,MAAM,CAAC,EAAE,EACtD,SAAS,EACR,iBAAiB,YACjB,EACD,CAAC"}
@@ -18,4 +18,4 @@
18
18
  declare function exitPreview(): Promise<Response>;
19
19
  //#endregion
20
20
  export { exitPreview };
21
- //# sourceMappingURL=exitPreview.d.ts.map
21
+ //# sourceMappingURL=exitPreview.d.cts.map
@@ -0,0 +1,12 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
3
+ let lz_string = require("lz-string");
4
+
5
+ //#region src/getSlices.ts
6
+ const getSlices = (state) => {
7
+ return state ? JSON.parse((0, lz_string.decompressFromEncodedURIComponent)(state)) : (0, _prismicio_simulator_kit.getDefaultSlices)();
8
+ };
9
+
10
+ //#endregion
11
+ exports.getSlices = getSlices;
12
+ //# sourceMappingURL=getSlices.cjs.map
@@ -0,0 +1 @@
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 = (\n\tstate: string | null | undefined,\n): StateEvents[StateEventType.Slices] => {\n\treturn state\n\t\t? JSON.parse(decompressFromEncodedURIComponent(state))\n\t\t: getDefaultSlices();\n};\n"],"mappings":";;;;;AAIA,MAAa,aACZ,UACwC;AACxC,QAAO,QACJ,KAAK,uDAAwC,MAAM,CAAC,mDAClC"}
@@ -4,4 +4,4 @@ import { StateEventType, StateEvents } from "@prismicio/simulator/kit";
4
4
  declare const getSlices: (state: string | null | undefined) => StateEvents[StateEventType.Slices];
5
5
  //#endregion
6
6
  export { getSlices };
7
- //# sourceMappingURL=getSlices.d.ts.map
7
+ //# sourceMappingURL=getSlices.d.cts.map
@@ -1,4 +1,5 @@
1
- import { buildURL } from "imgix-url-builder";
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let imgix_url_builder = require("imgix-url-builder");
2
3
 
3
4
  //#region src/imgixLoader.ts
4
5
  /**
@@ -15,9 +16,9 @@ const imgixLoader = (args) => {
15
16
  h: void 0
16
17
  };
17
18
  if (args.quality) params.q = args.quality;
18
- return buildURL(args.src, params);
19
+ return (0, imgix_url_builder.buildURL)(args.src, params);
19
20
  };
20
21
 
21
22
  //#endregion
22
- export { imgixLoader };
23
- //# sourceMappingURL=imgixLoader.js.map
23
+ exports.imgixLoader = imgixLoader;
24
+ //# sourceMappingURL=imgixLoader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImageLoaderProps } from \"next/image\";\nimport type { ImgixURLParams } from \"imgix-url-builder\";\nimport { buildURL } from \"imgix-url-builder\";\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional\n * collection of default Imgix 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;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,wCAAgB,KAAK,KAAK,OAAO"}
@@ -12,4 +12,4 @@ import { ImageLoaderProps } from "next/image";
12
12
  declare const imgixLoader: (args: ImageLoaderProps) => string;
13
13
  //#endregion
14
14
  export { imgixLoader };
15
- //# sourceMappingURL=imgixLoader.d.ts.map
15
+ //# sourceMappingURL=imgixLoader.d.cts.map
package/dist/index.cjs ADDED
@@ -0,0 +1,21 @@
1
+ const require_exitPreview = require('./exitPreview.cjs');
2
+ const require_PrismicPreview = require('./PrismicPreview.cjs');
3
+ const require_PrismicNextLink = require('./PrismicNextLink.cjs');
4
+ const require_enableAutoPreviews = require('./enableAutoPreviews.cjs');
5
+ const require_redirectToPreviewURL = require('./redirectToPreviewURL.cjs');
6
+ const require_imgixLoader = require('./imgixLoader.cjs');
7
+ const require_PrismicNextImage = require('./PrismicNextImage.cjs');
8
+ const require_getSlices = require('./getSlices.cjs');
9
+ const require_SliceSimulator = require('./SliceSimulator.cjs');
10
+ const require_createLocaleRedirect = require('./createLocaleRedirect.cjs');
11
+
12
+ exports.PrismicNextImage = require_PrismicNextImage.PrismicNextImage;
13
+ exports.PrismicNextLink = require_PrismicNextLink.PrismicNextLink;
14
+ exports.PrismicPreview = require_PrismicPreview.PrismicPreview;
15
+ exports.SliceSimulator = require_SliceSimulator.SliceSimulator;
16
+ exports.createLocaleRedirect = require_createLocaleRedirect.createLocaleRedirect;
17
+ exports.enableAutoPreviews = require_enableAutoPreviews.enableAutoPreviews;
18
+ exports.exitPreview = require_exitPreview.exitPreview;
19
+ exports.getSlices = require_getSlices.getSlices;
20
+ exports.imgixLoader = require_imgixLoader.imgixLoader;
21
+ exports.redirectToPreviewURL = require_redirectToPreviewURL.redirectToPreviewURL;