@molecule/app-react 1.10.2 → 1.11.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 +61 -7
- package/dist/hooks/useTranslation.d.ts +25 -3
- package/dist/hooks/useTranslation.d.ts.map +1 -1
- package/dist/hooks/useTranslation.js +89 -18
- package/dist/hooks/useTranslation.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +20 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-25T09:04:08.240Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-react
|
|
@@ -1816,6 +1816,34 @@ How far the return-page verification has got.
|
|
|
1816
1816
|
type VerifyPaymentReturnStatus = 'idle' | 'verifying' | 'verified' | 'failed'
|
|
1817
1817
|
```
|
|
1818
1818
|
|
|
1819
|
+
#### `UseTShorthandOptions`
|
|
1820
|
+
|
|
1821
|
+
Options for the shorthand form of {@link UseTFunction}: the fallback text is
|
|
1822
|
+
passed positionally, so only `count` remains here.
|
|
1823
|
+
|
|
1824
|
+
```typescript
|
|
1825
|
+
type UseTShorthandOptions = Omit<TranslateOptions, 'defaultValue'>
|
|
1826
|
+
```
|
|
1827
|
+
|
|
1828
|
+
#### `UseTFunction`
|
|
1829
|
+
|
|
1830
|
+
Translation function returned by `useT()`.
|
|
1831
|
+
|
|
1832
|
+
Two compatible call forms:
|
|
1833
|
+
|
|
1834
|
+
- `t(key, values?, options?)` — the {@link I18nProvider.t} signature.
|
|
1835
|
+
- `t(key, fallback, options?)` — a string second argument is the inline
|
|
1836
|
+
English `defaultValue`, with optional `count` for pluralization.
|
|
1837
|
+
|
|
1838
|
+
Its identity is stable while the i18n provider instance is unchanged, so it
|
|
1839
|
+
can be used directly as an effect dependency.
|
|
1840
|
+
|
|
1841
|
+
```typescript
|
|
1842
|
+
type UseTFunction = I18nProvider['t'] & {
|
|
1843
|
+
(key: string, fallback: string, options?: UseTShorthandOptions): string
|
|
1844
|
+
}
|
|
1845
|
+
```
|
|
1846
|
+
|
|
1819
1847
|
### Functions
|
|
1820
1848
|
|
|
1821
1849
|
#### `resetAIModelsCache()`
|
|
@@ -2651,15 +2679,32 @@ function useTranslation(): UseTranslationResult
|
|
|
2651
2679
|
|
|
2652
2680
|
Hook to get just the translation function.
|
|
2653
2681
|
|
|
2682
|
+
The returned function keeps ONE identity for as long as the provider
|
|
2683
|
+
instance is unchanged, so it is safe as an effect dependency: an effect
|
|
2684
|
+
written as `useEffect(..., [t])` does not re-run on ordinary re-renders or on
|
|
2685
|
+
a locale change. The hook still re-renders the calling component on every
|
|
2686
|
+
locale notification (including `addTranslations` for the active locale), so
|
|
2687
|
+
text it reads while rendering is current. A value memoized on `[t]` alone
|
|
2688
|
+
keeps the old text after a locale switch: `useMemo(() => t(...), [t])`, or a
|
|
2689
|
+
`React.memo` child that receives `t` as a prop. Call `useT()` inside that
|
|
2690
|
+
child, or add `useLocale()` to the dependencies.
|
|
2691
|
+
|
|
2692
|
+
Call it in either of two compatible forms:
|
|
2693
|
+
|
|
2694
|
+
- `t(key, values?, options?)` — the provider signature from
|
|
2695
|
+
`@molecule/app-i18n`, e.g. `t('cart.total', { total })`.
|
|
2696
|
+
- `t(key, fallback, options?)` — a shorthand for the common inline-English
|
|
2697
|
+
call: a string second argument is the `defaultValue`, so
|
|
2698
|
+
`t('cart.empty', 'Your cart is empty')` equals
|
|
2699
|
+
`t('cart.empty', undefined, { defaultValue: 'Your cart is empty' })`.
|
|
2700
|
+
Interpolation and pluralization still work:
|
|
2701
|
+
`t('cart.items', '{{count}} items', { count: 3 })`.
|
|
2702
|
+
|
|
2654
2703
|
```typescript
|
|
2655
|
-
function useT():
|
|
2656
|
-
key: string,
|
|
2657
|
-
values?: InterpolationValues,
|
|
2658
|
-
options?: { defaultValue?: string; count?: number },
|
|
2659
|
-
) => string
|
|
2704
|
+
function useT(): UseTFunction
|
|
2660
2705
|
```
|
|
2661
2706
|
|
|
2662
|
-
**Returns:** The translation function
|
|
2707
|
+
**Returns:** The translation function (stable identity while the provider is unchanged).
|
|
2663
2708
|
|
|
2664
2709
|
#### `useLocale()`
|
|
2665
2710
|
|
|
@@ -3188,6 +3233,15 @@ Peer dependencies:
|
|
|
3188
3233
|
`useTranslation()` (or `useT()`); it re-renders on `onLocaleChange` — even when
|
|
3189
3234
|
`addTranslations()` only adds keys for the current locale. Calling the raw `t()` import from
|
|
3190
3235
|
`@molecule/app-i18n` in render works once but leaves stale text after a locale switch.
|
|
3236
|
+
`useT()` returns a function with a STABLE identity (safe as an effect dependency) that also
|
|
3237
|
+
takes an inline fallback as its second argument: `t('cart.empty', 'Your cart is empty')` is
|
|
3238
|
+
shorthand for `t('cart.empty', undefined, { defaultValue: 'Your cart is empty' })`.
|
|
3239
|
+
Prefer it over a hand-written local wrapper (`const t = (key, fallback) => …`), whose new
|
|
3240
|
+
identity every render re-runs any effect that depends on `t`. The identity also survives a
|
|
3241
|
+
locale switch, so text memoized on `[t]` alone (`useMemo`, or a `React.memo` child given `t`)
|
|
3242
|
+
keeps the old language — add `useLocale()` to those dependencies. Register translations at
|
|
3243
|
+
module scope or in a `useEffect`, never while rendering: the notification would update
|
|
3244
|
+
other components mid-render.
|
|
3191
3245
|
- **Load a page's data with `useQuery` from `@molecule/app-query-react`, never with `fetch` in a
|
|
3192
3246
|
`useEffect`.** A hand-written load effect that cancels on cleanup (a `cancelled` flag or an
|
|
3193
3247
|
`AbortController`) cancels its own request on every re-render when a dependency is rebuilt each
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import type { I18nProvider } from '@molecule/app-i18n';
|
|
7
|
-
import type { UseTranslationResult } from '../types.js';
|
|
7
|
+
import type { UseTFunction, UseTranslationResult } from '../types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Hook to access the i18n provider from context.
|
|
10
10
|
*
|
|
@@ -37,9 +37,31 @@ export declare function useTranslation(): UseTranslationResult;
|
|
|
37
37
|
/**
|
|
38
38
|
* Hook to get just the translation function.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
40
|
+
* The returned function keeps ONE identity for as long as the provider
|
|
41
|
+
* instance is unchanged, so it is safe as an effect dependency: an effect
|
|
42
|
+
* written as `useEffect(..., [t])` does not re-run on ordinary re-renders or on
|
|
43
|
+
* a locale change. The hook still re-renders the calling component on every
|
|
44
|
+
* locale notification (including `addTranslations` for the active locale), so
|
|
45
|
+
* text it reads while rendering is current. A value memoized on `[t]` alone
|
|
46
|
+
* keeps the old text after a locale switch: `useMemo(() => t(...), [t])`, or a
|
|
47
|
+
* `React.memo` child that receives `t` as a prop. Call `useT()` inside that
|
|
48
|
+
* child, or add `useLocale()` to the dependencies.
|
|
49
|
+
*
|
|
50
|
+
* Call it in either of two compatible forms:
|
|
51
|
+
*
|
|
52
|
+
* - `t(key, values?, options?)` — the provider signature from
|
|
53
|
+
* `@molecule/app-i18n`, e.g. `t('cart.total', { total })`.
|
|
54
|
+
* - `t(key, fallback, options?)` — a shorthand for the common inline-English
|
|
55
|
+
* call: a string second argument is the `defaultValue`, so
|
|
56
|
+
* `t('cart.empty', 'Your cart is empty')` equals
|
|
57
|
+
* `t('cart.empty', undefined, { defaultValue: 'Your cart is empty' })`.
|
|
58
|
+
* Interpolation and pluralization still work:
|
|
59
|
+
* `t('cart.items', '{{count}} items', { count: 3 })`.
|
|
60
|
+
*
|
|
61
|
+
* @returns The translation function (stable identity while the provider is
|
|
62
|
+
* unchanged).
|
|
41
63
|
*/
|
|
42
|
-
export declare function useT():
|
|
64
|
+
export declare function useT(): UseTFunction;
|
|
43
65
|
/**
|
|
44
66
|
* Hook to get the current locale.
|
|
45
67
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAEV,YAAY,
|
|
1
|
+
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAEV,YAAY,EAIb,MAAM,oBAAoB,CAAA;AAI3B,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAErE;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAU9C;AAwDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,CA8CrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,IAAI,YAAY,CAcnC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAGlC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,KAAK,GAAG,KAAK,CAG5C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAW3E"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { useCallback, useContext,
|
|
6
|
+
import { useCallback, useContext, useLayoutEffect, useMemo, useSyncExternalStore } from 'react';
|
|
7
7
|
import { I18nError, t } from '@molecule/app-i18n';
|
|
8
8
|
import { I18nContext } from '../contexts.js';
|
|
9
9
|
/**
|
|
@@ -21,6 +21,58 @@ export function useI18nProvider() {
|
|
|
21
21
|
}
|
|
22
22
|
return provider;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Subscribes the calling component to the provider's locale notifications
|
|
26
|
+
* through `useSyncExternalStore`, like the package's other store hooks.
|
|
27
|
+
*
|
|
28
|
+
* The snapshot counts this hook's notifications, carries the active locale,
|
|
29
|
+
* and includes the provider's `getRevision()` when it exposes one. A
|
|
30
|
+
* notification, a locale switch, or a revision bump re-renders the component.
|
|
31
|
+
*
|
|
32
|
+
* The one provider listener is attached in a layout effect, and
|
|
33
|
+
* `useSyncExternalStore` subscribes to it later, in the passive phase, then
|
|
34
|
+
* reads the snapshot again. Every layout effect of a commit runs before any
|
|
35
|
+
* mount effect, so a notification fired in a child's or an earlier sibling's
|
|
36
|
+
* `useEffect` is still counted and re-renders this component.
|
|
37
|
+
*
|
|
38
|
+
* The revision covers what the listener cannot: a change announced BEFORE the
|
|
39
|
+
* listener exists — from a child's or an earlier sibling's layout effect, or
|
|
40
|
+
* while React keeps the tree hidden (`<Activity mode="hidden">`) with effects
|
|
41
|
+
* unmounted. The snapshot re-read after subscribing sees the new revision and
|
|
42
|
+
* re-renders with the current text. `createSimpleI18nProvider` implements
|
|
43
|
+
* `getRevision`; a provider written before it existed falls back to the
|
|
44
|
+
* listener count, and a locale switch is still caught for it through the
|
|
45
|
+
* locale in the snapshot. Only a notification fired during the render, before
|
|
46
|
+
* this hook runs, remains unobservable — register translations at module scope
|
|
47
|
+
* or in an effect, never while rendering.
|
|
48
|
+
*
|
|
49
|
+
* No hook-returned function is rebuilt, so an effect that depends on one stays
|
|
50
|
+
* stable.
|
|
51
|
+
*
|
|
52
|
+
* @param provider - The i18n provider from context.
|
|
53
|
+
* @returns A value that changes on every notification, revision and locale switch.
|
|
54
|
+
*/
|
|
55
|
+
function useLocaleSnapshot(provider) {
|
|
56
|
+
const store = useMemo(() => {
|
|
57
|
+
let notifications = 0;
|
|
58
|
+
const onChanges = new Set();
|
|
59
|
+
return {
|
|
60
|
+
listener: () => {
|
|
61
|
+
notifications += 1;
|
|
62
|
+
onChanges.forEach((onChange) => onChange());
|
|
63
|
+
},
|
|
64
|
+
subscribe: (onChange) => {
|
|
65
|
+
onChanges.add(onChange);
|
|
66
|
+
return () => {
|
|
67
|
+
onChanges.delete(onChange);
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
getSnapshot: () => `${notifications}:${provider.getRevision?.() ?? 0}:${provider.getLocale()}`,
|
|
71
|
+
};
|
|
72
|
+
}, [provider]);
|
|
73
|
+
useLayoutEffect(() => provider.onLocaleChange(store.listener), [provider, store]);
|
|
74
|
+
return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
75
|
+
}
|
|
24
76
|
/**
|
|
25
77
|
* Hook for internationalization.
|
|
26
78
|
*
|
|
@@ -44,21 +96,15 @@ export function useI18nProvider() {
|
|
|
44
96
|
*/
|
|
45
97
|
export function useTranslation() {
|
|
46
98
|
const provider = useI18nProvider();
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// Force re-render even when locale string is unchanged (e.g. when
|
|
57
|
-
// addTranslations adds new keys for the current locale).
|
|
58
|
-
forceUpdate({});
|
|
59
|
-
});
|
|
60
|
-
return unsubscribe;
|
|
61
|
-
}, [provider]);
|
|
99
|
+
const snapshot = useLocaleSnapshot(provider);
|
|
100
|
+
// Read from the provider on every render, never copied into state: a
|
|
101
|
+
// replaced provider, or a switch that landed before the subscription, shows
|
|
102
|
+
// its own values on the first render instead of the previous ones.
|
|
103
|
+
const locale = provider.getLocale();
|
|
104
|
+
const direction = provider.getDirection();
|
|
105
|
+
// `snapshot` is the recompute key: a new list once per notification, the same
|
|
106
|
+
// list otherwise, so an effect that depends on `locales` stays stable.
|
|
107
|
+
const locales = useMemo(() => provider.getLocales(), [provider, snapshot]);
|
|
62
108
|
// Memoized translation function
|
|
63
109
|
const t = useCallback((key, values, options) => provider.t(key, values, options), [provider, locale]);
|
|
64
110
|
// Memoized action wrappers
|
|
@@ -78,11 +124,36 @@ export function useTranslation() {
|
|
|
78
124
|
/**
|
|
79
125
|
* Hook to get just the translation function.
|
|
80
126
|
*
|
|
81
|
-
*
|
|
127
|
+
* The returned function keeps ONE identity for as long as the provider
|
|
128
|
+
* instance is unchanged, so it is safe as an effect dependency: an effect
|
|
129
|
+
* written as `useEffect(..., [t])` does not re-run on ordinary re-renders or on
|
|
130
|
+
* a locale change. The hook still re-renders the calling component on every
|
|
131
|
+
* locale notification (including `addTranslations` for the active locale), so
|
|
132
|
+
* text it reads while rendering is current. A value memoized on `[t]` alone
|
|
133
|
+
* keeps the old text after a locale switch: `useMemo(() => t(...), [t])`, or a
|
|
134
|
+
* `React.memo` child that receives `t` as a prop. Call `useT()` inside that
|
|
135
|
+
* child, or add `useLocale()` to the dependencies.
|
|
136
|
+
*
|
|
137
|
+
* Call it in either of two compatible forms:
|
|
138
|
+
*
|
|
139
|
+
* - `t(key, values?, options?)` — the provider signature from
|
|
140
|
+
* `@molecule/app-i18n`, e.g. `t('cart.total', { total })`.
|
|
141
|
+
* - `t(key, fallback, options?)` — a shorthand for the common inline-English
|
|
142
|
+
* call: a string second argument is the `defaultValue`, so
|
|
143
|
+
* `t('cart.empty', 'Your cart is empty')` equals
|
|
144
|
+
* `t('cart.empty', undefined, { defaultValue: 'Your cart is empty' })`.
|
|
145
|
+
* Interpolation and pluralization still work:
|
|
146
|
+
* `t('cart.items', '{{count}} items', { count: 3 })`.
|
|
147
|
+
*
|
|
148
|
+
* @returns The translation function (stable identity while the provider is
|
|
149
|
+
* unchanged).
|
|
82
150
|
*/
|
|
83
151
|
export function useT() {
|
|
84
152
|
const provider = useI18nProvider();
|
|
85
|
-
|
|
153
|
+
useLocaleSnapshot(provider);
|
|
154
|
+
return useCallback((key, valuesOrDefault, options) => typeof valuesOrDefault === 'string'
|
|
155
|
+
? provider.t(key, undefined, { ...options, defaultValue: valuesOrDefault })
|
|
156
|
+
: provider.t(key, valuesOrDefault, options), [provider]);
|
|
86
157
|
}
|
|
87
158
|
/**
|
|
88
159
|
* Hook to get the current locale.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslation.js","sourceRoot":"","sources":["../../src/hooks/useTranslation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"useTranslation.js","sourceRoot":"","sources":["../../src/hooks/useTranslation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAS/F,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACxC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,CAAC,CAAC,oCAAoC,EAAE,SAAS,EAAE;YACjD,YAAY,EAAE,qDAAqD;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAS,iBAAiB,CAAC,QAAsB;IAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,IAAI,aAAa,GAAG,CAAC,CAAA;QACrB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;QACvC,OAAO;YACL,QAAQ,EAAE,GAAS,EAAE;gBACnB,aAAa,IAAI,CAAC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AC,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC,EAC/C,CAAC,QAAQ,CAAC,CACK,CAAA;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAA;IACnC,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAA;IACtC,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,KAA+B;IAC1D,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,4EAA4E;IAC5E,qEAAqE;IACrE,4EAA4E;IAC5E,uEAAuE;IACvE,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAA;AACtB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -114,6 +114,15 @@
|
|
|
114
114
|
* `useTranslation()` (or `useT()`); it re-renders on `onLocaleChange` — even when
|
|
115
115
|
* `addTranslations()` only adds keys for the current locale. Calling the raw `t()` import from
|
|
116
116
|
* `@molecule/app-i18n` in render works once but leaves stale text after a locale switch.
|
|
117
|
+
* `useT()` returns a function with a STABLE identity (safe as an effect dependency) that also
|
|
118
|
+
* takes an inline fallback as its second argument: `t('cart.empty', 'Your cart is empty')` is
|
|
119
|
+
* shorthand for `t('cart.empty', undefined, { defaultValue: 'Your cart is empty' })`.
|
|
120
|
+
* Prefer it over a hand-written local wrapper (`const t = (key, fallback) => …`), whose new
|
|
121
|
+
* identity every render re-runs any effect that depends on `t`. The identity also survives a
|
|
122
|
+
* locale switch, so text memoized on `[t]` alone (`useMemo`, or a `React.memo` child given `t`)
|
|
123
|
+
* keeps the old language — add `useLocale()` to those dependencies. Register translations at
|
|
124
|
+
* module scope or in a `useEffect`, never while rendering: the notification would update
|
|
125
|
+
* other components mid-render.
|
|
117
126
|
* - **Load a page's data with `useQuery` from `@molecule/app-query-react`, never with `fetch` in a
|
|
118
127
|
* `useEffect`.** A hand-written load effect that cancels on cleanup (a `cancelled` flag or an
|
|
119
128
|
* `AbortController`) cancels its own request on every re-render when a dependency is rebuilt each
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8JG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -114,6 +114,15 @@
|
|
|
114
114
|
* `useTranslation()` (or `useT()`); it re-renders on `onLocaleChange` — even when
|
|
115
115
|
* `addTranslations()` only adds keys for the current locale. Calling the raw `t()` import from
|
|
116
116
|
* `@molecule/app-i18n` in render works once but leaves stale text after a locale switch.
|
|
117
|
+
* `useT()` returns a function with a STABLE identity (safe as an effect dependency) that also
|
|
118
|
+
* takes an inline fallback as its second argument: `t('cart.empty', 'Your cart is empty')` is
|
|
119
|
+
* shorthand for `t('cart.empty', undefined, { defaultValue: 'Your cart is empty' })`.
|
|
120
|
+
* Prefer it over a hand-written local wrapper (`const t = (key, fallback) => …`), whose new
|
|
121
|
+
* identity every render re-runs any effect that depends on `t`. The identity also survives a
|
|
122
|
+
* locale switch, so text memoized on `[t]` alone (`useMemo`, or a `React.memo` child given `t`)
|
|
123
|
+
* keeps the old language — add `useLocale()` to those dependencies. Register translations at
|
|
124
|
+
* module scope or in a `useEffect`, never while rendering: the notification would update
|
|
125
|
+
* other components mid-render.
|
|
117
126
|
* - **Load a page's data with `useQuery` from `@molecule/app-query-react`, never with `fetch` in a
|
|
118
127
|
* `useEffect`.** A hand-written load effect that cancels on cleanup (a `cancelled` flag or an
|
|
119
128
|
* `AbortController`) cancels its own request on every re-render when a dependency is rebuilt each
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8JG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { AuthClient, AuthState, RegisterExtraShape } from '@molecule/app-au
|
|
|
9
9
|
import type { DiffFile, EditorFile, EditorProvider, EditorTab, FixWithAIRequest } from '@molecule/app-code-editor';
|
|
10
10
|
import type { FormController, FormOptions } from '@molecule/app-forms';
|
|
11
11
|
import type { HttpClient } from '@molecule/app-http';
|
|
12
|
-
import type { I18nProvider } from '@molecule/app-i18n';
|
|
12
|
+
import type { I18nProvider, TranslateOptions } from '@molecule/app-i18n';
|
|
13
13
|
import type { PanelId, WorkspaceLayout, WorkspaceProvider } from '@molecule/app-ide';
|
|
14
14
|
import type { DeviceFrame, PreviewProvider, PreviewState } from '@molecule/app-live-preview';
|
|
15
15
|
import type { LoggerProvider } from '@molecule/app-logger';
|
|
@@ -203,6 +203,25 @@ export interface UseTranslationResult {
|
|
|
203
203
|
formatDate: I18nProvider['formatDate'];
|
|
204
204
|
direction: 'ltr' | 'rtl';
|
|
205
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Options for the shorthand form of {@link UseTFunction}: the fallback text is
|
|
208
|
+
* passed positionally, so only `count` remains here.
|
|
209
|
+
*/
|
|
210
|
+
export type UseTShorthandOptions = Omit<TranslateOptions, 'defaultValue'>;
|
|
211
|
+
/**
|
|
212
|
+
* Translation function returned by `useT()`.
|
|
213
|
+
*
|
|
214
|
+
* Two compatible call forms:
|
|
215
|
+
* - `t(key, values?, options?)` — the {@link I18nProvider.t} signature.
|
|
216
|
+
* - `t(key, fallback, options?)` — a string second argument is the inline
|
|
217
|
+
* English `defaultValue`, with optional `count` for pluralization.
|
|
218
|
+
*
|
|
219
|
+
* Its identity is stable while the i18n provider instance is unchanged, so it
|
|
220
|
+
* can be used directly as an effect dependency.
|
|
221
|
+
*/
|
|
222
|
+
export type UseTFunction = I18nProvider['t'] & {
|
|
223
|
+
(key: string, fallback: string, options?: UseTShorthandOptions): string;
|
|
224
|
+
};
|
|
206
225
|
/**
|
|
207
226
|
* Hook options for useChat.
|
|
208
227
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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I,CAAA;IACnB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IAClC,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACxD,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;CAC3E;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,YAAY,CAAA;IACnB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACxC,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB;;;;;;OAMG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5D,6EAA6E;IAC7E,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAMD,YAAY,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,KAAK,GACN,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "React framework bindings for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc",
|
|
14
14
|
"dev": "tsc --watch",
|
|
15
|
+
"pretest": "npm run typecheck:tests",
|
|
15
16
|
"test": "vitest run",
|
|
16
|
-
"test:watch": "vitest"
|
|
17
|
+
"test:watch": "vitest",
|
|
18
|
+
"typecheck:tests": "tsc -p tsconfig.tests.json"
|
|
17
19
|
},
|
|
18
20
|
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
19
21
|
"license": "Apache-2.0",
|
|
@@ -60,7 +62,7 @@
|
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@molecule/app-ai-models": "1.4.3",
|
|
62
64
|
"@molecule/app-bonds-default-react": "2.0.0",
|
|
63
|
-
"@molecule/app-i18n": "1.0
|
|
65
|
+
"@molecule/app-i18n": "1.1.0",
|
|
64
66
|
"@testing-library/dom": "10.4.2",
|
|
65
67
|
"@testing-library/react": "16.3.3",
|
|
66
68
|
"@types/node": "26.6.5",
|