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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/PrismicNextImage.cjs +16 -20
  2. package/dist/PrismicNextImage.cjs.map +1 -1
  3. package/dist/PrismicNextImage.d.cts +14 -23
  4. package/dist/PrismicNextImage.d.cts.map +1 -0
  5. package/dist/PrismicNextImage.d.ts +14 -23
  6. package/dist/PrismicNextImage.d.ts.map +1 -0
  7. package/dist/PrismicNextImage.js +11 -15
  8. package/dist/PrismicNextImage.js.map +1 -1
  9. package/dist/PrismicNextLink.cjs +7 -8
  10. package/dist/PrismicNextLink.cjs.map +1 -1
  11. package/dist/PrismicNextLink.d.cts +10 -10
  12. package/dist/PrismicNextLink.d.cts.map +1 -0
  13. package/dist/PrismicNextLink.d.ts +10 -10
  14. package/dist/PrismicNextLink.d.ts.map +1 -0
  15. package/dist/PrismicNextLink.js +3 -4
  16. package/dist/PrismicNextLink.js.map +1 -1
  17. package/dist/PrismicPreview.cjs +13 -15
  18. package/dist/PrismicPreview.cjs.map +1 -1
  19. package/dist/PrismicPreview.d.cts +12 -14
  20. package/dist/PrismicPreview.d.cts.map +1 -0
  21. package/dist/PrismicPreview.d.ts +12 -14
  22. package/dist/PrismicPreview.d.ts.map +1 -0
  23. package/dist/PrismicPreview.js +8 -10
  24. package/dist/PrismicPreview.js.map +1 -1
  25. package/dist/PrismicPreviewClient.cjs +5 -9
  26. package/dist/PrismicPreviewClient.cjs.map +1 -1
  27. package/dist/PrismicPreviewClient.js +6 -10
  28. package/dist/PrismicPreviewClient.js.map +1 -1
  29. package/dist/SliceSimulator.cjs +6 -8
  30. package/dist/SliceSimulator.cjs.map +1 -1
  31. package/dist/SliceSimulator.d.cts +3 -6
  32. package/dist/SliceSimulator.d.cts.map +1 -0
  33. package/dist/SliceSimulator.d.ts +3 -6
  34. package/dist/SliceSimulator.d.ts.map +1 -0
  35. package/dist/SliceSimulator.js +4 -6
  36. package/dist/SliceSimulator.js.map +1 -1
  37. package/dist/SliceSimulatorWrapper.cjs +3 -7
  38. package/dist/SliceSimulatorWrapper.cjs.map +1 -1
  39. package/dist/SliceSimulatorWrapper.js +2 -6
  40. package/dist/SliceSimulatorWrapper.js.map +1 -1
  41. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +8 -14
  42. package/dist/createLocaleRedirect.cjs +2 -3
  43. package/dist/createLocaleRedirect.cjs.map +1 -1
  44. package/dist/createLocaleRedirect.d.cts.map +1 -0
  45. package/dist/createLocaleRedirect.d.ts.map +1 -0
  46. package/dist/createLocaleRedirect.js +1 -2
  47. package/dist/createLocaleRedirect.js.map +1 -1
  48. package/dist/enableAutoPreviews.cjs +4 -6
  49. package/dist/enableAutoPreviews.cjs.map +1 -1
  50. package/dist/enableAutoPreviews.d.cts +2 -4
  51. package/dist/enableAutoPreviews.d.cts.map +1 -0
  52. package/dist/enableAutoPreviews.d.ts +2 -4
  53. package/dist/enableAutoPreviews.d.ts.map +1 -0
  54. package/dist/enableAutoPreviews.js +3 -5
  55. package/dist/enableAutoPreviews.js.map +1 -1
  56. package/dist/exitPreview.cjs +11 -13
  57. package/dist/exitPreview.cjs.map +1 -1
  58. package/dist/exitPreview.d.cts +9 -10
  59. package/dist/exitPreview.d.cts.map +1 -0
  60. package/dist/exitPreview.d.ts +9 -10
  61. package/dist/exitPreview.d.ts.map +1 -0
  62. package/dist/exitPreview.js +11 -12
  63. package/dist/exitPreview.js.map +1 -1
  64. package/dist/getSlices.cjs +2 -3
  65. package/dist/getSlices.cjs.map +1 -1
  66. package/dist/getSlices.d.cts.map +1 -0
  67. package/dist/getSlices.d.ts.map +1 -0
  68. package/dist/getSlices.js +1 -2
  69. package/dist/getSlices.js.map +1 -1
  70. package/dist/imgixLoader.cjs +4 -5
  71. package/dist/imgixLoader.cjs.map +1 -1
  72. package/dist/imgixLoader.d.cts +3 -4
  73. package/dist/imgixLoader.d.cts.map +1 -0
  74. package/dist/imgixLoader.d.ts +3 -4
  75. package/dist/imgixLoader.d.ts.map +1 -0
  76. package/dist/imgixLoader.js +3 -4
  77. package/dist/imgixLoader.js.map +1 -1
  78. package/dist/index.cjs +12 -12
  79. package/dist/index.js +1 -2
  80. package/dist/lib/devMsg.cjs +8 -11
  81. package/dist/lib/devMsg.cjs.map +1 -1
  82. package/dist/lib/devMsg.js +7 -10
  83. package/dist/lib/devMsg.js.map +1 -1
  84. package/dist/lib/resolveDefaultExport.cjs +9 -14
  85. package/dist/lib/resolveDefaultExport.cjs.map +1 -1
  86. package/dist/lib/resolveDefaultExport.js +9 -13
  87. package/dist/lib/resolveDefaultExport.js.map +1 -1
  88. package/dist/package.cjs +7 -8
  89. package/dist/package.js +2 -2
  90. package/dist/pages/PrismicPreview.cjs +12 -14
  91. package/dist/pages/PrismicPreview.cjs.map +1 -1
  92. package/dist/pages/PrismicPreview.d.cts +12 -14
  93. package/dist/pages/PrismicPreview.d.cts.map +1 -0
  94. package/dist/pages/PrismicPreview.d.ts +12 -14
  95. package/dist/pages/PrismicPreview.d.ts.map +1 -0
  96. package/dist/pages/PrismicPreview.js +8 -10
  97. package/dist/pages/PrismicPreview.js.map +1 -1
  98. package/dist/pages/SliceSimulator.cjs +5 -6
  99. package/dist/pages/SliceSimulator.cjs.map +1 -1
  100. package/dist/pages/SliceSimulator.d.cts +10 -13
  101. package/dist/pages/SliceSimulator.d.cts.map +1 -0
  102. package/dist/pages/SliceSimulator.d.ts +10 -13
  103. package/dist/pages/SliceSimulator.d.ts.map +1 -0
  104. package/dist/pages/SliceSimulator.js +3 -4
  105. package/dist/pages/SliceSimulator.js.map +1 -1
  106. package/dist/pages/enableAutoPreviews.cjs +4 -5
  107. package/dist/pages/enableAutoPreviews.cjs.map +1 -1
  108. package/dist/pages/enableAutoPreviews.d.cts +6 -8
  109. package/dist/pages/enableAutoPreviews.d.cts.map +1 -0
  110. package/dist/pages/enableAutoPreviews.d.ts +6 -8
  111. package/dist/pages/enableAutoPreviews.d.ts.map +1 -0
  112. package/dist/pages/enableAutoPreviews.js +4 -4
  113. package/dist/pages/enableAutoPreviews.js.map +1 -1
  114. package/dist/pages/exitPreview.cjs +10 -12
  115. package/dist/pages/exitPreview.cjs.map +1 -1
  116. package/dist/pages/exitPreview.d.cts +9 -10
  117. package/dist/pages/exitPreview.d.cts.map +1 -0
  118. package/dist/pages/exitPreview.d.ts +9 -10
  119. package/dist/pages/exitPreview.d.ts.map +1 -0
  120. package/dist/pages/exitPreview.js +10 -11
  121. package/dist/pages/exitPreview.js.map +1 -1
  122. package/dist/pages/redirectToPreviewURL.cjs +1 -2
  123. package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
  124. package/dist/pages/redirectToPreviewURL.d.cts +8 -11
  125. package/dist/pages/redirectToPreviewURL.d.cts.map +1 -0
  126. package/dist/pages/redirectToPreviewURL.d.ts +8 -11
  127. package/dist/pages/redirectToPreviewURL.d.ts.map +1 -0
  128. package/dist/pages/redirectToPreviewURL.js +1 -1
  129. package/dist/pages/redirectToPreviewURL.js.map +1 -1
  130. package/dist/pages/setPreviewData.cjs +2 -3
  131. package/dist/pages/setPreviewData.cjs.map +1 -1
  132. package/dist/pages/setPreviewData.d.cts.map +1 -0
  133. package/dist/pages/setPreviewData.d.ts.map +1 -0
  134. package/dist/pages/setPreviewData.js +1 -2
  135. package/dist/pages/setPreviewData.js.map +1 -1
  136. package/dist/pages/types.d.cts +3 -9
  137. package/dist/pages/types.d.cts.map +1 -0
  138. package/dist/pages/types.d.ts +3 -9
  139. package/dist/pages/types.d.ts.map +1 -0
  140. package/dist/pages.cjs +12 -12
  141. package/dist/pages.js +1 -2
  142. package/dist/redirectToPreviewURL.cjs +3 -4
  143. package/dist/redirectToPreviewURL.cjs.map +1 -1
  144. package/dist/redirectToPreviewURL.d.cts +4 -7
  145. package/dist/redirectToPreviewURL.d.cts.map +1 -0
  146. package/dist/redirectToPreviewURL.d.ts +4 -7
  147. package/dist/redirectToPreviewURL.d.ts.map +1 -0
  148. package/dist/redirectToPreviewURL.js +2 -3
  149. package/dist/redirectToPreviewURL.js.map +1 -1
  150. package/dist/types.d.cts +1 -2
  151. package/dist/types.d.cts.map +1 -0
  152. package/dist/types.d.ts +1 -2
  153. package/dist/types.d.ts.map +1 -0
  154. package/package.json +34 -36
  155. package/src/PrismicNextImage.tsx +113 -134
  156. package/src/PrismicNextLink.tsx +43 -45
  157. package/src/PrismicPreview.tsx +28 -29
  158. package/src/PrismicPreviewClient.tsx +42 -44
  159. package/src/SliceSimulator.tsx +38 -43
  160. package/src/SliceSimulatorWrapper.tsx +15 -25
  161. package/src/createLocaleRedirect.ts +3 -3
  162. package/src/enableAutoPreviews.ts +15 -16
  163. package/src/exitPreview.ts +12 -13
  164. package/src/getSlices.ts +6 -10
  165. package/src/imgixLoader.ts +10 -10
  166. package/src/index.ts +18 -21
  167. package/src/lib/devMsg.ts +9 -11
  168. package/src/lib/resolveDefaultExport.ts +9 -13
  169. package/src/pages/PrismicPreview.tsx +47 -51
  170. package/src/pages/SliceSimulator.tsx +35 -37
  171. package/src/pages/enableAutoPreviews.ts +17 -17
  172. package/src/pages/exitPreview.ts +17 -18
  173. package/src/pages/index.ts +20 -23
  174. package/src/pages/redirectToPreviewURL.ts +22 -33
  175. package/src/pages/setPreviewData.ts +7 -7
  176. package/src/pages/types.ts +16 -20
  177. package/src/redirectToPreviewURL.ts +21 -30
  178. package/src/types.ts +12 -13
