@leavittsoftware/web 10.2.0 → 10.2.1

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/CLAUDE.md CHANGED
@@ -23,12 +23,23 @@ When bumping `@leavittsoftware/web` in a downstream project, read every entry **
23
23
 
24
24
  ### Unreleased
25
25
 
26
- **Upgrade if coming from:** `< unreleased` (published latest is `10.0.2`)
26
+ **Upgrade if coming from:** `< unreleased` (published latest is `10.2.0`)
27
+
28
+ **Search downstream for:**
29
+
30
+ - `AppRoute` / `PageRoute` / `RedirectRoute` imports from `titanium/helpers/route`
31
+ - App-shell `#routes` tables and `before` handlers on page routes
32
+ - `'page' in route` / `'redirect' in route` discriminators used to collect or execute matches
27
33
 
28
34
  **Adopt when upgrading to this version:**
29
35
 
30
- - `TitaniumDataTableCoreItemMetaData.omitFromCsv` set on action/button columns to exclude them from built-in CSV export; use `csvValue` when a complex `render` column should export a scalar value
31
- - `titanium-drawer.openQuick()` — opens without slide-in animation; pair with `closeQuick()` when restoring persisted open state on component mount
36
+ - **Middleware + halt pipeline** — `AppRoute` now includes `MiddlewareRoute` (`pattern` + required `before`, no `page`/`redirect`). Matching destinations run **all** matching middleware (and page `before` handlers) in declaration order; handlers continue by default and may return `ROUTE_HALT` / `'halt'` (`RouteHandlerResult`) to stop the pipeline without rendering. Rework app routers from “first match wins immediately” to the two-pass collect-then-execute pattern (see skeleton.leavitt.com `develop` / leavittbook `my-app.ts`). Prefer importing `ROUTE_HALT` from `titanium/helpers/route` instead of the string literal.
37
+
38
+ **Renamed / API changes:**
39
+
40
+ - `AppRoute` = `MiddlewareRoute | PageRoute | RedirectRoute`
41
+ - `PageRoute.before` return type is now `RouteHandlerResult | Promise<RouteHandlerResult>` (may return `ROUTE_HALT` / `'halt'`)
42
+ - New exports: `MiddlewareRoute`, `RouteHandlerResult`, `ROUTE_HALT`
32
43
 
33
44
  ### 10.0.0
34
45
 
@@ -1319,23 +1330,23 @@ These apply to the **host class** (`LitElement` or `Md*` subclass). They stack w
1319
1330
 
1320
1331
  ## Helpers (selected)
1321
1332
 
1322
- | Symbol | Import path | Purpose |
1323
- | ----------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------- |
1324
- | `Debouncer` | `titanium/helpers/debouncer` | Debounced async calls |
1325
- | `delay` | `titanium/helpers/delay` | Promise delay |
1326
- | `getCdnDownloadUrl`, `getCdnInlineUrl` | `titanium/helpers/get-cdn-download-url`, `get-cdn-Inline-url` | CDN attachment URLs |
1327
- | `getCompanyMarkUrl`, `getCompanyLogoUrl` | `titanium/helpers/get-company-mark-url`, `get-company-logo-url` | Company branding URLs |
1328
- | `formatAddress`, address utils | `titanium/helpers/address/*` | Address formatting |
1329
- | Phone formatters | `titanium/helpers/phone-numbers/*` | Phone number display |
1330
- | `convertArrayToCsv`, `startCsvDownload` | `titanium/helpers/csv/*` | CSV export |
1331
- | `getSearchTokens` | `titanium/helpers/get-search-token` | OData search token parsing |
1332
- | `escapeTerm` | `titanium/helpers/escape-term` | OData string escaping |
1333
- | `groupBy`, `join`, `middleEllipsis` | `titanium/helpers/*` | General utilities |
1334
- | `notNull`, `notUndefined`, `notNullOrUndefined` | `titanium/helpers/*` | Type guards |
1335
- | `installMediaQueryWatcher` | `titanium/helpers/install-media-query-watcher` | Responsive layout callback |
1336
- | `findScrollableParent` | `titanium/helpers/find-scrollable-parent` | Scroll container detection |
1337
- | `isDevelopment` | `titanium/helpers/is-development` | Dev environment detection |
1338
- | `AppRoute`, `PageRoute`, `RedirectRoute` | `titanium/helpers/route` | Route table types for Navigation API SPA routers (`URLPattern` + lazy `import`) |
1333
+ | Symbol | Import path | Purpose |
1334
+ | --------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1335
+ | `Debouncer` | `titanium/helpers/debouncer` | Debounced async calls |
1336
+ | `delay` | `titanium/helpers/delay` | Promise delay |
1337
+ | `getCdnDownloadUrl`, `getCdnInlineUrl` | `titanium/helpers/get-cdn-download-url`, `get-cdn-Inline-url` | CDN attachment URLs |
1338
+ | `getCompanyMarkUrl`, `getCompanyLogoUrl` | `titanium/helpers/get-company-mark-url`, `get-company-logo-url` | Company branding URLs |
1339
+ | `formatAddress`, address utils | `titanium/helpers/address/*` | Address formatting |
1340
+ | Phone formatters | `titanium/helpers/phone-numbers/*` | Phone number display |
1341
+ | `convertArrayToCsv`, `startCsvDownload` | `titanium/helpers/csv/*` | CSV export |
1342
+ | `getSearchTokens` | `titanium/helpers/get-search-token` | OData search token parsing |
1343
+ | `escapeTerm` | `titanium/helpers/escape-term` | OData string escaping |
1344
+ | `groupBy`, `join`, `middleEllipsis` | `titanium/helpers/*` | General utilities |
1345
+ | `notNull`, `notUndefined`, `notNullOrUndefined` | `titanium/helpers/*` | Type guards |
1346
+ | `installMediaQueryWatcher` | `titanium/helpers/install-media-query-watcher` | Responsive layout callback |
1347
+ | `findScrollableParent` | `titanium/helpers/find-scrollable-parent` | Scroll container detection |
1348
+ | `isDevelopment` | `titanium/helpers/is-development` | Dev environment detection |
1349
+ | `AppRoute`, `PageRoute`, `RedirectRoute`, `MiddlewareRoute`, `RouteHandlerResult`, `ROUTE_HALT` | `titanium/helpers/route` | Route table types for Navigation API SPA routers (`URLPattern` + lazy `import`). `MiddlewareRoute` (`pattern` + `before`, no `page`/`redirect`) runs for every matching destination in declaration order before the first matching page/redirect; handlers continue by default and may return `ROUTE_HALT` / `'halt'` (`RouteHandlerResult`) to stop the pipeline (e.g. after a guard redirect). `PageRoute.before` may also return `ROUTE_HALT` to skip its render. |
1339
1350
 
