@localess/react 0.8.1-next.20250625-100209.0 → 0.8.2-next.20251219-195228.0
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 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +10 -4
- package/dist/index.mjs +10 -7
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { LocalessClientOptions, ContentData, Links, LocalessClient } from '@localess/js-client';
|
|
4
|
-
export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, Translations, llEditable } from '@localess/js-client';
|
|
4
|
+
export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, Translations, llEditable, llEditableField, localessEditable, localessEditableField } from '@localess/js-client';
|
|
5
5
|
|
|
6
6
|
type LocalessOptions = LocalessClientOptions & {
|
|
7
7
|
/**
|
|
@@ -18,11 +18,11 @@ type LocalessOptions = LocalessClientOptions & {
|
|
|
18
18
|
enableSync?: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
type LocalessComponentProps = {
|
|
22
|
-
data
|
|
21
|
+
type LocalessComponentProps<T extends ContentData = ContentData> = {
|
|
22
|
+
data?: T;
|
|
23
23
|
links?: Links;
|
|
24
24
|
};
|
|
25
|
-
declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
|
|
26
26
|
|
|
27
27
|
declare function localessInit(options: LocalessOptions): LocalessClient;
|
|
28
28
|
declare function getLocalessClient(): LocalessClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { LocalessClientOptions, ContentData, Links, LocalessClient } from '@localess/js-client';
|
|
4
|
-
export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, Translations, llEditable } from '@localess/js-client';
|
|
4
|
+
export { Content, ContentAsset, ContentData, ContentDataField, ContentDataSchema, ContentLink, ContentMetadata, ContentReference, ContentRichText, EventCallback, EventToApp, EventToAppType, Links, LocalessClient, LocalessSync, Translations, llEditable, llEditableField, localessEditable, localessEditableField } from '@localess/js-client';
|
|
5
5
|
|
|
6
6
|
type LocalessOptions = LocalessClientOptions & {
|
|
7
7
|
/**
|
|
@@ -18,11 +18,11 @@ type LocalessOptions = LocalessClientOptions & {
|
|
|
18
18
|
enableSync?: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
type LocalessComponentProps = {
|
|
22
|
-
data
|
|
21
|
+
type LocalessComponentProps<T extends ContentData = ContentData> = {
|
|
22
|
+
data?: T;
|
|
23
23
|
links?: Links;
|
|
24
24
|
};
|
|
25
|
-
declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
declare const LocalessComponent: React.ForwardRefExoticComponent<LocalessComponentProps<ContentData> & React.RefAttributes<HTMLElement>>;
|
|
26
26
|
|
|
27
27
|
declare function localessInit(options: LocalessOptions): LocalessClient;
|
|
28
28
|
declare function getLocalessClient(): LocalessClient;
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,9 @@ __export(index_exports, {
|
|
|
26
26
|
getLocalessClient: () => getLocalessClient,
|
|
27
27
|
isSyncEnabled: () => isSyncEnabled,
|
|
28
28
|
llEditable: () => import_js_client3.llEditable,
|
|
29
|
+
llEditableField: () => import_js_client3.llEditableField,
|
|
30
|
+
localessEditable: () => import_js_client3.localessEditable,
|
|
31
|
+
localessEditableField: () => import_js_client3.localessEditableField,
|
|
29
32
|
localessInit: () => localessInit
|
|
30
33
|
});
|
|
31
34
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -53,7 +56,7 @@ var LocalessComponent = (0, import_react.forwardRef)(({ data, links, ...restProp
|
|
|
53
56
|
}
|
|
54
57
|
const Comp = getComponent(data._schema || data.schema);
|
|
55
58
|
if (Comp) {
|
|
56
|
-
const attr = isSyncEnabled() ? (0, import_js_client.
|
|
59
|
+
const attr = isSyncEnabled() ? (0, import_js_client.localessEditable)(data) : {};
|
|
57
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { ref, data, links, ...attr, ...restProps });
|
|
58
61
|
}
|
|
59
62
|
const FallbackComponent = getFallbackComponent();
|
|
@@ -96,10 +99,10 @@ function getLocalessClient() {
|
|
|
96
99
|
}
|
|
97
100
|
function getComponent(key) {
|
|
98
101
|
if (Object.hasOwn(_components, key)) {
|
|
99
|
-
|
|
100
|
-
return void 0;
|
|
102
|
+
return _components[key];
|
|
101
103
|
}
|
|
102
|
-
|
|
104
|
+
console.error(`[Localess] component %c${key}%c can't be found.`, FONT_BOLD, FONT_NORMAL);
|
|
105
|
+
return void 0;
|
|
103
106
|
}
|
|
104
107
|
function getFallbackComponent() {
|
|
105
108
|
return _fallbackComponent;
|
|
@@ -115,5 +118,8 @@ function isSyncEnabled() {
|
|
|
115
118
|
getLocalessClient,
|
|
116
119
|
isSyncEnabled,
|
|
117
120
|
llEditable,
|
|
121
|
+
llEditableField,
|
|
122
|
+
localessEditable,
|
|
123
|
+
localessEditableField,
|
|
118
124
|
localessInit
|
|
119
125
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -6,11 +6,11 @@ var FONT_BOLD = "font-weight: bold";
|
|
|
6
6
|
var FONT_NORMAL = "font-weight: normal";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import { llEditable as
|
|
9
|
+
import { llEditable, llEditableField, localessEditable as localessEditable2, localessEditableField } from "@localess/js-client";
|
|
10
10
|
|
|
11
11
|
// src/localess-componenet.tsx
|
|
12
12
|
import { forwardRef } from "react";
|
|
13
|
-
import {
|
|
13
|
+
import { localessEditable } from "@localess/js-client";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
var LocalessComponent = forwardRef(({ data, links, ...restProps }, ref) => {
|
|
16
16
|
if (!data) {
|
|
@@ -23,7 +23,7 @@ var LocalessComponent = forwardRef(({ data, links, ...restProps }, ref) => {
|
|
|
23
23
|
}
|
|
24
24
|
const Comp = getComponent(data._schema || data.schema);
|
|
25
25
|
if (Comp) {
|
|
26
|
-
const attr = isSyncEnabled() ?
|
|
26
|
+
const attr = isSyncEnabled() ? localessEditable(data) : {};
|
|
27
27
|
return /* @__PURE__ */ jsx(Comp, { ref, data, links, ...attr, ...restProps });
|
|
28
28
|
}
|
|
29
29
|
const FallbackComponent = getFallbackComponent();
|
|
@@ -66,10 +66,10 @@ function getLocalessClient() {
|
|
|
66
66
|
}
|
|
67
67
|
function getComponent(key) {
|
|
68
68
|
if (Object.hasOwn(_components, key)) {
|
|
69
|
-
|
|
70
|
-
return void 0;
|
|
69
|
+
return _components[key];
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
console.error(`[Localess] component %c${key}%c can't be found.`, FONT_BOLD, FONT_NORMAL);
|
|
72
|
+
return void 0;
|
|
73
73
|
}
|
|
74
74
|
function getFallbackComponent() {
|
|
75
75
|
return _fallbackComponent;
|
|
@@ -83,6 +83,9 @@ export {
|
|
|
83
83
|
getFallbackComponent,
|
|
84
84
|
getLocalessClient,
|
|
85
85
|
isSyncEnabled,
|
|
86
|
-
|
|
86
|
+
llEditable,
|
|
87
|
+
llEditableField,
|
|
88
|
+
localessEditable2 as localessEditable,
|
|
89
|
+
localessEditableField,
|
|
87
90
|
localessInit
|
|
88
91
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localess/react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2-next.20251219-195228.0",
|
|
4
4
|
"description": "ReactJS JavaScript/TypeScript SDK for Localess's API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"localess",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"react-dom": "^17 || ^18 || ^19"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@localess/js-client": "0.8.2
|
|
47
|
+
"@localess/js-client": "0.8.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/react": "
|
|
50
|
+
"@types/react": "^19.0.0",
|
|
51
51
|
"@types/node": "^20.12.12",
|
|
52
|
-
"react": "^
|
|
53
|
-
"react-dom": "^
|
|
54
|
-
"tsup": "^8.
|
|
52
|
+
"react": "^19.0.0",
|
|
53
|
+
"react-dom": "^19.0.0",
|
|
54
|
+
"tsup": "^8.5.1",
|
|
55
55
|
"typescript": "^5.8.3"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|