react-intlayer 9.5.10 → 9.5.11
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerNode.cjs","names":["isValidElement","getIntlayerNodePrototype"],"sources":["../../src/IntlayerNode.tsx"],"sourcesContent":["import type { NodeProps } from '@intlayer/core/interpreter';\nimport { getIntlayerNodePrototype } from '@intlayer/core/utils';\nimport type { ResolvedEditor } from '@intlayer/types/module_augmentation';\nimport { isValidElement, type PropsWithChildren, type ReactNode } from 'react';\n\nexport type IntlayerNode<\n T = NodeProps['children'],\n AdditionalProps =
|
|
1
|
+
{"version":3,"file":"IntlayerNode.cjs","names":["isValidElement","getIntlayerNodePrototype"],"sources":["../../src/IntlayerNode.tsx"],"sourcesContent":["import type { NodeProps } from '@intlayer/core/interpreter';\nimport { getIntlayerNodePrototype } from '@intlayer/core/utils';\nimport type { ResolvedEditor } from '@intlayer/types/module_augmentation';\nimport { isValidElement, type PropsWithChildren, type ReactNode } from 'react';\n\n/**\n * Content node returned by `useIntlayer`.\n *\n * Without the editor it is typed as its value (`\"Hello\" & { value: \"Hello\" }`)\n * so it can go straight into string props (`aria-label={content.title}`).\n * With the editor, it is a React node wrapping the editable selector, so\n * string props must use `.value`.\n */\nexport type IntlayerNode<\n T = NodeProps['children'],\n AdditionalProps = unknown,\n> = ResolvedEditor<\n T & { value: T } & AdditionalProps,\n ReactNode & { value: T } & AdditionalProps\n>;\n\ntype RenderIntlayerNodeProps<T> = PropsWithChildren<{\n value: T;\n children: ReactNode;\n additionalProps?: { [key: string]: any };\n}>;\n\n/**\n * Renders content as a React element that also behaves like its value\n * (`node.value`, `${node}`, `node.toUpperCase()`).\n *\n * The node is a copy of the element built on a shared prototype serving the\n * value's members, rather than a Proxy: React reads an element's fields many\n * times while reconciling, and a Proxy trap makes each read several times\n * slower.\n *\n * @param props - The value, the rendered children and extra node members.\n * @returns The renderable node.\n */\nexport const renderIntlayerNode = <\n T, // Broadened to support arrays, numbers, objects, etc.\n>({\n children,\n value,\n additionalProps,\n}: RenderIntlayerNodeProps<T>): IntlayerNode<T> =>\n // Fields first, prototype last: set the other way round, each field would\n // first look for a setter along the prototype chain, through its Proxy\n Object.setPrototypeOf(\n {\n ...(isValidElement(children) ? children : <>{children}</>),\n value,\n ...additionalProps,\n },\n getIntlayerNodePrototype(value)\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,MAAa,sBAEX,EACA,UACA,OACA,sBAIA,OAAO,eACL;CACE,OAAIA,sBAAe,QAAQ,IAAI,WAAW,yEAAG,SAAW;CACxD;CACA,GAAG;AACL,OACAC,+CAAyB,KAAK,CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerNode.mjs","names":[],"sources":["../../src/IntlayerNode.tsx"],"sourcesContent":["import type { NodeProps } from '@intlayer/core/interpreter';\nimport { getIntlayerNodePrototype } from '@intlayer/core/utils';\nimport type { ResolvedEditor } from '@intlayer/types/module_augmentation';\nimport { isValidElement, type PropsWithChildren, type ReactNode } from 'react';\n\nexport type IntlayerNode<\n T = NodeProps['children'],\n AdditionalProps =
|
|
1
|
+
{"version":3,"file":"IntlayerNode.mjs","names":[],"sources":["../../src/IntlayerNode.tsx"],"sourcesContent":["import type { NodeProps } from '@intlayer/core/interpreter';\nimport { getIntlayerNodePrototype } from '@intlayer/core/utils';\nimport type { ResolvedEditor } from '@intlayer/types/module_augmentation';\nimport { isValidElement, type PropsWithChildren, type ReactNode } from 'react';\n\n/**\n * Content node returned by `useIntlayer`.\n *\n * Without the editor it is typed as its value (`\"Hello\" & { value: \"Hello\" }`)\n * so it can go straight into string props (`aria-label={content.title}`).\n * With the editor, it is a React node wrapping the editable selector, so\n * string props must use `.value`.\n */\nexport type IntlayerNode<\n T = NodeProps['children'],\n AdditionalProps = unknown,\n> = ResolvedEditor<\n T & { value: T } & AdditionalProps,\n ReactNode & { value: T } & AdditionalProps\n>;\n\ntype RenderIntlayerNodeProps<T> = PropsWithChildren<{\n value: T;\n children: ReactNode;\n additionalProps?: { [key: string]: any };\n}>;\n\n/**\n * Renders content as a React element that also behaves like its value\n * (`node.value`, `${node}`, `node.toUpperCase()`).\n *\n * The node is a copy of the element built on a shared prototype serving the\n * value's members, rather than a Proxy: React reads an element's fields many\n * times while reconciling, and a Proxy trap makes each read several times\n * slower.\n *\n * @param props - The value, the rendered children and extra node members.\n * @returns The renderable node.\n */\nexport const renderIntlayerNode = <\n T, // Broadened to support arrays, numbers, objects, etc.\n>({\n children,\n value,\n additionalProps,\n}: RenderIntlayerNodeProps<T>): IntlayerNode<T> =>\n // Fields first, prototype last: set the other way round, each field would\n // first look for a setter along the prototype chain, through its Proxy\n Object.setPrototypeOf(\n {\n ...(isValidElement(children) ? children : <>{children}</>),\n value,\n ...additionalProps,\n },\n getIntlayerNodePrototype(value)\n );\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,MAAa,sBAEX,EACA,UACA,OACA,sBAIA,OAAO,eACL;CACE,GAAI,eAAe,QAAQ,IAAI,WAAW,kCAAG,SAAW;CACxD;CACA,GAAG;AACL,GACA,yBAAyB,KAAK,CAChC"}
|
|
@@ -2,9 +2,19 @@ import { NodeProps } from "@intlayer/core/interpreter";
|
|
|
2
2
|
import { ResolvedEditor } from "@intlayer/types/module_augmentation";
|
|
3
3
|
import { PropsWithChildren, ReactNode } from "react";
|
|
4
4
|
//#region src/IntlayerNode.d.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Content node returned by `useIntlayer`.
|
|
7
|
+
*
|
|
8
|
+
* Without the editor it is typed as its value (`"Hello" & { value: "Hello" }`)
|
|
9
|
+
* so it can go straight into string props (`aria-label={content.title}`).
|
|
10
|
+
* With the editor, it is a React node wrapping the editable selector, so
|
|
11
|
+
* string props must use `.value`.
|
|
12
|
+
*/
|
|
13
|
+
export type IntlayerNode<T = NodeProps['children'], AdditionalProps = unknown> = ResolvedEditor<T & {
|
|
14
|
+
value: T;
|
|
15
|
+
} & AdditionalProps, ReactNode & {
|
|
6
16
|
value: T;
|
|
7
|
-
} & AdditionalProps
|
|
17
|
+
} & AdditionalProps>;
|
|
8
18
|
type RenderIntlayerNodeProps<T> = PropsWithChildren<{
|
|
9
19
|
value: T;
|
|
10
20
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerNode.d.ts","names":[],"sources":["../../src/IntlayerNode.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerNode.d.ts","names":[],"sources":["../../src/IntlayerNode.tsx"],"mappings":";;;;;;;;;;;;YAaY,aACV,IAAI,uBACJ,6BACE,eACF;EAAM,OAAO;IAAM,iBACnB;EAAc,OAAO;IAAM;KAGxB,wBAAwB,KAAK;EAChC,OAAO;EACP,UAAU;EACV;KAAqB;;;;;;;;;;;;;;;qBAeV,qBACX,KAAC,UAAA,OAAA,mBAKA,wBAAwB,OAAK,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -133,12 +133,12 @@
|
|
|
133
133
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
134
134
|
},
|
|
135
135
|
"dependencies": {
|
|
136
|
-
"@intlayer/api": "9.5.
|
|
137
|
-
"@intlayer/config": "9.5.
|
|
138
|
-
"@intlayer/core": "9.5.
|
|
139
|
-
"@intlayer/dictionaries-entry": "9.5.
|
|
140
|
-
"@intlayer/editor": "9.5.
|
|
141
|
-
"@intlayer/types": "9.5.
|
|
136
|
+
"@intlayer/api": "9.5.11",
|
|
137
|
+
"@intlayer/config": "9.5.11",
|
|
138
|
+
"@intlayer/core": "9.5.11",
|
|
139
|
+
"@intlayer/dictionaries-entry": "9.5.11",
|
|
140
|
+
"@intlayer/editor": "9.5.11",
|
|
141
|
+
"@intlayer/types": "9.5.11"
|
|
142
142
|
},
|
|
143
143
|
"devDependencies": {
|
|
144
144
|
"@craco/types": "7.1.0",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"react-dom": ">=16.0.0"
|
|
160
160
|
},
|
|
161
161
|
"optionalDependencies": {
|
|
162
|
-
"@intlayer/analytics": "9.5.
|
|
162
|
+
"@intlayer/analytics": "9.5.11"
|
|
163
163
|
},
|
|
164
164
|
"engines": {
|
|
165
165
|
"node": ">=14.18"
|