@generaltranslation/react-core 1.8.15 → 1.8.16
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/CHANGELOG.md +11 -0
- package/dist/errors.cjs.min.cjs.map +1 -1
- package/dist/errors.esm.min.mjs.map +1 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/variables/Derive.d.ts +23 -8
- package/dist/variables/Derive.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Marks JSX children as derivable by the GT compiler and CLI.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Use `<Derive>` inside translated JSX when child content is computed from
|
|
6
|
+
* source code, but should still be discovered during extraction instead of
|
|
7
|
+
* treated as a runtime interpolation variable. The CLI attempts to resolve the
|
|
8
|
+
* derivable children into every possible static value and includes those values
|
|
9
|
+
* in the source content that gets translated.
|
|
10
|
+
*
|
|
11
|
+
* `<Derive>` renders its children unchanged at runtime.
|
|
12
|
+
*
|
|
13
|
+
* Run `gt validate` after adding or changing `<Derive>` usage to verify that
|
|
14
|
+
* each derivable expression can be resolved by the CLI before translating or
|
|
15
|
+
* building.
|
|
6
16
|
*
|
|
7
17
|
* @example
|
|
8
18
|
* ```jsx
|
|
@@ -18,8 +28,8 @@ import React from 'react';
|
|
|
18
28
|
* </T>
|
|
19
29
|
* ```
|
|
20
30
|
*
|
|
21
|
-
* @param {T extends React.ReactNode} children -
|
|
22
|
-
* @returns {T} The
|
|
31
|
+
* @param {T extends React.ReactNode} children - JSX content to derive for translation extraction.
|
|
32
|
+
* @returns {T} The same children, unchanged at runtime.
|
|
23
33
|
*/
|
|
24
34
|
declare function Derive<T extends React.ReactNode>({ children }: {
|
|
25
35
|
children: T;
|
|
@@ -30,9 +40,14 @@ declare namespace Derive {
|
|
|
30
40
|
/**
|
|
31
41
|
* @deprecated Use `<Derive>` instead.
|
|
32
42
|
*
|
|
33
|
-
*
|
|
43
|
+
* Marks JSX children as derivable by the GT compiler and CLI.
|
|
44
|
+
*
|
|
45
|
+
* Use `<Derive>` instead of `<Static>` for new code. This alias is kept for
|
|
46
|
+
* backwards compatibility and renders its children unchanged at runtime.
|
|
34
47
|
*
|
|
35
|
-
*
|
|
48
|
+
* Run `gt validate` after adding or changing derived JSX content to verify that
|
|
49
|
+
* each derivable expression can be resolved by the CLI before translating or
|
|
50
|
+
* building.
|
|
36
51
|
*
|
|
37
52
|
* @example
|
|
38
53
|
* ```jsx
|
|
@@ -48,8 +63,8 @@ declare namespace Derive {
|
|
|
48
63
|
* </T>
|
|
49
64
|
* ```
|
|
50
65
|
*
|
|
51
|
-
* @param {T extends React.ReactNode} children -
|
|
52
|
-
* @returns {T} The
|
|
66
|
+
* @param {T extends React.ReactNode} children - JSX content to derive for translation extraction.
|
|
67
|
+
* @returns {T} The same children, unchanged at runtime.
|
|
53
68
|
*/
|
|
54
69
|
declare function Static<T extends React.ReactNode>(props: {
|
|
55
70
|
children: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Derive.d.ts","sourceRoot":"","sources":["../../src/variables/Derive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B
|
|
1
|
+
{"version":3,"file":"Derive.d.ts","sourceRoot":"","sources":["../../src/variables/Derive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,CAAC,CAAA;CAAE,GAAG,CAAC,CAE3E;kBAFQ,MAAM;;;AAIf;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE;IAAE,QAAQ,EAAE,CAAC,CAAA;CAAE,GAAG,CAAC,CAEpE;kBAFQ,MAAM;;;AAQf,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/react-core",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.16",
|
|
4
4
|
"description": "A pure React library for internationalization",
|
|
5
5
|
"main": "./dist/index.cjs.min.cjs",
|
|
6
6
|
"module": "./dist/index.esm.min.mjs",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"react": ">=16.8.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
17
|
+
"generaltranslation": "8.2.12",
|
|
18
|
+
"gt-i18n": "0.9.0",
|
|
19
|
+
"@generaltranslation/supported-locales": "2.0.70"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"release:beta": "pnpm run build:clean && pnpm publish --tag beta",
|
|
112
112
|
"release:latest": "pnpm run build:clean && pnpm publish --tag latest",
|
|
113
113
|
"test": "vitest run",
|
|
114
|
-
"test:watch": "vitest"
|
|
114
|
+
"test:watch": "vitest",
|
|
115
|
+
"typecheck": "tsc --noEmit"
|
|
115
116
|
}
|
|
116
117
|
}
|