@saykit/react 0.0.0-beta-20260518070019 → 0.0.0-beta-20260717182009
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.client.mjs +5 -3
- package/dist/index.d.mts +1 -0
- package/dist/index.server.mjs +5 -3
- package/package.json +8 -6
package/dist/index.client.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"; import { useSay as GET_SAY } from "./client.mjs";import { Fragment, cloneElement, createElement, isValidElement } from "react";
|
|
2
2
|
//#region src/components/renderer.ts
|
|
3
|
-
function Renderer({ html, components }) {
|
|
3
|
+
function Renderer({ html, components, whitespace = true }) {
|
|
4
4
|
function getComponent(tag) {
|
|
5
5
|
if (typeof components === "function") return components(tag) ?? tag ?? Fragment;
|
|
6
6
|
return tag && tag in components ? components[tag] : Fragment;
|
|
@@ -36,7 +36,7 @@ function Renderer({ html, components }) {
|
|
|
36
36
|
let textEnd = input.indexOf("<", i);
|
|
37
37
|
if (textEnd === -1) textEnd = input.length;
|
|
38
38
|
const text = input.slice(i, textEnd);
|
|
39
|
-
current.push(text);
|
|
39
|
+
if (whitespace || text.trim() !== "") current.push(text);
|
|
40
40
|
i = textEnd;
|
|
41
41
|
}
|
|
42
42
|
return current;
|
|
@@ -56,9 +56,11 @@ function resolveJsxSafePropKeys(props) {
|
|
|
56
56
|
function Say(props) {
|
|
57
57
|
if (!("id" in props)) throw new Error("'Say' is a macro and must be used with the relevant saykit plugin", { cause: /* @__PURE__ */ new Error("The 'id' property is required for a descriptor") });
|
|
58
58
|
const say = GET_SAY();
|
|
59
|
-
const
|
|
59
|
+
const { whitespace, ...rest } = props;
|
|
60
|
+
const descriptor = resolveJsxSafePropKeys(rest);
|
|
60
61
|
return createElement(Renderer, {
|
|
61
62
|
html: say.call(descriptor),
|
|
63
|
+
whitespace,
|
|
62
64
|
components(tag) {
|
|
63
65
|
if (tag && tag in descriptor && isValidElement(descriptor[tag])) {
|
|
64
66
|
const element = descriptor[tag];
|
package/dist/index.d.mts
CHANGED
package/dist/index.server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSay as GET_SAY } from "./server.mjs";import { Fragment, cloneElement, createElement, isValidElement } from "react";
|
|
2
2
|
//#region src/components/renderer.ts
|
|
3
|
-
function Renderer({ html, components }) {
|
|
3
|
+
function Renderer({ html, components, whitespace = true }) {
|
|
4
4
|
function getComponent(tag) {
|
|
5
5
|
if (typeof components === "function") return components(tag) ?? tag ?? Fragment;
|
|
6
6
|
return tag && tag in components ? components[tag] : Fragment;
|
|
@@ -36,7 +36,7 @@ function Renderer({ html, components }) {
|
|
|
36
36
|
let textEnd = input.indexOf("<", i);
|
|
37
37
|
if (textEnd === -1) textEnd = input.length;
|
|
38
38
|
const text = input.slice(i, textEnd);
|
|
39
|
-
current.push(text);
|
|
39
|
+
if (whitespace || text.trim() !== "") current.push(text);
|
|
40
40
|
i = textEnd;
|
|
41
41
|
}
|
|
42
42
|
return current;
|
|
@@ -56,9 +56,11 @@ function resolveJsxSafePropKeys(props) {
|
|
|
56
56
|
function Say(props) {
|
|
57
57
|
if (!("id" in props)) throw new Error("'Say' is a macro and must be used with the relevant saykit plugin", { cause: /* @__PURE__ */ new Error("The 'id' property is required for a descriptor") });
|
|
58
58
|
const say = GET_SAY();
|
|
59
|
-
const
|
|
59
|
+
const { whitespace, ...rest } = props;
|
|
60
|
+
const descriptor = resolveJsxSafePropKeys(rest);
|
|
60
61
|
return createElement(Renderer, {
|
|
61
62
|
html: say.call(descriptor),
|
|
63
|
+
whitespace,
|
|
62
64
|
components(tag) {
|
|
63
65
|
if (tag && tag in descriptor && isValidElement(descriptor[tag])) {
|
|
64
66
|
const element = descriptor[tag];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saykit/react",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-20260717182009",
|
|
4
4
|
"description": "React integration for saykit, i18n hooks and components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -46,16 +46,18 @@
|
|
|
46
46
|
"server-only": "^0.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/react": "^19.2.
|
|
50
|
-
"react": "^19.2.
|
|
51
|
-
"saykit": "^0.0.0-beta-
|
|
49
|
+
"@types/react": "^19.2.17",
|
|
50
|
+
"react": "^19.2.7",
|
|
51
|
+
"saykit": "^0.0.0-beta-20260717182009"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"react": "*",
|
|
55
|
-
"saykit": "0.0.0-beta-
|
|
55
|
+
"saykit": "0.0.0-beta-20260717182009"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"check": "tsc --noEmit",
|
|
59
|
-
"build": "tsdown"
|
|
59
|
+
"build": "tsdown",
|
|
60
|
+
"test": "vitest",
|
|
61
|
+
"coverage": "vitest run --coverage"
|
|
60
62
|
}
|
|
61
63
|
}
|