@saykit/react 0.0.0-beta-20260805071713 → 0.0.0-beta-20260810145057

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.mjs CHANGED
@@ -4,17 +4,6 @@ import { Say } from "saykit";
4
4
  //#region src/runtime/client.ts
5
5
  const SayContext = createContext({ current: null });
6
6
  SayContext.displayName = "SayContext";
7
- /**
8
- * Provide a localised {@link runtime.Say} instance to descendant **client** components via context.
9
- * Must wrap any component tree using {@link useSay} or {@link Say}.
10
- *
11
- * The instance is rebuilt whenever `locale` or `messages` changes, so keep `messages`
12
- * referentially stable (module scope, or memoised) rather than passing a fresh object
13
- * literal on every render.
14
- *
15
- * @param props.locale The current locale
16
- * @param props.messages The current messages for the locale
17
- */
18
7
  function SayProvider({ locale, messages, children }) {
19
8
  const ref = useMemo(() => {
20
9
  const instance = new Say({
@@ -27,13 +16,6 @@ function SayProvider({ locale, messages, children }) {
27
16
  }, [locale, messages]);
28
17
  return createElement(SayContext.Provider, { value: ref }, children);
29
18
  }
30
- /**
31
- * Get the current {@link Say} **client** instance.
32
- * Must be called within a {@link SayProvider}.
33
- *
34
- * @returns The current {@link Say} instance
35
- * @throws If no provider is in the component tree
36
- */
37
19
  function useSay() {
38
20
  const ref = useContext(SayContext);
39
21
  if (!ref.current) throw new Error("'useSay' must be used within a 'SayProvider'");
package/dist/index.mjs CHANGED
@@ -47,17 +47,6 @@ function Renderer({ html, components, whitespace = true }) {
47
47
  }
48
48
  //#endregion
49
49
  //#region src/types.ts
50
- /**
51
- * Map the props the transform compiled a message's values into back to the
52
- * identifiers they carry. Every value is emitted with one underscore in front,
53
- * which is what keeps a numbered identifier a valid prop name and what keeps
54
- * any name a message chooses out of `Say`'s own namespace, so stripping exactly
55
- * one is the whole inverse — `_0` is `0`, and `__link` is a tag named `_link`.
56
- *
57
- * The result is deliberately not typed as the props that went in: renaming the
58
- * keys is the point, so claiming they survived would be a lie the only caller
59
- * cannot use anyway, it looks tags up by a name that comes from a translation.
60
- */
61
50
  function resolveValuePropKeys(props) {
62
51
  const result = {};
63
52
  for (const key in props) if (key.startsWith("_")) result[key.slice(1)] = props[key];
@@ -47,17 +47,6 @@ function Renderer({ html, components, whitespace = true }) {
47
47
  }
48
48
  //#endregion
49
49
  //#region src/types.ts
50
- /**
51
- * Map the props the transform compiled a message's values into back to the
52
- * identifiers they carry. Every value is emitted with one underscore in front,
53
- * which is what keeps a numbered identifier a valid prop name and what keeps
54
- * any name a message chooses out of `Say`'s own namespace, so stripping exactly
55
- * one is the whole inverse — `_0` is `0`, and `__link` is a tag named `_link`.
56
- *
57
- * The result is deliberately not typed as the props that went in: renaming the
58
- * keys is the point, so claiming they survived would be a lie the only caller
59
- * cannot use anyway, it looks tags up by a name that comes from a translation.
60
- */
61
50
  function resolveValuePropKeys(props) {
62
51
  const result = {};
63
52
  for (const key in props) if (key.startsWith("_")) result[key.slice(1)] = props[key];
package/dist/server.mjs CHANGED
@@ -3,40 +3,17 @@ import { Say } from "saykit";
3
3
  import "server-only";
4
4
  //#region src/runtime/server.ts
5
5
  const serverContext = cache(() => ({ current: null }));
6
- /**
7
- * Set the current {@link Say} **server** instance.
8
- * Must be called before any {@link getSay} calls.
9
- *
10
- * @param say The current {@link Say} instance
11
- */
12
6
  function setSay(say) {
13
7
  const ref = serverContext();
14
8
  if (say instanceof Say) ref.current = say.clone().freeze();
15
9
  else ref.current = say().clone().freeze();
16
10
  }
17
- /**
18
- * Get the current {@link Say} **server** instance.
19
- * Must only be called after any {@link setSay} calls.
20
- *
21
- * @returns The current {@link Say} instance
22
- * @throws If no {@link Say} instance has been set
23
- */
24
11
  function getSay() {
25
12
  const ref = serverContext();
26
13
  if (!ref.current) throw new Error("Attempt to access the server-only Say instance before initialisation", { cause: /* @__PURE__ */ new Error("'getSay' must be called after 'setSay'") });
27
14
  return ref.current;
28
15
  }
29
- /**
30
- * Create a {@link withSay} higher-order component factory bound to a specific {@link Say} instance.
31
- *
32
- * @param say The {@link Say} instance to bind into the server context
33
- *
34
- * @returns A {@link withSay} higher-order component factory
35
- */
36
16
  function unstable_createWithSay(say) {
37
- /**
38
- * Wrap a server component so that a {@link Say} instance is initialised before render.
39
- */
40
17
  return function withSay(Component, getLocale) {
41
18
  return async function WithSay(props) {
42
19
  const guess = await getLocale(props);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saykit/react",
3
- "version": "0.0.0-beta-20260805071713",
3
+ "version": "0.0.0-beta-20260810145057",
4
4
  "description": "React integration for saykit, i18n hooks and components",
5
5
  "keywords": [
6
6
  "i18n",
@@ -52,11 +52,11 @@
52
52
  "jsdom": "^29.1.1",
53
53
  "react": "^19.2.8",
54
54
  "react-dom": "^19.2.8",
55
- "saykit": "^0.0.0-beta-20260805071713"
55
+ "saykit": "^0.0.0-beta-20260810145057"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "react": "*",
59
- "saykit": "0.0.0-beta-20260805071713"
59
+ "saykit": "0.0.0-beta-20260810145057"
60
60
  },
61
61
  "scripts": {
62
62
  "check": "tsc --noEmit",