@prismicio/next 2.2.3-pr.136.19d76d2 → 2.2.3

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 (159) hide show
  1. package/dist/PrismicNextImage.cjs +11 -9
  2. package/dist/PrismicNextImage.cjs.map +1 -1
  3. package/dist/PrismicNextImage.d.cts +21 -13
  4. package/dist/PrismicNextImage.d.ts +21 -13
  5. package/dist/PrismicNextImage.js +11 -9
  6. package/dist/PrismicNextImage.js.map +1 -1
  7. package/dist/PrismicNextLink.cjs.map +1 -1
  8. package/dist/PrismicNextLink.js.map +1 -1
  9. package/dist/PrismicPreview.cjs +7 -6
  10. package/dist/PrismicPreview.cjs.map +1 -1
  11. package/dist/PrismicPreview.d.cts +12 -11
  12. package/dist/PrismicPreview.d.ts +12 -11
  13. package/dist/PrismicPreview.js +7 -6
  14. package/dist/PrismicPreview.js.map +1 -1
  15. package/dist/PrismicPreviewClient.cjs +3 -1
  16. package/dist/PrismicPreviewClient.cjs.map +1 -1
  17. package/dist/PrismicPreviewClient.js +3 -1
  18. package/dist/PrismicPreviewClient.js.map +1 -1
  19. package/dist/SliceSimulator.cjs +3 -3
  20. package/dist/SliceSimulator.cjs.map +1 -1
  21. package/dist/SliceSimulator.d.cts +5 -3
  22. package/dist/SliceSimulator.d.ts +5 -3
  23. package/dist/SliceSimulator.js +3 -3
  24. package/dist/SliceSimulator.js.map +1 -1
  25. package/dist/SliceSimulatorWrapper.cjs +4 -1
  26. package/dist/SliceSimulatorWrapper.cjs.map +1 -1
  27. package/dist/SliceSimulatorWrapper.js +4 -1
  28. package/dist/SliceSimulatorWrapper.js.map +1 -1
  29. package/dist/createLocaleRedirect.cjs.map +1 -1
  30. package/dist/createLocaleRedirect.js.map +1 -1
  31. package/dist/enableAutoPreviews.cjs +2 -1
  32. package/dist/enableAutoPreviews.cjs.map +1 -1
  33. package/dist/enableAutoPreviews.d.cts +2 -1
  34. package/dist/enableAutoPreviews.d.ts +2 -1
  35. package/dist/enableAutoPreviews.js +2 -1
  36. package/dist/enableAutoPreviews.js.map +1 -1
  37. package/dist/exitPreview.cjs +10 -9
  38. package/dist/exitPreview.cjs.map +1 -1
  39. package/dist/exitPreview.d.cts +10 -9
  40. package/dist/exitPreview.d.ts +10 -9
  41. package/dist/exitPreview.js +10 -9
  42. package/dist/exitPreview.js.map +1 -1
  43. package/dist/getSlices.cjs.map +1 -1
  44. package/dist/getSlices.js.map +1 -1
  45. package/dist/imgixLoader.cjs +2 -2
  46. package/dist/imgixLoader.cjs.map +1 -1
  47. package/dist/imgixLoader.d.cts +2 -2
  48. package/dist/imgixLoader.d.ts +2 -2
  49. package/dist/imgixLoader.js +2 -2
  50. package/dist/imgixLoader.js.map +1 -1
  51. package/dist/lib/devMsg.cjs +8 -6
  52. package/dist/lib/devMsg.cjs.map +1 -1
  53. package/dist/lib/devMsg.js +8 -6
  54. package/dist/lib/devMsg.js.map +1 -1
  55. package/dist/lib/resolveDefaultExport.cjs +12 -8
  56. package/dist/lib/resolveDefaultExport.cjs.map +1 -1
  57. package/dist/lib/resolveDefaultExport.js +12 -8
  58. package/dist/lib/resolveDefaultExport.js.map +1 -1
  59. package/dist/package.cjs +1 -1
  60. package/dist/package.js +1 -1
  61. package/dist/pages/PrismicPreview.cjs +7 -6
  62. package/dist/pages/PrismicPreview.cjs.map +1 -1
  63. package/dist/pages/PrismicPreview.d.cts +12 -11
  64. package/dist/pages/PrismicPreview.d.ts +12 -11
  65. package/dist/pages/PrismicPreview.js +7 -6
  66. package/dist/pages/PrismicPreview.js.map +1 -1
  67. package/dist/pages/SliceSimulator.cjs +2 -2
  68. package/dist/pages/SliceSimulator.cjs.map +1 -1
  69. package/dist/pages/SliceSimulator.d.cts +13 -10
  70. package/dist/pages/SliceSimulator.d.ts +13 -10
  71. package/dist/pages/SliceSimulator.js +2 -2
  72. package/dist/pages/SliceSimulator.js.map +1 -1
  73. package/dist/pages/enableAutoPreviews.cjs +3 -3
  74. package/dist/pages/enableAutoPreviews.cjs.map +1 -1
  75. package/dist/pages/enableAutoPreviews.d.cts +5 -5
  76. package/dist/pages/enableAutoPreviews.d.ts +5 -5
  77. package/dist/pages/enableAutoPreviews.js +3 -3
  78. package/dist/pages/enableAutoPreviews.js.map +1 -1
  79. package/dist/pages/exitPreview.cjs +10 -9
  80. package/dist/pages/exitPreview.cjs.map +1 -1
  81. package/dist/pages/exitPreview.d.cts +10 -9
  82. package/dist/pages/exitPreview.d.ts +10 -9
  83. package/dist/pages/exitPreview.js +10 -9
  84. package/dist/pages/exitPreview.js.map +1 -1
  85. package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
  86. package/dist/pages/redirectToPreviewURL.d.cts +9 -7
  87. package/dist/pages/redirectToPreviewURL.d.ts +9 -7
  88. package/dist/pages/redirectToPreviewURL.js.map +1 -1
  89. package/dist/pages/setPreviewData.cjs.map +1 -1
  90. package/dist/pages/setPreviewData.js.map +1 -1
  91. package/dist/pages/types.d.cts +8 -3
  92. package/dist/pages/types.d.ts +8 -3
  93. package/dist/redirectToPreviewURL.cjs.map +1 -1
  94. package/dist/redirectToPreviewURL.d.cts +5 -3
  95. package/dist/redirectToPreviewURL.d.ts +5 -3
  96. package/dist/redirectToPreviewURL.js.map +1 -1
  97. package/dist/types.d.cts +2 -1
  98. package/dist/types.d.ts +2 -1
  99. package/package.json +25 -23
  100. package/src/PrismicNextImage.tsx +134 -113
  101. package/src/PrismicNextLink.tsx +45 -43
  102. package/src/PrismicPreview.tsx +29 -28
  103. package/src/PrismicPreviewClient.tsx +44 -42
  104. package/src/SliceSimulator.tsx +43 -38
  105. package/src/SliceSimulatorWrapper.tsx +25 -15
  106. package/src/createLocaleRedirect.ts +3 -3
  107. package/src/enableAutoPreviews.ts +16 -15
  108. package/src/exitPreview.ts +13 -12
  109. package/src/getSlices.ts +10 -6
  110. package/src/imgixLoader.ts +10 -10
  111. package/src/index.ts +21 -18
  112. package/src/lib/devMsg.ts +11 -9
  113. package/src/lib/resolveDefaultExport.ts +13 -9
  114. package/src/pages/PrismicPreview.tsx +51 -47
  115. package/src/pages/SliceSimulator.tsx +37 -35
  116. package/src/pages/enableAutoPreviews.ts +17 -17
  117. package/src/pages/exitPreview.ts +18 -17
  118. package/src/pages/index.ts +23 -20
  119. package/src/pages/redirectToPreviewURL.ts +33 -22
  120. package/src/pages/setPreviewData.ts +7 -7
  121. package/src/pages/types.ts +20 -16
  122. package/src/redirectToPreviewURL.ts +30 -21
  123. package/src/types.ts +13 -12
  124. package/dist/PrismicNextImage.d.cts.map +0 -1
  125. package/dist/PrismicNextImage.d.ts.map +0 -1
  126. package/dist/PrismicNextLink.d.cts.map +0 -1
  127. package/dist/PrismicNextLink.d.ts.map +0 -1
  128. package/dist/PrismicPreview.d.cts.map +0 -1
  129. package/dist/PrismicPreview.d.ts.map +0 -1
  130. package/dist/SliceSimulator.d.cts.map +0 -1
  131. package/dist/SliceSimulator.d.ts.map +0 -1
  132. package/dist/createLocaleRedirect.d.cts.map +0 -1
  133. package/dist/createLocaleRedirect.d.ts.map +0 -1
  134. package/dist/enableAutoPreviews.d.cts.map +0 -1
  135. package/dist/enableAutoPreviews.d.ts.map +0 -1
  136. package/dist/exitPreview.d.cts.map +0 -1
  137. package/dist/exitPreview.d.ts.map +0 -1
  138. package/dist/getSlices.d.cts.map +0 -1
  139. package/dist/getSlices.d.ts.map +0 -1
  140. package/dist/imgixLoader.d.cts.map +0 -1
  141. package/dist/imgixLoader.d.ts.map +0 -1
  142. package/dist/pages/PrismicPreview.d.cts.map +0 -1
  143. package/dist/pages/PrismicPreview.d.ts.map +0 -1
  144. package/dist/pages/SliceSimulator.d.cts.map +0 -1
  145. package/dist/pages/SliceSimulator.d.ts.map +0 -1
  146. package/dist/pages/enableAutoPreviews.d.cts.map +0 -1
  147. package/dist/pages/enableAutoPreviews.d.ts.map +0 -1
  148. package/dist/pages/exitPreview.d.cts.map +0 -1
  149. package/dist/pages/exitPreview.d.ts.map +0 -1
  150. package/dist/pages/redirectToPreviewURL.d.cts.map +0 -1
  151. package/dist/pages/redirectToPreviewURL.d.ts.map +0 -1
  152. package/dist/pages/setPreviewData.d.cts.map +0 -1
  153. package/dist/pages/setPreviewData.d.ts.map +0 -1
  154. package/dist/pages/types.d.cts.map +0 -1
  155. package/dist/pages/types.d.ts.map +0 -1
  156. package/dist/redirectToPreviewURL.d.cts.map +0 -1
  157. package/dist/redirectToPreviewURL.d.ts.map +0 -1
  158. package/dist/types.d.cts.map +0 -1
  159. package/dist/types.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  require("./_virtual/_rolldown/runtime.cjs");
