@real-router/solid 0.2.0 → 0.2.2

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.
@@ -39,8 +39,8 @@ declare const RouteView: typeof RouteViewRoot & {
39
39
  NotFound: typeof NotFound;
40
40
  };
41
41
 
42
- interface RouteState<P extends Params = Params, MP extends Params = Params> {
43
- route: State<P, MP> | undefined;
42
+ interface RouteState<P extends Params = Params> {
43
+ route: State<P> | undefined;
44
44
  previousRoute?: State | undefined;
45
45
  }
46
46
  interface LinkProps<P extends Params = Params> extends Omit<JSX.HTMLAttributes<HTMLAnchorElement>, "onClick"> {
@@ -101,7 +101,7 @@ interface RouterContextValue {
101
101
  routeSelector: (routeName: string) => boolean;
102
102
  }
103
103
  declare const RouterContext: solid_js.Context<RouterContextValue | null>;
104
- declare const RouteContext: solid_js.Context<Accessor<RouteState<_real_router_core.Params, _real_router_core.Params>> | null>;
104
+ declare const RouteContext: solid_js.Context<Accessor<RouteState<_real_router_core.Params>> | null>;
105
105
 
106
106
  declare function createSignalFromSource<T>(source: RouterSource<T>): Accessor<T>;
107
107
 
package/dist/cjs/index.js CHANGED
@@ -148,7 +148,7 @@ const RouteView = Object.assign(RouteViewRoot, {
148
148
  NotFound
149
149
  });
150
150
 
151
- var t="data-real-router-announcer";function e(e,n){const r="Navigated to ";let o,u=true,c=false,a=false,s="";const l=function(){const e=document.querySelector(`[${t}]`);if(e)return e;const n=document.createElement("div");return n.setAttribute("style","position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0"),n.setAttribute("aria-live","assertive"),n.setAttribute("aria-atomic","true"),n.setAttribute(t,""),document.body.prepend(n),n}(),m=setTimeout(()=>{c=true;},100),d=e.subscribe(({route:t})=>{u?u=false:requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(a)return;const e=function(t,e,n){const r=document.querySelector("h1"),i=r?.textContent.trim()??"",o=t.name.startsWith("@@")?"":t.name;return `${e}${i||document.title||o||globalThis.location.pathname}`}(t,r);e&&e!==s&&c&&(s=e,clearTimeout(o),l.textContent=e,o=setTimeout(()=>{l.textContent="",s="";},7e3),function(){const t=document.querySelector("h1");t&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:true}));}());});});});return {destroy(){a=true,d(),clearTimeout(o),clearTimeout(m),document.querySelector(`[${t}]`)?.remove();}}}function n(t){return !(0!==t.button||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function r(t,e,n){const r=t.buildUrl;return r?r(e,n):t.buildPath(e,n)}function i(t,e,n){return t&&e?n?`${n} ${e}`.trim():e:n??void 0}function o(t){t instanceof HTMLAnchorElement||t instanceof HTMLButtonElement||(t.getAttribute("role")||t.setAttribute("role","link"),t.getAttribute("tabindex")||t.setAttribute("tabindex","0"));}
151
+ const e=`data-real-router-announcer`;function t(e,t){let o=`Navigated to `,c=true,l=false,u=false,d=``,f,p=n(),m=setTimeout(()=>{l=true;},100),h=e.subscribe(({route:e})=>{if(c){c=false;return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(u)return;let t=i(e,o);t&&t!==d&&l&&(d=t,clearTimeout(f),p.textContent=t,f=setTimeout(()=>{p.textContent=``,d=``;},7e3),a());});});});return {destroy(){u=true,h(),clearTimeout(f),clearTimeout(m),r();}}}function n(){let t=document.querySelector(`[${e}]`);if(t)return t;let n=document.createElement(`div`);return n.setAttribute(`style`,`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0`),n.setAttribute(`aria-live`,`assertive`),n.setAttribute(`aria-atomic`,`true`),n.setAttribute(e,``),document.body.prepend(n),n}function r(){document.querySelector(`[${e}]`)?.remove();}function i(e,t,n){let r=document.querySelector(`h1`)?.textContent.trim()??``,i=e.name.startsWith(`@@`)?``:e.name;return `${t}${r||document.title||i||globalThis.location.pathname}`}function a(){let e=document.querySelector(`h1`);e&&(e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`-1`),e.focus({preventScroll:true}));}function o(e){return e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function s(e,t,n){try{let r=e.buildUrl;return r?r(t,n):e.buildPath(t,n)}catch{console.error(`[real-router] Route "${t}" is not defined. The element will render without an href attribute.`);return}}function c(e,t,n){return e&&t?n?`${n} ${t}`.trim():t:n??void 0}function l(e){e instanceof HTMLAnchorElement||e instanceof HTMLButtonElement||(e.getAttribute(`role`)||e.setAttribute(`role`,`link`),e.getAttribute(`tabindex`)||e.setAttribute(`tabindex`,`0`));}
152
152
 
153
153
  /**
154
154
  * Stable empty object for default params
@@ -177,7 +177,7 @@ function Link(props) {
177
177
  strict: local.activeStrict,
178
178
  ignoreQueryParams: local.ignoreQueryParams
179
179
  }));
180
- const href = solidJs.createMemo(() => r(router, local.routeName, local.routeParams));
180
+ const href = solidJs.createMemo(() => s(router, local.routeName, local.routeParams));
181
181
  const handleClick = evt => {
182
182
  if (local.onClick) {
183
183
  local.onClick(evt);
@@ -185,13 +185,13 @@ function Link(props) {
185
185
  return;
186
186
  }
187
187
  }
188
- if (!n(evt) || local.target === "_blank") {
188
+ if (!o(evt) || local.target === "_blank") {
189
189
  return;
190
190
  }
191
191
  evt.preventDefault();
192
192
  router.navigate(local.routeName, local.routeParams, local.routeOptions).catch(() => {});
193
193
  };
194
- const finalClassName = solidJs.createMemo(() => i(isActive(), local.activeClassName, local.class));
194
+ const finalClassName = solidJs.createMemo(() => c(isActive(), local.activeClassName, local.class));
195
195
  return (() => {
196
196
  var _el$ = _tmpl$();
197
197
  web.spread(_el$, web.mergeProps(rest, {
@@ -245,9 +245,14 @@ function link(element, accessor) {
245
245
 
246
246
  // Set href on <a> elements
247
247
  if (element instanceof HTMLAnchorElement) {
248
- element.href = router.buildPath(options.routeName, options.routeParams ?? EMPTY_PARAMS);
248
+ const href = s(router, options.routeName, options.routeParams ?? EMPTY_PARAMS);
249
+ if (href === undefined) {
250
+ element.removeAttribute("href");
251
+ } else {
252
+ element.href = href;
253
+ }
249
254
  }
250
- o(element);
255
+ l(element);
251
256
 
252
257
  // Active class tracking (reactive)
253
258
  if (options.activeClassName) {
@@ -264,7 +269,7 @@ function link(element, accessor) {
264
269
 
265
270
  // Click handler
266
271
  function handleClick(evt) {
267
- if (!n(evt)) {
272
+ if (!o(evt)) {
268
273
  return;
269
274
  }
270
275
  if (element instanceof HTMLAnchorElement) {
@@ -336,7 +341,7 @@ function RouterProvider(props) {
336
341
  if (!props.announceNavigation) {
337
342
  return;
338
343
  }
339
- const announcer = e(props.router);
344
+ const announcer = t(props.router);
340
345
  solidJs.onCleanup(() => {
341
346
  announcer.destroy();
342
347
  });
@@ -39,8 +39,8 @@ declare const RouteView: typeof RouteViewRoot & {
39
39
  NotFound: typeof NotFound;
40
40
  };
41
41
 
42
- interface RouteState<P extends Params = Params, MP extends Params = Params> {
43
- route: State<P, MP> | undefined;
42
+ interface RouteState<P extends Params = Params> {
43
+ route: State<P> | undefined;
44
44
  previousRoute?: State | undefined;
45
45
  }
46
46
  interface LinkProps<P extends Params = Params> extends Omit<JSX.HTMLAttributes<HTMLAnchorElement>, "onClick"> {
@@ -101,7 +101,7 @@ interface RouterContextValue {
101
101
  routeSelector: (routeName: string) => boolean;
102
102
  }
103
103
  declare const RouterContext: solid_js.Context<RouterContextValue | null>;
104
- declare const RouteContext: solid_js.Context<Accessor<RouteState<_real_router_core.Params, _real_router_core.Params>> | null>;
104
+ declare const RouteContext: solid_js.Context<Accessor<RouteState<_real_router_core.Params>> | null>;
105
105
 
106
106
  declare function createSignalFromSource<T>(source: RouterSource<T>): Accessor<T>;
107
107
 
@@ -146,7 +146,7 @@ const RouteView = Object.assign(RouteViewRoot, {
146
146
  NotFound
147
147
  });
148
148
 
149
- var t="data-real-router-announcer";function e(e,n){const r="Navigated to ";let o,u=true,c=false,a=false,s="";const l=function(){const e=document.querySelector(`[${t}]`);if(e)return e;const n=document.createElement("div");return n.setAttribute("style","position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0"),n.setAttribute("aria-live","assertive"),n.setAttribute("aria-atomic","true"),n.setAttribute(t,""),document.body.prepend(n),n}(),m=setTimeout(()=>{c=true;},100),d=e.subscribe(({route:t})=>{u?u=false:requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(a)return;const e=function(t,e,n){const r=document.querySelector("h1"),i=r?.textContent.trim()??"",o=t.name.startsWith("@@")?"":t.name;return `${e}${i||document.title||o||globalThis.location.pathname}`}(t,r);e&&e!==s&&c&&(s=e,clearTimeout(o),l.textContent=e,o=setTimeout(()=>{l.textContent="",s="";},7e3),function(){const t=document.querySelector("h1");t&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:true}));}());});});});return {destroy(){a=true,d(),clearTimeout(o),clearTimeout(m),document.querySelector(`[${t}]`)?.remove();}}}function n(t){return !(0!==t.button||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function r(t,e,n){const r=t.buildUrl;return r?r(e,n):t.buildPath(e,n)}function i(t,e,n){return t&&e?n?`${n} ${e}`.trim():e:n??void 0}function o(t){t instanceof HTMLAnchorElement||t instanceof HTMLButtonElement||(t.getAttribute("role")||t.setAttribute("role","link"),t.getAttribute("tabindex")||t.setAttribute("tabindex","0"));}
149
+ const e=`data-real-router-announcer`;function t(e,t){let o=`Navigated to `,c=true,l=false,u=false,d=``,f,p=n(),m=setTimeout(()=>{l=true;},100),h=e.subscribe(({route:e})=>{if(c){c=false;return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(u)return;let t=i(e,o);t&&t!==d&&l&&(d=t,clearTimeout(f),p.textContent=t,f=setTimeout(()=>{p.textContent=``,d=``;},7e3),a());});});});return {destroy(){u=true,h(),clearTimeout(f),clearTimeout(m),r();}}}function n(){let t=document.querySelector(`[${e}]`);if(t)return t;let n=document.createElement(`div`);return n.setAttribute(`style`,`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0`),n.setAttribute(`aria-live`,`assertive`),n.setAttribute(`aria-atomic`,`true`),n.setAttribute(e,``),document.body.prepend(n),n}function r(){document.querySelector(`[${e}]`)?.remove();}function i(e,t,n){let r=document.querySelector(`h1`)?.textContent.trim()??``,i=e.name.startsWith(`@@`)?``:e.name;return `${t}${r||document.title||i||globalThis.location.pathname}`}function a(){let e=document.querySelector(`h1`);e&&(e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`-1`),e.focus({preventScroll:true}));}function o(e){return e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function s(e,t,n){try{let r=e.buildUrl;return r?r(t,n):e.buildPath(t,n)}catch{console.error(`[real-router] Route "${t}" is not defined. The element will render without an href attribute.`);return}}function c(e,t,n){return e&&t?n?`${n} ${t}`.trim():t:n??void 0}function l(e){e instanceof HTMLAnchorElement||e instanceof HTMLButtonElement||(e.getAttribute(`role`)||e.setAttribute(`role`,`link`),e.getAttribute(`tabindex`)||e.setAttribute(`tabindex`,`0`));}
150
150
 
151
151
  /**
152
152
  * Stable empty object for default params
@@ -175,7 +175,7 @@ function Link(props) {
175
175
  strict: local.activeStrict,
176
176
  ignoreQueryParams: local.ignoreQueryParams
177
177
  }));
178
- const href = createMemo(() => r(router, local.routeName, local.routeParams));
178
+ const href = createMemo(() => s(router, local.routeName, local.routeParams));
179
179
  const handleClick = evt => {
180
180
  if (local.onClick) {
181
181
  local.onClick(evt);
@@ -183,13 +183,13 @@ function Link(props) {
183
183
  return;
184
184
  }
185
185
  }
186
- if (!n(evt) || local.target === "_blank") {
186
+ if (!o(evt) || local.target === "_blank") {
187
187
  return;
188
188
  }
189
189
  evt.preventDefault();
190
190
  router.navigate(local.routeName, local.routeParams, local.routeOptions).catch(() => {});
191
191
  };
192
- const finalClassName = createMemo(() => i(isActive(), local.activeClassName, local.class));
192
+ const finalClassName = createMemo(() => c(isActive(), local.activeClassName, local.class));
193
193
  return (() => {
194
194
  var _el$ = _tmpl$();
195
195
  spread(_el$, mergeProps$1(rest, {
@@ -243,9 +243,14 @@ function link(element, accessor) {
243
243
 
244
244
  // Set href on <a> elements
245
245
  if (element instanceof HTMLAnchorElement) {
246
- element.href = router.buildPath(options.routeName, options.routeParams ?? EMPTY_PARAMS);
246
+ const href = s(router, options.routeName, options.routeParams ?? EMPTY_PARAMS);
247
+ if (href === undefined) {
248
+ element.removeAttribute("href");
249
+ } else {
250
+ element.href = href;
251
+ }
247
252
  }
248
- o(element);
253
+ l(element);
249
254
 
250
255
  // Active class tracking (reactive)
251
256
  if (options.activeClassName) {
@@ -262,7 +267,7 @@ function link(element, accessor) {
262
267
 
263
268
  // Click handler
264
269
  function handleClick(evt) {
265
- if (!n(evt)) {
270
+ if (!o(evt)) {
266
271
  return;
267
272
  }
268
273
  if (element instanceof HTMLAnchorElement) {
@@ -334,7 +339,7 @@ function RouterProvider(props) {
334
339
  if (!props.announceNavigation) {
335
340
  return;
336
341
  }
337
- const announcer = e(props.router);
342
+ const announcer = t(props.router);
338
343
  onCleanup(() => {
339
344
  announcer.destroy();
340
345
  });
@@ -7,5 +7,5 @@ export interface RouterContextValue {
7
7
  routeSelector: (routeName: string) => boolean;
8
8
  }
9
9
  export declare const RouterContext: import("solid-js", { with: { "resolution-mode": "import" } }).Context<RouterContextValue | null>;
10
- export declare const RouteContext: import("solid-js", { with: { "resolution-mode": "import" } }).Context<Accessor<RouteState<import("@real-router/core").Params, import("@real-router/core").Params>> | null>;
10
+ export declare const RouteContext: import("solid-js", { with: { "resolution-mode": "import" } }).Context<Accessor<RouteState<import("@real-router/core").Params>> | null>;
11
11
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CAC/C;AAED,eAAO,MAAM,aAAa,kGAAiD,CAAC;AAE5E,eAAO,MAAM,YAAY,4KAAmD,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CAC/C;AAED,eAAO,MAAM,aAAa,kGAAiD,CAAC;AAE5E,eAAO,MAAM,YAAY,wIAAmD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/directives/link.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC5C,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,oBAAoB,CAAC,CAAC,CAAC,GACtC,IAAI,CAwDN"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/directives/link.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC5C,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,oBAAoB,CAAC,CAAC,CAAC,GACtC,IAAI,CA+DN"}
@@ -1,7 +1,7 @@
1
1
  import type { NavigationOptions, Params, State } from "@real-router/core";
2
2
  import type { JSX } from "solid-js";
3
- export interface RouteState<P extends Params = Params, MP extends Params = Params> {
4
- route: State<P, MP> | undefined;
3
+ export interface RouteState<P extends Params = Params> {
4
+ route: State<P> | undefined;
5
5
  previousRoute?: State | undefined;
6
6
  }
7
7
  export interface LinkProps<P extends Params = Params> extends Omit<JSX.HTMLAttributes<HTMLAnchorElement>, "onClick"> {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,UAAU,CACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,EAAE,SAAS,MAAM,GAAG,MAAM;IAE1B,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,IAAI,CAChE,GAAG,CAAC,cAAc,CAAC,iBAAiB,CAAC,EACrC,SAAS,CACV;IACC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;CACrC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACnD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,IAAI,CAChE,GAAG,CAAC,cAAc,CAAC,iBAAiB,CAAC,EACrC,SAAS,CACV;IACC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;CACrC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/solid",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "commonjs",
5
5
  "description": "Solid.js integration for Real-Router",
6
6
  "main": "./dist/cjs/index.js",
@@ -51,10 +51,10 @@
51
51
  "license": "MIT",
52
52
  "sideEffects": false,
53
53
  "dependencies": {
54
- "@real-router/route-utils": "^0.1.6",
55
- "@real-router/core": "^0.40.1",
56
- "@real-router/sources": "^0.3.0",
57
- "dom-utils": "^0.2.2"
54
+ "@real-router/core": "^0.41.0",
55
+ "@real-router/route-utils": "^0.1.7",
56
+ "@real-router/sources": "^0.3.1",
57
+ "dom-utils": "^0.2.3"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@babel/core": "7.29.0",
@@ -72,7 +72,7 @@
72
72
  "solid-js": "1.9.5",
73
73
  "vite-plugin-solid": "2.11.11",
74
74
  "vitest": "4.1.0",
75
- "@real-router/browser-plugin": "^0.10.6"
75
+ "@real-router/browser-plugin": "^0.11.0"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "solid-js": ">=1.7.0"
@@ -1,5 +1,5 @@
1
1
  import { createActiveRouteSource } from "@real-router/sources";
2
- import { shouldNavigate, applyLinkA11y } from "dom-utils";
2
+ import { shouldNavigate, applyLinkA11y, buildHref } from "dom-utils";
3
3
  import { createEffect, onCleanup } from "solid-js";
4
4
 
5
5
  import { EMPTY_PARAMS, EMPTY_OPTIONS } from "../constants";
@@ -26,10 +26,17 @@ export function link<P extends Params = Params>(
26
26
 
27
27
  // Set href on <a> elements
28
28
  if (element instanceof HTMLAnchorElement) {
29
- element.href = router.buildPath(
29
+ const href = buildHref(
30
+ router,
30
31
  options.routeName,
31
32
  options.routeParams ?? (EMPTY_PARAMS as P),
32
33
  );
34
+
35
+ if (href === undefined) {
36
+ element.removeAttribute("href");
37
+ } else {
38
+ element.href = href;
39
+ }
33
40
  }
34
41
 
35
42
  applyLinkA11y(element);
package/src/types.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  import type { NavigationOptions, Params, State } from "@real-router/core";
2
2
  import type { JSX } from "solid-js";
3
3
 
4
- export interface RouteState<
5
- P extends Params = Params,
6
- MP extends Params = Params,
7
- > {
8
- route: State<P, MP> | undefined;
4
+ export interface RouteState<P extends Params = Params> {
5
+ route: State<P> | undefined;
9
6
  previousRoute?: State | undefined;
10
7
  }
11
8