@prismicio/react 3.5.0 → 3.5.1-canary.0bf029d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,8 +90,8 @@ limitations under the License.
90
90
  [npm-version-href]: https://npmjs.com/package/@prismicio/react
91
91
  [npm-downloads-src]: https://img.shields.io/npm/dm/@prismicio/react.svg
92
92
  [npm-downloads-href]: https://npmjs.com/package/@prismicio/react
93
- [github-actions-ci-src]: https://github.com/prismicio/prismic-react/workflows/ci/badge.svg
94
- [github-actions-ci-href]: https://github.com/prismicio/prismic-react/actions?query=workflow%3Aci
93
+ [github-actions-ci-src]: https://github.com/prismicio/prismic-react/actions/workflows/validate.yml/badge.svg
94
+ [github-actions-ci-href]: https://github.com/prismicio/prismic-react/actions/workflows/validate.yml
95
95
  [codecov-src]: https://img.shields.io/codecov/c/github/prismicio/prismic-react.svg
96
96
  [codecov-href]: https://codecov.io/gh/prismicio/prismic-react
97
97
  [conventional-commits-src]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
@@ -1,6 +1,5 @@
1
1
  import { ImageFieldImage, asImagePixelDensitySrcSet, asImageWidthSrcSet } from "@prismicio/client";
2
2
  import { ComponentProps, FC, ReactNode } from "react";
3
- //#region src/PrismicImage.d.ts
4
3
  type ImgixURLParams = Omit<NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>, "widths"> & Omit<NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>, "pixelDensities">;
5
4
  /** Props for `<PrismicImage>`. */
