@saykit/react 0.0.0-beta-20260912200031 → 0.0.0-beta-20261017001906
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/client.d.mts +6 -1
- package/dist/client.mjs +5 -3
- package/dist/client.server.d.mts +4 -4
- package/dist/client.server.mjs +2 -1
- package/package.json +3 -3
package/dist/client.d.mts
CHANGED
|
@@ -17,14 +17,17 @@ type SayProviderProps = {
|
|
|
17
17
|
store: Store;
|
|
18
18
|
locale?: never;
|
|
19
19
|
messages?: never;
|
|
20
|
+
options?: never;
|
|
20
21
|
} | {
|
|
21
22
|
store?: never;
|
|
22
23
|
locale: string;
|
|
23
24
|
messages: View.Messages;
|
|
25
|
+
options?: View.Options;
|
|
24
26
|
} | {
|
|
25
27
|
store?: never;
|
|
26
28
|
locale?: never;
|
|
27
29
|
messages?: never;
|
|
30
|
+
options?: never;
|
|
28
31
|
};
|
|
29
32
|
/**
|
|
30
33
|
* Provide a {@link View} to descendant **client** components via context.
|
|
@@ -36,8 +39,10 @@ type SayProviderProps = {
|
|
|
36
39
|
* locale by the server
|
|
37
40
|
* @param props.messages The messages for that locale, which should be
|
|
38
41
|
* referentially stable rather than a fresh object literal per render
|
|
42
|
+
* @param props.options How that locale's view formats its messages, as the
|
|
43
|
+
* server's view was built with
|
|
39
44
|
*/
|
|
40
|
-
declare function SayProvider({ store, locale, messages, children }: PropsWithChildren<SayProviderProps>): import("react").FunctionComponentElement<import("react").ProviderProps<
|
|
45
|
+
declare function SayProvider({ store, locale, messages, options, children }: PropsWithChildren<SayProviderProps>): import("react").FunctionComponentElement<import("react").ProviderProps<Store<string> | null>>;
|
|
41
46
|
/**
|
|
42
47
|
* Get the current {@link View}, on the client.
|
|
43
48
|
* Must be called within a {@link SayProvider}.
|
package/dist/client.mjs
CHANGED
|
@@ -4,15 +4,17 @@ import { createCatalogue, createStore } from "saykit";
|
|
|
4
4
|
//#region src/runtime/client.ts
|
|
5
5
|
const SayContext = createContext(null);
|
|
6
6
|
SayContext.displayName = "SayContext";
|
|
7
|
-
function SayProvider({ store, locale, messages, children }) {
|
|
7
|
+
function SayProvider({ store, locale, messages, options, children }) {
|
|
8
|
+
const bidiIsolation = options?.bidiIsolation;
|
|
8
9
|
const held = useMemo(() => {
|
|
9
10
|
if (store) return store;
|
|
10
11
|
if (locale === void 0 || !messages) throw new Error("'SayProvider' must be given a store, or a locale and its messages");
|
|
11
|
-
return createStore(createCatalogue({ [locale]: messages }), locale);
|
|
12
|
+
return createStore(createCatalogue({ [locale]: messages }, { bidiIsolation }), locale);
|
|
12
13
|
}, [
|
|
13
14
|
store,
|
|
14
15
|
locale,
|
|
15
|
-
messages
|
|
16
|
+
messages,
|
|
17
|
+
bidiIsolation
|
|
16
18
|
]);
|
|
17
19
|
return createElement(SayContext.Provider, { value: held }, children);
|
|
18
20
|
}
|
package/dist/client.server.d.mts
CHANGED
|
@@ -6,10 +6,10 @@ import "server-only";
|
|
|
6
6
|
*
|
|
7
7
|
* A store is a live object and cannot cross the server/client boundary, and a
|
|
8
8
|
* server component cannot hand its own scope to a client one either. What can
|
|
9
|
-
* cross is the locale and
|
|
10
|
-
* the enclosing segment established with
|
|
11
|
-
*
|
|
12
|
-
* takes no props.
|
|
9
|
+
* cross is the locale, its messages and the view's options, so this reads them
|
|
10
|
+
* off the view the enclosing segment established with
|
|
11
|
+
* {@link import('./server.js').setSay}, and passes them to the real provider,
|
|
12
|
+
* which is why `<SayProvider>` written on the server takes no props.
|
|
13
13
|
*/
|
|
14
14
|
declare function SayProvider({ children }: {
|
|
15
15
|
children?: ReactNode;
|
package/dist/client.server.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saykit/react",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-20261017001906",
|
|
4
4
|
"description": "React integration for saykit, i18n hooks and components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"jsdom": "^29.1.1",
|
|
54
54
|
"react": "^19.2.8",
|
|
55
55
|
"react-dom": "^19.2.8",
|
|
56
|
-
"saykit": "^0.0.0-beta-
|
|
56
|
+
"saykit": "^0.0.0-beta-20261017001906"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": "*",
|
|
60
|
-
"saykit": "0.0.0-beta-
|
|
60
|
+
"saykit": "0.0.0-beta-20261017001906"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"check": "tsc --noEmit",
|