@@ -1,25 +1,22 @@
1
- const require_package = require('../package.cjs');
2
-
1
+ const require_package = require("../package.cjs");
3
2
  //#region src/lib/devMsg.ts
4
3
  /**
5
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
6
5
  *
7
6
  * @example
7
+ * ```ts
8
+ * devMsg("missing-param")
9
+ * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
10
+ * ```
8
11
  *
9
- * ```ts
10
- * devMsg("missing-param");
11
- * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
12
- * ```
13
- *
14
- * @param slug - Slug for the message. This corresponds to a Markdown file in
15
- * the Git repository's `/messages` directory.
16
- *
12
+ * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
13
+ * `/messages` directory.
17
14
  * @returns The `prismic.dev/msg` URL for the given slug.
18
15
  */
19
16
  const devMsg = (slug) => {
20
17
  return `https://prismic.dev/msg/next/v${require_package.version}/${slug}`;
21
18
  };
22
-
23
19
  //#endregion
24
20
  exports.devMsg = devMsg;
21
+
25
22
  //# sourceMappingURL=devMsg.cjs.map
@@ -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 *\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,wBAAQ,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 * \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,25 +1,22 @@
1
1
  import { version } from "../package.js";
2
-
3
2
  //#region src/lib/devMsg.ts
4
3
  /**
5
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
6
5
  *
7
6
  * @example
7
+ * ```ts
8
+ * devMsg("missing-param")
9
+ * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
10
+ * ```
8
11
  *
9
- * ```ts
10
- * devMsg("missing-param");
11
- * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
12
- * ```
13
- *
14
- * @param slug - Slug for the message. This corresponds to a Markdown file in
15
- * the Git repository's `/messages` directory.
16
- *
12
+ * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
13
+ * `/messages` directory.
17
14
  * @returns The `prismic.dev/msg` URL for the given slug.
18
15
  */
