@uxf/router 11.90.0 → 11.92.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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/router.d.ts +1 -1
  3. package/router.js +18 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/router",
3
- "version": "11.90.0",
3
+ "version": "11.92.0",
4
4
  "description": "UXF Router",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/router#readme",
package/router.d.ts CHANGED
@@ -3,7 +3,7 @@ import { LinkProps } from "next/link";
3
3
  import { Infer, Struct } from "superstruct";
4
4
  import { SitemapGeneratorOptions, SitemapGeneratorType, SitemapRouteResolvers } from "./sitemap-generator";
5
5
  import { QueryParams, RouteDefinition, RoutesDefinition } from "./types";
6
- interface TransitionOptions {
6
+ export interface TransitionOptions {
7
7
  shallow?: boolean;
8
8
  locale?: string | false;
9
9
  scroll?: boolean;
package/router.js CHANGED
@@ -105,7 +105,24 @@ function createRouter(routes, routerOptions) {
105
105
  if ((0, is_nil_1.isNil)(searchParams) || (0, is_nil_1.isNil)(params)) {
106
106
  return null;
107
107
  }
108
- return Array.from(searchParams.entries()).reduce((acc, [key, value]) => ({ ...acc, [key]: value }), params);
108
+ // Collect all query params, handling duplicate keys as arrays
109
+ const queryParams = Array.from(searchParams.entries()).reduce((acc, [key, value]) => {
110
+ const existing = acc[key];
111
+ if (existing === undefined) {
112
+ // First occurrence - set as single value
113
+ acc[key] = value;
114
+ }
115
+ else if (Array.isArray(existing)) {
116
+ // Already an array - append
117
+ existing.push(value);
118
+ }
119
+ else {
120
+ // Second occurrence - convert to array
121
+ acc[key] = [existing, value];
122
+ }
123
+ return acc;
124
+ }, {});
125
+ return { ...params, ...queryParams };
109
126
  };
110
127
  return {
111
128
  route(...args) {