@solidjs/router 2.0.0-next.36 → 2.0.0-next.37

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.
@@ -8,7 +8,7 @@
8
8
  // // before: a client component exists only to make the call
9
9
  // const getStory = query(storyView, "story");
10
10
  // component: props => {
11
- // const View = dynamic(() => getStory(props.params.id));
11
+ // const View = dynamicComponent(() => getStory(props.params.id));
12
12
  // return <View>{props.children}</View>;
13
13
  // }
14
14
  // // after
@@ -36,7 +36,7 @@
36
36
  // A server component that takes other client positions — handlers, refs,
37
37
  // named slots — has a client half, and that half is a client component; the
38
38
  // helper does not pretend otherwise. Write the wrapper for that route.
39
- import { dynamic } from "@solidjs/web";
39
+ import { dynamicComponent } from "@solidjs/web";
40
40
  import { createComponent, DEV } from "solid-js";
41
41
  import { SERVER_ROUTE } from "./serverRouteShared.js";
42
42
  /**
@@ -77,8 +77,9 @@ source) {
77
77
  };
78
78
  function render(args, routeProps) {
79
79
  // The source may answer a component, a promise of one, or (a live query)
80
- // successive components; `dynamic`'s memo lands each the same way.
81
- const View = dynamic(() => call(args()));
80
+ // successive components; `dynamicComponent`'s memo lands each the same
81
+ // way. Never a tag, so the element runtime `dynamic` retains stays out.
82
+ const View = dynamicComponent(() => call(args()));
82
83
  return createComponent(View, {
83
84
  get children() {
84
85
  return routeProps.children;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Component, Signal } from "solid-js";
1
+ import type { Component, Owner, Signal } from "solid-js";
2
2
  import type { JSX, ResponseEnvelope } from "@solidjs/web";
3
3
  declare module "@solidjs/web" {
4
4
  interface RequestEvent {
@@ -118,13 +118,13 @@ export interface LocationWrite<S = unknown> extends Omit<LocationChange<S>, "val
118
118
  export interface RouterIntegration {
119
119
  signal: [get: () => LocationChange, set: (next: LocationWrite) => void];
120
120
  /**
121
- * The navigation written but not yet committed to history — the window
122
- * between its location write and the settle that pushes it. A destination
123
- * in that window was never shown, so a `navigate()` issued inside it (a
124
- * guard redirecting as the held route lands) is a hop of that navigation
125
- * rather than a new one, exactly as one issued while it is still pending.
121
+ * Whether a navigation write's settle has run: Solid's `onSettled`,
122
+ * registered beside the write, fired for the transition that carried it.
123
+ * Until then the write is in flight: its destination was never shown, so a
124
+ * `navigate()` issued meanwhile (a guard redirecting as the held route
125
+ * lands) is a hop of that navigation rather than a new one.
126
126
  */
127
- inflight?: () => LocationChange | undefined;
127
+ settled?: (write: LocationChange) => boolean;
128
128
  utils?: Partial<RouterUtils>;
129
129
  }
130
130
  export type Intent = "initial" | "native" | "navigate" | "preload";
@@ -330,11 +330,12 @@ export interface RouterContext {
330
330
  params: Params;
331
331
  wrapParams: (getParams: () => Params) => Params;
332
332
  navigatorFactory: NavigatorFactory;
333
- isRouting: () => boolean;
334
333
  /** @internal Intent of the in-flight canonical location transition. */
335
334
  intent?: () => Intent | undefined;
336
- /** The target of the in-flight navigation transition, if any. Not reactive. */
337
- readonly pendingTarget?: LocationChange;
335
+ /** @internal The integration's location signal: the last flushed write. */
336
+ _source: () => LocationChange;
337
+ /** @internal The owner the router's own computations live under. */
338
+ _owner: Owner | null;
338
339
  matches: () => RouteMatch[];
339
340
  renderPath(path: string): string;
340
341
  parsePath(str: string): string;
@@ -343,6 +344,22 @@ export interface RouterContext {
343
344
  singleFlight: boolean;
344
345
  submissions: Signal<Submission<any, any>[]>;
345
346
  }
347
+ /**
348
+ * A plugin for the router's `links` option that extends the state it writes
349
+ * onto claimed anchors. Built once per router with its base path. The router
350
+ * ships `pendingLinks`, which adds `data-pending`.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * const Router = createRouter({ routes, links: pendingLinks });
355
+ * ```
356
+ */
357
+ export type LinksPlugin = (router: RouterContext, base: string) => {
358
+ /** The reactive read the claims sweep re-runs on. */
359
+ track(): unknown;
360
+ /** Whether an anchor resolving to `target` is the in-flight destination; read when `track()` is truthy. */
361
+ pending(target: string | undefined): boolean;
362
+ };
346
363
  export interface BeforeLeaveEventArgs {
347
364
  from: Location;
348
365
  to: string | number;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "Ryan Turnquist"
7
7
  ],
8
8
  "license": "MIT",
9
- "version": "2.0.0-next.36",
9
+ "version": "2.0.0-next.37",
10
10
  "homepage": "https://github.com/solidjs/solid-router#readme",
11
11
  "repository": {
12
12
  "type": "git",
@@ -37,23 +37,23 @@
37
37
  "@rollup/plugin-babel": "6.0.4",
38
38
  "@rollup/plugin-node-resolve": "15.3.0",
39
39
  "@rollup/plugin-terser": "0.4.4",
40
- "@solidjs/vite-plugin": "3.0.0-next.35",
41
- "@solidjs/web": "^2.0.0-rc.13",
40
+ "@solidjs/vite-plugin": "3.0.0-next.47",
41
+ "@solidjs/web": "^2.0.0-rc.14",
42
42
  "@types/jest": "^29.5.14",
43
43
  "@types/node": "^22.10.0",
44
44
  "babel-preset-solid": "^2.0.0-rc.2",
45
45
  "jsdom": "^25.0.1",
46
46
  "prettier": "^3.4.1",
47
47
  "rollup": "^4.27.4",
48
- "solid-js": "^2.0.0-rc.13",
48
+ "solid-js": "^2.0.0-rc.14",
49
49
  "typescript": "^5.7.2",
50
50
  "vite": "^8.2.2",
51
51
  "vitest": "^4.1.11"
52
52
  },
53
53
  "peerDependencies": {
54
- "@solidjs/web": "^2.0.0-rc.13",
54
+ "@solidjs/web": "^2.0.0-rc.14",
55
55
  "filesystem-routing": ">=0.4.0",
56
- "solid-js": "^2.0.0-rc.13"
56
+ "solid-js": "^2.0.0-rc.14"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "filesystem-routing": {