@opencxh/domain 1.142.0 → 1.145.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.
@@ -8,6 +8,18 @@ export interface RouteDefinition {
8
8
  resource: string;
9
9
  /** If true, the path must match exactly. */
10
10
  exact?: boolean;
11
+ /**
12
+ * Fixed props handed to the resource on top of the path parameters.
13
+ *
14
+ * Lets one component serve several routes without the viewport having to
15
+ * remount a different resource per URL — which is what makes navigating
16
+ * between them flash. Two paths that produce the same parameters (a list and
17
+ * its `/search` sibling, say) stay distinguishable because the route says
18
+ * which one it is.
19
+ *
20
+ * Path parameters win on a name collision: those come from the URL.
21
+ */
22
+ props?: Record<string, string>;
11
23
  /**
12
24
  * Readable without a session. The shell skips its bounce to the login screen
13
25
  * for these paths and renders them without any chrome.
@@ -66,6 +78,8 @@ export interface PublicRoutePattern {
66
78
  resource: string;
67
79
  /** Absolute pattern, e.g. `/help/:hcSlug/:locale`. */
68
80
  pattern: string;
81
+ /** See {@link RouteDefinition.props}. */
82
+ props?: Record<string, string>;
69
83
  }
70
84
  export interface PublicRouteMatch extends PublicRoutePattern {
71
85
  params: Record<string, string>;
@@ -74,6 +88,19 @@ export interface PublicRouteMatch extends PublicRoutePattern {
74
88
  export declare function publicBasePathFor(app: PublicRouteSource): string;
75
89
  /** Every public route across the installed apps, as absolute patterns. */
76
90
  export declare function publicRoutePatterns(apps: Iterable<PublicRouteSource>): PublicRoutePattern[];
91
+ /**
92
+ * Is `a` a more specific pattern than `b`?
93
+ *
94
+ * Segment by segment, a literal beats a parameter: `/help/:hc/:locale/search`
95
+ * has to win over `/help/:hc/:locale/:collection`, or a help centre can never
96
+ * have a search page. Comparing string lengths would get exactly that case
97
+ * backwards, since `:collection` is the longer text.
98
+ *
99
+ * Exported because the shell asks the same question about `/apps/{name}` routes.
100
+ * It used to answer it with "whichever matched last", so a declared `/create`
101
+ * lost to the `/:id` below it — the opposite of what the author wrote down.
102
+ */
103
+ export declare function isMoreSpecificPattern(a: string, b: string): boolean;
77
104
  /**
78
105
  * The public route this path lands on, or null.
79
106
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.142.0",
3
+ "version": "1.145.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",