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

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 (64) hide show
  1. package/dist/console.d.ts +2 -0
  2. package/dist/console.js +1 -0
  3. package/dist/console.mjs +4 -0
  4. package/dist/core/components/index.d.ts +8 -0
  5. package/dist/core/components/localess-component.d.ts +54 -0
  6. package/dist/core/components/localess-component.js +1 -0
  7. package/dist/core/components/localess-component.mjs +39 -0
  8. package/dist/{rsc.d.ts → core/components/localess-document.d.ts} +6 -25
  9. package/dist/core/components/localess-document.js +1 -0
  10. package/dist/core/components/localess-document.mjs +26 -0
  11. package/dist/core/hooks/index.d.ts +9 -0
  12. package/dist/core/hooks/use-localess.d.ts +45 -0
  13. package/dist/core/hooks/use-localess.js +1 -0
  14. package/dist/core/hooks/use-localess.mjs +25 -0
  15. package/dist/core/models/client.d.ts +43 -0
  16. package/dist/core/models/content.d.ts +1 -0
  17. package/dist/core/models/index.d.ts +33 -0
  18. package/dist/core/models/sync.d.ts +1 -0
  19. package/dist/core/models/translation.d.ts +1 -0
  20. package/dist/core/richtext.d.ts +26 -0
  21. package/dist/core/richtext.js +1 -0
  22. package/dist/core/richtext.mjs +48 -0
  23. package/dist/core/state.d.ts +127 -0
  24. package/dist/core/state.js +1 -0
  25. package/dist/core/state.mjs +43 -0
  26. package/dist/core/utils/index.d.ts +19 -0
  27. package/dist/core/utils/index.mjs +3 -0
  28. package/dist/core/utils/link.util.d.ts +24 -0
  29. package/dist/core/utils/link.util.js +1 -0
  30. package/dist/core/utils/link.util.mjs +15 -0
  31. package/dist/index.d.ts +19 -97
  32. package/dist/index.js +1 -257
  33. package/dist/index.mjs +8 -44
  34. package/dist/rsc/index.d.ts +30 -0
  35. package/dist/rsc/index.js +1 -0
  36. package/dist/rsc/index.mjs +9 -0
  37. package/dist/{rsc.d.mts → rsc/localess-document.d.ts} +6 -25
  38. package/dist/rsc/localess-document.js +1 -0
  39. package/dist/rsc/localess-document.mjs +23 -0
  40. package/dist/rsc/localess-sync.d.ts +7 -0
  41. package/dist/rsc/localess-sync.js +1 -0
  42. package/dist/rsc/localess-sync.mjs +12 -0
  43. package/dist/ssr/index.d.ts +33 -0
  44. package/dist/ssr/index.js +1 -0
  45. package/dist/ssr/index.mjs +7 -0
  46. package/dist/ssr/localess-component.d.ts +48 -0
  47. package/dist/ssr/localess-component.js +1 -0
  48. package/dist/ssr/localess-component.mjs +37 -0
  49. package/dist/ssr/localess-document.d.ts +42 -0
  50. package/dist/ssr/localess-document.js +1 -0
  51. package/dist/ssr/localess-document.mjs +17 -0
  52. package/package.json +32 -24
  53. package/dist/chunk-AJP75NRT.mjs +0 -56
  54. package/dist/chunk-ETSLIILF.mjs +0 -149
  55. package/dist/chunk-V6JSXN66.mjs +0 -76
  56. package/dist/index.d.mts +0 -104
  57. package/dist/richtext-l2BRZFEP.d.mts +0 -218
  58. package/dist/richtext-l2BRZFEP.d.ts +0 -218
  59. package/dist/rsc.js +0 -322
  60. package/dist/rsc.mjs +0 -73
  61. package/dist/ssr.d.mts +0 -96
  62. package/dist/ssr.d.ts +0 -96
  63. package/dist/ssr.js +0 -223
  64. package/dist/ssr.mjs +0 -38
