@localess/react 3.0.1-dev.20260410071322 → 3.0.1-dev.20260411012947

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.
@@ -39,7 +39,7 @@ var LocalessServerComponent = forwardRef(({ data, links, references, ...restProp
39
39
  import { forwardRef as forwardRef2 } from "react";
40
40
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
41
41
  var LocalessServerDocument = forwardRef2(({ document }, ref) => {
42
- if (!document || !document.data) {
42
+ if (!document.data) {
43
43
  console.error("LocalessServerDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
44
44
  return /* @__PURE__ */ jsxs2("div", { children: [
45
45
  "LocalessServerDocument property ",
@@ -3,7 +3,6 @@ import {
3
3
  FONT_NORMAL,
4
4
  getComponent,
5
5
  getFallbackComponent,
6
- getLocalessClient,
7
6
  isSyncEnabled,
8
7
  localessEditable
9
8
  } from "./chunk-ETSLIILF.mjs";
@@ -41,36 +40,6 @@ var LocalessComponent = forwardRef(
41
40
  }
42
41
  );
43
42
 
44
- // src/core/hooks/use-localess.ts
45
- import { useEffect, useState } from "react";
46
- import { isBrowser } from "@localess/client";
47
- var useLocaless = (slug, options = {}) => {
48
- const [document, setDocument] = useState();
49
- const client = getLocalessClient();
50
- let normalizedSlug;
51
- if (Array.isArray(slug)) {
52
- normalizedSlug = slug.join("/");
53
- } else {
54
- normalizedSlug = slug;
55
- }
56
- useEffect(() => {
57
- async function loadDocument() {
58
- const document2 = await client.getContentBySlug(normalizedSlug, options);
59
- setDocument(document2);
60
- if (isSyncEnabled() && isBrowser()) {
61
- window.localess?.on(["input", "change"], (event) => {
62
- if (event.type === "change" || event.type === "input") {
63
- setDocument({ ...document2, data: event.data });
64
- }
65
- });
66
- }
67
- }
68
- loadDocument();
69
- }, [slug, options, client]);
70
- return document;
71
- };
72
-
73
43
  export {
74
- LocalessComponent,
75
- useLocaless
44
+ LocalessComponent
76
45
  };
package/dist/index.d.mts CHANGED
@@ -1,61 +1,61 @@
1
- export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, s as setComponents, e as setFallbackComponent, u as unregisterComponent } from './richtext-l2BRZFEP.mjs';
2
- import * as React from 'react';
3
- import { ContentData, Links, References, ContentFetchParams, Content } from '@localess/client';
1
+ export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, s as setComponents, e as setFallbackComponent, u as unregisterComponent } from './richtext-D6tBmv-7.mjs';
2
+ export { L as LocalessComponent, a as LocalessComponentProps } from './localess-component-DikkO35Z.mjs';
3
+ import * as react from 'react';
4
+ import { ContentData, Content, ContentFetchParams } from '@localess/client';
4
5
  export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, References, Translations, isBrowser, isIframe, isServer, localessEditable, localessEditableField } from '@localess/client';
5
6
 
6
7
  /**
7
- * Props for {@link LocalessComponent}.
8
+ * Props for {@link LocalessDocument}.
8
9
  *
9
10
  * @template T - The content data shape. Defaults to the base {@link ContentData} type.
10
11
  */
11
- type LocalessComponentProps<T extends ContentData = ContentData> = {
12
+ type LocalessDocumentProps<T extends ContentData = ContentData> = {
12
13
  /**
13
- * The content data object to render. Must have a `_schema` field that matches a key
14
- * in the component registry configured via `localessInit`.
14
+ * The full content response object as returned by `getContentBySlug` or `getContentById`.
15
+ * Must contain a `data` field with a valid `_schema` key.
15
16
  */
16
- data: T;
17
- /**
18
- * Optional map of content links keyed by link ID.
19
- * Pass through to child components so they can resolve {@link ContentLink} values with `findLink`.
20
- */
21
- links?: Links;
22
- /**
23
- * Optional map of resolved content references keyed by reference ID.
24
- * Pass through to child components that consume referenced content.
25
- */
26
- references?: References;
17
+ document: Content<T>;
27
18
  };
28
19
  /**
29
- * Dynamic schema-to-component renderer for use in SPA and client-side contexts.
20
+ * Client Component that renders content and automatically subscribes to Visual Editor sync events.
21
+ *
22
+ * Wraps {@link LocalessComponent} with local state so that live `input` and `change` events
23
+ * from the Localess Visual Editor update the rendered content without a full page reload.
30
24
  *
31
- * Looks up `data._schema` in the component registry (set via `localessInit` or `setComponents`),
32
- * renders the matched component, and when Visual Editor sync is active automatically
33
- * spreads `localessEditable` attributes on the root element for live targeting.
25
+ * **Recommended pattern for Next.js App Router:** fetch data in a Server Component and pass it
26
+ * as props. The page renders immediately with server data; once the client hydrates, live editing
27
+ * activates on top no loading state needed.
34
28
  *
35
- * Falls back to the `fallbackComponent` (if registered) when the schema key is not found,
36
- * or renders an inline error message as a last resort.
29
+ * Sync only activates when `enableSync: true` was passed to `localessInit` **and** the page
30
+ * is running inside the Visual Editor iframe (`isIframe()` is true).
37
31
  *
38
- * **Server-safe** — does not include a `'use client'` directive and can be used in
39
- * React Server Components. For SSR / static-export environments use {@link LocalessServerComponent}
40
- * from `@localess/react/ssr` instead, which omits the sync attribute injection.
32
+ * **Requires `'use client'`** must be used inside a Client Component boundary in Next.js
33
+ * App Router. Available from `@localess/react` (SPA) and `@localess/react/rsc` (RSC).
34
+ * Not available from `@localess/react/ssr`.
41
35
  *
42
36
  * @template T - The content data shape. Defaults to {@link ContentData}.
43
37
  *
44
- * @example Basic usage
38
+ * @example Server Component passes data; Client Component renders with live sync
45
39
  * ```tsx
46
- * import { LocalessComponent } from '@localess/react';
40
+ * // app/[locale]/page.tsx (Server Component)
41
+ * import { getLocalessClient } from '@localess/react/rsc';
42
+ * import PageClient from './page-client';
47
43
  *
48
- * <LocalessComponent data={content.data} links={content.links} references={content.references} />
49
- * ```
44
+ * export default async function Page({ params }) {
45
+ * const content = await getLocalessClient().getContentBySlug('home', { locale: params.locale });
46
+ * return <PageClient data={content.data} links={content.links} references={content.references} />;
47
+ * }
50
48
  *
51
- * @example Rendering a list of nested blocks
52
- * ```tsx
53
- * {data.body.map(item => (
54
- * <LocalessComponent key={item._id} data={item} links={content.links} references={content.references} />
55
- * ))}
49
+ * // app/[locale]/page-client.tsx (Client Component)
50
+ * 'use client';
51
+ * import { LocalessDocument } from '@localess/react/rsc';
52
+ *
53
+ * export default function PageClient({ data, links, references }) {
54
+ * return <LocalessDocument data={data} links={links} references={references} />;
55
+ * }
56
56
  * ```
57
57
  */
58
- declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
58
+ declare const LocalessDocument: react.ForwardRefExoticComponent<LocalessDocumentProps<ContentData> & react.RefAttributes<HTMLElement>>;
59
59
 
60
60
  /**
61
61
  * Options for {@link useLocaless}.
@@ -101,4 +101,4 @@ type UseLocalessOptions = ContentFetchParams & {};
101
101
  */
102
102
  declare const useLocaless: <T extends ContentData = ContentData>(slug: string | string[], options?: UseLocalessOptions) => Content<T> | undefined;
103
103
 
104
- export { LocalessComponent, type LocalessComponentProps, type UseLocalessOptions, useLocaless };
104
+ export { LocalessDocument, type LocalessDocumentProps, type UseLocalessOptions, useLocaless };
package/dist/index.d.ts CHANGED
@@ -1,61 +1,61 @@
1
- export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, s as setComponents, e as setFallbackComponent, u as unregisterComponent } from './richtext-l2BRZFEP.js';
2
- import * as React from 'react';
3
- import { ContentData, Links, References, ContentFetchParams, Content } from '@localess/client';
1
+ export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, s as setComponents, e as setFallbackComponent, u as unregisterComponent } from './richtext-D6tBmv-7.js';
2
+ export { L as LocalessComponent, a as LocalessComponentProps } from './localess-component-DikkO35Z.js';
3
+ import * as react from 'react';
4
+ import { ContentData, Content, ContentFetchParams } from '@localess/client';
4
5
  export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, References, Translations, isBrowser, isIframe, isServer, localessEditable, localessEditableField } from '@localess/client';
5
6
 
6
7
  /**
7
- * Props for {@link LocalessComponent}.
8
+ * Props for {@link LocalessDocument}.
8
9
  *
9
10
  * @template T - The content data shape. Defaults to the base {@link ContentData} type.
10
11
  */
11
- type LocalessComponentProps<T extends ContentData = ContentData> = {
12
+ type LocalessDocumentProps<T extends ContentData = ContentData> = {
12
13
  /**
13
- * The content data object to render. Must have a `_schema` field that matches a key
14
- * in the component registry configured via `localessInit`.
14
+ * The full content response object as returned by `getContentBySlug` or `getContentById`.
15
+ * Must contain a `data` field with a valid `_schema` key.
15
16
  */
16
- data: T;
17
- /**
18
- * Optional map of content links keyed by link ID.
19
- * Pass through to child components so they can resolve {@link ContentLink} values with `findLink`.
20
- */
21
- links?: Links;
22
- /**
23
- * Optional map of resolved content references keyed by reference ID.
24
- * Pass through to child components that consume referenced content.
25
- */
26
- references?: References;
17
+ document: Content<T>;
27
18
  };
28
19
  /**
29
- * Dynamic schema-to-component renderer for use in SPA and client-side contexts.
20
+ * Client Component that renders content and automatically subscribes to Visual Editor sync events.
21
+ *
22
+ * Wraps {@link LocalessComponent} with local state so that live `input` and `change` events
23
+ * from the Localess Visual Editor update the rendered content without a full page reload.
30
24
  *
31
- * Looks up `data._schema` in the component registry (set via `localessInit` or `setComponents`),
32
- * renders the matched component, and when Visual Editor sync is active automatically
33
- * spreads `localessEditable` attributes on the root element for live targeting.
25
+ * **Recommended pattern for Next.js App Router:** fetch data in a Server Component and pass it
26
+ * as props. The page renders immediately with server data; once the client hydrates, live editing
27
+ * activates on top no loading state needed.
34
28
  *
35
- * Falls back to the `fallbackComponent` (if registered) when the schema key is not found,
36
- * or renders an inline error message as a last resort.
29
+ * Sync only activates when `enableSync: true` was passed to `localessInit` **and** the page
30
+ * is running inside the Visual Editor iframe (`isIframe()` is true).
37
31
  *
38
- * **Server-safe** — does not include a `'use client'` directive and can be used in
39
- * React Server Components. For SSR / static-export environments use {@link LocalessServerComponent}
40
- * from `@localess/react/ssr` instead, which omits the sync attribute injection.
32
+ * **Requires `'use client'`** must be used inside a Client Component boundary in Next.js
33
+ * App Router. Available from `@localess/react` (SPA) and `@localess/react/rsc` (RSC).
34
+ * Not available from `@localess/react/ssr`.
41
35
  *
42
36
  * @template T - The content data shape. Defaults to {@link ContentData}.
43
37
  *
44
- * @example Basic usage
38
+ * @example Server Component passes data; Client Component renders with live sync
45
39
  * ```tsx
46
- * import { LocalessComponent } from '@localess/react';
40
+ * // app/[locale]/page.tsx (Server Component)
41
+ * import { getLocalessClient } from '@localess/react/rsc';
42
+ * import PageClient from './page-client';
47
43
  *
48
- * <LocalessComponent data={content.data} links={content.links} references={content.references} />
49
- * ```
44
+ * export default async function Page({ params }) {
45
+ * const content = await getLocalessClient().getContentBySlug('home', { locale: params.locale });
46
+ * return <PageClient data={content.data} links={content.links} references={content.references} />;
47
+ * }
50
48
  *
51
- * @example Rendering a list of nested blocks
52
- * ```tsx
53
- * {data.body.map(item => (
54
- * <LocalessComponent key={item._id} data={item} links={content.links} references={content.references} />
55
- * ))}
49
+ * // app/[locale]/page-client.tsx (Client Component)
50
+ * 'use client';
51
+ * import { LocalessDocument } from '@localess/react/rsc';
52
+ *
53
+ * export default function PageClient({ data, links, references }) {
54
+ * return <LocalessDocument data={data} links={links} references={references} />;
55
+ * }
56
56
  * ```
57
57
  */
58
- declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
58
+ declare const LocalessDocument: react.ForwardRefExoticComponent<LocalessDocumentProps<ContentData> & react.RefAttributes<HTMLElement>>;
59
59
 
60
60
  /**
61
61
  * Options for {@link useLocaless}.
@@ -101,4 +101,4 @@ type UseLocalessOptions = ContentFetchParams & {};
101
101
  */
102
102
  declare const useLocaless: <T extends ContentData = ContentData>(slug: string | string[], options?: UseLocalessOptions) => Content<T> | undefined;
103
103
 
104
- export { LocalessComponent, type LocalessComponentProps, type UseLocalessOptions, useLocaless };
104
+ export { LocalessDocument, type LocalessDocumentProps, type UseLocalessOptions, useLocaless };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
23
  LocalessComponent: () => LocalessComponent,
24
+ LocalessDocument: () => LocalessDocument,
24
25
  findLink: () => findLink,
25
26
  getComponent: () => getComponent,
26
27
  getFallbackComponent: () => getFallbackComponent,
@@ -163,11 +164,36 @@ var LocalessComponent = (0, import_react.forwardRef)(
163
164
  }
164
165
  );
165
166
 
166
- // src/core/hooks/use-localess.ts
167
+ // src/core/components/localess-document.tsx
167
168
  var import_react2 = require("react");
169
+ var import_jsx_runtime2 = require("react/jsx-runtime");
170
+ var LocalessDocument = (0, import_react2.forwardRef)(({ document }, ref) => {
171
+ const [contentData, setContentData] = (0, import_react2.useState)(document.data);
172
+ (0, import_react2.useEffect)(() => {
173
+ if (isSyncEnabled() && (0, import_client2.isBrowser)() && (0, import_client2.isIframe)()) {
174
+ window.localess?.on(["input", "change"], (event) => {
175
+ if (event.type === "change" || event.type === "input") {
176
+ setContentData(event.data);
177
+ }
178
+ });
179
+ }
180
+ }, []);
181
+ if (!contentData) {
182
+ console.error("LocalessDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
183
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
184
+ "LocalessDocument property ",
185
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: "document.data" }),
186
+ " is not provided."
187
+ ] });
188
+ }
189
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LocalessComponent, { ref, data: contentData, links: document.links, references: document.references });
190
+ });
191
+
192
+ // src/core/hooks/use-localess.ts
193
+ var import_react3 = require("react");
168
194
  var import_client3 = require("@localess/client");
