preact-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","h","Fragment","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 {\n type ComponentChildren,\n Fragment,\n h,\n isValidElement,\n type VNode,\n} from 'preact';\n\nexport type IntlayerNode<\n T = NodeProps['children'],\n AdditionalProps =
|
|
1
|
+
{"version":3,"file":"IntlayerNode.cjs","names":["isValidElement","h","Fragment","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 {\n type ComponentChildren,\n Fragment,\n h,\n isValidElement,\n type VNode,\n} from 'preact';\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 vnode 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 VNode & { value: T } & AdditionalProps\n>;\n\ntype RenderIntlayerNodeProps<T> = {\n value: T;\n children: ComponentChildren;\n additionalProps?: { [key: string]: any };\n};\n\n/**\n * Renders content as a Preact vnode that also behaves like its value\n * (`node.value`, `${node}`, `node.toUpperCase()`).\n *\n * The node is a copy of the vnode built on a shared prototype serving the\n * value's members, rather than a Proxy, so the renderer reads plain fields.\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 : h(Fragment, {}, children)),\n value,\n ...additionalProps,\n },\n getIntlayerNodePrototype(value)\n );\n"],"mappings":";;;;;;;;;;;;;;;AA2CA,MAAa,sBAEX,EACA,UACA,OACA,sBAIA,OAAO,eACL;CACE,OAAIA,uBAAe,QAAQ,IAAI,eAAWC,UAAEC,iBAAU,CAAC,GAAG,QAAQ;CAClE;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 {\n type ComponentChildren,\n Fragment,\n h,\n isValidElement,\n type VNode,\n} from 'preact';\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 {\n type ComponentChildren,\n Fragment,\n h,\n isValidElement,\n type VNode,\n} from 'preact';\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 vnode 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 VNode & { value: T } & AdditionalProps\n>;\n\ntype RenderIntlayerNodeProps<T> = {\n value: T;\n children: ComponentChildren;\n additionalProps?: { [key: string]: any };\n};\n\n/**\n * Renders content as a Preact vnode that also behaves like its value\n * (`node.value`, `${node}`, `node.toUpperCase()`).\n *\n * The node is a copy of the vnode built on a shared prototype serving the\n * value's members, rather than a Proxy, so the renderer reads plain fields.\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 : h(Fragment, {}, children)),\n value,\n ...additionalProps,\n },\n getIntlayerNodePrototype(value)\n );\n"],"mappings":";;;;;;;;;;;;;;AA2CA,MAAa,sBAEX,EACA,UACA,OACA,sBAIA,OAAO,eACL;CACE,GAAI,eAAe,QAAQ,IAAI,WAAW,EAAE,UAAU,CAAC,GAAG,QAAQ;CAClE;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 { ComponentChildren, VNode } from "preact";
|
|
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 vnode 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, VNode & {
|
|
6
16
|
value: T;
|
|
7
|
-
} & AdditionalProps
|
|
17
|
+
} & AdditionalProps>;
|
|
8
18
|
type RenderIntlayerNodeProps<T> = {
|
|
9
19
|
value: T;
|
|
10
20
|
children: ComponentChildren;
|
|
@@ -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":";;;;;;;;;;;;YAmBY,aACV,IAAI,uBACJ,6BACE,eACF;EAAM,OAAO;IAAM,iBACnB;EAAU,OAAO;IAAM;KAGpB,wBAAwB;EAC3B,OAAO;EACP,UAAU;EACV;KAAqB;;;;;;;;;;;;;qBAaV,qBACX,KAAC,UAAA,OAAA,mBAKA,wBAAwB,OAAK,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-intlayer",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Preact applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -101,12 +101,12 @@
|
|
|
101
101
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@intlayer/api": "9.5.
|
|
105
|
-
"@intlayer/config": "9.5.
|
|
106
|
-
"@intlayer/core": "9.5.
|
|
107
|
-
"@intlayer/editor": "9.5.
|
|
108
|
-
"@intlayer/engine": "9.5.
|
|
109
|
-
"@intlayer/types": "9.5.
|
|
104
|
+
"@intlayer/api": "9.5.11",
|
|
105
|
+
"@intlayer/config": "9.5.11",
|
|
106
|
+
"@intlayer/core": "9.5.11",
|
|
107
|
+
"@intlayer/editor": "9.5.11",
|
|
108
|
+
"@intlayer/engine": "9.5.11",
|
|
109
|
+
"@intlayer/types": "9.5.11"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@types/node": "^22",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"preact": ">=8.0.0"
|
|
124
124
|
},
|
|
125
125
|
"optionalDependencies": {
|
|
126
|
-
"@intlayer/analytics": "9.5.
|
|
126
|
+
"@intlayer/analytics": "9.5.11"
|
|
127
127
|
},
|
|
128
128
|
"engines": {
|
|
129
129
|
"node": ">=14.18"
|