package/dist/index.d.mts DELETED
@@ -1,104 +0,0 @@
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';
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
-
6
- /**
7
- * Props for {@link LocalessComponent}.
8
- *
9
- * @template T - The content data shape. Defaults to the base {@link ContentData} type.
10
- */
11
- type LocalessComponentProps<T extends ContentData = ContentData> = {
12
- /**
13
- * The content data object to render. Must have a `_schema` field that matches a key
14
- * in the component registry configured via `localessInit`.
15
- */
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;
27
- };
28
- /**
29
- * Dynamic schema-to-component renderer for use in SPA and client-side contexts.
30
- *
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.
34
- *
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.
37
- *
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.
41
- *
42
- * @template T - The content data shape. Defaults to {@link ContentData}.
43
- *
44
- * @example Basic usage
45
- * ```tsx
46
- * import { LocalessComponent } from '@localess/react';
47
- *
48
- * <LocalessComponent data={content.data} links={content.links} references={content.references} />
49
- * ```
50
- *
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
- * ))}
56
- * ```
57
- */
58
- declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
59
-
60
- /**
61
- * Options for {@link useLocaless}.
62
- * Extends {@link ContentFetchParams} with any future hook-specific settings.
63
- */
64
- type UseLocalessOptions = ContentFetchParams & {};
65
- /**
66
- * React hook for fetching Localess content by slug inside a Client Component.
67
- *
68
- * Fetches content on mount using `getLocalessClient().getContentBySlug`, stores it in local state,
69
- * and — when `enableSync` is active and the page is running inside the Visual Editor iframe —
70
- * automatically subscribes to `input` and `change` events so content updates live without a reload.
71
- *
72
- * **Requires `'use client'`** — must be called inside a Client Component.
73
- *
74
- * **Recommended pattern:** fetch data server-side and pass it as `initialContent`, then use the
75
- * hook result with `?? initialContent` to avoid a loading flash:
76
- * ```tsx
77
- * const content = useLocaless('home', { locale }) ?? initialContent;
78
- * ```
79
- *
80
- * @template T - The content data shape. Defaults to {@link ContentData}.
81
- *
82
- * @param slug - Content slug string, or an array of path segments that will be joined with `/`.
83
- * @param options - Optional fetch parameters (locale, version, resolveReference, resolveLink).
84
- * @returns The fetched {@link Content}<T> object, or `undefined` while the initial fetch is in flight.
85
- *
86
- * @example Basic usage
87
- * ```tsx
88
- * 'use client';
89
- * import { useLocaless } from '@localess/react/rsc';
90
- *
91
- * export function PageClient({ initialContent, locale }) {
92
- * const content = useLocaless('home', { locale }) ?? initialContent;
93
- * return <LocalessComponent data={content.data} links={content.links} />;
94
- * }
95
- * ```
96
- *
97
- * @example Array slug (joined as 'blog/my-post')
98
- * ```tsx
99
- * const content = useLocaless(['blog', 'my-post'], { locale: 'en' });
100
- * ```
101
- */
102
- declare const useLocaless: <T extends ContentData = ContentData>(slug: string | string[], options?: UseLocalessOptions) => Content<T> | undefined;
103
-
104
- export { LocalessComponent, type LocalessComponentProps, type UseLocalessOptions, useLocaless };
@@ -1,218 +0,0 @@
1
- import React__default from 'react';
2
- import { LocalessClientOptions, LocalessClient, ContentAsset, Links, ContentLink, ContentRichText } from '@localess/client';
3
-
4
- /**
5
- * Initialization options for {@link localessInit}.
6
- *
7
- * Extends {@link LocalessClientOptions} (origin, spaceId, token, version, debug, cacheTTL)
8
- * with React-specific settings for component mapping and Visual Editor sync.
9
- */
10
- type LocalessOptions = LocalessClientOptions & {
11
- /**
12
- * Map of schema keys to React components used by {@link LocalessComponent} and
13
- * {@link LocalessServerComponent} to render content blocks.
14
- *
15
- * Keys must match the `_schema` field of your Localess content objects.
16
- * Use lowercase hyphenated names by convention (e.g. `'hero-section'`).
17
- *
18
- * @example
19
- * ```ts
20
- * components: {
21
- * 'page': PageComponent,
22
- * 'hero-section': HeroSection,
23
- * 'nav-menu': NavMenu,
24
- * }
25
- * ```
26
- */
27
- components?: Record<string, React__default.ElementType>;
28
- /**
29
- * Fallback React component rendered when `_schema` has no match in the registry.
30
- * Receives the same `data`, `links`, and `references` props as any registered component.
31
- * If omitted, an inline error message is rendered instead.
32
- */
33
- fallbackComponent?: React__default.ElementType;
34
- /**
35
- * When `true`, injects the Localess Visual Editor sync script (`sync-v1.js`) into
36
- * `<head>` so that `input` and `change` events from the editor reach the app.
37
- * Only takes effect when the page is running inside the Visual Editor iframe.
38
- * Set to `false` (or omit) in production builds to avoid loading the script.
39
- *
40
- * @default false
41
- */
42
- enableSync?: boolean;
43
- };
44
-
45
- /**
46
- * Initialize the Localess SDK.
47
- *
48
- * Must be called **once** at application startup (e.g. root layout, `_app.tsx`) before any
49
- * other SDK function is used. Calling it again overwrites the existing client and state.
50
- *
51
- * - Creates the underlying {@link LocalessClient} with the supplied API options.
52
- * - Registers the component map and optional fallback component.
53
- * - When `enableSync` is `true` and the page is running inside the Visual Editor iframe,
54
- * injects the Localess sync script into `<head>` to enable live editing events.
55
- *
56
- * @param options - Initialization options. Extends {@link LocalessClientOptions} with
57
- * `components`, `fallbackComponent`, and `enableSync`.
58
- * @returns The initialized {@link LocalessClient} instance.
59
- *
60
- * @example
61
- * ```ts
62
- * import { localessInit } from '@localess/react';
63
- * import { Page, Header, Teaser } from '@/components';
64
- *
65
- * localessInit({
66
- * origin: 'https://my-localess.web.app',
67
- * spaceId: 'YOUR_SPACE_ID',
68
- * token: 'YOUR_API_TOKEN', // keep server-side only
69
- * enableSync: process.env.NODE_ENV !== 'production',
70
- * components: { page: Page, header: Header, teaser: Teaser },
71
- * });
72
- * ```
73
- */
74
- declare function localessInit(options: LocalessOptions): LocalessClient;
75
- /**
76
- * Returns the initialized {@link LocalessClient} instance.
77
- *
78
- * Throws an error if called before {@link localessInit}. Use this in server components,
79
- * API routes, or server-side data fetching functions to make API calls.
80
- *
81
- * @throws {Error} If `localessInit` has not been called yet.
82
- * @returns The active {@link LocalessClient}.
83
- *
84
- * @example
85
- * ```ts
86
- * const content = await getLocalessClient().getContentBySlug<MyPage>('home', { locale: 'en' });
87
- * ```
88
- */
89
- declare function getLocalessClient(): LocalessClient;
90
- /**
91
- * Adds a single component to the registry under the given schema key.
92
- *
93
- * The key must match the `_schema` field of the content objects you want to render.
94
- * Overwrites any previously registered component for the same key.
95
- *
96
- * @param key - The schema key (e.g. `'hero-section'`).
97
- * @param component - The React component to render for this schema key.
98
- */
99
- declare function registerComponent(key: string, component: React__default.ElementType): void;
100
- /**
101
- * Removes a component from the registry by schema key.
102
- * No-op if the key does not exist.
103
- *
104
- * @param key - The schema key to remove.
105
- */
106
- declare function unregisterComponent(key: string): void;
107
- /**
108
- * Replaces the entire component registry with the supplied map.
109
- *
110
- * Useful when you need to swap all components at once (e.g. lazy-loaded registry).
111
- * Any previously registered components (including those set via `localessInit`) are discarded.
112
- *
113
- * @param components - A record mapping schema keys to React components.
114
- */
115
- declare function setComponents(components: Record<string, React__default.ElementType>): void;
116
- /**
117
- * Looks up a React component by its schema key.
118
- *
119
- * Returns `undefined` and logs a console error when the key is not found.
120
- * Called internally by {@link LocalessComponent} and {@link LocalessServerComponent}.
121
- *
122
- * @param key - The schema key to look up (matches `content._schema`).
123
- * @returns The registered React component, or `undefined` if not found.
124
- */
125
- declare function getComponent(key: string): React__default.ElementType | undefined;
126
- /**
127
- * Sets the fallback component rendered when no registry match is found for a schema key.
128
- *
129
- * The fallback receives the same `data`, `links`, and `references` props as any
130
- * registered component, so it can render a generic placeholder or log the unknown schema.
131
- *
132
- * @param fallbackComponent - The React component to use as the fallback.
133
- */
134
- declare function setFallbackComponent(fallbackComponent: React__default.ElementType): void;
135
- /**
136
- * Returns the currently registered fallback component, or `undefined` if none is set.
137
- *
138
- * Called internally by {@link LocalessComponent} and {@link LocalessServerComponent}
139
- * when a schema key has no matching component in the registry.
140
- *
141
- * @returns The fallback React component, or `undefined`.
142
- */
143
- declare function getFallbackComponent(): React__default.ElementType | undefined;
144
- /**
145
- * Returns `true` when Visual Editor sync was enabled via `enableSync: true` in `localessInit`.
146
- *
147
- * Used internally by {@link LocalessComponent}, {@link LocalessDocument}, and {@link useLocaless}
148
- * to decide whether to inject editable attributes and subscribe to sync events.
149
- *
150
- * @returns `true` if sync is enabled, `false` otherwise.
151
- */
152
- declare function isSyncEnabled(): boolean;
153
- /**
154
- * Resolves a {@link ContentAsset} to its full URL string.
155
- *
156
- * Constructs the URL using the `origin` and `spaceId` from `localessInit`:
157
- * `{origin}/api/v1/spaces/{spaceId}/assets/{asset.uri}`
158
- *
159
- * @param asset - The asset reference object containing a `uri` field.
160
- * @returns The fully qualified asset URL string.
161
- *
162
- * @example
163
- * ```tsx
164
- * <img src={resolveAsset(data.heroImage)} alt={data.heroImage.alt} />
165
- * ```
166
- */
167
- declare function resolveAsset(asset: ContentAsset): string;
168
-
169
- /**
170
- * Resolves a {@link ContentLink} reference to a navigable URL string.
171
- *
172
- * Resolution rules by `link.type`:
173
- * - `'content'` — looks up `link.uri` in the `links` map and returns `'/' + fullSlug`.
174
- * Returns `'/not-found'` when `links` is undefined or the URI is not in the map.
175
- * - `'url'` — returns `link.uri` directly (external or absolute URL).
176
- * - anything else — returns `'no-type'` (indicates a misconfigured link field).
177
- *
178
- * @param links - The links map from `content.links` (keyed by link URI). May be `undefined`.
179
- * @param link - The content link reference to resolve.
180
- * @returns A URL string ready to use in an `<a href>` or Next.js `<Link href>`.
181
- *
182
- * @example
183
- * ```tsx
184
- * import { findLink } from '@localess/react';
185
- *
186
- * function NavItem({ data, links }) {
187
- * return <a href={findLink(links, data.url)}>{data.label}</a>;
188
- * }
189
- * ```
190
- */
191
- declare function findLink(links: Links | undefined, link: ContentLink): string;
192
-
193
- /**
194
- * Renders a Localess rich text field to a React node tree.
195
- *
196
- * Converts a {@link ContentRichText} value (TipTap ProseMirror document JSON) into
197
- * `React.ReactNode` using TipTap's static renderer. No browser APIs are required —
198
- * safe to call in React Server Components and SSR.
199
- *
200
- * Supported TipTap extensions: Document, Text, Paragraph, Heading (h1–h6), Bold,
201
- * Italic, Strike, Underline, History, ListItem, OrderedList, BulletList, Code,
202
- * CodeBlockLowlight, Link.
203
- *
204
- * @param content - The rich text value from a Localess content field (type `ContentRichText`).
205
- * @returns A `React.ReactNode` ready to render inside JSX.
206
- *
207
- * @example
208
- * ```tsx
209
- * import { renderRichTextToReact } from '@localess/react';
210
- *
211
- * export function Article({ data }: { data: MyContent }) {
212
- * return <article>{renderRichTextToReact(data.body)}</article>;
213
- * }
214
- * ```
215
- */
216
- declare function renderRichTextToReact(content: ContentRichText): React__default.ReactNode;
217
-
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,218 +0,0 @@
1
- import React__default from 'react';
2
- import { LocalessClientOptions, LocalessClient, ContentAsset, Links, ContentLink, ContentRichText } from '@localess/client';
3
-
4
- /**
5
- * Initialization options for {@link localessInit}.
6
- *
7
- * Extends {@link LocalessClientOptions} (origin, spaceId, token, version, debug, cacheTTL)
8
- * with React-specific settings for component mapping and Visual Editor sync.
9
- */
10
- type LocalessOptions = LocalessClientOptions & {
11
- /**
12
- * Map of schema keys to React components used by {@link LocalessComponent} and
13
- * {@link LocalessServerComponent} to render content blocks.
14
- *
15
- * Keys must match the `_schema` field of your Localess content objects.
16
- * Use lowercase hyphenated names by convention (e.g. `'hero-section'`).
17
- *
18
- * @example
19
- * ```ts
20
- * components: {
21
- * 'page': PageComponent,
22
- * 'hero-section': HeroSection,
23
- * 'nav-menu': NavMenu,
24
- * }
25
- * ```
26
- */
27
- components?: Record<string, React__default.ElementType>;
28
- /**
29
- * Fallback React component rendered when `_schema` has no match in the registry.
30
- * Receives the same `data`, `links`, and `references` props as any registered component.
31
- * If omitted, an inline error message is rendered instead.
32
- */
33
- fallbackComponent?: React__default.ElementType;
34
- /**
35
- * When `true`, injects the Localess Visual Editor sync script (`sync-v1.js`) into
36
- * `<head>` so that `input` and `change` events from the editor reach the app.
37
- * Only takes effect when the page is running inside the Visual Editor iframe.
38
- * Set to `false` (or omit) in production builds to avoid loading the script.
39
- *
40
- * @default false
41
- */
42
- enableSync?: boolean;
43
- };
44
-
45
- /**
46
- * Initialize the Localess SDK.
47
- *
48
- * Must be called **once** at application startup (e.g. root layout, `_app.tsx`) before any
49
- * other SDK function is used. Calling it again overwrites the existing client and state.
50
- *
51
- * - Creates the underlying {@link LocalessClient} with the supplied API options.
52
- * - Registers the component map and optional fallback component.
53
- * - When `enableSync` is `true` and the page is running inside the Visual Editor iframe,
54
- * injects the Localess sync script into `<head>` to enable live editing events.
55
- *
56
- * @param options - Initialization options. Extends {@link LocalessClientOptions} with
57
- * `components`, `fallbackComponent`, and `enableSync`.
58
- * @returns The initialized {@link LocalessClient} instance.
59
- *
60
- * @example
61
- * ```ts
62
- * import { localessInit } from '@localess/react';
63
- * import { Page, Header, Teaser } from '@/components';
64
- *
65
- * localessInit({
66
- * origin: 'https://my-localess.web.app',
67
- * spaceId: 'YOUR_SPACE_ID',
68
- * token: 'YOUR_API_TOKEN', // keep server-side only
69
- * enableSync: process.env.NODE_ENV !== 'production',
70
- * components: { page: Page, header: Header, teaser: Teaser },
71
- * });
72
- * ```
73
- */
74
- declare function localessInit(options: LocalessOptions): LocalessClient;
75
- /**
76
- * Returns the initialized {@link LocalessClient} instance.
77
- *
78
- * Throws an error if called before {@link localessInit}. Use this in server components,
79
- * API routes, or server-side data fetching functions to make API calls.
80
- *
81
- * @throws {Error} If `localessInit` has not been called yet.
82
- * @returns The active {@link LocalessClient}.
83
- *
84
- * @example
85
- * ```ts
86
- * const content = await getLocalessClient().getContentBySlug<MyPage>('home', { locale: 'en' });
87
- * ```
88
- */
89
- declare function getLocalessClient(): LocalessClient;
90
- /**
91
- * Adds a single component to the registry under the given schema key.
92
- *
93
- * The key must match the `_schema` field of the content objects you want to render.
94
- * Overwrites any previously registered component for the same key.
95
- *
96
- * @param key - The schema key (e.g. `'hero-section'`).
97
- * @param component - The React component to render for this schema key.
98
- */
99
- declare function registerComponent(key: string, component: React__default.ElementType): void;
100
- /**
101
- * Removes a component from the registry by schema key.
102
- * No-op if the key does not exist.
103
- *
104
- * @param key - The schema key to remove.
105
- */
106
- declare function unregisterComponent(key: string): void;
107
- /**
108
- * Replaces the entire component registry with the supplied map.
109
- *
110
- * Useful when you need to swap all components at once (e.g. lazy-loaded registry).
111
- * Any previously registered components (including those set via `localessInit`) are discarded.
112
- *
113
- * @param components - A record mapping schema keys to React components.
114
- */
115
- declare function setComponents(components: Record<string, React__default.ElementType>): void;
116
- /**
117
- * Looks up a React component by its schema key.
118
- *
119
- * Returns `undefined` and logs a console error when the key is not found.
120
- * Called internally by {@link LocalessComponent} and {@link LocalessServerComponent}.
121
- *
122
- * @param key - The schema key to look up (matches `content._schema`).
123
- * @returns The registered React component, or `undefined` if not found.
124
- */
125
- declare function getComponent(key: string): React__default.ElementType | undefined;
126
- /**
127
- * Sets the fallback component rendered when no registry match is found for a schema key.
128
- *
129
- * The fallback receives the same `data`, `links`, and `references` props as any
130
- * registered component, so it can render a generic placeholder or log the unknown schema.
131
- *
132
- * @param fallbackComponent - The React component to use as the fallback.
133
- */
134
- declare function setFallbackComponent(fallbackComponent: React__default.ElementType): void;
135
- /**
136
- * Returns the currently registered fallback component, or `undefined` if none is set.
137
- *
138
- * Called internally by {@link LocalessComponent} and {@link LocalessServerComponent}
139
- * when a schema key has no matching component in the registry.
140
- *
141
- * @returns The fallback React component, or `undefined`.
142
- */
143
- declare function getFallbackComponent(): React__default.ElementType | undefined;
144
- /**
145
- * Returns `true` when Visual Editor sync was enabled via `enableSync: true` in `localessInit`.
146
- *
147
- * Used internally by {@link LocalessComponent}, {@link LocalessDocument}, and {@link useLocaless}
148
- * to decide whether to inject editable attributes and subscribe to sync events.
149
- *
150
- * @returns `true` if sync is enabled, `false` otherwise.
151
- */
152
- declare function isSyncEnabled(): boolean;
153
- /**
154
- * Resolves a {@link ContentAsset} to its full URL string.
155
- *
156
- * Constructs the URL using the `origin` and `spaceId` from `localessInit`:
157
- * `{origin}/api/v1/spaces/{spaceId}/assets/{asset.uri}`
158
- *
159
- * @param asset - The asset reference object containing a `uri` field.
160
- * @returns The fully qualified asset URL string.
161
- *
162
- * @example
163
- * ```tsx
164
- * <img src={resolveAsset(data.heroImage)} alt={data.heroImage.alt} />
165
- * ```
166
- */
167
- declare function resolveAsset(asset: ContentAsset): string;
168
-
169
- /**
170
- * Resolves a {@link ContentLink} reference to a navigable URL string.
171
- *
172
- * Resolution rules by `link.type`:
173
- * - `'content'` — looks up `link.uri` in the `links` map and returns `'/' + fullSlug`.
174
- * Returns `'/not-found'` when `links` is undefined or the URI is not in the map.
175
- * - `'url'` — returns `link.uri` directly (external or absolute URL).
176
- * - anything else — returns `'no-type'` (indicates a misconfigured link field).
177
- *
178
- * @param links - The links map from `content.links` (keyed by link URI). May be `undefined`.
179
- * @param link - The content link reference to resolve.
180
- * @returns A URL string ready to use in an `<a href>` or Next.js `<Link href>`.
181
- *
182
- * @example
183
- * ```tsx
184
- * import { findLink } from '@localess/react';
185
- *
186
- * function NavItem({ data, links }) {
187
- * return <a href={findLink(links, data.url)}>{data.label}</a>;
188
- * }
189
- * ```
190
- */
191
- declare function findLink(links: Links | undefined, link: ContentLink): string;
192
-
193
- /**
194
- * Renders a Localess rich text field to a React node tree.
195
- *
196
- * Converts a {@link ContentRichText} value (TipTap ProseMirror document JSON) into
197
- * `React.ReactNode` using TipTap's static renderer. No browser APIs are required —
198
- * safe to call in React Server Components and SSR.
199
- *
200
- * Supported TipTap extensions: Document, Text, Paragraph, Heading (h1–h6), Bold,
201
- * Italic, Strike, Underline, History, ListItem, OrderedList, BulletList, Code,
202
- * CodeBlockLowlight, Link.
203
- *
204
- * @param content - The rich text value from a Localess content field (type `ContentRichText`).
205
- * @returns A `React.ReactNode` ready to render inside JSX.
206
- *
207
- * @example
208
- * ```tsx
209
- * import { renderRichTextToReact } from '@localess/react';
210
- *
211
- * export function Article({ data }: { data: MyContent }) {
212
- * return <article>{renderRichTextToReact(data.body)}</article>;
213
- * }
214
- * ```
215
- */
216
- declare function renderRichTextToReact(content: ContentRichText): React__default.ReactNode;
217
-
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 };