@localess/react 3.0.1-dev.20260325211243 → 3.0.1-dev.20260405094412
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/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +23 -0
- package/dist/index.mjs +22 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { LocalessClientOptions,
|
|
3
|
+
import { LocalessClientOptions, Links, ContentLink, ContentData, References, ContentRichText, LocalessClient, ContentAsset } 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
|
|
|
6
6
|
type LocalessOptions = LocalessClientOptions & {
|
|
@@ -18,6 +18,8 @@ type LocalessOptions = LocalessClientOptions & {
|
|
|
18
18
|
enableSync?: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
declare function findLink(links: Links | undefined, link: ContentLink): string;
|
|
22
|
+
|
|
21
23
|
type LocalessComponentProps<T extends ContentData = ContentData> = {
|
|
22
24
|
data: T;
|
|
23
25
|
links?: Links;
|
|
@@ -86,4 +88,4 @@ declare function isSyncEnabled(): boolean;
|
|
|
86
88
|
*/
|
|
87
89
|
declare function resolveAsset(asset: ContentAsset): string;
|
|
88
90
|
|
|
89
|
-
export { LocalessComponent, type LocalessComponentProps, type LocalessOptions, getComponent, getFallbackComponent, getLocalessClient, isSyncEnabled, localessInit, registerComponent, renderRichTextToReact, resolveAsset, setComponents, setFallbackComponent, unregisterComponent };
|
|
91
|
+
export { LocalessComponent, type LocalessComponentProps, type LocalessOptions, findLink, getComponent, getFallbackComponent, getLocalessClient, isSyncEnabled, localessInit, registerComponent, renderRichTextToReact, resolveAsset, setComponents, setFallbackComponent, unregisterComponent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { LocalessClientOptions,
|
|
3
|
+
import { LocalessClientOptions, Links, ContentLink, ContentData, References, ContentRichText, LocalessClient, ContentAsset } 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
|
|
|
6
6
|
type LocalessOptions = LocalessClientOptions & {
|
|
@@ -18,6 +18,8 @@ type LocalessOptions = LocalessClientOptions & {
|
|
|
18
18
|
enableSync?: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
declare function findLink(links: Links | undefined, link: ContentLink): string;
|
|
22
|
+
|
|
21
23
|
type LocalessComponentProps<T extends ContentData = ContentData> = {
|
|
22
24
|
data: T;
|
|
23
25
|
links?: Links;
|
|
@@ -86,4 +88,4 @@ declare function isSyncEnabled(): boolean;
|
|
|
86
88
|
*/
|
|
87
89
|
declare function resolveAsset(asset: ContentAsset): string;
|
|
88
90
|
|
|
89
|
-
export { LocalessComponent, type LocalessComponentProps, type LocalessOptions, getComponent, getFallbackComponent, getLocalessClient, isSyncEnabled, localessInit, registerComponent, renderRichTextToReact, resolveAsset, setComponents, setFallbackComponent, unregisterComponent };
|
|
91
|
+
export { LocalessComponent, type LocalessComponentProps, type LocalessOptions, findLink, getComponent, getFallbackComponent, getLocalessClient, isSyncEnabled, localessInit, registerComponent, renderRichTextToReact, resolveAsset, setComponents, setFallbackComponent, unregisterComponent };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
LocalessComponent: () => LocalessComponent,
|
|
24
|
+
findLink: () => findLink,
|
|
24
25
|
getComponent: () => getComponent,
|
|
25
26
|
getFallbackComponent: () => getFallbackComponent,
|
|
26
27
|
getLocalessClient: () => getLocalessClient,
|
|
@@ -48,6 +49,27 @@ var FONT_NORMAL = "font-weight: normal";
|
|
|
48
49
|
// src/index.ts
|
|
49
50
|
var import_client3 = require("@localess/client");
|
|
50
51
|
|
|
52
|
+
// src/utils/link.util.ts
|
|
53
|
+
function findLink(links, link) {
|
|
54
|
+
switch (link.type) {
|
|
55
|
+
case "content": {
|
|
56
|
+
if (links) {
|
|
57
|
+
const path = links[link.uri];
|
|
58
|
+
if (path) {
|
|
59
|
+
return "/" + path.fullSlug;
|
|
60
|
+
} else {
|
|
61
|
+
return "/not-found";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return "/not-found";
|
|
65
|
+
}
|
|
66
|
+
case "url":
|
|
67
|
+
return link.uri;
|
|
68
|
+
default:
|
|
69
|
+
return "no-type";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
51
73
|
// src/localess-componenet.tsx
|
|
52
74
|
var import_react = require("react");
|
|
53
75
|
var import_client = require("@localess/client");
|
|
@@ -179,6 +201,7 @@ function resolveAsset(asset) {
|
|
|
179
201
|
// Annotate the CommonJS export names for ESM import in node:
|
|
180
202
|
0 && (module.exports = {
|
|
181
203
|
LocalessComponent,
|
|
204
|
+
findLink,
|
|
182
205
|
getComponent,
|
|
183
206
|
getFallbackComponent,
|
|
184
207
|
getLocalessClient,
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,27 @@ var FONT_NORMAL = "font-weight: normal";
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { localessEditable as localessEditable2, localessEditableField, isBrowser, isServer, isIframe } from "@localess/client";
|
|
10
10
|
|
|
11
|
+
// src/utils/link.util.ts
|
|
12
|
+
function findLink(links, link) {
|
|
13
|
+
switch (link.type) {
|
|
14
|
+
case "content": {
|
|
15
|
+
if (links) {
|
|
16
|
+
const path = links[link.uri];
|
|
17
|
+
if (path) {
|
|
18
|
+
return "/" + path.fullSlug;
|
|
19
|
+
} else {
|
|
20
|
+
return "/not-found";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return "/not-found";
|
|
24
|
+
}
|
|
25
|
+
case "url":
|
|
26
|
+
return link.uri;
|
|
27
|
+
default:
|
|
28
|
+
return "no-type";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
11
32
|
// src/localess-componenet.tsx
|
|
12
33
|
import { forwardRef } from "react";
|
|
13
34
|
import { localessEditable } from "@localess/client";
|
|
@@ -138,6 +159,7 @@ function resolveAsset(asset) {
|
|
|
138
159
|
}
|
|
139
160
|
export {
|
|
140
161
|
LocalessComponent,
|
|
162
|
+
findLink,
|
|
141
163
|
getComponent,
|
|
142
164
|
getFallbackComponent,
|
|
143
165
|
getLocalessClient,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localess/react",
|
|
3
|
-
"version": "3.0.1-dev.
|
|
3
|
+
"version": "3.0.1-dev.20260405094412",
|
|
4
4
|
"description": "ReactJS JavaScript/TypeScript SDK for Localess's API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"localess",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react-dom": "^17 || ^18 || ^19"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@localess/client": "3.0.1-dev.
|
|
49
|
+
"@localess/client": "3.0.1-dev.20260405094412",
|
|
50
50
|
"@tiptap/static-renderer": "^3.20.1",
|
|
51
51
|
"@tiptap/html": "^3.20.1",
|
|
52
52
|
"@tiptap/extension-bold": "^3.20.1",
|