1340
1351
  ## Hacks
1341
1352
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavittsoftware/web",
3
- "version": "10.2.0",
3
+ "version": "10.2.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "files": [
@@ -42,5 +42,5 @@
42
42
  "url": "https://github.com/LeavittSoftware/titanium-elements/issues"
43
43
  },
44
44
  "homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
45
- "gitHead": "c1b51233df8756c26d7fc0a8c01499f81615936f"
45
+ "gitHead": "3162a6324c1b3e2b860c779defcd5dec6655cbff"
46
46
  }
@@ -1,12 +1,26 @@
1
+ /** Return value that stops the routing pipeline (skip remaining matches and the page render). */
2
+ export declare const ROUTE_HALT: "halt";
3
+ /** Return `ROUTE_HALT` / `'halt'` to stop the pipeline. Returning nothing continues. */
4
+ export type RouteHandlerResult = typeof ROUTE_HALT | void;
5
+ /**
6
+ * A route with a pattern and a `before` handler but no page or redirect.
7
+ * All middleware routes matching the destination run in declaration order before
8
+ * the first matching page/redirect route; the pipeline continues automatically
9
+ * unless a handler returns `ROUTE_HALT` / `'halt'`.
10
+ */
11
+ export type MiddlewareRoute = {
12
+ pattern: URLPattern;
13
+ before: (params: Record<string, string>, url: URL) => RouteHandlerResult | Promise<RouteHandlerResult>;
14
+ };
1
15
  export type PageRoute = {
2
16
  pattern: URLPattern;
3
17
  page: string;
4
18
  import: () => Promise<unknown>;
5
- before?: (params: Record<string, string>, url: URL) => void | Promise<void>;
19
+ before?: (params: Record<string, string>, url: URL) => RouteHandlerResult | Promise<RouteHandlerResult>;
6
20
  };
7
21
  export type RedirectRoute = {
8
22
  pattern: URLPattern;
9
23
  redirect: string | ((params: Record<string, string>) => string);
10
24
  };
11
- export type AppRoute = PageRoute | RedirectRoute;
25
+ export type AppRoute = MiddlewareRoute | PageRoute | RedirectRoute;
12
26
  //# sourceMappingURL=route.d.ts.map
@@ -1,2 +1,3 @@
1
- export {};
1
+ /** Return value that stops the routing pipeline (skip remaining matches and the page render). */
2
+ export const ROUTE_HALT = 'halt';
2
3
  //# sourceMappingURL=route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["route.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["route.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,MAAM,CAAC,MAAM,UAAU,GAAG,MAAe,CAAC"}