6
5
  export type PrismicImageProps = Omit<ComponentProps<"img">, "src" | "srcset" | "alt"> & {
@@ -65,5 +64,5 @@ export type PrismicImageProps = Omit<ComponentProps<"img">, "src" | "srcset" | "
65
64
  * @see Learn how to optimize images with imgix, use responsive images, and use framework-specific image components: {@link https://prismic.io/docs/fields/image}
66
65
  */
67
66
  export declare const PrismicImage: FC<PrismicImageProps>;
68
- //#endregion
67
+ export {};
69
68
  //# sourceMappingURL=PrismicImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicImage.d.ts","names":[],"sources":["../src/PrismicImage.tsx"],"mappings":";;;KAWK,iBAAiB,KAAK,YAAY,kBAAkB,qCACxD,KAAK,YAAY,kBAAkB;;YAGxB,oBAAoB,KAAK;;EAEpC,OAAO;;;;;;EAOP,iBAAiB,WAAW,iBAAiB,eAAe;;;;;;EAO5D;;;;;;;EAQA;;;;;EAMA,WAAW;;;;;;;;;;;EAYR,SAAS,YAAY,kBAAkB;;EAEvC;;;EAIA;;;;;;;EAOA,gBACG,YAAY,kBAAkB;;;;;;;;;;;;qBAexB,cAAc,GAAG"}
1
+ {"version":3,"file":"PrismicImage.d.ts","names":[],"sources":["../src/PrismicImage.tsx"],"mappings":";;KAWK,iBAAiB,KAAK,YAAY,kBAAkB,qCACxD,KAAK,YAAY,kBAAkB;;YAGxB,oBAAoB,KAAK;;EAEpC,OAAO;;;;;;EAOP,iBAAiB,WAAW,iBAAiB,eAAe;;;;;;EAO5D;;;;;;;EAQA;;;;;EAMA,WAAW;;;;;;;;;;;EAYR,SAAS,YAAY,kBAAkB;;EAEvC;;;EAIA;;;;;;;EAOA,gBACG,YAAY,kBAAkB;;;;;;;;;;;;qBAexB,cAAc,GAAG"}
@@ -1,9 +1,9 @@
1
- import { devMsg } from "./lib/devMsg.js";
2
1
  import { asImagePixelDensitySrcSet, asImageWidthSrcSet, isFilled } from "@prismicio/client";
3
2
  import { DEV } from "esm-env";
4
3
  import { forwardRef } from "react";
4
+ import { devMsg } from "./lib/devMsg.js";
5
5
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
6
- //#region src/PrismicImage.tsx
6
+ // src/PrismicImage.tsx
7
7
  /**
8
8
  * Renders an optimized image from a Prismic image field.
9
9
  *
@@ -49,7 +49,6 @@ const PrismicImage = forwardRef(function PrismicImage(props, ref) {
49
49
  ...restProps
50
50
  });
51
51
  });
52
- //#endregion
53
52
  export { PrismicImage };
54
53
 
55
54
  //# sourceMappingURL=PrismicImage.js.map
@@ -1,6 +1,5 @@
1
1
  import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
2
2
  import { ComponentProps, ComponentType, ForwardedRef, HTMLAttributeAnchorTarget, ReactNode } from "react";
3
- //#region src/PrismicLink.d.ts
4
3
  /** The default component rendered for internal and external links. */
5
4
  declare const defaultComponent = "a";
6
5
  /** Props provided to a component when rendered with `<PrismicLink>`. */
@@ -76,5 +75,5 @@ export type PrismicLinkProps<InternalComponentProps = ComponentProps<typeof defa
76
75
  export declare const PrismicLink: <InternalComponentProps = ComponentProps<typeof defaultComponent>, ExternalComponentProps = ComponentProps<typeof defaultComponent>>(props: PrismicLinkProps<InternalComponentProps, ExternalComponentProps> & {
77
76
  ref?: ForwardedRef<Element>;
78
77
  }) => ReactNode;
79
- //#endregion
78
+ export {};
80
79
  //# sourceMappingURL=PrismicLink.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicLink.d.ts","names":[],"sources":["../src/PrismicLink.tsx"],"mappings":";;;;cAoBM;;iBAGW;;EAEhB;;;;;EAMA,SAAS;;;;;EAMT;;EAGA,WAAW;;YAGA,iBACX,yBAAyB,sBAAsB,mBAC/C,yBAAyB,sBAAsB,qBAC5C,KAAK,yBAAyB;;;;;;EAMjC,eAAe;;;;;;;;;EAUf,eAAe;;;;;;;EAQf,oBAAoB,cAAc;;EAGlC,oBAAoB,cAAc;;;;;EAMlC,WAAW;;EAGR,UAAU;EACV;EACA;;EAGA,OAAO;EACP;EACA;;EAGA,MAAM;EACN,QAAQ;EACR;;;;;;;;;;;;qBAcS,cAkFZ,yBAAyB,sBAAsB,mBAC/C,yBAAyB,sBAAsB,mBAE/C,OAAO,iBAAiB,wBAAwB;EAC/C,MAAM,aAAa;MAEhB"}
1
+ {"version":3,"file":"PrismicLink.d.ts","names":[],"sources":["../src/PrismicLink.tsx"],"mappings":";;;cAoBM;;iBAGW;;EAEhB;;;;;EAMA,SAAS;;;;;EAMT;;EAGA,WAAW;;YAGA,iBACX,yBAAyB,sBAAsB,mBAC/C,yBAAyB,sBAAsB,qBAC5C,KAAK,yBAAyB;;;;;;EAMjC,eAAe;;;;;;;;;EAUf,eAAe;;;;;;;EAQf,oBAAoB,cAAc;;EAGlC,oBAAoB,cAAc;;;;;EAMlC,WAAW;;EAGR,UAAU;EACV;EACA;;EAGA,OAAO;EACP;EACA;;EAGA,MAAM;EACN,QAAQ;EACR;;;;;;;;;;;;qBAcS,cAkFZ,yBAAyB,sBAAsB,mBAC/C,yBAAyB,sBAAsB,mBAE/C,OAAO,iBAAiB,wBAAwB;EAC/C,MAAM,aAAa;MAEhB"}
@@ -1,9 +1,9 @@
1
- import { devMsg } from "./lib/devMsg.js";
2
1
  import { asLinkAttrs } from "@prismicio/client";
3
2
  import { DEV } from "esm-env";
4
3
  import { forwardRef } from "react";
4
+ import { devMsg } from "./lib/devMsg.js";
5
5
  import { jsx } from "react/jsx-runtime";
6
- //#region src/PrismicLink.tsx
6
+ // src/PrismicLink.tsx
7
7
  /** The default component rendered for internal and external links. */
8
8
  const defaultComponent = "a";
9
9
  /**
@@ -58,7 +58,6 @@ function isInternalURL(url) {
58
58
  const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
59
59
  return isInternal && !isSpecialLink;
60
60
  }
61
- //#endregion
62
61
  export { PrismicLink, isInternalURL };
63
62
 
64
63
  //# sourceMappingURL=PrismicLink.js.map
@@ -1,8 +1,7 @@
1
- import { LinkProps } from "./PrismicLink.js";
2
1
  import { LinkResolverFunction, RichTextField } from "@prismicio/client";
3
- import { ComponentType, FC, ReactNode } from "react";
4
2
  import { RichTextFunctionSerializer, RichTextMapSerializer } from "@prismicio/client/richtext";
5
- //#region src/PrismicRichText.d.ts
3
+ import { ComponentType, FC, ReactNode } from "react";
4
+ import { LinkProps } from "./PrismicLink.js";
6
5
  /**
7
6
  * A function mapping rich text block types to React Components. It is used to render rich text
8
7
  * fields.
@@ -89,5 +88,4 @@ export type PrismicRichTextProps = {
89
88
  * @see Learn how to style rich text, use custom components, and use labels for custom formatting: {@link https://prismic.io/docs/fields/rich-text}
90
89
  */
91
90
  export declare const PrismicRichText: FC<PrismicRichTextProps>;
92
- //#endregion
93
91
  //# sourceMappingURL=PrismicRichText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichText.d.ts","names":[],"sources":["../src/PrismicRichText.tsx"],"mappings":";;;;;;;;;;;YAgCY,wBAAwB,2BAA2B;;;;;;YAOnD,qBAAqB,sBAAsB;;YAG3C,mBAAmB;;YAGnB;;EAEX,OAAO;;;;;;;;;EAUP,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Bf,aAAa,qBAAqB;;;;;;EAOlC,wBAAwB,cAAc;;;;;;EAOtC,wBAAwB,cAAc;;;;;EAMtC,WAAW;;;;;;;;;;;;qBAkJC,iBAAiB,GAAG"}
1
+ {"version":3,"file":"PrismicRichText.d.ts","names":[],"sources":["../src/PrismicRichText.tsx"],"mappings":";;;;;;;;;;YAgCY,wBAAwB,2BAA2B;;;;;;YAOnD,qBAAqB,sBAAsB;;YAG3C,mBAAmB;;YAGnB;;EAEX,OAAO;;;;;;;;;EAUP,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Bf,aAAa,qBAAqB;;;;;;EAOlC,wBAAwB,cAAc;;;;;;EAOtC,wBAAwB,cAAc;;;;;EAMtC,WAAW;;;;;;;;;;;;qBAkJC,iBAAiB,GAAG"}
@@ -1,11 +1,11 @@
1
- import { devMsg } from "./lib/devMsg.js";
2
- import { PrismicLink } from "./PrismicLink.js";
3
1
  import { isFilled } from "@prismicio/client";
2
+ import { composeSerializers, serialize, wrapMapSerializer } from "@prismicio/client/richtext";
4
3
  import { DEV } from "esm-env";
5
4
  import { Fragment, cloneElement, isValidElement } from "react";
5
+ import { devMsg } from "./lib/devMsg.js";
6
+ import { PrismicLink } from "./PrismicLink.js";
6
7
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
7
- import { composeSerializers, serialize, wrapMapSerializer } from "@prismicio/client/richtext";
8
- //#region src/PrismicRichText.tsx
8
+ // src/PrismicRichText.tsx
9
9
  const getDir = (node) => {
10
10
  if ("direction" in node && node.direction === "rtl") return "rtl";
11
11
  };
@@ -125,7 +125,6 @@ const PrismicRichText = (props) => {
125
125
  if (!serialized) return fallback != null ? /* @__PURE__ */ jsx(Fragment$1, { children: fallback }) : null;
126
126
  return /* @__PURE__ */ jsx(Fragment$1, { children: serialized });
127
127
  };
128
- //#endregion
129
128
  export { PrismicRichText };
130
129
 
131
130
  //# sourceMappingURL=PrismicRichText.js.map
@@ -1,7 +1,6 @@
1
- import { JSXMapSerializer } from "./PrismicRichText.js";
2
1
  import { TableField, TableFieldBody, TableFieldBodyRow, TableFieldDataCell, TableFieldHead, TableFieldHeadRow, TableFieldHeaderCell } from "@prismicio/client";
3
2
  import { ComponentType, FC, ReactNode } from "react";
4
- //#region src/PrismicTable.d.ts
3
+ import { JSXMapSerializer } from "./PrismicRichText.js";
5
4
  type TableComponents = {
6
5
  table?: ComponentType<{
7
6
  table: TableField<"filled">;
@@ -63,5 +62,5 @@ export type PrismicTableProps = {
63
62
  * @see Learn how to style tables and customize table element components: {@link https://prismic.io/docs/fields/table}
64
63
  */
65
64
  export declare const PrismicTable: FC<PrismicTableProps>;
66
- //#endregion
65
+ export {};
67
66
  //# sourceMappingURL=PrismicTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicTable.d.ts","names":[],"sources":["../src/PrismicTable.tsx"],"mappings":";;;;KAcK;EACJ,QAAQ;IAAgB,OAAO;IAAsB,UAAU;;EAC/D,QAAQ;IAAgB,MAAM;IAAgB,UAAU;;EACxD,QAAQ;IAAgB,MAAM;IAAgB,UAAU;;EACxD,KAAK;IACJ,KAAK,oBAAoB;IACzB,UAAU;;EAEX,KAAK;IAAgB,MAAM;IAAsB,UAAU;;EAC3D,KAAK;IAAgB,MAAM;IAAoB,UAAU;;;;YAa9C;;EAEX,OAAO;;;;;;;;;;;;;;EAeP,aAAa,mBAAmB;;;;;EAMhC,WAAW;;;;;;;;;;;;qBAaC,cAAc,GAAG"}
1
+ {"version":3,"file":"PrismicTable.d.ts","names":[],"sources":["../src/PrismicTable.tsx"],"mappings":";;;KAcK;EACJ,QAAQ;IAAgB,OAAO;IAAsB,UAAU;;EAC/D,QAAQ;IAAgB,MAAM;IAAgB,UAAU;;EACxD,QAAQ;IAAgB,MAAM;IAAgB,UAAU;;EACxD,KAAK;IACJ,KAAK,oBAAoB;IACzB,UAAU;;EAEX,KAAK;IAAgB,MAAM;IAAsB,UAAU;;EAC3D,KAAK;IAAgB,MAAM;IAAoB,UAAU;;;;YAa9C;;EAEX,OAAO;;;;;;;;;;;;;;EAeP,aAAa,mBAAmB;;;;;EAMhC,WAAW;;;;;;;;;;;;qBAaC,cAAc,GAAG"}
@@ -1,7 +1,7 @@
1
- import { PrismicRichText } from "./PrismicRichText.js";
2
1
  import { isFilled } from "@prismicio/client";
2
+ import { PrismicRichText } from "./PrismicRichText.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/PrismicTable.tsx
4
+ // src/PrismicTable.tsx
5
5
  const defaultComponents = {
6
6
  table: ({ children }) => /* @__PURE__ */ jsx("table", { children }),
7
7
  thead: ({ children }) => /* @__PURE__ */ jsx("thead", { children }),
@@ -67,7 +67,6 @@ function TableRow(props) {
67
67
  }, cell.key))
68
68
  });
69
69
  }
70
- //#endregion
71
70
  export { PrismicTable };
72
71
 
73
72
  //# sourceMappingURL=PrismicTable.js.map
@@ -1,6 +1,5 @@
1
1
  import { RichTextField } from "@prismicio/client";
2
2
  import { FC } from "react";
3
- //#region src/PrismicText.d.ts
4
3
  /** Props for `<PrismicText>`. */
5
4
  export type PrismicTextProps = {
6
5
  /** The Prismic rich text field to render. */
@@ -24,5 +23,4 @@ export type PrismicTextProps = {
24
23
  * @see Learn how to display rich text as plain text or React components: {@link https://prismic.io/docs/fields/rich-text}
25
24
  */
26
25
  export declare const PrismicText: FC<PrismicTextProps>;
27
- //#endregion
28
26
  //# sourceMappingURL=PrismicText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicText.d.ts","names":[],"sources":["../src/PrismicText.tsx"],"mappings":";;;;YAOY;;EAEX,OAAO;;;;;EAMP;;EAGA;;;;;;;;;;;;qBAaY,aAAa,GAAG"}
1
+ {"version":3,"file":"PrismicText.d.ts","names":[],"sources":["../src/PrismicText.tsx"],"mappings":";;;YAOY;;EAEX,OAAO;;;;;EAMP;;EAGA;;;;;;;;;;;;qBAaY,aAAa,GAAG"}
@@ -1,8 +1,8 @@
1
- import { devMsg } from "./lib/devMsg.js";
2
1
  import { asText, isFilled } from "@prismicio/client";
3
2
  import { DEV } from "esm-env";
3
+ import { devMsg } from "./lib/devMsg.js";
4
4
  import { Fragment, jsx } from "react/jsx-runtime";
5
- //#region src/PrismicText.tsx
5
+ // src/PrismicText.tsx
6
6
  /**
7
7
  * Renders content from a Prismic rich text field as plain text (no HTML).
8
8
  *
@@ -25,7 +25,6 @@ const PrismicText = (props) => {
25
25
  if (!isFilled.richText(field)) return fallback != null ? /* @__PURE__ */ jsx(Fragment, { children: fallback }) : null;
26
26
  return /* @__PURE__ */ jsx(Fragment, { children: asText(field, { separator }) });
27
27
  };
28
- //#endregion
29
28
  export { PrismicText };
30
29
 
31
30
  //# sourceMappingURL=PrismicText.js.map
@@ -1,5 +1,4 @@
1
1
  import { FC } from "react";
2
- //#region src/PrismicToolbar.d.ts
3
2
  /** Props for `<PrismicToolbar>`. */
4
3
  export type PrismicToolbarProps = {
5
4
  /**
@@ -37,5 +36,4 @@ export type PrismicToolbarProps = {
37
36
  * @see Learn how to set up preview functionality and the toolbar's role in preview sessions: {@link https://prismic.io/docs/previews}
38
37
  */
39
38
  export declare const PrismicToolbar: FC<PrismicToolbarProps>;
40
- //#endregion
41
39
  //# sourceMappingURL=PrismicToolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicToolbar.d.ts","names":[],"sources":["../src/PrismicToolbar.tsx"],"mappings":";;;YAMY;;;;;EAKX;;;;;;;;;EAUA,mBAAmB,OAAO;IAAc;;;;;;;;EAQxC,gBAAgB,OAAO;;;;;;;;;;;;qBAaX,gBAAgB,GAAG"}
1
+ {"version":3,"file":"PrismicToolbar.d.ts","names":[],"sources":["../src/PrismicToolbar.tsx"],"mappings":";;YAMY;;;;;EAKX;;;;;;;;;EAUA,mBAAmB,OAAO;IAAc;;;;;;;;EAQxC,gBAAgB,OAAO;;;;;;;;;;;;qBAaX,gBAAgB,GAAG"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { getToolbarSrc } from "@prismicio/client";
3
3
  import { useEffect, useRef } from "react";
4
- //#region src/PrismicToolbar.tsx
4
+ // src/PrismicToolbar.tsx
5
5
  /**
6
6
  * Renders the Prismic Toolbar script to support draft previews.
7
7
  *
@@ -40,7 +40,6 @@ const PrismicToolbar = (props) => {
40
40
  }, []);
41
41
  return null;
42
42
  };
43
- //#endregion
44
43
  export { PrismicToolbar };
45
44
 
46
45
  //# sourceMappingURL=PrismicToolbar.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useId, useLayoutEffect, useRef, useSyncExternalStore } from "react";
3
3
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/SliceBoundary.tsx
4
+ // src/SliceBoundary.tsx
5
5
  function SliceBoundary(props) {
6
6
  const { children, sliceId } = props;
7
7
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -15,19 +15,20 @@ function CommentMarker(props) {
15
15
  const id = useId();
16
16
  const isClient = useIsClient();
17
17
  const anchorRef = useRef(null);
18
+ const anchorValue = `__prismic_react_internal_comment_anchor_${id}__`;
18
19
  useLayoutEffect(() => {
19
20
  let anchor = anchorRef.current;
20
21
  if (!anchor?.isConnected) {
21
- anchor = findTextNode(id);
22
+ anchor = findTextNode(anchorValue);
22
23
  if (!anchor) return;
23
- anchor.data = "";
24
24
  anchorRef.current = anchor;
25
25
  }
26
+ if (anchor.data !== "") anchor.data = "";
26
27
  const comment = document.createComment(value);
27
28
  anchor.after(comment);
28
29
  return () => comment.remove();
29
30
  });
30
- return isClient ? id : null;
31
+ return isClient ? anchorValue : null;
31
32
  }
32
33
  function useIsClient() {
33
34
  return useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);
@@ -49,7 +50,6 @@ function findTextNode(value) {
49
50
  }
50
51
  return null;
51
52
  }
52
- //#endregion
53
53
  export { SliceBoundary };
54
54
 
55
55
  //# sourceMappingURL=SliceBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SliceBoundary.js","names":[],"sources":["../src/SliceBoundary.tsx"],"sourcesContent":["\"use client\"\n\nimport { type ReactNode, useId, useLayoutEffect, useRef, useSyncExternalStore } from \"react\"\n\ntype SliceBoundaryProps = {\n\tchildren: ReactNode\n\tsliceId: string\n}\n\nexport function SliceBoundary(props: SliceBoundaryProps): ReactNode {\n\tconst { children, sliceId } = props\n\n\treturn (\n\t\t<>\n\t\t\t<CommentMarker value={`prismic-slice-start:${sliceId}`} />\n\t\t\t{children}\n\t\t\t<CommentMarker value={`prismic-slice-end:${sliceId}`} />\n\t\t</>\n\t)\n}\n\ntype CommentMarkerProps = {\n\tvalue: string\n}\n\nfunction CommentMarker(props: CommentMarkerProps) {\n\tconst { value } = props\n\tconst id = useId()\n\tconst isClient = useIsClient()\n\tconst anchorRef = useRef<Text>(null)\n\n\tuseLayoutEffect(() => {\n\t\tlet anchor = anchorRef.current\n\n\t\tif (!anchor?.isConnected) {\n\t\t\tanchor = findTextNode(id)\n\t\t\tif (!anchor) return\n\n\t\t\tanchor.data = \"\"\n\t\t\tanchorRef.current = anchor\n\t\t}\n\n\t\tconst comment = document.createComment(value)\n\t\tanchor.after(comment)\n\n\t\treturn () => comment.remove()\n\t})\n\n\treturn isClient ? id : null\n}\n\nfunction useIsClient() {\n\treturn useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot)\n}\n\nfunction subscribe() {\n\treturn () => {}\n}\n\nfunction getClientSnapshot() {\n\treturn true\n}\n\nfunction getServerSnapshot() {\n\treturn false\n}\n\nfunction findTextNode(value: string) {\n\tconst walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT)\n\n\twhile (walker.nextNode()) {\n\t\tconst node = walker.currentNode\n\t\tif (node instanceof Text && node.data === value) return node\n\t}\n\n\treturn null\n}\n"],"mappings":";;;;AASA,SAAgB,cAAc,OAAsC;CACnE,MAAM,EAAE,UAAU,YAAY;CAE9B,OACC,qBAAA,YAAA,EAAA,UAAA;EACC,oBAAC,eAAD,EAAe,OAAO,uBAAuB,UAAY,CAAA;EACxD;EACD,oBAAC,eAAD,EAAe,OAAO,qBAAqB,UAAY,CAAA;CACtD,EAAA,CAAA;AAEJ;AAMA,SAAS,cAAc,OAA2B;CACjD,MAAM,EAAE,UAAU;CAClB,MAAM,KAAK,MAAM;CACjB,MAAM,WAAW,YAAY;CAC7B,MAAM,YAAY,OAAa,IAAI;CAEnC,sBAAsB;EACrB,IAAI,SAAS,UAAU;EAEvB,IAAI,CAAC,QAAQ,aAAa;GACzB,SAAS,aAAa,EAAE;GACxB,IAAI,CAAC,QAAQ;GAEb,OAAO,OAAO;GACd,UAAU,UAAU;EACrB;EAEA,MAAM,UAAU,SAAS,cAAc,KAAK;EAC5C,OAAO,MAAM,OAAO;EAEpB,aAAa,QAAQ,OAAO;CAC7B,CAAC;CAED,OAAO,WAAW,KAAK;AACxB;AAEA,SAAS,cAAc;CACtB,OAAO,qBAAqB,WAAW,mBAAmB,iBAAiB;AAC5E;AAEA,SAAS,YAAY;CACpB,aAAa,CAAC;AACf;AAEA,SAAS,oBAAoB;CAC5B,OAAO;AACR;AAEA,SAAS,oBAAoB;CAC5B,OAAO;AACR;AAEA,SAAS,aAAa,OAAe;CACpC,MAAM,SAAS,SAAS,iBAAiB,SAAS,MAAM,WAAW,SAAS;CAE5E,OAAO,OAAO,SAAS,GAAG;EACzB,MAAM,OAAO,OAAO;EACpB,IAAI,gBAAgB,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzD;CAEA,OAAO;AACR"}
1
+ {"version":3,"file":"SliceBoundary.js","names":[],"sources":["../src/SliceBoundary.tsx"],"sourcesContent":["\"use client\"\n\nimport { type ReactNode, useId, useLayoutEffect, useRef, useSyncExternalStore } from \"react\"\n\ntype SliceBoundaryProps = {\n\tchildren: ReactNode\n\tsliceId: string\n}\n\nexport function SliceBoundary(props: SliceBoundaryProps): ReactNode {\n\tconst { children, sliceId } = props\n\n\treturn (\n\t\t<>\n\t\t\t<CommentMarker value={`prismic-slice-start:${sliceId}`} />\n\t\t\t{children}\n\t\t\t<CommentMarker value={`prismic-slice-end:${sliceId}`} />\n\t\t</>\n\t)\n}\n\ntype CommentMarkerProps = {\n\tvalue: string\n}\n\nfunction CommentMarker(props: CommentMarkerProps) {\n\tconst { value } = props\n\tconst id = useId()\n\tconst isClient = useIsClient()\n\tconst anchorRef = useRef<Text>(null)\n\tconst anchorValue = `__prismic_react_internal_comment_anchor_${id}__`\n\n\tuseLayoutEffect(() => {\n\t\tlet anchor = anchorRef.current\n\n\t\tif (!anchor?.isConnected) {\n\t\t\tanchor = findTextNode(anchorValue)\n\t\t\tif (!anchor) return\n\t\t\tanchorRef.current = anchor\n\t\t}\n\n\t\t// React restores the text when a hidden Suspense or Activity subtree is shown again.\n\t\tif (anchor.data !== \"\") anchor.data = \"\"\n\n\t\tconst comment = document.createComment(value)\n\t\tanchor.after(comment)\n\n\t\treturn () => comment.remove()\n\t})\n\n\treturn isClient ? anchorValue : null\n}\n\nfunction useIsClient() {\n\treturn useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot)\n}\n\nfunction subscribe() {\n\treturn () => {}\n}\n\nfunction getClientSnapshot() {\n\treturn true\n}\n\nfunction getServerSnapshot() {\n\treturn false\n}\n\nfunction findTextNode(value: string) {\n\tconst walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT)\n\n\twhile (walker.nextNode()) {\n\t\tconst node = walker.currentNode\n\t\tif (node instanceof Text && node.data === value) return node\n\t}\n\n\treturn null\n}\n"],"mappings":";;;;AASA,SAAgB,cAAc,OAAsC;CACnE,MAAM,EAAE,UAAU,YAAY;CAE9B,OACC,qBAAA,YAAA,EAAA,UAAA;EACC,oBAAC,eAAD,EAAe,OAAO,uBAAuB,UAAY,CAAA;EACxD;EACD,oBAAC,eAAD,EAAe,OAAO,qBAAqB,UAAY,CAAA;CACtD,EAAA,CAAA;AAEJ;AAMA,SAAS,cAAc,OAA2B;CACjD,MAAM,EAAE,UAAU;CAClB,MAAM,KAAK,MAAM;CACjB,MAAM,WAAW,YAAY;CAC7B,MAAM,YAAY,OAAa,IAAI;CACnC,MAAM,cAAc,2CAA2C,GAAG;CAElE,sBAAsB;EACrB,IAAI,SAAS,UAAU;EAEvB,IAAI,CAAC,QAAQ,aAAa;GACzB,SAAS,aAAa,WAAW;GACjC,IAAI,CAAC,QAAQ;GACb,UAAU,UAAU;EACrB;EAGA,IAAI,OAAO,SAAS,IAAI,OAAO,OAAO;EAEtC,MAAM,UAAU,SAAS,cAAc,KAAK;EAC5C,OAAO,MAAM,OAAO;EAEpB,aAAa,QAAQ,OAAO;CAC7B,CAAC;CAED,OAAO,WAAW,cAAc;AACjC;AAEA,SAAS,cAAc;CACtB,OAAO,qBAAqB,WAAW,mBAAmB,iBAAiB;AAC5E;AAEA,SAAS,YAAY;CACpB,aAAa,CAAC;AACf;AAEA,SAAS,oBAAoB;CAC5B,OAAO;AACR;AAEA,SAAS,oBAAoB;CAC5B,OAAO;AACR;AAEA,SAAS,aAAa,OAAe;CACpC,MAAM,SAAS,SAAS,iBAAiB,SAAS,MAAM,WAAW,SAAS;CAE5E,OAAO,OAAO,SAAS,GAAG;EACzB,MAAM,OAAO,OAAO;EACpB,IAAI,gBAAgB,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzD;CAEA,OAAO;AACR"}
@@ -1,6 +1,5 @@
1
1
  import { Slice } from "@prismicio/client";
2
2
  import { ComponentType, FC, ReactNode } from "react";
3
- //#region src/SliceZone.d.ts
4
3
  /**
5
4
  * Returns the type of a `SliceLike` type.
6
5
  *
@@ -120,5 +119,5 @@ export declare const TODOSliceComponent: <TSlice extends SliceLike>({ slice }: {
120
119
  * @see Learn how to create slices, use slice variations, and display slices: {@link https://prismic.io/docs/slices}
121
120
  */
122
121
  export declare const SliceZone: FC<SliceZoneProps>;
123
- //#endregion
122
+ export {};
124
123
  //# sourceMappingURL=SliceZone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SliceZone.d.ts","names":[],"sources":["../src/SliceZone.tsx"],"mappings":";;;;;;;;KAWK,iBAAiB,eAAe,aAAa,eAAe,QAC9D,uBACA,eAAe,mBACd;;;;;;;YASQ,gBAAgB,sCAAsC,KACjE,MAAM;;;;;;;YAUK,iBAAiB;EAC5B,MAAM,MAAM;;;;;;;;;;YAWD,UAAU,uCACnB,gBAAgB,cAChB,iBAAiB;;;;;;;EAQnB;;;;;;;;;;YAWW,cAAc,eAAe,YAAY,sBAAsB;;;;;;;;;YAU/D,oBAAoB,eAAe,YAAY,WAAW;;EAErE,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;;;;;;YASE,mBAEX,eAAe,iBACf,sBACG,cAAc,oBAAoB,QAAQ;;;;;;;;;;YAWlC,oBAAoB,eAAe,YAAY,WAAW,yBAWnE,aAAa,iBAAiB,UAAU,mBACxC,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B;;;;;;;YAUS,eAAe;;EAE1B,SAAS;;EAIT,aAAa,eAAe;;EAI5B,mBAAmB,cAAc,yBAAyB;;EAG1D,UAAU;;;;;;;;qBASE,qBAAsB,eAAe,aAAS;EAG1D,OAAO;MACJ;;;;;;;;;;;qBA2BS,WAAW,GAAG"}
1
+ {"version":3,"file":"SliceZone.d.ts","names":[],"sources":["../src/SliceZone.tsx"],"mappings":";;;;;;;KAWK,iBAAiB,eAAe,aAAa,eAAe,QAC9D,uBACA,eAAe,mBACd;;;;;;;YASQ,gBAAgB,sCAAsC,KACjE,MAAM;;;;;;;YAUK,iBAAiB;EAC5B,MAAM,MAAM;;;;;;;;;;YAWD,UAAU,uCACnB,gBAAgB,cAChB,iBAAiB;;;;;;;EAQnB;;;;;;;;;;YAWW,cAAc,eAAe,YAAY,sBAAsB;;;;;;;;;YAU/D,oBAAoB,eAAe,YAAY,WAAW;;EAErE,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;;;;;;YASE,mBAEX,eAAe,iBACf,sBACG,cAAc,oBAAoB,QAAQ;;;;;;;;;;YAWlC,oBAAoB,eAAe,YAAY,WAAW,yBAWnE,aAAa,iBAAiB,UAAU,mBACxC,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B;;;;;;;YAUS,eAAe;;EAE1B,SAAS;;EAIT,aAAa,eAAe;;EAI5B,mBAAmB,cAAc,yBAAyB;;EAG1D,UAAU;;;;;;;;qBASE,qBAAsB,eAAe,aACjD;EAEA,OAAO;MACJ;;;;;;;;;;;qBA2BS,WAAW,GAAG"}
package/dist/SliceZone.js CHANGED
@@ -1,8 +1,8 @@
1
- import { SliceBoundary } from "./SliceBoundary.js";
2
1
  import { DEV } from "esm-env";
3
2
  import { Fragment } from "react";
3
+ import { SliceBoundary } from "./SliceBoundary.js";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
- //#region src/SliceZone.tsx
5
+ // src/SliceZone.tsx
6
6
  /**
7
7
  * This slice component can be used as a reminder to provide a proper implementation.
8
8
  *
@@ -58,7 +58,6 @@ const SliceZone = (props) => {
58
58
  });
59
59
  return /* @__PURE__ */ jsx(Fragment$1, { children: renderedSlices });
60
60
  };
61
- //#endregion
62
61
  export { SliceZone, TODOSliceComponent };
63
62
 
64
63
  //# sourceMappingURL=SliceZone.js.map
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { LinkProps, PrismicLink, PrismicLinkProps } from "./PrismicLink.js";
2
- import { JSXFunctionSerializer, JSXMapSerializer, PrismicRichText, PrismicRichTextProps, RichTextComponents } from "./PrismicRichText.js";
3
2
  import { PrismicTable, PrismicTableProps } from "./PrismicTable.js";
4
3
  import { PrismicText, PrismicTextProps } from "./PrismicText.js";
4
+ import { JSXFunctionSerializer, JSXMapSerializer, PrismicRichText, PrismicRichTextProps, RichTextComponents } from "./PrismicRichText.js";
5
+ import { Element } from "@prismicio/client/richtext";
5
6
  import { PrismicImage, PrismicImageProps } from "./PrismicImage.js";
6
7
  import { SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZone, SliceZoneComponents, SliceZoneLike, SliceZoneProps, TODOSliceComponent } from "./SliceZone.js";
7
8
  import { PrismicToolbar, PrismicToolbarProps } from "./PrismicToolbar.js";
8
- import { Element } from "@prismicio/client/richtext";
9
9
  export { Element, type JSXFunctionSerializer, type JSXMapSerializer, type LinkProps, PrismicImage, type PrismicImageProps, PrismicLink, type PrismicLinkProps, PrismicRichText, type PrismicRichTextProps, PrismicTable, type PrismicTableProps, PrismicText, type PrismicTextProps, PrismicToolbar, type PrismicToolbarProps, type RichTextComponents, type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, SliceZone, type SliceZoneComponents, type SliceZoneLike, type SliceZoneProps, TODOSliceComponent };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { PrismicLink } from "./PrismicLink.js";
2
- import { PrismicRichText } from "./PrismicRichText.js";
3
2
  import { PrismicTable } from "./PrismicTable.js";
4
3
  import { PrismicText } from "./PrismicText.js";
4
+ import { PrismicRichText } from "./PrismicRichText.js";
5
+ import { Element } from "@prismicio/client/richtext";
5
6
  import { PrismicImage } from "./PrismicImage.js";
6
7
  import { SliceZone, TODOSliceComponent } from "./SliceZone.js";
7
8
  import { PrismicToolbar } from "./PrismicToolbar.js";
8
- import { Element } from "@prismicio/client/richtext";
9
9
  export { Element, PrismicImage, PrismicLink, PrismicRichText, PrismicTable, PrismicText, PrismicToolbar, SliceZone, TODOSliceComponent };
@@ -1,5 +1,5 @@
1
- import { version } from "../package.js";
2
- //#region src/lib/devMsg.ts
1
+ import { version } from "../package.json.js";
2
+ // src/lib/devMsg.ts
3
3
  /**
4
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
5
5
  *
@@ -16,7 +16,6 @@ import { version } from "../package.js";
16
16
  function devMsg(slug) {
17
17
  return `https://prismic.dev/msg/react/v${version}/${slug}`;
18
18
  }
19
- //#endregion
20
19
  export { devMsg };
21
20
 
22
21
  //# sourceMappingURL=devMsg.js.map
@@ -0,0 +1,5 @@
1
+ // package.json
2
+ var version = "3.5.1-canary.0bf029d";
3
+ export { version };
4
+
5
+ //# sourceMappingURL=package.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.json.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/react",
3
- "version": "3.5.0",
3
+ "version": "3.5.1-canary.0bf029d",
4
4
  "description": "React components and hooks to fetch and present Prismic content",
5
5
  "keywords": [
6
6
  "prismic",
@@ -53,18 +53,18 @@
53
53
  "esm-env": "^1.2.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@playwright/test": "^1.63.0",
57
- "@prismicio/client": "^7.22.1",
56
+ "@playwright/test": "^1.65.1",
57
+ "@prismicio/client": "^7.23.1",
58
58
  "@prismicio/types-internal": "^3.17.2",
59
59
  "@types/react": "^19.3.0",
60
60
  "@types/react-dom": "^19.3.0",
61
- "dotenv": "^18.0.2",
62
- "oxfmt": "^0.70.0",
63
- "oxlint": "^1.85.0",
64
- "playwright": "^1.63.0",
65
- "react": "^19.3.0",
66
- "react-dom": "^19.3.0",
67
- "tsdown": "^0.23.0",
61
+ "dotenv": "^18.0.10",
62
+ "oxfmt": "^0.79.0",
63
+ "oxlint": "^1.94.0",
64
+ "playwright": "^1.65.1",
65
+ "react": "^19.3.1",
66
+ "react-dom": "^19.3.1",
67
+ "tsdown": "^0.23.7",
68
68
  "typescript": "^7.0.2"
69
69
  },
70
70
  "peerDependencies": {
@@ -28,25 +28,27 @@ function CommentMarker(props: CommentMarkerProps) {
28
28
  const id = useId()
29
29
  const isClient = useIsClient()
30
30
  const anchorRef = useRef<Text>(null)
31
+ const anchorValue = `__prismic_react_internal_comment_anchor_${id}__`
31
32
 
32
33
  useLayoutEffect(() => {
33
34
  let anchor = anchorRef.current
34
35
 
35
36
  if (!anchor?.isConnected) {
36
- anchor = findTextNode(id)
37
+ anchor = findTextNode(anchorValue)
37
38
  if (!anchor) return
38
-
39
- anchor.data = ""
40
39
  anchorRef.current = anchor
41
40
  }
42
41
 
42
+ // React restores the text when a hidden Suspense or Activity subtree is shown again.
43
+ if (anchor.data !== "") anchor.data = ""
44
+
43
45
  const comment = document.createComment(value)
44
46
  anchor.after(comment)
45
47
 
46
48
  return () => comment.remove()
47
49
  })
48
50
 
49
- return isClient ? id : null
51
+ return isClient ? anchorValue : null
50
52
  }
51
53
 
52
54
  function useIsClient() {
package/dist/package.js DELETED
@@ -1,6 +0,0 @@
1
- //#region package.json
2
- var version = "3.5.0";
3
- //#endregion
4
- export { version };
5
-
6
- //# sourceMappingURL=package.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}