169
195
  var useLocaless = (slug, options = {}) => {
170
- const [document, setDocument] = (0, import_react2.useState)();
196
+ const [document, setDocument] = (0, import_react3.useState)();
171
197
  const client = getLocalessClient();
172
198
  let normalizedSlug;
173
199
  if (Array.isArray(slug)) {
@@ -175,7 +201,7 @@ var useLocaless = (slug, options = {}) => {
175
201
  } else {
176
202
  normalizedSlug = slug;
177
203
  }
178
- (0, import_react2.useEffect)(() => {
204
+ (0, import_react3.useEffect)(() => {
179
205
  async function loadDocument() {
180
206
  const document2 = await client.getContentBySlug(normalizedSlug, options);
181
207
  setDocument(document2);
@@ -193,7 +219,7 @@ var useLocaless = (slug, options = {}) => {
193
219
  };
194
220
 
195
221
  // src/core/richtext.ts
196
- var import_react3 = require("@tiptap/static-renderer/pm/react");
222
+ var import_react4 = require("@tiptap/static-renderer/pm/react");
197
223
  var import_extension_document = require("@tiptap/extension-document");
198
224
  var import_extension_text = require("@tiptap/extension-text");
199
225
  var import_extension_paragraph = require("@tiptap/extension-paragraph");
@@ -210,7 +236,7 @@ var import_extension_code = require("@tiptap/extension-code");
210
236
  var import_extension_code_block_lowlight = require("@tiptap/extension-code-block-lowlight");
211
237
  var import_extension_link = require("@tiptap/extension-link");
212
238
  function renderRichTextToReact(content) {
213
- return (0, import_react3.renderToReactElement)({
239
+ return (0, import_react4.renderToReactElement)({
214
240
  content,
215
241
  extensions: [
216
242
  import_extension_document.Document,
@@ -236,6 +262,7 @@ function renderRichTextToReact(content) {
236
262
  // Annotate the CommonJS export names for ESM import in node:
237
263
  0 && (module.exports = {
238
264
  LocalessComponent,
265
+ LocalessDocument,
239
266
  findLink,
240
267
  getComponent,
241
268
  getFallbackComponent,
package/dist/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
- LocalessComponent,
3
- useLocaless
4
- } from "./chunk-V6JSXN66.mjs";
2
+ LocalessComponent
3
+ } from "./chunk-UW7OWE53.mjs";
5
4
  import {
5
+ FONT_BOLD,
6
+ FONT_NORMAL,
6
7
  findLink,
7
8
  getComponent,
8
9
  getFallbackComponent,
@@ -21,8 +22,63 @@ import {
21
22
  setFallbackComponent,
22
23
  unregisterComponent
23
24
  } from "./chunk-ETSLIILF.mjs";
25
+
26
+ // src/core/components/localess-document.tsx
27
+ import { forwardRef, useEffect, useState } from "react";
28
+ import { jsx, jsxs } from "react/jsx-runtime";
29
+ var LocalessDocument = forwardRef(({ document }, ref) => {
30
+ const [contentData, setContentData] = useState(document.data);
31
+ useEffect(() => {
32
+ if (isSyncEnabled() && isBrowser() && isIframe()) {
33
+ window.localess?.on(["input", "change"], (event) => {
34
+ if (event.type === "change" || event.type === "input") {
35
+ setContentData(event.data);
36
+ }
37
+ });
38
+ }
39
+ }, []);
40
+ if (!contentData) {
41
+ console.error("LocalessDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
42
+ return /* @__PURE__ */ jsxs("div", { children: [
43
+ "LocalessDocument property ",
44
+ /* @__PURE__ */ jsx("b", { children: "document.data" }),
45
+ " is not provided."
46
+ ] });
47
+ }
48
+ return /* @__PURE__ */ jsx(LocalessComponent, { ref, data: contentData, links: document.links, references: document.references });
49
+ });
50
+
51
+ // src/core/hooks/use-localess.ts
52
+ import { useEffect as useEffect2, useState as useState2 } from "react";
53
+ import { isBrowser as isBrowser2 } from "@localess/client";
54
+ var useLocaless = (slug, options = {}) => {
55
+ const [document, setDocument] = useState2();
56
+ const client = getLocalessClient();
57
+ let normalizedSlug;
58
+ if (Array.isArray(slug)) {
59
+ normalizedSlug = slug.join("/");
60
+ } else {
61
+ normalizedSlug = slug;
62
+ }
63
+ useEffect2(() => {
64
+ async function loadDocument() {
65
+ const document2 = await client.getContentBySlug(normalizedSlug, options);
66
+ setDocument(document2);
67
+ if (isSyncEnabled() && isBrowser2()) {
68
+ window.localess?.on(["input", "change"], (event) => {
69
+ if (event.type === "change" || event.type === "input") {
70
+ setDocument({ ...document2, data: event.data });
71
+ }
72
+ });
73
+ }
74
+ }
75
+ loadDocument();
76
+ }, [slug, options, client]);
77
+ return document;
78
+ };
24
79
  export {
25
80
  LocalessComponent,
81
+ LocalessDocument,
26
82
  findLink,
27
83
  getComponent,
28
84
  getFallbackComponent,
@@ -0,0 +1,58 @@
1
+ import * as react from 'react';
2
+ import { ContentData, Links, References } from '@localess/client';
3
+
4
+ /**
5
+ * Props for {@link LocalessComponent}.
6
+ *
7
+ * @template T - The content data shape. Defaults to the base {@link ContentData} type.
8
+ */
9
+ type LocalessComponentProps<T extends ContentData = ContentData> = {
10
+ /**
11
+ * The content data object to render. Must have a `_schema` field that matches a key
12
+ * in the component registry configured via `localessInit`.
13
+ */
14
+ data: T;
15
+ /**
16
+ * Optional map of content links keyed by link ID.
17
+ * Pass through to child components so they can resolve {@link ContentLink} values with `findLink`.
18
+ */
19
+ links?: Links;
20
+ /**
21
+ * Optional map of resolved content references keyed by reference ID.
22
+ * Pass through to child components that consume referenced content.
23
+ */
24
+ references?: References;
25
+ };
26
+ /**
27
+ * Dynamic schema-to-component renderer for use in SPA and client-side contexts.
28
+ *
29
+ * Looks up `data._schema` in the component registry (set via `localessInit` or `setComponents`),
30
+ * renders the matched component, and — when Visual Editor sync is active — automatically
31
+ * spreads `localessEditable` attributes on the root element for live targeting.
32
+ *
33
+ * Falls back to the `fallbackComponent` (if registered) when the schema key is not found,
34
+ * or renders an inline error message as a last resort.
35
+ *
36
+ * **Server-safe** — does not include a `'use client'` directive and can be used in
37
+ * React Server Components. For SSR / static-export environments use {@link LocalessServerComponent}
38
+ * from `@localess/react/ssr` instead, which omits the sync attribute injection.
39
+ *
40
+ * @template T - The content data shape. Defaults to {@link ContentData}.
41
+ *
42
+ * @example Basic usage
43
+ * ```tsx
44
+ * import { LocalessComponent } from '@localess/react';
45
+ *
46
+ * <LocalessComponent data={content.data} links={content.links} references={content.references} />
47
+ * ```
48
+ *
49
+ * @example Rendering a list of nested blocks
50
+ * ```tsx
51
+ * {data.body.map(item => (
52
+ * <LocalessComponent key={item._id} data={item} links={content.links} references={content.references} />
53
+ * ))}
54
+ * ```
55
+ */
56
+ declare const LocalessComponent: react.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & react.RefAttributes<HTMLElement>>;
57
+
58
+ export { LocalessComponent as L, type LocalessComponentProps as a };
@@ -0,0 +1,58 @@
1
+ import * as react from 'react';
2
+ import { ContentData, Links, References } from '@localess/client';
3
+
4
+ /**
5
+ * Props for {@link LocalessComponent}.
6
+ *
7
+ * @template T - The content data shape. Defaults to the base {@link ContentData} type.
8
+ */
9
+ type LocalessComponentProps<T extends ContentData = ContentData> = {
10
+ /**
11
+ * The content data object to render. Must have a `_schema` field that matches a key
12
+ * in the component registry configured via `localessInit`.
13
+ */
14
+ data: T;
15
+ /**
16
+ * Optional map of content links keyed by link ID.
17
+ * Pass through to child components so they can resolve {@link ContentLink} values with `findLink`.
18
+ */
19
+ links?: Links;
20
+ /**
21
+ * Optional map of resolved content references keyed by reference ID.
22
+ * Pass through to child components that consume referenced content.
23
+ */
24
+ references?: References;
25
+ };
26
+ /**
27
+ * Dynamic schema-to-component renderer for use in SPA and client-side contexts.
28
+ *
29
+ * Looks up `data._schema` in the component registry (set via `localessInit` or `setComponents`),
30
+ * renders the matched component, and — when Visual Editor sync is active — automatically
31
+ * spreads `localessEditable` attributes on the root element for live targeting.
32
+ *
33
+ * Falls back to the `fallbackComponent` (if registered) when the schema key is not found,
34
+ * or renders an inline error message as a last resort.
35
+ *
36
+ * **Server-safe** — does not include a `'use client'` directive and can be used in
37
+ * React Server Components. For SSR / static-export environments use {@link LocalessServerComponent}
38
+ * from `@localess/react/ssr` instead, which omits the sync attribute injection.
39
+ *
40
+ * @template T - The content data shape. Defaults to {@link ContentData}.
41
+ *
42
+ * @example Basic usage
43
+ * ```tsx
44
+ * import { LocalessComponent } from '@localess/react';
45
+ *
46
+ * <LocalessComponent data={content.data} links={content.links} references={content.references} />
47
+ * ```
48
+ *
49
+ * @example Rendering a list of nested blocks
50
+ * ```tsx
51
+ * {data.body.map(item => (
52
+ * <LocalessComponent key={item._id} data={item} links={content.links} references={content.references} />
53
+ * ))}
54
+ * ```
55
+ */
56
+ declare const LocalessComponent: react.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & react.RefAttributes<HTMLElement>>;
57
+
58
+ export { LocalessComponent as L, type LocalessComponentProps as a };
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import react__default from 'react';
2
2
  import { LocalessClientOptions, LocalessClient, ContentAsset, Links, ContentLink, ContentRichText } from '@localess/client';
3
3
 
4
4
  /**
@@ -24,13 +24,13 @@ type LocalessOptions = LocalessClientOptions & {
24
24
  * }
25
25
  * ```
26
26
  */
27
- components?: Record<string, React__default.ElementType>;
27
+ components?: Record<string, react__default.ElementType>;
28
28
  /**
29
29
  * Fallback React component rendered when `_schema` has no match in the registry.
30
30
  * Receives the same `data`, `links`, and `references` props as any registered component.
31
31
  * If omitted, an inline error message is rendered instead.
32
32
  */
33
- fallbackComponent?: React__default.ElementType;
33
+ fallbackComponent?: react__default.ElementType;
34
34
  /**
35
35
  * When `true`, injects the Localess Visual Editor sync script (`sync-v1.js`) into
36
36
  * `<head>` so that `input` and `change` events from the editor reach the app.
@@ -96,7 +96,7 @@ declare function getLocalessClient(): LocalessClient;
96
96
  * @param key - The schema key (e.g. `'hero-section'`).
97
97
  * @param component - The React component to render for this schema key.
98
98
  */
99
- declare function registerComponent(key: string, component: React__default.ElementType): void;
99
+ declare function registerComponent(key: string, component: react__default.ElementType): void;
100
100
  /**
101
101
  * Removes a component from the registry by schema key.
102
102
  * No-op if the key does not exist.
@@ -112,7 +112,7 @@ declare function unregisterComponent(key: string): void;
112
112
  *
113
113
  * @param components - A record mapping schema keys to React components.
114
114
  */
115
- declare function setComponents(components: Record<string, React__default.ElementType>): void;
115
+ declare function setComponents(components: Record<string, react__default.ElementType>): void;
116
116
  /**
117
117
  * Looks up a React component by its schema key.
118
118
  *
@@ -122,7 +122,7 @@ declare function setComponents(components: Record<string, React__default.Element
122
122
  * @param key - The schema key to look up (matches `content._schema`).
123
123
  * @returns The registered React component, or `undefined` if not found.
124
124
  */
125
- declare function getComponent(key: string): React__default.ElementType | undefined;
125
+ declare function getComponent(key: string): react__default.ElementType | undefined;
126
126
  /**
127
127
  * Sets the fallback component rendered when no registry match is found for a schema key.
128
128
  *
@@ -131,7 +131,7 @@ declare function getComponent(key: string): React__default.ElementType | undefin
131
131
  *
132
132
  * @param fallbackComponent - The React component to use as the fallback.
133
133
  */
134
- declare function setFallbackComponent(fallbackComponent: React__default.ElementType): void;
134
+ declare function setFallbackComponent(fallbackComponent: react__default.ElementType): void;
135
135
  /**
136
136
  * Returns the currently registered fallback component, or `undefined` if none is set.
137
137
  *
@@ -140,7 +140,7 @@ declare function setFallbackComponent(fallbackComponent: React__default.ElementT
140
140
  *
141
141
  * @returns The fallback React component, or `undefined`.
142
142
  */
143
- declare function getFallbackComponent(): React__default.ElementType | undefined;
143
+ declare function getFallbackComponent(): react__default.ElementType | undefined;
144
144
  /**
145
145
  * Returns `true` when Visual Editor sync was enabled via `enableSync: true` in `localessInit`.
146
146
  *
@@ -213,6 +213,6 @@ declare function findLink(links: Links | undefined, link: ContentLink): string;
213
213
  * }
214
214
  * ```
215
215
  */
216
- declare function renderRichTextToReact(content: ContentRichText): React__default.ReactNode;
216
+ declare function renderRichTextToReact(content: ContentRichText): react__default.ReactNode;
217
217
 
218
218
  export { type LocalessOptions as L, getFallbackComponent as a, getLocalessClient as b, renderRichTextToReact as c, resolveAsset as d, setFallbackComponent as e, findLink as f, getComponent as g, isSyncEnabled as i, localessInit as l, registerComponent as r, setComponents as s, unregisterComponent as u };
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import react__default from 'react';
2
2
  import { LocalessClientOptions, LocalessClient, ContentAsset, Links, ContentLink, ContentRichText } from '@localess/client';
3
3
 
4
4
  /**
@@ -24,13 +24,13 @@ type LocalessOptions = LocalessClientOptions & {
24
24
  * }
25
25
  * ```
26
26
  */
27
- components?: Record<string, React__default.ElementType>;
27
+ components?: Record<string, react__default.ElementType>;
28
28
  /**
29
29
  * Fallback React component rendered when `_schema` has no match in the registry.
30
30
  * Receives the same `data`, `links`, and `references` props as any registered component.
31
31
  * If omitted, an inline error message is rendered instead.
32
32
  */
33
- fallbackComponent?: React__default.ElementType;
33
+ fallbackComponent?: react__default.ElementType;
34
34
  /**
35
35
  * When `true`, injects the Localess Visual Editor sync script (`sync-v1.js`) into
36
36
  * `<head>` so that `input` and `change` events from the editor reach the app.
@@ -96,7 +96,7 @@ declare function getLocalessClient(): LocalessClient;
96
96
  * @param key - The schema key (e.g. `'hero-section'`).
97
97
  * @param component - The React component to render for this schema key.
98
98
  */
99
- declare function registerComponent(key: string, component: React__default.ElementType): void;
99
+ declare function registerComponent(key: string, component: react__default.ElementType): void;
100
100
  /**
101
101
  * Removes a component from the registry by schema key.
102
102
  * No-op if the key does not exist.
@@ -112,7 +112,7 @@ declare function unregisterComponent(key: string): void;
112
112
  *
113
113
  * @param components - A record mapping schema keys to React components.
114
114
  */
115
- declare function setComponents(components: Record<string, React__default.ElementType>): void;
115
+ declare function setComponents(components: Record<string, react__default.ElementType>): void;
116
116
  /**
117
117
  * Looks up a React component by its schema key.
118
118
  *
@@ -122,7 +122,7 @@ declare function setComponents(components: Record<string, React__default.Element
122
122
  * @param key - The schema key to look up (matches `content._schema`).
123
123
  * @returns The registered React component, or `undefined` if not found.
124
124
  */
125
- declare function getComponent(key: string): React__default.ElementType | undefined;
125
+ declare function getComponent(key: string): react__default.ElementType | undefined;
126
126
  /**
127
127
  * Sets the fallback component rendered when no registry match is found for a schema key.
128
128
  *
@@ -131,7 +131,7 @@ declare function getComponent(key: string): React__default.ElementType | undefin
131
131
  *
132
132
  * @param fallbackComponent - The React component to use as the fallback.
133
133
  */
134
- declare function setFallbackComponent(fallbackComponent: React__default.ElementType): void;
134
+ declare function setFallbackComponent(fallbackComponent: react__default.ElementType): void;
135
135
  /**
136
136
  * Returns the currently registered fallback component, or `undefined` if none is set.
137
137
  *
@@ -140,7 +140,7 @@ declare function setFallbackComponent(fallbackComponent: React__default.ElementT
140
140
  *
141
141
  * @returns The fallback React component, or `undefined`.
142
142
  */
143
- declare function getFallbackComponent(): React__default.ElementType | undefined;
143
+ declare function getFallbackComponent(): react__default.ElementType | undefined;
144
144
  /**
145
145
  * Returns `true` when Visual Editor sync was enabled via `enableSync: true` in `localessInit`.
146
146
  *
@@ -213,6 +213,6 @@ declare function findLink(links: Links | undefined, link: ContentLink): string;
213
213
  * }
214
214
  * ```
215
215
  */
216
- declare function renderRichTextToReact(content: ContentRichText): React__default.ReactNode;
216
+ declare function renderRichTextToReact(content: ContentRichText): react__default.ReactNode;
217
217
 
218
218
  export { type LocalessOptions as L, getFallbackComponent as a, getLocalessClient as b, renderRichTextToReact as c, resolveAsset as d, setFallbackComponent as e, findLink as f, getComponent as g, isSyncEnabled as i, localessInit as l, registerComponent as r, setComponents as s, unregisterComponent as u };
package/dist/rsc.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-l2BRZFEP.mjs';
1
+ export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-D6tBmv-7.mjs';
2
2
  export { LocalessServerComponent, LocalessServerComponentProps, LocalessServerDocument, LocalessServerDocumentProps } from './ssr.mjs';
3
- import { ContentData, Links, References } from '@localess/client';
3
+ import { ContentData, Content } from '@localess/client';
4
4
  export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, References, Translations, isBrowser, isIframe, isServer, localessEditable, localessEditableField } from '@localess/client';
5
- export { LocalessComponent, LocalessComponentProps, UseLocalessOptions, useLocaless } from './index.mjs';
6
- import * as React from 'react';
5
+ export { L as LocalessComponent, a as LocalessComponentProps } from './localess-component-DikkO35Z.mjs';
6
+ import * as react from 'react';
7
7
 
8
8
  /**
9
9
  * Props for {@link LocalessDocument}.
@@ -12,21 +12,10 @@ import * as React from 'react';
12
12
  */
13
13
  type LocalessDocumentProps<T extends ContentData = ContentData> = {
14
14
  /**
15
- * The content data object to render typically `content.data` from `getContentBySlug`.
16
- * Should be fetched server-side and passed as a prop so the page renders immediately
17
- * without a loading flash.
15
+ * The full content response object as returned by `getContentBySlug` or `getContentById`.
16
+ * Must contain a `data` field with a valid `_schema` key.
18
17
  */
19
- data: T;
20
- /**
21
- * Optional map of content links keyed by link ID.
22
- * Passed through to child components for resolving {@link ContentLink} values with `findLink`.
23
- */
24
- links?: Links;
25
- /**
26
- * Optional map of resolved content references keyed by reference ID.
27
- * Passed through to child components that consume referenced content.
28
- */
29
- references?: References;
18
+ document: Content<T>;
30
19
  };
31
20
  /**
32
21
  * Client Component that renders content and automatically subscribes to Visual Editor sync events.
@@ -67,6 +56,6 @@ type LocalessDocumentProps<T extends ContentData = ContentData> = {
67
56
  * }
68
57
  * ```
69
58
  */
70
- declare const LocalessDocument: React.ForwardRefExoticComponent<LocalessDocumentProps<ContentData> & React.RefAttributes<HTMLElement>>;
59
+ declare const LocalessDocument: react.ForwardRefExoticComponent<LocalessDocumentProps<ContentData> & react.RefAttributes<HTMLElement>>;
71
60
 
72
61
  export { LocalessDocument, type LocalessDocumentProps };
package/dist/rsc.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-l2BRZFEP.js';
1
+ export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, i as isSyncEnabled, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-D6tBmv-7.js';
2
2
  export { LocalessServerComponent, LocalessServerComponentProps, LocalessServerDocument, LocalessServerDocumentProps } from './ssr.js';
3
- import { ContentData, Links, References } from '@localess/client';
3
+ import { ContentData, Content } from '@localess/client';
4
4
  export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, References, Translations, isBrowser, isIframe, isServer, localessEditable, localessEditableField } from '@localess/client';
5
- export { LocalessComponent, LocalessComponentProps, UseLocalessOptions, useLocaless } from './index.js';
6
- import * as React from 'react';
5
+ export { L as LocalessComponent, a as LocalessComponentProps } from './localess-component-DikkO35Z.js';
6
+ import * as react from 'react';
7
7
 
8
8
  /**
9
9
  * Props for {@link LocalessDocument}.
@@ -12,21 +12,10 @@ import * as React from 'react';
12
12
  */
13
13
  type LocalessDocumentProps<T extends ContentData = ContentData> = {
14
14
  /**
15
- * The content data object to render typically `content.data` from `getContentBySlug`.
16
- * Should be fetched server-side and passed as a prop so the page renders immediately
17
- * without a loading flash.
15
+ * The full content response object as returned by `getContentBySlug` or `getContentById`.
16
+ * Must contain a `data` field with a valid `_schema` key.
18
17
  */
19
- data: T;
20
- /**
21
- * Optional map of content links keyed by link ID.
22
- * Passed through to child components for resolving {@link ContentLink} values with `findLink`.
23
- */
24
- links?: Links;
25
- /**
26
- * Optional map of resolved content references keyed by reference ID.
27
- * Passed through to child components that consume referenced content.
28
- */
29
- references?: References;
18
+ document: Content<T>;
30
19
  };
31
20
  /**
32
21
  * Client Component that renders content and automatically subscribes to Visual Editor sync events.
@@ -67,6 +56,6 @@ type LocalessDocumentProps<T extends ContentData = ContentData> = {
67
56
  * }
68
57
  * ```
69
58
  */
70
- declare const LocalessDocument: React.ForwardRefExoticComponent<LocalessDocumentProps<ContentData> & React.RefAttributes<HTMLElement>>;
59
+ declare const LocalessDocument: react.ForwardRefExoticComponent<LocalessDocumentProps<ContentData> & react.RefAttributes<HTMLElement>>;
71
60
 
72
61
  export { LocalessDocument, type LocalessDocumentProps };
package/dist/rsc.js CHANGED
@@ -38,8 +38,7 @@ __export(rsc_exports, {
38
38
  registerComponent: () => registerComponent,
39
39
  renderRichTextToReact: () => renderRichTextToReact,
40
40
  resolveAsset: () => resolveAsset,
41
- unregisterComponent: () => unregisterComponent,
42
- useLocaless: () => useLocaless
41
+ unregisterComponent: () => unregisterComponent
43
42
  });
44
43
  module.exports = __toCommonJS(rsc_exports);
45
44
 
@@ -133,7 +132,7 @@ var LocalessServerComponent = (0, import_react.forwardRef)(({ data, links, refer
133
132
  var import_react2 = require("react");
134
133
  var import_jsx_runtime2 = require("react/jsx-runtime");
135
134
  var LocalessServerDocument = (0, import_react2.forwardRef)(({ document }, ref) => {
136
- if (!document || !document.data) {
135
+ if (!document.data) {
137
136
  console.error("LocalessServerDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
138
137
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
139
138
  "LocalessServerDocument property ",
@@ -246,57 +245,17 @@ var LocalessComponent = (0, import_react4.forwardRef)(
246
245
  // src/rsc/localess-document.tsx
247
246
  var import_react5 = require("react");
248
247
  var import_jsx_runtime4 = require("react/jsx-runtime");
249
- var LocalessDocument = (0, import_react5.forwardRef)(({
250
- data,
251
- links,
252
- references,
253
- ...restProps
254
- }, ref) => {
255
- const [contentData, setContentData] = (0, import_react5.useState)(data);
256
- (0, import_react5.useEffect)(() => {
257
- console.log("LocalessDocument isSyncEnabled:", isSyncEnabled());
258
- console.log("LocalessDocument isBrowser:", (0, import_client2.isBrowser)());
259
- console.log("LocalessDocument isBrowser:", (0, import_client2.isBrowser)());
260
- if (isSyncEnabled() && (0, import_client2.isBrowser)() && (0, import_client2.isIframe)()) {
261
- window.localess?.on(["input", "change"], (event) => {
262
- console.log("Localess:event", event);
263
- if (event.type === "change" || event.type === "input") {
264
- setContentData(event.data);
265
- }
266
- });
267
- }
268
- }, []);
269
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LocalessComponent, { ref, data: contentData, links, references, ...restProps });
270
- });
271
-
272
- // src/core/hooks/use-localess.ts
273
- var import_react6 = require("react");
274
- var import_client3 = require("@localess/client");
275
- var useLocaless = (slug, options = {}) => {
276
- const [document, setDocument] = (0, import_react6.useState)();
277
- const client = getLocalessClient();
278
- let normalizedSlug;
279
- if (Array.isArray(slug)) {
280
- normalizedSlug = slug.join("/");
281
- } else {
282
- normalizedSlug = slug;
248
+ var LocalessDocument = (0, import_react5.forwardRef)(({ document }, ref) => {
249
+ if (!document.data) {
250
+ console.error("LocalessDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
251
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
252
+ "LocalessDocument property ",
253
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("b", { children: "document.data" }),
254
+ " is not provided."
255
+ ] });
283
256
  }
284
- (0, import_react6.useEffect)(() => {
285
- async function loadDocument() {
286
- const document2 = await client.getContentBySlug(normalizedSlug, options);
287
- setDocument(document2);
288
- if (isSyncEnabled() && (0, import_client3.isBrowser)()) {
289
- window.localess?.on(["input", "change"], (event) => {
290
- if (event.type === "change" || event.type === "input") {
291
- setDocument({ ...document2, data: event.data });
292
- }
293
- });
294
- }
295
- }
296
- loadDocument();
297
- }, [slug, options, client]);
298
- return document;
299
- };
257
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LocalessComponent, { ref, data: document.data, links: document.links, references: document.references }) });
258
+ });
300
259
  // Annotate the CommonJS export names for ESM import in node:
301
260
  0 && (module.exports = {
302
261
  LocalessComponent,
@@ -317,6 +276,5 @@ var useLocaless = (slug, options = {}) => {
317
276
  registerComponent,
318
277
  renderRichTextToReact,
319
278
  resolveAsset,
320
- unregisterComponent,
321
- useLocaless
279
+ unregisterComponent
322
280
  });
package/dist/rsc.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
- LocalessComponent,
3
- useLocaless
4
- } from "./chunk-V6JSXN66.mjs";
2
+ LocalessComponent
3
+ } from "./chunk-UW7OWE53.mjs";
5
4
  import {
6
5
  LocalessServerComponent,
7
6
  LocalessServerDocument
8
- } from "./chunk-AJP75NRT.mjs";
7
+ } from "./chunk-DD2NUMQJ.mjs";
9
8
  import {
9
+ FONT_BOLD,
10
+ FONT_NORMAL,
10
11
  findLink,
11
12
  getComponent,
12
13
  getFallbackComponent,
@@ -25,29 +26,18 @@ import {
25
26
  } from "./chunk-ETSLIILF.mjs";
26
27
 
27
28
  // src/rsc/localess-document.tsx
28
- import { forwardRef, useEffect, useState } from "react";
29
- import { jsx } from "react/jsx-runtime";
30
- var LocalessDocument = forwardRef(({
31
- data,
32
- links,
33
- references,
34
- ...restProps
35
- }, ref) => {
36
- const [contentData, setContentData] = useState(data);
37
- useEffect(() => {
38
- console.log("LocalessDocument isSyncEnabled:", isSyncEnabled());
39
- console.log("LocalessDocument isBrowser:", isBrowser());
40
- console.log("LocalessDocument isBrowser:", isBrowser());
41
- if (isSyncEnabled() && isBrowser() && isIframe()) {
42
- window.localess?.on(["input", "change"], (event) => {
43
- console.log("Localess:event", event);
44
- if (event.type === "change" || event.type === "input") {
45
- setContentData(event.data);
46
- }
47
- });
48
- }
49
- }, []);
50
- return /* @__PURE__ */ jsx(LocalessComponent, { ref, data: contentData, links, references, ...restProps });
29
+ import { forwardRef } from "react";
30
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
31
+ var LocalessDocument = forwardRef(({ document }, ref) => {
32
+ if (!document.data) {
33
+ console.error("LocalessDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
34
+ return /* @__PURE__ */ jsxs("div", { children: [
35
+ "LocalessDocument property ",
36
+ /* @__PURE__ */ jsx("b", { children: "document.data" }),
37
+ " is not provided."
38
+ ] });
39
+ }
40
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(LocalessComponent, { ref, data: document.data, links: document.links, references: document.references }) });
51
41
  });
52
42
  export {
53
43
  LocalessComponent,
@@ -68,6 +58,5 @@ export {
68
58
  registerComponent,
69
59
  renderRichTextToReact,
70
60
  resolveAsset,
71
- unregisterComponent,
72
- useLocaless
61
+ unregisterComponent
73
62
  };
package/dist/ssr.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-l2BRZFEP.mjs';
2
- import * as React from 'react';
1
+ export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-D6tBmv-7.mjs';
2
+ import * as react from 'react';
3
3
  import { ContentData, Links, References, Content } from '@localess/client';
4
4
  export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, References, Translations, isBrowser, isIframe, isServer, localessEditable, localessEditableField } from '@localess/client';
5
5
 
@@ -49,7 +49,7 @@ type LocalessServerComponentProps<T extends ContentData = ContentData> = {
49
49
  * <LocalessServerComponent data={content.data} links={content.links} references={content.references} />
50
50
  * ```
51
51
  */
52
- declare const LocalessServerComponent: React.ForwardRefExoticComponent<LocalessServerComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
52
+ declare const LocalessServerComponent: react.ForwardRefExoticComponent<LocalessServerComponentProps<ContentData> & react.RefAttributes<HTMLElement>>;
53
53
 
54
54
  /**
55
55
  * Props for {@link LocalessServerDocument}.
@@ -91,6 +91,6 @@ type LocalessServerDocumentProps<T extends ContentData = ContentData> = {
91
91
  * return <LocalessServerDocument document={content} />;
92
92
  * ```
93
93
  */
94
- declare const LocalessServerDocument: React.ForwardRefExoticComponent<LocalessServerDocumentProps<ContentData> & React.RefAttributes<HTMLElement>>;
94
+ declare const LocalessServerDocument: react.ForwardRefExoticComponent<LocalessServerDocumentProps<ContentData> & react.RefAttributes<HTMLElement>>;
95
95
 
96
96
  export { LocalessServerComponent, type LocalessServerComponentProps, LocalessServerDocument, type LocalessServerDocumentProps };
package/dist/ssr.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-l2BRZFEP.js';
2
- import * as React from 'react';
1
+ export { L as LocalessOptions, f as findLink, g as getComponent, a as getFallbackComponent, b as getLocalessClient, l as localessInit, r as registerComponent, c as renderRichTextToReact, d as resolveAsset, u as unregisterComponent } from './richtext-D6tBmv-7.js';
2
+ import * as react from 'react';
3
3
  import { ContentData, Links, References, Content } from '@localess/client';
4
4
  export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, References, Translations, isBrowser, isIframe, isServer, localessEditable, localessEditableField } from '@localess/client';
5
5
 
@@ -49,7 +49,7 @@ type LocalessServerComponentProps<T extends ContentData = ContentData> = {
49
49
  * <LocalessServerComponent data={content.data} links={content.links} references={content.references} />
50
50
  * ```
51
51
  */
52
- declare const LocalessServerComponent: React.ForwardRefExoticComponent<LocalessServerComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
52
+ declare const LocalessServerComponent: react.ForwardRefExoticComponent<LocalessServerComponentProps<ContentData> & react.RefAttributes<HTMLElement>>;
53
53
 
54
54
  /**
55
55
  * Props for {@link LocalessServerDocument}.
@@ -91,6 +91,6 @@ type LocalessServerDocumentProps<T extends ContentData = ContentData> = {
91
91
  * return <LocalessServerDocument document={content} />;
92
92
  * ```
93
93
  */
94
- declare const LocalessServerDocument: React.ForwardRefExoticComponent<LocalessServerDocumentProps<ContentData> & React.RefAttributes<HTMLElement>>;
94
+ declare const LocalessServerDocument: react.ForwardRefExoticComponent<LocalessServerDocumentProps<ContentData> & react.RefAttributes<HTMLElement>>;
95
95
 
96
96
  export { LocalessServerComponent, type LocalessServerComponentProps, LocalessServerDocument, type LocalessServerDocumentProps };
package/dist/ssr.js CHANGED
@@ -126,7 +126,7 @@ var LocalessServerComponent = (0, import_react.forwardRef)(({ data, links, refer
126
126
  var import_react2 = require("react");
127
127
  var import_jsx_runtime2 = require("react/jsx-runtime");
128
128
  var LocalessServerDocument = (0, import_react2.forwardRef)(({ document }, ref) => {
129
- if (!document || !document.data) {
129
+ if (!document.data) {
130
130
  console.error("LocalessServerDocument property %cdocument.data%c is not provided.", FONT_BOLD, FONT_NORMAL);
131
131
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
132
132
  "LocalessServerDocument property ",
package/dist/ssr.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LocalessServerComponent,
3
3
  LocalessServerDocument
4
- } from "./chunk-AJP75NRT.mjs";
4
+ } from "./chunk-DD2NUMQJ.mjs";
5
5
  import {
6
6
  findLink,
7
7
  getComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/react",
3
- "version": "3.0.1-dev.20260410071322",
3
+ "version": "3.0.1-dev.20260411012947",
4
4
  "description": "ReactJS JavaScript/TypeScript SDK for Localess's API.",
5
5
  "keywords": [
6
6
  "localess",
@@ -56,7 +56,7 @@
56
56
  "react-dom": "^17 || ^18 || ^19"
57
57
  },
58
58
  "dependencies": {
59
- "@localess/client": "3.0.1-dev.20260410071322",
59
+ "@localess/client": "3.0.1-dev.20260411012947",
60
60
  "@tiptap/static-renderer": "^3.20.1",
61
61
  "@tiptap/html": "^3.20.1",
62
62
  "@tiptap/extension-bold": "^3.20.1",