19
16
  const devMsg = (slug) => {
20
17
  return `https://prismic.dev/msg/next/v${version}/${slug}`;
21
18
  };
22
-
23
19
  //#endregion
24
20
  export { devMsg };
21
+
25
22
  //# sourceMappingURL=devMsg.js.map
@@ -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 *\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
+ {"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,26 +1,21 @@
1
-
2
1
  //#region src/lib/resolveDefaultExport.ts
3
2
  /**
4
- * Resolves a module's default export. The module may provide its default export
5
- * as a `default` property on an object. This happens when named and default
6
- * exports are mixed in modules.
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.
7
5
  *
8
- * In ES Modules, mixing is fine since the module resolver can distinguish
9
- * default and named exports. In transpiled modules, however, all exports are
10
- * put into a single object, and the default export is provided at a property
11
- * called `default`.
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`.
12
9
  *
13
- * This helper is needed by Next.js uses CJS files with named and default
14
- * exports.
10
+ * This helper is needed by Next.js uses CJS files with named and default exports.
15
11
  *
16
- * This helper _should_ be a temporary hack until Next.js and Node.js resolve
17
- * their ESM difficulties. This will likely not be removed any time soon,
18
- * unfortunately.
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.
19
14
  */
20
15
  function resolveDefaultExport(mod) {
21
16
  return "default" in mod ? mod.default : mod;
22
17
  }
23
-
24
18
  //#endregion
25
19
  exports.resolveDefaultExport = resolveDefaultExport;
20
+
26
21
  //# sourceMappingURL=resolveDefaultExport.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDefaultExport.cjs","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export\n * as a `default` property on an object. This happens when named and default\n * exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish\n * default and named exports. In transpiled modules, however, all exports are\n * put into a single object, and the default export is provided at a property\n * called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default\n * exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve\n * their ESM difficulties. This will likely not be removed any time soon,\n * unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,qBAAwB,KAAW;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
1
+ {"version":3,"file":"resolveDefaultExport.cjs","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export as a `default`\n * property on an object. This happens when named and default exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish default and named\n * exports. In transpiled modules, however, all exports are put into a single object, and the\n * default export is provided at a property called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM\n * difficulties. This will likely not be removed any time soon, unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,qBAAwB,KAAW;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
@@ -1,25 +1,21 @@
1
1
  //#region src/lib/resolveDefaultExport.ts
2
2
  /**
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.
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.
6
5
  *
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`.
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`.
11
9
  *
12
- * This helper is needed by Next.js uses CJS files with named and default
13
- * exports.
10
+ * This helper is needed by Next.js uses CJS files with named and default exports.
14
11
  *
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.
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.
18
14
  */
19
15
  function resolveDefaultExport(mod) {
20
16
  return "default" in mod ? mod.default : mod;
21
17
  }
22
-
23
18
  //#endregion
24
19
  export { resolveDefaultExport };
20
+
25
21
  //# sourceMappingURL=resolveDefaultExport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDefaultExport.js","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export\n * as a `default` property on an object. This happens when named and default\n * exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish\n * default and named exports. In transpiled modules, however, all exports are\n * put into a single object, and the default export is provided at a property\n * called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default\n * exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve\n * their ESM difficulties. This will likely not be removed any time soon,\n * unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAgB,qBAAwB,KAAW;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
1
+ {"version":3,"file":"resolveDefaultExport.js","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export as a `default`\n * property on an object. This happens when named and default exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish default and named\n * exports. In transpiled modules, however, all exports are put into a single object, and the\n * default export is provided at a property called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM\n * difficulties. This will likely not be removed any time soon, unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,qBAAwB,KAAW;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
package/dist/package.cjs CHANGED
@@ -1,12 +1,11 @@
1
-
2
1
  //#region package.json
3
- var version = "2.2.2";
4
-
2
+ var version = "2.2.3-pr.136.19d76d2";
5
3
  //#endregion
6
- Object.defineProperty(exports, 'version', {
7
- enumerable: true,
8
- get: function () {
9
- return version;
10
- }
4
+ Object.defineProperty(exports, "version", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return version;
8
+ }
11
9
  });
10
+
12
11
  //# sourceMappingURL=package.cjs.map
package/dist/package.js CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
- var version = "2.2.2";
3
-
2
+ var version = "2.2.3-pr.136.19d76d2";
4
3
  //#endregion
5
4
  export { version };
5
+
6
6
  //# sourceMappingURL=package.js.map
@@ -1,24 +1,22 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- let next_script = require("next/script");
3
- next_script = require_rolldown_runtime.__toESM(next_script);
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
4
2
  let _prismicio_client = require("@prismicio/client");
3
+ let next_script_js = require("next/script.js");
4
+ next_script_js = require_runtime.__toESM(next_script_js);
5
5
  let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
- let next_router = require("next/router");
8
-
7
+ let next_router_js = require("next/router.js");
9
8
  //#region src/pages/PrismicPreview.tsx
10
9
  /**
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.
10
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
11
+ * send events to the browser, such as on preview updates and exiting, this component will
12
+ * automatically refresh the page with the changes.
15
13
  *
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.
14
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
15
+ * rendered on every page.
18
16
  */
19
17
  const PrismicPreview = (props) => {
20
18
  const { repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview", children } = props;
21
- const router = (0, next_router.useRouter)();
19
+ const router = (0, next_router_js.useRouter)();
22
20
  const toolbarSrc = (0, _prismicio_client.getToolbarSrc)(repositoryName);
23
21
  (0, react.useEffect)(() => {
24
22
  const controller = new AbortController();
@@ -61,7 +59,7 @@ const PrismicPreview = (props) => {
61
59
  repositoryName,
62
60
  router
63
61
  ]);
64
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(next_script.default, {
62
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(next_script_js.default, {
65
63
  src: toolbarSrc,
66
64
  strategy: "lazyOnload"
67
65
  })] });
@@ -70,7 +68,7 @@ function getPreviewCookieRepositoryName() {
70
68
  const cookie = window.document.cookie.split("; ").find((row) => row.startsWith(`${_prismicio_client.cookie.preview}=`))?.split("=")[1];
71
69
  return (decodeURIComponent(cookie ?? "").match(/"([^"]+)\.prismic\.io"/) || [])[1];
72
70
  }
73
-
74
71
  //#endregion
75
72
  exports.PrismicPreview = PrismicPreview;
73
+
76
74
  //# sourceMappingURL=PrismicPreview.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.cjs","names":["Script","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\nimport type { FC } from \"react\";\nimport { type ReactNode, useEffect } from \"react\";\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> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props;\n\n\tconst router = useRouter();\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName);\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\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\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(\n\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tfetch(router.basePath + 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}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tstart();\n\t\t}\n\n\t\tfunction start() {\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 at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\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 or update 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}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false });\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n};\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1];\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) ||\n\t\t[])[1];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,qCAAoB;CAE1B,MAAM,kDAA2B,eAAe;AAEhD,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;AAQF,MACC,OAAO,SAAS,KAAK,WACpB,OAAO,SAAS,SAAS,OAAO,SAChC,IACD,gCAAgC,KAAK,kBACrC,CAAC,OAAO,UAER,QAAO;EAGR,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,SAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpE,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,UAAO;;EAGR,SAAS,QAAQ;AAKhB,SAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;IACnB,CAAC,CACA,MAAM,QAAQ;AACd,QAAI,IAAI,SAAS,kBAAkB;AAClC,aAAQ,MACP,mEAAmE,iBAAiB,mBACpF;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,UAAU;AAClB,UAAO,QAAQ,OAAO,QAAQ,QAAW,EAAE,QAAQ,OAAO,CAAC;;AAG5D,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAkB;EAAgB;EAAO,CAAC;AAE9D,QACC,qFACE,UACD,2CAACA;EAAO,KAAK;EAAY,UAAS;GAAe,IAC/C;;AAIL,SAAS,iCAAiC;CACzC,MAAM,SAAS,OAAO,SAAS,OAC7B,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,yBAAc,QAAQ,GAAG,CAAC,EACzD,MAAM,IAAI,CAAC;AAEd,SAAQ,mBAAmB,UAAU,GAAG,CAAC,MAAM,yBAAyB,IACvE,EAAE,EAAE"}
1
+ {"version":3,"file":"PrismicPreview.cjs","names":["Script","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\"\nimport { useRouter } from \"next/router\"\nimport Script from \"next/script\"\nimport type { FC } from \"react\"\nimport { type ReactNode, useEffect } from \"react\"\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered using this\n\t * repository.\n\t */\n\trepositoryName: string\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be\n\t * 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`). This URL will be\n\t * 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 the Prismic Toolbar\n * send events to the browser, such as on preview updates and exiting, this component will\n * automatically refresh the page with the changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's tree. It must be\n * rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props\n\n\tconst router = useRouter()\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName)\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\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\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(window.location.origin + router.basePath) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart()\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tfetch(router.basePath + 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}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tstart()\n\t\t}\n\n\t\tfunction start() {\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 at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\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 or update 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}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false })\n\t\t}\n\n\t\treturn () => controller.abort()\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router])\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t)\n}\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1]\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,UAAA,GAAA,eAAA,YAAoB;CAE1B,MAAM,cAAA,GAAA,kBAAA,eAA2B,eAAe;AAEhD,EAAA,GAAA,MAAA,iBAAgB;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;AAQF,MACC,OAAO,SAAS,KAAK,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS,IACzE,gCAAgC,KAAK,kBACrC,CAAC,OAAO,UAER,QAAO;EAGR,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,SAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpE,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,UAAO;;EAGR,SAAS,QAAQ;AAKhB,SAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;IACnB,CAAC,CACA,MAAM,QAAQ;AACd,QAAI,IAAI,SAAS,kBAAkB;AAClC,aAAQ,MACP,mEAAmE,iBAAiB,mBACpF;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,UAAU;AAClB,UAAO,QAAQ,OAAO,QAAQ,KAAA,GAAW,EAAE,QAAQ,OAAO,CAAC;;AAG5D,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAkB;EAAgB;EAAO,CAAC;AAE9D,QACC,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACE,UACD,iBAAA,GAAA,kBAAA,KAACA,eAAAA,SAAD;EAAQ,KAAK;EAAY,UAAS;EAAe,CAAA,CAC/C,EAAA,CAAA;;AAIL,SAAS,iCAAiC;CACzC,MAAM,SAAS,OAAO,SAAS,OAC7B,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,kBAAAA,OAAc,QAAQ,GAAG,CAAC,EACzD,MAAM,IAAI,CAAC;AAEd,SAAQ,mBAAmB,UAAU,GAAG,CAAC,MAAM,yBAAyB,IAAI,EAAE,EAAE"}
@@ -4,31 +4,29 @@ import { FC, ReactNode } from "react";
4
4
  /** Props for `<PrismicPreview>`. */
5
5
  type PrismicPreviewProps = {
6
6
  /**
7
- * The name of your Prismic repository. A Prismic Toolbar will be registered
8
- * using this repository.
7
+ * The name of your Prismic repository. A Prismic Toolbar will be registered using this
8
+ * repository.
9
9
  */
10
10
  repositoryName: string;
11
11
  /**
12
- * The URL of your app's Prismic preview endpoint (default: `/api/preview`).
13
- * This URL will be fetched on preview update events.
12
+ * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be
13
+ * fetched on preview update events.
14
14
  */
15
15
  updatePreviewURL?: string;
16
16
  /**
17
- * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
18
- * This URL will be fetched on preview exit events.
17
+ * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be
18
+ * fetched on preview exit events.
19
19
  */
20
- exitPreviewURL?: string;
21
- /** Children to render adjacent to the Prismic Toolbar. */
20
+ exitPreviewURL?: string; /** Children to render adjacent to the Prismic Toolbar. */
22
21
  children?: ReactNode;
23
22
  };
24
23
  /**
25
- * React component that sets up Prismic Previews using the Prismic Toolbar. When
26
- * the Prismic Toolbar send events to the browser, such as on preview updates
27
- * and exiting, this component will automatically refresh the page with the
28
- * changes.
24
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
25
+ * send events to the browser, such as on preview updates and exiting, this component will
26
+ * automatically refresh the page with the changes.
29
27
  *
30
- * This component can be wrapped around your app or added anywhere in your app's
31
- * tree. It must be rendered on every page.
28
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
29
+ * rendered on every page.
32
30
  */
33
31
  declare const PrismicPreview: FC<PrismicPreviewProps>;
34
32
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreview.d.cts","names":[],"sources":["../../src/pages/PrismicPreview.tsx"],"mappings":";;;;KAOY,mBAAA;EAAmB;;;;EAK9B,cAAA;EAYA;;;;EANA,gBAAA;EAoBY;;;;EAdZ,cAAA;EAGA,QAAA,GAAW,SAAA;AAAA;;;;;;;;;cAWC,cAAA,EAAgB,EAAA,CAAG,mBAAA"}
@@ -4,31 +4,29 @@ import { FC, ReactNode } from "react";
4
4
  /** Props for `<PrismicPreview>`. */
5
5
  type PrismicPreviewProps = {
6
6
  /**
7
- * The name of your Prismic repository. A Prismic Toolbar will be registered
8
- * using this repository.
7
+ * The name of your Prismic repository. A Prismic Toolbar will be registered using this
8
+ * repository.
9
9
  */
10
10
  repositoryName: string;
11
11
  /**
12
- * The URL of your app's Prismic preview endpoint (default: `/api/preview`).
13
- * This URL will be fetched on preview update events.
12
+ * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be
13
+ * fetched on preview update events.
14
14
  */
15
15
  updatePreviewURL?: string;
16
16
  /**
17
- * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
18
- * This URL will be fetched on preview exit events.
17
+ * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be
18
+ * fetched on preview exit events.
19
19
  */
20
- exitPreviewURL?: string;
21
- /** Children to render adjacent to the Prismic Toolbar. */
20
+ exitPreviewURL?: string; /** Children to render adjacent to the Prismic Toolbar. */
22
21
  children?: ReactNode;
23
22
  };
24
23
  /**
25
- * React component that sets up Prismic Previews using the Prismic Toolbar. When
26
- * the Prismic Toolbar send events to the browser, such as on preview updates
27
- * and exiting, this component will automatically refresh the page with the
28
- * changes.
24
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
25
+ * send events to the browser, such as on preview updates and exiting, this component will
26
+ * automatically refresh the page with the changes.
29
27
  *
30
- * This component can be wrapped around your app or added anywhere in your app's
31
- * tree. It must be rendered on every page.
28
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
29
+ * rendered on every page.
32
30
  */
33
31
  declare const PrismicPreview: FC<PrismicPreviewProps>;
34
32
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreview.d.ts","names":[],"sources":["../../src/pages/PrismicPreview.tsx"],"mappings":";;;;KAOY,mBAAA;EAAmB;;;;EAK9B,cAAA;EAYA;;;;EANA,gBAAA;EAoBY;;;;EAdZ,cAAA;EAGA,QAAA,GAAW,SAAA;AAAA;;;;;;;;;cAWC,cAAA,EAAgB,EAAA,CAAG,mBAAA"}
@@ -1,18 +1,16 @@
1
- import Script from "next/script";
2
1
  import { cookie, getToolbarSrc } from "@prismicio/client";
2
+ import Script from "next/script.js";
3
3
  import { useEffect } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import { useRouter } from "next/router";
6
-
5
+ import { useRouter } from "next/router.js";
7
6
  //#region src/pages/PrismicPreview.tsx
8
7
  /**
9
- * React component that sets up Prismic Previews using the Prismic Toolbar. When
10
- * the Prismic Toolbar send events to the browser, such as on preview updates
11
- * and exiting, this component will automatically refresh the page with the
12
- * changes.
8
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
9
+ * send events to the browser, such as on preview updates and exiting, this component will
10
+ * automatically refresh the page with the changes.
13
11
  *
14
- * This component can be wrapped around your app or added anywhere in your app's
15
- * tree. It must be rendered on every page.
12
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
13
+ * rendered on every page.
16
14
  */
17
15
  const PrismicPreview = (props) => {
18
16
  const { repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview", children } = props;
@@ -68,7 +66,7 @@ function getPreviewCookieRepositoryName() {
68
66
  const cookie$1 = window.document.cookie.split("; ").find((row) => row.startsWith(`${cookie.preview}=`))?.split("=")[1];
69
67
  return (decodeURIComponent(cookie$1 ?? "").match(/"([^"]+)\.prismic\.io"/) || [])[1];
70
68
  }
71
-
72
69
  //#endregion
73
70
  export { PrismicPreview };
71
+
74
72
  //# sourceMappingURL=PrismicPreview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.js","names":["cookie","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\nimport type { FC } from \"react\";\nimport { type ReactNode, useEffect } from \"react\";\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> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props;\n\n\tconst router = useRouter();\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName);\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\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\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(\n\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tfetch(router.basePath + 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}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tstart();\n\t\t}\n\n\t\tfunction start() {\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 at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\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 or update 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}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false });\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n};\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1];\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) ||\n\t\t[])[1];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,SAAS,WAAW;CAE1B,MAAM,aAAa,cAAc,eAAe;AAEhD,iBAAgB;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;AAQF,MACC,OAAO,SAAS,KAAK,WACpB,OAAO,SAAS,SAAS,OAAO,SAChC,IACD,gCAAgC,KAAK,kBACrC,CAAC,OAAO,UAER,QAAO;EAGR,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,SAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpE,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,UAAO;;EAGR,SAAS,QAAQ;AAKhB,SAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;IACnB,CAAC,CACA,MAAM,QAAQ;AACd,QAAI,IAAI,SAAS,kBAAkB;AAClC,aAAQ,MACP,mEAAmE,iBAAiB,mBACpF;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,UAAU;AAClB,UAAO,QAAQ,OAAO,QAAQ,QAAW,EAAE,QAAQ,OAAO,CAAC;;AAG5D,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAkB;EAAgB;EAAO,CAAC;AAE9D,QACC,4CACE,UACD,oBAAC;EAAO,KAAK;EAAY,UAAS;GAAe,IAC/C;;AAIL,SAAS,iCAAiC;CACzC,MAAMA,WAAS,OAAO,SAAS,OAC7B,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,OAAc,QAAQ,GAAG,CAAC,EACzD,MAAM,IAAI,CAAC;AAEd,SAAQ,mBAAmBD,YAAU,GAAG,CAAC,MAAM,yBAAyB,IACvE,EAAE,EAAE"}
1
+ {"version":3,"file":"PrismicPreview.js","names":["cookie","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\"\nimport { useRouter } from \"next/router\"\nimport Script from \"next/script\"\nimport type { FC } from \"react\"\nimport { type ReactNode, useEffect } from \"react\"\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered using this\n\t * repository.\n\t */\n\trepositoryName: string\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be\n\t * 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`). This URL will be\n\t * 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 the Prismic Toolbar\n * send events to the browser, such as on preview updates and exiting, this component will\n * automatically refresh the page with the changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's tree. It must be\n * rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props\n\n\tconst router = useRouter()\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName)\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\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\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(window.location.origin + router.basePath) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart()\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tfetch(router.basePath + 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}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tstart()\n\t\t}\n\n\t\tfunction start() {\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 at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\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 or update 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}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false })\n\t\t}\n\n\t\treturn () => controller.abort()\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router])\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t)\n}\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1]\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,SAAS,WAAW;CAE1B,MAAM,aAAa,cAAc,eAAe;AAEhD,iBAAgB;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;AAQF,MACC,OAAO,SAAS,KAAK,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS,IACzE,gCAAgC,KAAK,kBACrC,CAAC,OAAO,UAER,QAAO;EAGR,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,SAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpE,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,UAAO;;EAGR,SAAS,QAAQ;AAKhB,SAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;IACnB,CAAC,CACA,MAAM,QAAQ;AACd,QAAI,IAAI,SAAS,kBAAkB;AAClC,aAAQ,MACP,mEAAmE,iBAAiB,mBACpF;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,UAAU;AAClB,UAAO,QAAQ,OAAO,QAAQ,KAAA,GAAW,EAAE,QAAQ,OAAO,CAAC;;AAG5D,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAkB;EAAgB;EAAO,CAAC;AAE9D,QACC,qBAAA,UAAA,EAAA,UAAA,CACE,UACD,oBAAC,QAAD;EAAQ,KAAK;EAAY,UAAS;EAAe,CAAA,CAC/C,EAAA,CAAA;;AAIL,SAAS,iCAAiC;CACzC,MAAMA,WAAS,OAAO,SAAS,OAC7B,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,OAAc,QAAQ,GAAG,CAAC,EACzD,MAAM,IAAI,CAAC;AAEd,SAAQ,mBAAmBD,YAAU,GAAG,CAAC,MAAM,yBAAyB,IAAI,EAAE,EAAE"}
@@ -1,14 +1,13 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_SliceSimulatorWrapper = require('../SliceSimulatorWrapper.cjs');
1
+ require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_SliceSimulatorWrapper = require("../SliceSimulatorWrapper.cjs");
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
  let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
6
-
7
6
  //#region src/pages/SliceSimulator.tsx
8
7
  const simulatorManager = new _prismicio_simulator_kit.SimulatorManager();
9
8
  /**
10
- * Simulate slices in isolation. The slice simulator enables live slice
11
- * development in Slice Machine and live previews in the Page Builder.
9
+ * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
10
+ * and live previews in the Page Builder.
12
11
  */
13
12
  const SliceSimulator = ({ background, zIndex, className, sliceZone: SliceZoneComp }) => {
14
13
  const [slices, setSlices] = (0, react.useState)(() => (0, _prismicio_simulator_kit.getDefaultSlices)());
@@ -35,7 +34,7 @@ const SliceSimulator = ({ background, zIndex, className, sliceZone: SliceZoneCom
35
34
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliceZoneComp, { slices })
36
35
  });
37
36
  };
38
-
39
37
  //#endregion
40
38
  exports.SliceSimulator = SliceSimulator;
39
+
41
40
  //# sourceMappingURL=SliceSimulator.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SliceSimulator.cjs","names":["SimulatorManager","StateEventType","SliceSimulatorWrapper"],"sources":["../../src/pages/SliceSimulator.tsx"],"sourcesContent":["import { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\";\nimport {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\";\nimport type {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n} from \"@prismicio/simulator/kit\";\nimport { useEffect, useState } from \"react\";\nimport type { ComponentType, FC } from \"react\";\n\nconst simulatorManager = new SimulatorManager();\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"];\n};\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t *\n\t * ```tsx\n\t * import { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t * import { SliceZone } from \"@prismicio/react\";\n\t *\n\t * import { components } from \"../slices\";\n\t *\n\t * <SliceSimulator\n\t * \tsliceZone={({ slices }) => (\n\t * \t\t<SliceZone slices={slices} components={components} />\n\t * \t)}\n\t * />;\n\t * ```\n\t */\n\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>;\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\tbackground,\n\tzIndex,\n\tclassName,\n\tsliceZone: SliceZoneComp,\n}) => {\n\tconst [slices, setSlices] = useState(() => getDefaultSlices());\n\tconst [message, setMessage] = useState(() => getDefaultMessage());\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices);\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(_message) => {\n\t\t\t\tsetMessage(_message);\n\t\t\t},\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}, []);\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t);\n};\n"],"mappings":";;;;;;;AAcA,MAAM,mBAAmB,IAAIA,2CAAkB;;;;;AAiC/C,MAAa,kBAA2C,EACvD,YACA,QACA,WACA,WAAW,oBACN;CACL,MAAM,CAAC,QAAQ,uFAA8C,CAAC;CAC9D,MAAM,CAAC,SAAS,yFAAgD,CAAC;AAEjE,4BAAgB;AACf,mBAAiB,MAAM,GACtBC,wCAAe,SACd,YAAY;AACZ,aAAU,QAAQ;KAEnB,mBACA;AACD,mBAAiB,MAAM,GACtBA,wCAAe,UACd,aAAa;AACb,cAAW,SAAS;KAErB,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAIA,wCAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAIA,wCAAe,SAAS,oBAAoB;;IAEtE,EAAE,CAAC;AAEN,QACC,2CAACC;EACS;EACT,WAAW,OAAO,SAAS;EACf;EACJ;EACG;YAEX,2CAAC,iBAAsB,SAAU;GACV"}
1
+ {"version":3,"file":"SliceSimulator.cjs","names":["SimulatorManager","StateEventType","SliceSimulatorWrapper"],"sources":["../../src/pages/SliceSimulator.tsx"],"sourcesContent":["import {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\"\nimport type {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n} from \"@prismicio/simulator/kit\"\nimport { useEffect, useState } from \"react\"\nimport type { ComponentType, FC } from \"react\"\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\"\n\nconst simulatorManager = new SimulatorManager()\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"]\n}\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t * \t```tsx\n\t * \timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\"\n\t * \timport { SliceZone } from \"@prismicio/react\"\n\t *\n\t * \timport { components } from \"../slices\"\n\t *\n\t * \t;<SliceSimulator\n\t * \t\tsliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}\n\t * \t/>\n\t * \t```\n\t */\n\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>\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\tbackground,\n\tzIndex,\n\tclassName,\n\tsliceZone: SliceZoneComp,\n}) => {\n\tconst [slices, setSlices] = useState(() => getDefaultSlices())\n\tconst [message, setMessage] = useState(() => getDefaultMessage())\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices)\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(_message) => {\n\t\t\t\tsetMessage(_message)\n\t\t\t},\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}, [])\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t)\n}\n"],"mappings":";;;;;;AAeA,MAAM,mBAAmB,IAAIA,yBAAAA,kBAAkB;;;;;AA8B/C,MAAa,kBAA2C,EACvD,YACA,QACA,WACA,WAAW,oBACN;CACL,MAAM,CAAC,QAAQ,cAAA,GAAA,MAAA,iBAAA,GAAA,yBAAA,mBAA8C,CAAC;CAC9D,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,iBAAA,GAAA,yBAAA,oBAAgD,CAAC;AAEjE,EAAA,GAAA,MAAA,iBAAgB;AACf,mBAAiB,MAAM,GACtBC,yBAAAA,eAAe,SACd,YAAY;AACZ,aAAU,QAAQ;KAEnB,mBACA;AACD,mBAAiB,MAAM,GACtBA,yBAAAA,eAAe,UACd,aAAa;AACb,cAAW,SAAS;KAErB,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,SAAS,oBAAoB;;IAEtE,EAAE,CAAC;AAEN,QACC,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD;EACU;EACT,WAAW,OAAO,SAAS;EACf;EACJ;EACG;YAEX,iBAAA,GAAA,kBAAA,KAAC,eAAD,EAAuB,QAAU,CAAA;EACV,CAAA"}
@@ -10,26 +10,23 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
10
10
  * React component to render simulated Slices.
11
11
  *
12
12
  * @example
13
+ * ```tsx
14
+ * import { SliceSimulator } from "@slicemachine/adapter-next/simulator"
15
+ * import { SliceZone } from "@prismicio/react"
13
16
  *
14
- * ```tsx
15
- * import { SliceSimulator } from "@slicemachine/adapter-next/simulator";
16
- * import { SliceZone } from "@prismicio/react";
17
+ * import { components } from "../slices"
17
18
  *
18
- * import { components } from "../slices";
19
- *
20
- * <SliceSimulator
21
- * sliceZone={({ slices }) => (
22
- * <SliceZone slices={slices} components={components} />
23
- * )}
24
- * />;
25
- * ```
19
+ * ;<SliceSimulator
20
+ * sliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}
21
+ * />
22
+ * ```
26
23
  */
27
24
  sliceZone: ComponentType<SliceSimulatorSliceZoneProps>;
28
25
  className?: string;
29
26
  };
30
27
  /**
31
- * Simulate slices in isolation. The slice simulator enables live slice
32
- * development in Slice Machine and live previews in the Page Builder.
28
+ * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
29
+ * and live previews in the Page Builder.
33
30
  */
34
31
  declare const SliceSimulator: FC<SliceSimulatorProps$1>;
35
32
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceSimulator.d.cts","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"mappings":";;;;KAiBY,4BAAA;EACX,MAAA,EAAQ,mBAAA;AAAA;AAAA,KAGG,qBAAA,GAAsB,mBAAA;;;;AAAlC;;;;;;;;;;;;EAgBC,SAAA,EAAW,aAAA,CAAc,4BAAA;EACzB,SAAA;AAAA;AAOD;;;;AAAA,cAAa,cAAA,EAAgB,EAAA,CAAG,qBAAA"}
@@ -10,26 +10,23 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
10
10
  * React component to render simulated Slices.
