march-hare 0.6.1 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "march-hare",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "packageManager": "yarn@1.22.22",
@@ -88,7 +88,7 @@
88
88
  "react-flip-numbers": "^3.0.9",
89
89
  "react-router-dom": "^7.13.0",
90
90
  "react-test-renderer": "^19.2.4",
91
- "react-wayfinder": "^0.1.3",
91
+ "react-wayfinder": "^0.1.4",
92
92
  "rollup-plugin-visualizer": "^6.0.5",
93
93
  "terser": "^5.46.0",
94
94
  "traverse": "^0.6.11",
@@ -1,15 +0,0 @@
1
- import { Props } from './types.ts';
2
- import * as React from "react";
3
- export { useMode } from './utils.ts';
4
- export type { ModeHandle } from './utils.ts';
5
- /**
6
- * Provides a single mutable mode handle to every component inside the
7
- * boundary. Components opt in by calling {@link useMode} and threading the
8
- * returned handle through {@link useActions}'s `data` callback.
9
- *
10
- * Mode is **not** reactive — mutating it does not trigger a re-render.
11
- * Use it for cross-handler coordination (e.g. flagging an in-progress
12
- * sign-out) when you do not want the value showing up as render-time UI
13
- * state.
14
- */
15
- export declare function Mode({ children }: Props): React.ReactNode;
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- /**
3
- * Props for the Mode provider component.
4
- */
5
- export type Props = {
6
- children: ReactNode;
7
- };
@@ -1,55 +0,0 @@
1
- import * as React from "react";
2
- /**
3
- * React context exposing the per-Boundary mode handle. The handle itself
4
- * is stable across renders — readers grab `.current` at call time.
5
- *
6
- * @internal
7
- */
8
- export declare const Context: React.Context<React.RefObject<unknown>>;
9
- /**
10
- * Handle returned by {@link useMode}. Reads always reflect the latest
11
- * write, even after `await` boundaries.
12
- */
13
- export type ModeHandle<T> = {
14
- read(): T | null;
15
- update(value: T | null): void;
16
- };
17
- /**
18
- * Hook that returns a `{ read, update }` handle to the per-Boundary mode
19
- * value.
20
- *
21
- * Mode is a single mutable value shared across every component inside the
22
- * surrounding `<Boundary>`. It is **not** reactive &mdash; mutating it does
23
- * not trigger a re-render. Use it for coordinating between async action
24
- * handlers (e.g. short-circuiting refreshes during sign-out).
25
- *
26
- * Pass the handle through the {@link useActions} `data` callback so it
27
- * shows up under `context.data` inside handlers, fully typed.
28
- *
29
- * @example
30
- * ```ts
31
- * enum Mode {
32
- * Idle,
33
- * SigningOut,
34
- * }
35
- *
36
- * function useSignOutActions() {
37
- * const mode = useMode<Mode>();
38
- * const actions = useActions<Model, typeof Actions>(model, () => ({ mode }));
39
- *
40
- * actions.useAction(Actions.SignOut, async (context) => {
41
- * context.data.mode.update(Mode.SigningOut);
42
- * await api.signOut();
43
- * context.data.mode.update(Mode.Idle);
44
- * });
45
- *
46
- * actions.useAction(Actions.Refresh, async (context) => {
47
- * if (context.data.mode.read() === Mode.SigningOut) return;
48
- * // ...
49
- * });
50
- *
51
- * return actions;
52
- * }
53
- * ```
54
- */
55
- export declare function useMode<T>(): ModeHandle<T>;