@verbaly/react 0.77.0 → 0.78.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/README.md +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ pnpm add verbaly @verbaly/react
|
|
|
23
23
|
|
|
24
24
|
```tsx
|
|
25
25
|
import { VerbalyProvider, useT, useLocale } from '@verbaly/react';
|
|
26
|
-
import { verbaly } from '
|
|
26
|
+
import { verbaly } from 'verbaly/app';
|
|
27
27
|
|
|
28
28
|
<VerbalyProvider instance={verbaly}>
|
|
29
29
|
<App />
|
|
@@ -35,9 +35,9 @@ function Inbox() {
|
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
**The provider is optional in the browser.** With none above it, a hook reads the instance `
|
|
38
|
+
**The provider is optional in the browser.** With none above it, a hook reads the instance `verbaly/app` creates, so a single-page app can skip it and a component test renders with no wrapper, as with react-i18next. On a server it is required, since every request has its own instance.
|
|
39
39
|
|
|
40
|
-
**Keys are typed.** `useT()` checks every key and its params against your source catalog, through the types Verbaly generates (`src/verbaly.d.ts` in a Vite app): a key no catalog has does not compile. A key that comes from data, like `t(item.key)` or a variable typed as a union of keys, passes as it is, and its params are left open; declare it with `defineKeys` from `
|
|
40
|
+
**Keys are typed.** `useT()` checks every key and its params against your source catalog, through the types Verbaly generates (`src/verbaly.d.ts` in a Vite app): a key no catalog has does not compile. A key that comes from data, like `t(item.key)` or a variable typed as a union of keys, passes as it is, and its params are left open; declare it with `defineKeys` from `verbaly/app` when you want `check` to verify it exists.
|
|
41
41
|
|
|
42
42
|
`useT()` hands out a new `t` whenever the language changes or a catalog arrives, so a `useMemo`, `useCallback` or effect keyed on `t` runs again in the new language. While nothing changes it stays the same function.
|
|
43
43
|
|
package/dist/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function VerbalyProvider(props) {
|
|
|
13
13
|
}
|
|
14
14
|
function useVerbaly() {
|
|
15
15
|
const instance = (0, react.useContext)(VerbalyContext) ?? appInstance();
|
|
16
|
-
if (!instance) throw new Error("[verbaly] useVerbaly requires a <VerbalyProvider>: on a server, or before
|
|
16
|
+
if (!instance) throw new Error("[verbaly] useVerbaly requires a <VerbalyProvider>: on a server, or before verbaly/app loads");
|
|
17
17
|
return instance;
|
|
18
18
|
}
|
|
19
19
|
function useT() {
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ function VerbalyProvider(props) {
|
|
|
12
12
|
}
|
|
13
13
|
function useVerbaly() {
|
|
14
14
|
const instance = useContext(VerbalyContext) ?? appInstance();
|
|
15
|
-
if (!instance) throw new Error("[verbaly] useVerbaly requires a <VerbalyProvider>: on a server, or before
|
|
15
|
+
if (!instance) throw new Error("[verbaly] useVerbaly requires a <VerbalyProvider>: on a server, or before verbaly/app loads");
|
|
16
16
|
return instance;
|
|
17
17
|
}
|
|
18
18
|
function useT() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"description": "React bindings for Verbaly: hooks over the reactive core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"react": "^18.0.0 || ^19.0.0",
|
|
65
|
-
"verbaly": "^0.
|
|
65
|
+
"verbaly": "^0.78.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/react": "^19.3.0",
|
|
69
69
|
"@types/react-dom": "^19.3.0",
|
|
70
70
|
"happy-dom": "^21.0.4",
|
|
71
|
-
"preact": "^11.1.
|
|
71
|
+
"preact": "^11.1.1",
|
|
72
72
|
"preact-render-to-string": "^6.8.2",
|
|
73
73
|
"react": "^19.3.1",
|
|
74
74
|
"react-dom": "^19.3.1",
|
|
75
|
-
"verbaly": "^0.
|
|
75
|
+
"verbaly": "^0.78.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "tsdown",
|