11
11
  *
12
12
  * @example
13
+ * ```tsx
14
+ * import { SliceSimulator } from "@slicemachine/adapter-next/simulator"
15
+ * import { SliceZone } from "@prismicio/react"
13
16
  *
14
- * ```tsx
15
- * import { SliceSimulator } from "@slicemachine/adapter-next/simulator";
16
- * import { SliceZone } from "@prismicio/react";
17
+ * import { components } from "../slices"
17
18
  *
18
- * import { components } from "../slices";
19
- *
20
- * <SliceSimulator
21
- * sliceZone={({ slices }) => (
22
- * <SliceZone slices={slices} components={components} />
23
- * )}
24
- * />;
25
- * ```
19
+ * ;<SliceSimulator
20
+ * sliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}
21
+ * />
22
+ * ```
26
23
  */
27
24
  sliceZone: ComponentType<SliceSimulatorSliceZoneProps>;
28
25
  className?: string;
29
26
  };
30
27
  /**
31
- * Simulate slices in isolation. The slice simulator enables live slice
32
- * development in Slice Machine and live previews in the Page Builder.
28
+ * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
29
+ * and live previews in the Page Builder.
33
30
  */
34
31
  declare const SliceSimulator: FC<SliceSimulatorProps$1>;
35
32
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceSimulator.d.ts","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"mappings":";;;;KAiBY,4BAAA;EACX,MAAA,EAAQ,mBAAA;AAAA;AAAA,KAGG,qBAAA,GAAsB,mBAAA;;;;AAAlC;;;;;;;;;;;;EAgBC,SAAA,EAAW,aAAA,CAAc,4BAAA;EACzB,SAAA;AAAA;AAOD;;;;AAAA,cAAa,cAAA,EAAgB,EAAA,CAAG,qBAAA"}
@@ -2,12 +2,11 @@ import { SliceSimulatorWrapper } from "../SliceSimulatorWrapper.js";
2
2
  import { useEffect, useState } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { SimulatorManager, StateEventType, getDefaultMessage, getDefaultSlices } from "@prismicio/simulator/kit";
5
-
6
5
  //#region src/pages/SliceSimulator.tsx
7
6
  const simulatorManager = new SimulatorManager();
8
7
  /**
9
- * Simulate slices in isolation. The slice simulator enables live slice
10
- * development in Slice Machine and live previews in the Page Builder.
8
+ * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
9
+ * and live previews in the Page Builder.
11
10
  */
12
11
  const SliceSimulator = ({ background, zIndex, className, sliceZone: SliceZoneComp }) => {
13
12
  const [slices, setSlices] = useState(() => getDefaultSlices());
@@ -34,7 +33,7 @@ const SliceSimulator = ({ background, zIndex, className, sliceZone: SliceZoneCom
34
33
  children: /* @__PURE__ */ jsx(SliceZoneComp, { slices })
35
34
  });
36
35
  };
37
-
38
36
  //#endregion
39
37
  export { SliceSimulator };
38
+
40
39
  //# sourceMappingURL=SliceSimulator.js.map