3
- const require_getSlices = require("./getSlices.cjs");
4
3
  const require_SliceSimulatorWrapper = require("./SliceSimulatorWrapper.cjs");
4
+ const require_getSlices = require("./getSlices.cjs");
5
5
  let next_navigation = require("next/navigation");
6
6
  let react = require("react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -11,8 +11,8 @@ let lz_string = require("lz-string");
11
11
  const STATE_PARAMS_KEY = "state";
12
12
  const simulatorManager = new _prismicio_simulator_kit.SimulatorManager();
13
13
  /**
14
- * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
15
- * and live previews in the Page Builder.
14
+ * Simulate slices in isolation. The slice simulator enables live slice
15
+ * development in Slice Machine and live previews in the Page Builder.
16
16
  */
17
17
  const SliceSimulator = ({ children, background, zIndex, className }) => {
18
18
  const [message, setMessage] = (0, react.useState)(() => (0, _prismicio_simulator_kit.getDefaultMessage)());
@@ -1 +1 @@
1
- {"version":3,"file":"SliceSimulator.cjs","names":["SimulatorManager","getSlices","StateEventType","SliceSimulatorWrapper"],"sources":["../src/SliceSimulator.tsx"],"sourcesContent":["\"use client\"\n\nimport { SimulatorManager, StateEventType, getDefaultMessage } 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\nimport { getSlices } from \"./getSlices\"\nimport { SliceSimulatorWrapper } from \"./SliceSimulatorWrapper\"\n\nconst STATE_PARAMS_KEY = \"state\"\n\nconst simulatorManager = new SimulatorManager()\n\n/** Parameters provided to the Slice Simulator page. */\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 development in Slice Machine\n * 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":";;;;;;;;;;AAYA,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB,IAAIA,yBAAAA,kBAAkB;;;;;AAkB/C,MAAa,kBAA2C,EACvD,UACA,YACA,QACA,gBACK;CACL,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,iBAAA,GAAA,yBAAA,oBAAgD,CAAC;CACjE,MAAM,UAAA,GAAA,gBAAA,YAAoB;CAM1B,MAAM,YAAYC,kBAAAA,UAHjB,OAAO,WAAW,cACf,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,aAAa,IAAI,iBAAiB,GAChE,KAAA,EAC8B,CAAC,SAAS;AAE5C,EAAA,GAAA,MAAA,iBAAgB;AACf,mBAAiB,MAAM,GACtBC,yBAAAA,eAAe,SACd,cAAc;GACd,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,KAAK;AACzC,OAAI,aAAa,IAChB,mBAAA,GAAA,UAAA,+BAC8B,KAAK,UAAU,UAAU,CAAC,CACxD;AAED,UAAO,QAAQ,aAAa,MAAM,IAAI,IAAI;AAE1C,oBAAiB,OAAO,SAAS,EAAE,EAAE;KAEtC,mBACA;AACD,mBAAiB,MAAM,GACtBA,yBAAAA,eAAe,UACd,eAAe,WAAW,WAAW,EACtC,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,SAAS,oBAAoB;;IAEtE,CAAC,OAAO,CAAC;AAEZ,QACC,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD;EACU;EACE;EACC;EACJ;EACG;EAEV;EACsB,CAAA"}
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,yBAAAA,kBAAkB;;;;;AAoB/C,MAAa,kBAA2C,EACvD,UACA,YACA,QACA,gBACK;CACL,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,iBAAA,GAAA,yBAAA,oBAAgD,CAAC;CACjE,MAAM,UAAA,GAAA,gBAAA,YAAoB;CAM1B,MAAM,YAAYC,kBAAAA,UAHjB,OAAO,WAAW,cACf,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,aAAa,IAAI,iBAAiB,GAChE,KAAA,EAC8B,CAAC,SAAS;AAE5C,EAAA,GAAA,MAAA,iBAAgB;AACf,mBAAiB,MAAM,GACtBC,yBAAAA,eAAe,SACd,cAAc;GACd,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,KAAK;AACzC,OAAI,aAAa,IAChB,mBAAA,GAAA,UAAA,+BAC8B,KAAK,UAAU,UAAU,CAAC,CACxD;AAED,UAAO,QAAQ,aAAa,MAAM,IAAI,IAAI;AAE1C,oBAAiB,OAAO,SAAS,EAAE,EAAE;KAEtC,mBACA;AACD,mBAAiB,MAAM,GACtBA,yBAAAA,eAAe,UACd,eAAe,WAAW,WAAW,EACtC,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,SAAS,oBAAoB;;IAEtE,CAAC,OAAO,CAAC;AAEZ,QACC,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD;EACU;EACE;EACC;EACJ;EACG;EAEV;EACsB,CAAA"}
@@ -2,7 +2,9 @@ import { FC, ReactNode } from "react";
2
2
  import { SliceSimulatorProps } from "@prismicio/simulator/kit";
3
3
 
4
4
  //#region src/SliceSimulator.d.ts
5
- /** Parameters provided to the Slice Simulator page. */
5
+ /**
6
+ * Parameters provided to the Slice Simulator page.
7
+ */
6
8
  type SliceSimulatorParams = {
7
9
  searchParams: Promise<{
8
10
  state?: string;
@@ -13,8 +15,8 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
13
15
  className?: string;
14
16
  };
15
17
  /**
16
- * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
17
- * and live previews in the Page Builder.
18
+ * Simulate slices in isolation. The slice simulator enables live slice
19
+ * development in Slice Machine and live previews in the Page Builder.
18
20
  */
19
21
  declare const SliceSimulator: FC<SliceSimulatorProps$1>;
20
22
  //#endregion
@@ -2,7 +2,9 @@ import { FC, ReactNode } from "react";
2
2
  import { SliceSimulatorProps } from "@prismicio/simulator/kit";
3
3
 
4
4
  //#region src/SliceSimulator.d.ts
5
- /** Parameters provided to the Slice Simulator page. */
5
+ /**
6
+ * Parameters provided to the Slice Simulator page.
7
+ */
6
8
  type SliceSimulatorParams = {
7
9
  searchParams: Promise<{
8
10
  state?: string;
@@ -13,8 +15,8 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
13
15
  className?: string;
14
16
  };
15
17
  /**
16
- * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
17
- * and live previews in the Page Builder.
18
+ * Simulate slices in isolation. The slice simulator enables live slice
19
+ * development in Slice Machine and live previews in the Page Builder.
18
20
  */
19
21
  declare const SliceSimulator: FC<SliceSimulatorProps$1>;
20
22
  //#endregion
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { getSlices } from "./getSlices.js";
3
2
  import { SliceSimulatorWrapper } from "./SliceSimulatorWrapper.js";
3
+ import { getSlices } from "./getSlices.js";
4
4
  import { useRouter } from "next/navigation";
5
5
  import { useEffect, useState } from "react";
6
6
  import { jsx } from "react/jsx-runtime";
@@ -10,8 +10,8 @@ import { compressToEncodedURIComponent } from "lz-string";
10
10
  const STATE_PARAMS_KEY = "state";
11
11
  const simulatorManager = new SimulatorManager();
12
12
  /**
13
- * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
14
- * and live previews in the Page Builder.
13
+ * Simulate slices in isolation. The slice simulator enables live slice
14
+ * development in Slice Machine and live previews in the Page Builder.
15
15
  */
16
16
  const SliceSimulator = ({ children, background, zIndex, className }) => {
17
17
  const [message, setMessage] = useState(() => getDefaultMessage());
@@ -1 +1 @@
1
- {"version":3,"file":"SliceSimulator.js","names":[],"sources":["../src/SliceSimulator.tsx"],"sourcesContent":["\"use client\"\n\nimport { SimulatorManager, StateEventType, getDefaultMessage } 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\nimport { getSlices } from \"./getSlices\"\nimport { SliceSimulatorWrapper } from \"./SliceSimulatorWrapper\"\n\nconst STATE_PARAMS_KEY = \"state\"\n\nconst simulatorManager = new SimulatorManager()\n\n/** Parameters provided to the Slice Simulator page. */\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 development in Slice Machine\n * 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":";;;;;;;;;AAYA,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB,IAAI,kBAAkB;;;;;AAkB/C,MAAa,kBAA2C,EACvD,UACA,YACA,QACA,gBACK;CACL,MAAM,CAAC,SAAS,cAAc,eAAe,mBAAmB,CAAC;CACjE,MAAM,SAAS,WAAW;CAM1B,MAAM,YAAY,UAHjB,OAAO,WAAW,cACf,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,aAAa,IAAI,iBAAiB,GAChE,KAAA,EAC8B,CAAC,SAAS;AAE5C,iBAAgB;AACf,mBAAiB,MAAM,GACtB,eAAe,SACd,cAAc;GACd,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,KAAK;AACzC,OAAI,aAAa,IAChB,kBACA,8BAA8B,KAAK,UAAU,UAAU,CAAC,CACxD;AAED,UAAO,QAAQ,aAAa,MAAM,IAAI,IAAI;AAE1C,oBAAiB,OAAO,SAAS,EAAE,EAAE;KAEtC,mBACA;AACD,mBAAiB,MAAM,GACtB,eAAe,UACd,eAAe,WAAW,WAAW,EACtC,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAI,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAI,eAAe,SAAS,oBAAoB;;IAEtE,CAAC,OAAO,CAAC;AAEZ,QACC,oBAAC,uBAAD;EACU;EACE;EACC;EACJ;EACG;EAEV;EACsB,CAAA"}
1
+ {"version":3,"file":"SliceSimulator.js","names":[],"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,IAAI,kBAAkB;;;;;AAoB/C,MAAa,kBAA2C,EACvD,UACA,YACA,QACA,gBACK;CACL,MAAM,CAAC,SAAS,cAAc,eAAe,mBAAmB,CAAC;CACjE,MAAM,SAAS,WAAW;CAM1B,MAAM,YAAY,UAHjB,OAAO,WAAW,cACf,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,aAAa,IAAI,iBAAiB,GAChE,KAAA,EAC8B,CAAC,SAAS;AAE5C,iBAAgB;AACf,mBAAiB,MAAM,GACtB,eAAe,SACd,cAAc;GACd,MAAM,MAAM,IAAI,IAAI,OAAO,SAAS,KAAK;AACzC,OAAI,aAAa,IAChB,kBACA,8BAA8B,KAAK,UAAU,UAAU,CAAC,CACxD;AAED,UAAO,QAAQ,aAAa,MAAM,IAAI,IAAI;AAE1C,oBAAiB,OAAO,SAAS,EAAE,EAAE;KAEtC,mBACA;AACD,mBAAiB,MAAM,GACtB,eAAe,UACd,eAAe,WAAW,WAAW,EACtC,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAI,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAI,eAAe,SAAS,oBAAoB;;IAEtE,CAAC,OAAO,CAAC;AAEZ,QACC,oBAAC,uBAAD;EACU;EACE;EACC;EACJ;EACG;EAEV;EACsB,CAAA"}
@@ -2,7 +2,10 @@ require("./_virtual/_rolldown/runtime.cjs");
2
2
  let react_jsx_runtime = require("react/jsx-runtime");
3
3
  let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
4
4
  //#region src/SliceSimulatorWrapper.tsx
5
- /** A wrapper for the slice simulator that isolates the given children from the page's layout. */
5
+ /**
6
+ * A wrapper for the slice simulator that isolates the given children from the
7
+ * page's layout.
8
+ */
6
9
  const SliceSimulatorWrapper = ({ className, children, zIndex, background, message, hasSlices }) => {
7
10
  const defaultProps = (0, _prismicio_simulator_kit.getDefaultProps)();
8
11
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1 +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/** 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,gBAAA,GAAA,yBAAA,kBAAgC;AAEtC,QACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACC,WAAW,CAACA,yBAAAA,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,iBAAA,GAAA,kBAAA,KAAC,WAAD,EAAS,yBAAyB,EAAE,QAAQ,SAAS,EAAI,CAAA,GACtD,YACH,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACC,IAAG;GACH,WAAWC,yBAAAA;GACX,gBAAgBC,yBAAAA;GAChB,iBAAiBC,yBAAAA;GAEhB;GACI,CAAA,GACH;EACC,CAAA"}
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,gBAAA,GAAA,yBAAA,kBAAgC;AAEtC,QACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACC,WAAW,CAACA,yBAAAA,gBAAgB,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;EAChE,OAAO;GACN,QACC,OAAO,WAAW,cACf,aAAa,SACZ,UAAU,KAAA;GACf,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,UAAU;GACV,YACC,OAAO,eAAe,cACnB,aAAa,aACZ,cAAc,KAAA;GACnB;YAEA,UACA,iBAAA,GAAA,kBAAA,KAAC,WAAD,EAAS,yBAAyB,EAAE,QAAQ,SAAS,EAAI,CAAA,GACtD,YACH,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACC,IAAG;GACH,WAAWC,yBAAAA;GACX,gBAAgBC,yBAAAA;GAChB,iBACCC,yBAAAA;GAGA;GACI,CAAA,GACH;EACC,CAAA"}
@@ -1,7 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { disableEventHandler, getDefaultProps, onClickHandler, simulatorClass, simulatorRootClass } from "@prismicio/simulator/kit";
3
3
  //#region src/SliceSimulatorWrapper.tsx
4
- /** A wrapper for the slice simulator that isolates the given children from the page's layout. */
4
+ /**
5
+ * A wrapper for the slice simulator that isolates the given children from the
6
+ * page's layout.
7
+ */
5
8
  const SliceSimulatorWrapper = ({ className, children, zIndex, background, message, hasSlices }) => {
6
9
  const defaultProps = getDefaultProps();
7
10
  return /* @__PURE__ */ jsx("div", {
@@ -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\"\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
+ {"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/**\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,eAAe,iBAAiB;AAEtC,QACC,oBAAC,OAAD;EACC,WAAW,CAAC,gBAAgB,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;EAChE,OAAO;GACN,QACC,OAAO,WAAW,cACf,aAAa,SACZ,UAAU,KAAA;GACf,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,UAAU;GACV,YACC,OAAO,eAAe,cACnB,aAAa,aACZ,cAAc,KAAA;GACnB;YAEA,UACA,oBAAC,WAAD,EAAS,yBAAyB,EAAE,QAAQ,SAAS,EAAI,CAAA,GACtD,YACH,oBAAC,OAAD;GACC,IAAG;GACH,WAAW;GACX,gBAAgB;GAChB,iBACC;GAGA;GACI,CAAA,GACH;EACC,CAAA"}
@@ -1 +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,eAAAA,OACzE,+BACA,CAAC,oBACF"}
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"}
@@ -1 +1 @@
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
+ {"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"}
@@ -2,7 +2,8 @@ require("./_virtual/_rolldown/runtime.cjs");
2
2
  let _prismicio_client = require("@prismicio/client");
3
3
  //#region src/enableAutoPreviews.ts
4
4
  /**
5
- * Configures a Prismic client to automatically query draft content during a preview session.
5
+ * Configures a Prismic client to automatically query draft content during a
6
+ * preview session.
6
7
  *
7
8
  * @param config - Configuration for the function.
8
9
  */
@@ -1 +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 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"}
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,kBAAAA,OAAc,QAAQ,EAAE;AAC7D,MAAI,CAAC,OACJ;AAID,MAAI,CADmB,OAAO,SAAS,oBAAoB,CAE1D;AAGD,SAAO;GACN"}
@@ -6,7 +6,8 @@ type EnableAutoPreviewsConfig = {
6
6
  /** Prismic client with which automatic previews will be enabled. */client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
7
7
  };
8
8
  /**
9
- * Configures a Prismic client to automatically query draft content during a preview session.
9
+ * Configures a Prismic client to automatically query draft content during a
10
+ * preview session.
10
11
  *
11
12
  * @param config - Configuration for the function.
12
13
  */
@@ -6,7 +6,8 @@ type EnableAutoPreviewsConfig = {
6
6
  /** Prismic client with which automatic previews will be enabled. */client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
7
7
  };
8
8
  /**
9
- * Configures a Prismic client to automatically query draft content during a preview session.
9
+ * Configures a Prismic client to automatically query draft content during a
10
+ * preview session.
10
11
  *
11
12
  * @param config - Configuration for the function.
12
13
  */
@@ -1,7 +1,8 @@
1
1
  import { cookie } from "@prismicio/client";
2
2
  //#region src/enableAutoPreviews.ts
3
3
  /**
4
- * Configures a Prismic client to automatically query draft content during a preview session.
4
+ * Configures a Prismic client to automatically query draft content during a
5
+ * preview session.
5
6
  *
6
7
  * @param config - Configuration for the function.
7
8
  */
@@ -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\"\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"}
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\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,MAAMA,YAAU,MAAM,SAAS,EAAE,IAAIC,OAAc,QAAQ,EAAE;AAC7D,MAAI,CAACD,SACJ;AAID,MAAI,CADmBA,SAAO,SAAS,oBAAoB,CAE1D;AAGD,SAAOA;GACN"}
@@ -1,18 +1,19 @@
1
1
  //#region src/exitPreview.ts
2
2
  /**
3
- * Ends a Prismic preview session within a Next.js app. This function should be used in a Router
4
- * Handler.
3
+ * Ends a Prismic preview session within a Next.js app. This function should be
4
+ * used in a Router Handler.
5
5
  *
6
6
  * @example
7
- * ```typescript
8
- * // src/app/api/exit-preview/route.js
9
7
  *
10
- * import { exitPreview } from "@prismicio/next"
8
+ * ```typescript
9
+ * // src/app/api/exit-preview/route.js
11
10
  *
12
- * export async function GET() {
13
- * return await exitPreview()
14
- * }
15
- * ```
11
+ * import { exitPreview } from "@prismicio/next";
12
+ *
13
+ * export async function GET() {
14
+ * return await exitPreview();
15
+ * }
16
+ * ```
16
17
  */
17
18
  async function exitPreview() {
18
19
  const { draftMode } = await import("next/headers.js");
@@ -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 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"}
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"}
@@ -1,18 +1,19 @@
1
1
  //#region src/exitPreview.d.ts
2
2
  /**
3
- * Ends a Prismic preview session within a Next.js app. This function should be used in a Router
4
- * Handler.
3
+ * Ends a Prismic preview session within a Next.js app. This function should be
4
+ * used in a Router Handler.
5
5
  *
6
6
  * @example
7
- * ```typescript
8
- * // src/app/api/exit-preview/route.js
9
7
  *
10
- * import { exitPreview } from "@prismicio/next"
8
+ * ```typescript
9
+ * // src/app/api/exit-preview/route.js
11
10
  *
12
- * export async function GET() {
13
- * return await exitPreview()
14
- * }
15
- * ```
11
+ * import { exitPreview } from "@prismicio/next";
12
+ *
13
+ * export async function GET() {
14
+ * return await exitPreview();
15
+ * }
16
+ * ```
16
17
  */
17
18
  declare function exitPreview(): Promise<Response>;
18
19
  //#endregion
@@ -1,18 +1,19 @@
1
1
  //#region src/exitPreview.d.ts
2
2
  /**
3
- * Ends a Prismic preview session within a Next.js app. This function should be used in a Router
4
- * Handler.
3
+ * Ends a Prismic preview session within a Next.js app. This function should be
4
+ * used in a Router Handler.
5
5
  *
6
6
  * @example
7
- * ```typescript
8
- * // src/app/api/exit-preview/route.js
9
7
  *
10
- * import { exitPreview } from "@prismicio/next"
8
+ * ```typescript
9
+ * // src/app/api/exit-preview/route.js
11
10
  *
12
- * export async function GET() {
13
- * return await exitPreview()
14
- * }
15
- * ```
11
+ * import { exitPreview } from "@prismicio/next";
12
+ *
13
+ * export async function GET() {
14
+ * return await exitPreview();
15
+ * }
16
+ * ```
16
17
  */
17
18
  declare function exitPreview(): Promise<Response>;
18
19
  //#endregion
@@ -1,18 +1,19 @@
1
1
  //#region src/exitPreview.ts
2
2
  /**
3
- * Ends a Prismic preview session within a Next.js app. This function should be used in a Router
4
- * Handler.
3
+ * Ends a Prismic preview session within a Next.js app. This function should be
4
+ * used in a Router Handler.
5
5
  *
6
6
  * @example
7
- * ```typescript
8
- * // src/app/api/exit-preview/route.js
9
7
  *
10
- * import { exitPreview } from "@prismicio/next"
8
+ * ```typescript
9
+ * // src/app/api/exit-preview/route.js
11
10
  *
12
- * export async function GET() {
13
- * return await exitPreview()
14
- * }
15
- * ```
11
+ * import { exitPreview } from "@prismicio/next";
12
+ *
13
+ * export async function GET() {
14
+ * return await exitPreview();
15
+ * }
16
+ * ```
16
17
  */
17
18
  async function exitPreview() {
18
19
  const { draftMode } = await import("next/headers.js");
@@ -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 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"}
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\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"}
@@ -1 +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 = (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"}
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,OAAA,GAAA,UAAA,mCAAwC,MAAM,CAAC,IAAA,GAAA,yBAAA,mBAClC"}
@@ -1 +1 @@
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"}
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 = (\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,MAAM,kCAAkC,MAAM,CAAC,GACpD,kBAAkB"}
@@ -2,8 +2,8 @@ require("./_virtual/_rolldown/runtime.cjs");
2
2
  let imgix_url_builder = require("imgix-url-builder");
3
3
  //#region src/imgixLoader.ts
4
4
  /**
5
- * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
6
- * parameters.
5
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional
6
+ * collection of default Imgix parameters.
7
7
  *
8
8
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
9
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -1 +1 @@
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"}
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,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,SAAA,GAAA,kBAAA,UAAgB,KAAK,KAAK,OAAO"}
@@ -2,8 +2,8 @@ import { ImageLoaderProps } from "next/image.js";
2
2
 
3
3
  //#region src/imgixLoader.d.ts
4
4
  /**
5
- * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
6
- * parameters.
5
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional
6
+ * collection of default Imgix parameters.
7
7
  *
8
8
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
9
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -2,8 +2,8 @@ import { ImageLoaderProps } from "next/image.js";
2
2
 
3
3
  //#region src/imgixLoader.d.ts
4
4
  /**
5
- * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
6
- * parameters.
5
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional
6
+ * collection of default Imgix parameters.
7
7
  *
8
8
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
9
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -1,8 +1,8 @@
1
1
  import { buildURL } from "imgix-url-builder";
2
2
  //#region src/imgixLoader.ts
3
3
  /**
4
- * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
5
- * parameters.
4
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional
5
+ * collection of default Imgix parameters.
6
6
  *
7
7
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
8
8
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"imgixLoader.js","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,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,QAAO,SAAS,KAAK,KAAK,OAAO"}
@@ -4,13 +4,15 @@ const require_package = require("../package.cjs");
4
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
5
5
  *
6
6
  * @example
7
- * ```ts
8
- * devMsg("missing-param")
9
- * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
10
- * ```
11
7
  *
12
- * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
13
- * `/messages` directory.
8
+ * ```ts
9
+ * devMsg("missing-param");
10
+ * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
11
+ * ```
12
+ *
13
+ * @param slug - Slug for the message. This corresponds to a Markdown file in
14
+ * the Git repository's `/messages` directory.
15
+ *
14
16
  * @returns The `prismic.dev/msg` URL for the given slug.
15
17
  */
16
18
  const devMsg = (slug) => {
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiCA,gBAAAA,QAAQ,GAAG"}
1
+ {"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiCA,gBAAAA,QAAQ,GAAG"}
@@ -4,13 +4,15 @@ import { version } from "../package.js";
4
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
5
5
  *
6
6
  * @example
7
- * ```ts
8
- * devMsg("missing-param")
9
- * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
10
- * ```
11
7
  *
12
- * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
13
- * `/messages` directory.
8
+ * ```ts
9
+ * devMsg("missing-param");
10
+ * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
11
+ * ```
12
+ *
13
+ * @param slug - Slug for the message. This corresponds to a Markdown file in
14
+ * the Git repository's `/messages` directory.
15
+ *
14
16
  * @returns The `prismic.dev/msg` URL for the given slug.
15
17
  */
16
18
  const devMsg = (slug) => {
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiC,QAAQ,GAAG"}
1
+ {"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiC,QAAQ,GAAG"}
@@ -1,16 +1,20 @@
1
1
  //#region src/lib/resolveDefaultExport.ts
2
2
  /**
3
- * Resolves a module's default export. The module may provide its default export as a `default`
4
- * property on an object. This happens when named and default exports are mixed in modules.
3
+ * Resolves a module's default export. The module may provide its default export
4
+ * as a `default` property on an object. This happens when named and default
5
+ * exports are mixed in modules.
5
6
  *
6
- * In ES Modules, mixing is fine since the module resolver can distinguish default and named
7
- * exports. In transpiled modules, however, all exports are put into a single object, and the
8
- * default export is provided at a property called `default`.
7
+ * In ES Modules, mixing is fine since the module resolver can distinguish
8
+ * default and named exports. In transpiled modules, however, all exports are
9
+ * put into a single object, and the default export is provided at a property
10
+ * called `default`.
9
11
  *
10
- * This helper is needed by Next.js uses CJS files with named and default exports.
12
+ * This helper is needed by Next.js uses CJS files with named and default
13
+ * exports.
11
14
  *
12
- * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM
13
- * difficulties. This will likely not be removed any time soon, unfortunately.
15
+ * This helper _should_ be a temporary hack until Next.js and Node.js resolve
16
+ * their ESM difficulties. This will likely not be removed any time soon,
17
+ * unfortunately.
14
18
  */
15
19
  function resolveDefaultExport(mod) {
16
20
  return "default" in mod ? mod.default : mod;