@k8ordo/state 2.3.1 → 4.0.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": "@k8ordo/state",
3
- "version": "2.3.1",
3
+ "version": "4.0.0",
4
4
  "description": "Declare state by where it lives — URL search params, history-entry state, localStorage, sessionStorage, a cookie, or memory. One zod schema per boundary place and a typed box for memory, over the Navigation API.",
5
5
  "keywords": [
6
6
  "cookie",
@@ -35,6 +35,10 @@
35
35
  "types": "./dist/index.d.mts",
36
36
  "default": "./dist/index.mjs"
37
37
  },
38
+ "./testing": {
39
+ "types": "./dist/testing.d.mts",
40
+ "default": "./dist/testing.mjs"
41
+ },
38
42
  "./package.json": "./package.json"
39
43
  },
40
44
  "publishConfig": {
@@ -43,25 +47,25 @@
43
47
  },
44
48
  "devDependencies": {
45
49
  "@arethetypeswrong/cli": "0.18.5",
46
- "@k8ordo/router": "^2.3.1",
50
+ "@k8ordo/router": "^4.0.0",
47
51
  "@types/react": "19.3.0",
48
52
  "@types/react-dom": "19.3.0",
49
53
  "@vitejs/plugin-basic-ssl": "2.3.0",
50
- "@vitejs/plugin-react": "6.1.2",
51
- "@vitest/browser-playwright": "5.0.5",
52
- "playwright": "1.63.0",
54
+ "@vitejs/plugin-react": "6.3.0",
55
+ "@vitest/browser-playwright": "5.1.1",
56
+ "playwright": "1.65.1",
53
57
  "publint": "0.3.25",
54
58
  "react": "19.3.1",
55
59
  "react-dom": "19.3.1",
56
60
  "typescript": "7.0.2",
57
- "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
58
- "vite-plus": "1.4.0",
59
- "vitest": "5.0.5",
61
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
62
+ "vite-plus": "1.7.0",
63
+ "vitest": "5.1.1",
60
64
  "vitest-browser-react": "2.3.0",
61
65
  "zod": "4.6.7"
62
66
  },
63
67
  "peerDependencies": {
64
- "@k8ordo/router": "^2.3.1",
68
+ "@k8ordo/router": "^4.0.0",
65
69
  "@types/react": ">=19.3.0",
66
70
  "react": ">=19.3.0",
67
71
  "typescript": ">=7.0.0",
package/dist/base.d.mts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * A path as the URL spells it: Vite's `base` in front, so `/products` is
3
- * `/docs/products` under `base: '/docs/'` and `/` is `/docs/`. The same rule
4
- * as `@k8ordo/router`'s `withBase` — not borrowed, because the router is an
5
- * optional peer this package only reads types from.
6
- */
7
- export declare const withBase: (path: string) => string;
package/dist/base.mjs DELETED
@@ -1,14 +0,0 @@
1
- // src/base.ts
2
- /**
3
- * A path as the URL spells it: Vite's `base` in front, so `/products` is
4
- * `/docs/products` under `base: '/docs/'` and `/` is `/docs/`. The same rule
5
- * as `@k8ordo/router`'s `withBase` — not borrowed, because the router is an
6
- * optional peer this package only reads types from.
7
- */
8
- const withBase = (path) => {
9
- const base = import.meta.env === void 0 ? "/" : import.meta.env.BASE_URL;
10
- if (!base.startsWith("/") || base === "/") return path;
11
- const prefix = base.endsWith("/") ? base.slice(0, -1) : base;
12
- return path === "/" ? `${prefix}/` : `${prefix}${path}`;
13
- };
14
- export { withBase };
@@ -1,39 +0,0 @@
1
- import { NavigablePath, NavigablePatternOf, Routes, RoutesRecord } from "@k8ordo/router";
2
- /**
3
- * The app-side hook for typed route paths. An application augments this once,
4
- * with the same line its `@k8ordo/router` augmentation uses:
5
- *
6
- * ```ts
7
- * import type { routes } from './routes';
8
- * declare module '@k8ordo/state' {
9
- * interface Register { routes: typeof routes }
10
- * }
11
- * ```
12
- *
13
- * and every `href()` in the app is checked against the table's linkable
14
- * patterns. A router that is not `@k8ordo/router` registers its path union
15
- * directly — `interface Register { path: Route }` with `Route` from `next`.
16
- * Declared as an interface — the one exception to the repository's
17
- * type-only rule — because declaration merging is the entire mechanism.
18
- */
19
- export interface Register {}
20
- type LinkablePatterns<D> = D extends Routes<infer R extends RoutesRecord> ? { [K in NavigablePatternOf<R>]: K; }[NavigablePatternOf<R>] : never;
21
- /**
22
- * `Path` when the router a `Register` shape describes accepts it, and what
23
- * that router accepts when it does not, so the type error names the
24
- * alternatives: matched against the table's linkable patterns segment by
25
- * segment when it carries `routes` (refused, the patterns themselves),
26
- * against the union as given when it carries `path` (refused, that union),
27
- * and any `/`-path when it carries neither (refused, `` `/${string}` ``). A
28
- * union of paths is accepted only when every member is. `NavigablePath` is
29
- * imported as a type only, so `@k8ordo/router` is never loaded at runtime
30
- * and stays an optional peer.
31
- */
32
- export type AcceptedPath<R, Path extends string> = R extends {
33
- routes: infer Table;
34
- } ? [Path] extends [NavigablePath<Table, Path>] ? Path : LinkablePatterns<Table> : R extends {
35
- path: infer P extends string;
36
- } ? [Path] extends [P] ? Path : P : [Path] extends [`/${string}`] ? Path : `/${string}`;
37
- /** `href()`'s path check: `Path` when the registered router accepts it. */
38
- export type RegisteredPath<Path extends string> = AcceptedPath<Register, Path>;
39
- export {};
package/dist/register.mjs DELETED
@@ -1 +0,0 @@
1
- export {};