react-stateshape 0.2.0 → 0.2.1

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/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
2
  let stateshape = require("stateshape");
2
3
  let react = require("react");
3
4
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -312,9 +313,11 @@ exports.useRouteLinks = useRouteLinks;
312
313
  exports.useRouteState = useRouteState;
313
314
  exports.useTransientState = useTransientState;
314
315
  exports.useURL = useURL;
315
- Object.keys(stateshape).forEach(function (k) {
316
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
316
+ Object.keys(stateshape).forEach(function(k) {
317
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
317
318
  enumerable: true,
318
- get: function () { return stateshape[k]; }
319
+ get: function() {
320
+ return stateshape[k];
321
+ }
319
322
  });
320
323
  });
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as stateshape0 from "stateshape";
1
+ import * as stateshape from "stateshape";
2
2
  import { ContainerElement, EventCallback, LocationValue, MatchState, NavigationOptions, Route, State, StatePayloadMap, URLData, URLState } from "stateshape";
3
- import * as react0 from "react";
3
+ import * as react from "react";
4
4
  import { AnchorHTMLAttributes, AreaHTMLAttributes, MouseEvent, ReactNode, RefObject } from "react";
5
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  export * from "stateshape";
@@ -32,7 +32,7 @@ declare const Area: ({
32
32
  ...props
33
33
  }: AreaProps) => react_jsx_runtime0.JSX.Element;
34
34
 
35
- declare const RouteContext: react0.Context<Route>;
35
+ declare const RouteContext: react.Context<Route>;
36
36
 
37
37
  type RouteProviderProps = {
38
38
  href?: string | Route | undefined;
@@ -53,7 +53,7 @@ type TransientState = {
53
53
  time?: number | undefined;
54
54
  };
55
55
 
56
- declare const TransientStateContext: react0.Context<Map<string, State<TransientState, stateshape0.StatePayloadMap<TransientState>>>>;
56
+ declare const TransientStateContext: react.Context<Map<string, State<TransientState, stateshape.StatePayloadMap<TransientState>>>>;
57
57
 
58
58
  type TransientStateProviderProps = {
59
59
  value?: Record<string, TransientState> | Map<string, State<TransientState>> | null | undefined;
@@ -66,7 +66,7 @@ declare const TransientStateProvider: ({
66
66
 
67
67
  type RenderCallback<T> = (render: () => void, payload: T) => boolean | undefined | void;
68
68
 
69
- declare const URLContext: react0.Context<URLState>;
69
+ declare const URLContext: react.Context<URLState>;
70
70
 
71
71
  type URLProviderProps = {
72
72
  href?: string | URLState | undefined;
@@ -94,10 +94,10 @@ declare function useNavigationComplete(callback: EventCallback<NavigationOptions
94
94
  declare function useNavigationStart(callback: EventCallback<NavigationOptions>): void;
95
95
 
96
96
  declare function useRoute(callback?: RenderCallback<NavigationOptions>): {
97
- route: stateshape0.Route;
97
+ route: stateshape.Route;
98
98
  at: {
99
- <P extends stateshape0.LocationPattern, X>(urlPattern: P, matchOutput: X | stateshape0.MatchHandler<P, X>): X | undefined;
100
- <P extends stateshape0.LocationPattern, X, Y>(urlPattern: P, matchOutput: X | stateshape0.MatchHandler<P, X>, mismatchOutput: Y | stateshape0.MatchHandler<P, Y>): X | Y;
99
+ <P extends stateshape.LocationPattern, X>(urlPattern: P, matchOutput: X | stateshape.MatchHandler<P, X>): X | undefined;
100
+ <P extends stateshape.LocationPattern, X, Y>(urlPattern: P, matchOutput: X | stateshape.MatchHandler<P, X>, mismatchOutput: Y | stateshape.MatchHandler<P, Y>): X | Y;
101
101
  };
102
102
  };
103
103
 
@@ -159,6 +159,6 @@ type ControllableTransientState = TransientState & {
159
159
  declare function useTransientState<F extends (...args: unknown[]) => unknown>(state: string | State<TransientState> | null, action: F): [ControllableTransientState, (...args: [...Parameters<F>, TransientStateOptions?]) => ReturnType<F>];
160
160
  declare function useTransientState(state: string | State<TransientState> | null): [ControllableTransientState];
161
161
 
162
- declare function useURL(callback?: RenderCallback<NavigationOptions>): [string, (update: string | stateshape0.StateUpdate<string>) => void];
162
+ declare function useURL(callback?: RenderCallback<NavigationOptions>): [string, (update: string | stateshape.StateUpdate<string>) => void];
163
163
 
164
164
  export { A, AProps, Area, AreaProps, ControllableTransientState, EnhanceHref, LinkNavigationProps, RenderCallback, RouteContext, RouteProvider, RouteProviderProps, SetExternalStateValue, SetRouteState, TransientState, TransientStateContext, TransientStateOptions, TransientStateProvider, TransientStateProviderProps, URLContext, URLProvider, URLProviderProps, useExternalState, useLinkClick, useNavigationComplete, useNavigationStart, useRoute, useRouteLinks, useRouteState, useTransientState, useURL };
package/dist/index.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  import { Route, State, URLState, compileURL, getNavigationOptions, isRouteEvent, isState, matchURL } from "stateshape";
2
2
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
-
5
- export * from "stateshape"
4
+ export * from "stateshape";
6
5
 
7
6
  const RouteContext = createContext(new Route(null, { autoStart: false }));
8
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-stateshape",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Concise shared state management and routing in React apps",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -12,7 +12,7 @@
12
12
  "shape": "npx codeshape",
13
13
  "t3": "npx auxsrv tests/Tic-tac-toe",
14
14
  "test": "npx playwright test --project=chromium",
15
- "typecheck": "npx codeshape --typecheck-only"
15
+ "typecheck": "npx codeshape typecheck"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
@@ -34,16 +34,16 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@playwright/test": "^1.58.2",
37
- "@types/node": "^25.3.0",
37
+ "@types/node": "^25.5.0",
38
38
  "@types/react": "^19.2.14",
39
39
  "@types/react-dom": "^19.2.3",
40
- "auxsrv": "^0.3.1",
40
+ "auxsrv": "^0.3.2",
41
41
  "immer": "^11.1.4",
42
42
  "react-dom": "^19.2.4",
43
- "url-shape": "^1.3.13",
43
+ "url-shape": "^1.3.15",
44
44
  "zod": "^4.3.6"
45
45
  },
46
46
  "dependencies": {
47
- "stateshape": "^0.2.0"
47
+ "stateshape": "^0.2.1"
48
48
  }
49
49
  }
package/tsconfig.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "declaration": true,
5
5
  "emitDeclarationOnly": true,
6
6
  "lib": ["ESNext", "DOM"],
7
+ "types": ["node"],
7
8
  "target": "esnext",
8
9
  "outDir": "dist",
9
10
  "module": "nodenext",