@saykit/react 0.0.0-beta-20260418085054 → 0.0.0-beta-20260420171848

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/dist/server.d.mts CHANGED
@@ -24,12 +24,10 @@ declare function getSay(): ReadonlySay;
24
24
  *
25
25
  * @returns A {@link withSay} higher-order component factory
26
26
  */
27
- declare function unstable_createWithSay(say: Say): <P extends object>(Component: (props: P & {
27
+ declare function unstable_createWithSay(say: Say): <P = unknown>(Component: (props: PropsWithSay<P>) => ReactNode, getLocale: (props: P) => string | Promise<string>) => (props: P) => Promise<_$react.FunctionComponentElement<PropsWithSay<P>>>;
28
+ type PropsWithSay<P = unknown> = P & {
28
29
  locale: string;
29
30
  messages: Say.Messages;
30
- }) => ReactNode, getLocale: (props: P) => string | Promise<string>) => (props: P) => Promise<_$react.FunctionComponentElement<P & {
31
- locale: string;
32
- messages: Say.Messages;
33
- }>>;
31
+ };
34
32
  //#endregion
35
- export { getSay, setSay, unstable_createWithSay };
33
+ export { PropsWithSay, getSay, setSay, unstable_createWithSay };
package/dist/server.mjs CHANGED
@@ -11,8 +11,8 @@ const serverContext = cache(() => ({ current: null }));
11
11
  */
12
12
  function setSay(say) {
13
13
  const ref = serverContext();
14
- if (say instanceof Say) ref.current = say;
15
- else ref.current = say();
14
+ if (say instanceof Say) ref.current = say.clone().freeze();
15
+ else ref.current = say().clone().freeze();
16
16
  }
17
17
  /**
18
18
  * Get the current {@link Say} **server** instance.
@@ -39,7 +39,8 @@ function unstable_createWithSay(say) {
39
39
  */
40
40
  return function withSay(Component, getLocale) {
41
41
  return async function WithSay(props) {
42
- const locale = await getLocale(props);
42
+ const guess = await getLocale(props);
43
+ const locale = say.match(guess);
43
44
  await say.load(locale);
44
45
  say.activate(locale);
45
46
  setSay(say);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saykit/react",
3
- "version": "0.0.0-beta-20260418085054",
3
+ "version": "0.0.0-beta-20260420171848",
4
4
  "description": "React integration for saykit, i18n hooks and components",
5
5
  "keywords": [
6
6
  "i18n",
@@ -48,11 +48,11 @@
48
48
  "devDependencies": {
49
49
  "@types/react": "^19.2.14",
50
50
  "react": "^19.2.5",
51
- "saykit": "^0.0.0-beta-20260418085054"
51
+ "saykit": "^0.0.0-beta-20260420171848"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": "*",
55
- "saykit": "0.0.0-beta-20260418085054"
55
+ "saykit": "0.0.0-beta-20260420171848"
56
56
  },
57
57
  "scripts": {
58
58
  "check": "tsc --noEmit",