@ultimat3/render 31.31.0 → 31.33.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/render",
3
- "version": "31.31.0",
3
+ "version": "31.33.0",
4
4
  "description": "The route primitive and the five render modes: static, isr, ssr, stream, spa.",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -52,12 +52,12 @@
52
52
  "test": "bun test"
53
53
  },
54
54
  "dependencies": {
55
- "@ultimat3/cache": "31.31.0",
56
- "@ultimat3/core": "31.31.0",
57
- "@ultimat3/http": "31.31.0",
58
- "@ultimat3/i18n": "31.31.0",
59
- "@ultimat3/schema": "31.31.0",
60
- "@ultimat3/seo": "31.31.0",
55
+ "@ultimat3/cache": "31.33.0",
56
+ "@ultimat3/core": "31.33.0",
57
+ "@ultimat3/http": "31.33.0",
58
+ "@ultimat3/i18n": "31.33.0",
59
+ "@ultimat3/schema": "31.33.0",
60
+ "@ultimat3/seo": "31.33.0",
61
61
  "sass": "1.107.1"
62
62
  }
63
63
  }
package/src/asset.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * `asset('assets/hero.avif')` — the one way a page names a public file of its own: the path under
3
- * `apps/web/site/assets/` in, its content-hashed URL out. Typed so a path outside that tree or with
4
- * an extension nothing serves is a compile error, and resolved while the page RENDERS so a file
5
- * that is not there fails `x build --target static` with `X_ASSET_MISSING`, exactly as a bad
6
- * `island({ src })` does. The table is the CLI's (`site-assets.ts`); this file holds only the seam.
3
+ * `apps/web/site/assets/` in, its content-hashed URL out.
4
+ *
5
+ * Typed so a path outside that tree or with an extension nothing serves is a compile error, and
6
+ * resolved while the page RENDERS so a file that is not there fails `x build --target static` with
7
+ * `X_ASSET_MISSING`, exactly as a bad `island({ src })` does. The table is the CLI's
8
+ * (`site-assets.ts`); this file holds only the seam.
7
9
  */
8
10
 
9
11
  import { renderCauseValue } from '@ultimat3/core';
@@ -1,9 +1,10 @@
1
1
  /**
2
- * The page's client scope, as a `<head>` tag: `<meta name="ultimate-scope" content="…">`, read
3
- * once by `@ultimat3/core`'s `pageClient()` when the page's client handle is created. Only a
4
- * PRIVATE document carries one (`documentCarriesScope`): anything a shared cache may hold would
5
- * serve one visitor's scope to the next, and a store fenced as the wrong principal is the leak the
6
- * fence exists to stop.
2
+ * The page's client scope, as a `<head>` tag: `<meta name="ultimate-scope" content="…">`, read once
3
+ * by `@ultimat3/core`'s `pageClient()` when the page's client handle is created.
4
+ *
5
+ * Only a PRIVATE document carries one (`documentCarriesScope`): anything a shared cache may hold
6
+ * would serve one visitor's scope to the next, and a store fenced as the wrong principal is the
7
+ * leak the fence exists to stop.
7
8
  */
8
9
 
9
10
  import { CLIENT_PERSIST_META, CLIENT_SCOPE_META } from '@ultimat3/core';
package/src/client.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  // `@ultimat3/render/client` — THE browser entry of this package: what an island or a page script
2
- // may call, and nothing that drags the rest along. The `.` barrel bare-retains `errors.ts` (render's
3
- // whole code table, registered at import, plus core's titles tables); this entry's graph is
4
- // `navigation-api.ts`, `navigation-errors.ts`, `island-dispose.ts`, `island-mount.ts`,
5
- // `refresh-idle.ts`, the pure rules and `@ultimat3/core/page`, held by `client-bundle.test.ts`.
2
+ // may call, and nothing that drags the rest along.
3
+ //
4
+ // The `.` barrel bare-retains `errors.ts` (render's whole code table, registered at import, plus
5
+ // core's titles tables); this entry's graph is `navigation-api.ts`, `navigation-errors.ts`,
6
+ // `island-dispose.ts`, `island-mount.ts`, `refresh-idle.ts`, the pure rules and
7
+ // `@ultimat3/core/page`, held by `client-bundle.test.ts`.
6
8
  //
7
9
  // import { navigate, refresh, scheduleRefresh } from '@ultimat3/render/client';
8
10
  //
@@ -4,8 +4,13 @@
4
4
  * on every machine and the output diffs across deploys the way the HTML does.
5
5
  */
6
6
 
7
+ // why: Sass's `FileImporter` is synchronous and `Bun.file().exists()` is async (and files-only);
8
+ // Bun ships no path API.
7
9
  import { existsSync } from 'node:fs';
8
10
  import { basename, dirname, resolve } from 'node:path';
11
+ // why: `node:url` and not `Bun.fileURLToPath` ON PURPOSE — its browser polyfill exports neither
12
+ // name, so `bun build --target=browser` cannot link this file: `scripts/browser-barrel.test.ts`
13
+ // relies on that to prove the client barrel never reaches the build-time half.
9
14
  import { fileURLToPath, pathToFileURL } from 'node:url';
10
15
  import { renderThrowable } from '@ultimat3/core';
11
16
  import type * as Sass from 'sass';
package/src/duration.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  /**
2
- * The one reader of a TTL string. It sits below both `modes.ts` (which asks "is this a TTL at
3
- * all?" when it refuses an `isr` route with no regeneration trigger) and `render-isr.ts` (which
4
- * asks "how many ms?"), because a second answer is what let `revalidate: { ttl: '5 minutes' }`
5
- * pass registration and then parse to `null` — a page generated once and served for the life of
6
- * the process while the CDN was told `s-maxage=60`.
2
+ * The one reader of a TTL string.
3
+ *
4
+ * It sits below both `modes.ts` (which asks "is this a TTL at all?" when it refuses an `isr` route
5
+ * with no regeneration trigger) and `render-isr.ts` (which asks "how many ms?"), because a second
6
+ * answer is what let `revalidate: { ttl: '5 minutes' }` pass registration and then parse to `null`
7
+ * — a page generated once and served for the life of the process while the CDN was told
8
+ * `s-maxage=60`.
7
9
  */
8
10
 
9
11
  /** A `Map`, never an object literal: a unit is read by a string key, and a `Map` has no prototype chain to answer for it. */
@@ -1,9 +1,11 @@
1
1
  // Single responsibility: the one screen a `RenderResult.status` passes before it reaches
2
2
  // `new Response(body, { status })`, which answers a bare `RangeError` — no code, no fix, no
3
- // `--json` — for anything outside the range it accepts. Its own module because two render modes
4
- // take a status from their caller and a second copy of the rule is how the two drift apart.
5
- // Named for `finiteOption`, and the name is load-bearing: `bun run finite-bounds` recognises a
6
- // repair by the shape of the CALL, so a screen spelled `renderStatus` reads as no screen at all.
3
+ // `--json` — for anything outside the range it accepts.
4
+ //
5
+ // Its own module because two render modes take a status from their caller and a second copy of the
6
+ // rule is how the two drift apart. Named for `finiteOption`, and the name is load-bearing:
7
+ // `bun run finite-bounds` recognises a repair by the shape of the CALL, so a screen spelled `renderStatus`
8
+ // reads as no screen at all.
7
9
 
8
10
  import { assert, finiteCount } from '@ultimat3/core';
9
11
 
package/src/head-seo.ts CHANGED
@@ -8,12 +8,15 @@ import { renderMeta } from '@ultimat3/seo';
8
8
  import type { HeadRenderers, HeadTag } from './head';
9
9
 
10
10
  /** Attributes that identify a tag for dedupe, read in this order. */
11
- const IDENTITY: Readonly<Record<SeoHeadTag['tag'], readonly string[]>> = {
12
- title: [],
13
- meta: ['name', 'property', 'http-equiv', 'charset', 'media'],
14
- link: ['rel', 'hreflang', 'sizes'],
15
- script: ['type'],
16
- };
11
+ const IDENTITY: Readonly<Record<SeoHeadTag['tag'], readonly string[]>> = Object.assign(
12
+ Object.create(null),
13
+ {
14
+ title: [],
15
+ meta: ['name', 'property', 'http-equiv', 'charset', 'media'],
16
+ link: ['rel', 'hreflang', 'sizes'],
17
+ script: ['type'],
18
+ } satisfies Readonly<Record<SeoHeadTag['tag'], readonly string[]>>,
19
+ );
17
20
 
18
21
  /**
19
22
  * Open Graph properties a document carries once PER VALUE. Keyed by property alone, the dedupe
package/src/hydrate.ts CHANGED
@@ -239,11 +239,14 @@ const RUNTIME_INTERACTION = `
239
239
  each('[data-x-hydrate="interaction"]',catchUp)
240
240
  `.trim();
241
241
 
242
- const RUNTIME_PARTS: Readonly<Record<Exclude<HydrateStrategy, 'never'>, string>> = {
243
- idle: RUNTIME_IDLE,
244
- visible: RUNTIME_VISIBLE,
245
- interaction: RUNTIME_INTERACTION,
246
- };
242
+ const RUNTIME_PARTS: Readonly<Record<Exclude<HydrateStrategy, 'never'>, string>> = Object.assign(
243
+ Object.create(null),
244
+ {
245
+ idle: RUNTIME_IDLE,
246
+ visible: RUNTIME_VISIBLE,
247
+ interaction: RUNTIME_INTERACTION,
248
+ } satisfies Readonly<Record<Exclude<HydrateStrategy, 'never'>, string>>,
249
+ );
247
250
 
248
251
  /**
249
252
  * Emission order, and the order the subsets below are enumerated in. Derived from core's one
@@ -1,8 +1,10 @@
1
- // A HELD island (#506): server markup that must not paint before the island mounts, because what
2
- // it shows can be older than what the page will show — an offline reload's cached count, under a
3
- // queued write the mount rebuilds. Hidden from its first byte, booted at once, revealed when the
4
- // mount settles or at the cap. Who is held is the renderer's caller's call (`hold` on the collector):
5
- // only an island with page state to restore — server markup nothing will contradict is never hidden.
1
+ // A HELD island (#506): server markup that must not paint before the island mounts, because what it
2
+ // shows can be older than what the page will show — an offline reload's cached count, under a
3
+ // queued write the mount rebuilds.
4
+ //
5
+ // Hidden from its first byte, booted at once, revealed when the mount settles or at the cap. Who is
6
+ // held is the renderer's caller's call (`hold` on the collector): only an island with page state to
7
+ // restore — server markup nothing will contradict is never hidden.
6
8
 
7
9
  /** On a held island's wrapper until the runtime reveals it; what the runtime finds it by. */
8
10
  export const ISLAND_HOLD_ATTRIBUTE = 'data-x-hold';
package/src/islands.ts CHANGED
@@ -14,7 +14,11 @@
14
14
  * reached, through `registerRoute`, and it is what puts a number on a route that declares none.
15
15
  */
16
16
 
17
- const UNITS: Readonly<Record<string, number>> = { b: 1, kb: 1024, mb: 1024 * 1024 };
17
+ const UNITS: Readonly<Record<string, number>> = Object.assign(Object.create(null), {
18
+ b: 1,
19
+ kb: 1024,
20
+ mb: 1024 * 1024,
21
+ } satisfies Readonly<Record<string, number>>);
18
22
 
19
23
  /** `'40kb'` → 40960. Throws nothing: an unparseable budget is `null` and skipped. */
20
24
  export function parseByteBudget(budget: string | undefined): number | null {
package/src/modes.ts CHANGED
@@ -210,7 +210,9 @@ export function assertModeInvariants(config: RouteShape, ctx: ModeCheckContext):
210
210
  );
211
211
  }
212
212
 
213
- if (config.prerender !== undefined && !MODE_SPECS[config.render].prerenderable) {
213
+ const prerenderable =
214
+ Object.hasOwn(MODE_SPECS, config.render) && MODE_SPECS[config.render].prerenderable;
215
+ if (config.prerender !== undefined && !prerenderable) {
214
216
  throw new RouteModeInvalidError(
215
217
  `${ctx.file} declares prerender with render: '${config.render}', which is not prerenderable`,
216
218
  `remove prerender from ${ctx.file} or change render to 'static' | 'isr'`,
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * Navigating from code: the client router's public face for an island or an app script —
3
- * `navigate`, `refresh`, `openModal`, `closeModal`. Each goes through the router when the page
4
- * carries one (`window.__xNavigation`, started by `@ultimat3/render/navigation`), and falls back to
5
- * what the browser does without it — so the same call is right on a `site/` page, a
6
- * `navigation: 'document'` page, or with the router's script blocked. Imports the router's TYPE
7
- * only: an island that navigates never ships the router.
3
+ * `navigate`, `refresh`, `openModal`, `closeModal`.
4
+ *
5
+ * Each goes through the router when the page carries one (`window.__xNavigation`, started by
6
+ * `@ultimat3/render/navigation`), and falls back to what the browser does without it — so the same
7
+ * call is right on a `site/` page, a `navigation: 'document'` page, or with the router's script
8
+ * blocked. Imports the router's TYPE only: an island that navigates never ships the router.
8
9
  */
9
10
 
10
11
  import type { NavigationRouter } from './navigation';
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * The one refusal a BROWSER can reach in this package — `openModal`'s — apart from `errors.ts` for
3
3
  * bytes: that module registers render's whole code table at import, and an island that calls
4
- * `openModal` must not carry it. `errors.ts` re-exports this class, so it is ONE class wherever it is
5
- * imported from and `instanceof` agrees across both entries. Without the table loaded, core titles
6
- * the code from its name; the code, cause and fix are the same either way. Runs nothing at import.
4
+ * `openModal` must not carry it.
5
+ *
6
+ * `errors.ts` re-exports this class, so it is ONE class wherever it is imported from and
7
+ * `instanceof` agrees across both entries. Without the table loaded, core titles the code from its
8
+ * name; the code, cause and fix are the same either way. Runs nothing at import.
7
9
  */
8
10
 
9
11
  import { UltimateError } from '@ultimat3/core/page';
@@ -1,9 +1,11 @@
1
1
  /**
2
- * The client router's one request: the headers the server's navigation gate reads (purpose, the
3
- * document's `<app>:<surface>`, its principal, its build on a GET), `redirect: 'manual'` so no
4
- * redirect is followed behind the router's back, `cache: 'no-cache'` so the browser's HTTP cache
5
- * never answers, and the answer read ONCE into an `Answer` — the page's text, or a non-page's
6
- * bytes to hand over (a prefetch's are dropped unread).
2
+ * The client router's one request: the headers the server's navigation gate reads, a redirect never
3
+ * followed, the HTTP cache never asked, and the answer read ONCE into an `Answer`.
4
+ *
5
+ * The headers: purpose, the document's `<app>:<surface>`, its principal, its build on a GET.
6
+ * `redirect: 'manual'` so no redirect is followed behind the router's back; `cache: 'no-cache'` so
7
+ * the browser's HTTP cache never answers. The `Answer` is the page's text, or a non-page's bytes to
8
+ * hand over (a prefetch's are dropped unread).
7
9
  */
8
10
 
9
11
  import {
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * The route-presented modal: ONE native `<dialog>` over the page on screen, holding the `<main>` of
3
- * a page whose route declared `navigation: 'modal'`. The page beneath is never touched — its
4
- * islands, socket and state stay live, out of reach behind the top layer — and the modal is
5
- * addressed by the URL's hash (`/runs#/runs/new`), so a reload, Back/Forward and a pasted link
6
- * reopen it. A route the document names a modal (`NAVIGATION_MODALS_META`) opens on the click, as a
7
- * busy frame the answer fills. `navigation.ts` decides WHEN (`navigation-modal-rules.ts`); this
8
- * file only shows and hides, and `navigation-modal-frame.ts` is the dialog's DOM.
3
+ * a page whose route declared `navigation: 'modal'`.
4
+ *
5
+ * The page beneath is never touched — its islands, socket and state stay live, out of reach behind
6
+ * the top layer — and the modal is addressed by the URL's hash (`/runs#/runs/new`), so a reload,
7
+ * Back/Forward and a pasted link reopen it. A route the document names a modal
8
+ * (`NAVIGATION_MODALS_META`) opens on the click, as a busy frame the answer fills. `navigation.ts`
9
+ * decides WHEN (`navigation-modal-rules.ts`); this file only shows and hides, and
10
+ * `navigation-modal-frame.ts` is the dialog's DOM.
9
11
  */
10
12
 
11
13
  import { disposeIslands } from './island-dispose';
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Which clicks and submits the client router takes, and which it leaves to the browser — as pure
3
3
  * functions over plain facts, so every rule is testable without a DOM and the router
4
- * (`navigation.ts`) only gathers the facts. Also the one declaration of every attribute and event
5
- * name the router shares with the documents the server renders and the apps that listen; the
6
- * router's headers are core's (`CLIENT_NAVIGATION_*_HEADER`), imported where they are sent.
4
+ * (`navigation.ts`) only gathers the facts.
5
+ *
6
+ * Also the one declaration of every attribute and event name the router shares with the documents
7
+ * the server renders and the apps that listen; the router's headers are core's
8
+ * (`CLIENT_NAVIGATION_*_HEADER`), imported where they are sent.
7
9
  */
8
10
 
9
11
  /**
package/src/navigation.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * The client router: soft navigation over server-rendered documents. A same-surface link or form
3
3
  * fetches the next document the server renders anyway (its own mode, its own policy, its own cache
4
4
  * headers) and swaps it in, so the tab keeps its islands, its socket and its state between pages.
5
+ *
5
6
  * NOT a render mode — every page is still rendered by its route; without this script, or with
6
7
  * `data-x-reload`, the same markup is an ordinary full-page web app.
7
8
  *
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * The invariants of `revalidate`'s keys beyond "it has a trigger": `onInvalidate`, `maxStale` and
3
- * `query`, checked where `modes.ts` checks the trigger, and `tags` as purge keys, checked where
4
- * the registry knows the file. Each is a declaration the ISR controller acts on per request, so
5
- * one it cannot act on is refused up front, with the edit, rather than read as its permissive
6
- * default for the life of the process.
3
+ * `query`, checked where `modes.ts` checks the trigger, and `tags` as purge keys, checked where the
4
+ * registry knows the file.
5
+ *
6
+ * Each is a declaration the ISR controller acts on per request, so one it cannot act on is refused
7
+ * up front, with the edit, rather than read as its permissive default for the life of the process.
7
8
  */
8
9
 
9
10
  import type { CacheTag } from '@ultimat3/cache';
package/src/route-path.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // refused with the exact move that makes the file a route. Split out of `registry.ts`, which keeps
3
3
  // the table itself.
4
4
 
5
+ import { trimTrailingSlashes } from '@ultimat3/core/page';
5
6
  import { RouteFileInvalidError, SurfaceBoundaryError } from './errors';
6
7
  import type { RouteSurface, Surface } from './surfaces';
7
8
  import { locateSurface } from './surfaces';
@@ -57,7 +58,7 @@ export function routePathFromFile(file: string): { surface: RouteSurface; path:
57
58
  .filter((s) => !(s.startsWith('(') && s.endsWith(')')))
58
59
  .map(toUrlSegment);
59
60
 
60
- const path = `/${urlSegments.join('/')}`.replace(/\/+$/, '') || '/';
61
+ const path = trimTrailingSlashes(`/${urlSegments.join('/')}`) || '/';
61
62
  return { surface, path };
62
63
  }
63
64
 
@@ -99,7 +100,10 @@ function assertRouteFilename(
99
100
  surface: RouteSurface,
100
101
  basename: string | undefined,
101
102
  ): void {
102
- const expected = ROUTE_FILENAME[surface];
103
+ // Own keys only: an `Object.prototype` member is never the filename a surface accepts.
104
+ const expected = Object.hasOwn(ROUTE_FILENAME, surface)
105
+ ? ROUTE_FILENAME[surface]
106
+ : ROUTE_FILENAME.site;
103
107
  if (basename === expected) return;
104
108
 
105
109
  // The directory the author meant is the file's own path minus its extension: `site/pricing.tsx`
@@ -4,6 +4,7 @@
4
4
 
5
5
  // why: Bun ships no path API, and a relative root must be resolved against the working directory.
6
6
  import { posix, resolve } from 'node:path';
7
+ import { trimTrailingSlashes } from '@ultimat3/core/page';
7
8
 
8
9
  /** POSIX-absolute (`/srv/app`), drive-absolute (`D:\app`, `d:/app`) or UNC (`\\host\share`). */
9
10
  const ABSOLUTE = /^(?:[A-Za-z]:)?[\\/]/;
@@ -18,7 +19,7 @@ export function comparablePath(path: string): string {
18
19
  const slashed = posix.normalize(absolute.replaceAll('\\', '/'));
19
20
  const drive = slashed.replace(/^([a-z]):/, (_, letter: string) => `${letter.toUpperCase()}:`);
20
21
  // A trailing separator is dropped so `${dir}/` is one prefix — except the filesystem root itself.
21
- const trimmed = drive.replace(/\/+$/, '');
22
+ const trimmed = trimTrailingSlashes(drive);
22
23
  return trimmed === '' || trimmed.endsWith(':') ? `${trimmed}/` : trimmed;
23
24
  }
24
25
 
package/src/surfaces.ts CHANGED
@@ -5,7 +5,12 @@
5
5
  * aspirational. Violations are build errors, resolved through the whole chain.
6
6
  */
7
7
 
8
- import type { RenderMode, Surface } from '@ultimat3/core';
8
+ import {
9
+ type RenderMode,
10
+ renderFixShellArg,
11
+ type Surface,
12
+ trimTrailingSlashes,
13
+ } from '@ultimat3/core';
9
14
  import { byCodeUnit } from './code-unit-order';
10
15
  import { SurfaceBoundaryError } from './errors';
11
16
 
@@ -127,7 +132,7 @@ export function surfaceOf(file: string): Surface | null {
127
132
  * which both graphs carry.
128
133
  */
129
134
  export function surfaceUnder(root: string, file: string): Surface | null {
130
- const base = normalize(root).replace(/\/+$/, '');
135
+ const base = trimTrailingSlashes(normalize(root));
131
136
  const path = normalize(file);
132
137
  const relative = path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;
133
138
  if (/(?:^|\/)node_modules\//.test(relative)) return null;
@@ -276,13 +281,15 @@ function classify(i: ClassifyInput): BoundaryViolation | null {
276
281
  ...base,
277
282
  rule: 'site-imports-app',
278
283
  cause: chainText,
279
- fix: `x fix boundary ${i.entry} (or move ${i.imported} out of the shared graph)`,
284
+ fix: `x fix boundary ${renderFixShellArg(i.entry, '<entry file>')} (or move ${i.imported} out of the shared graph)`,
280
285
  };
281
286
  }
282
287
  const from = i.importerSurface;
283
288
  const to = i.importedSurface;
284
289
  if (from === null || to === null || from === to) return null;
285
- const spec = SURFACE_SPECS[from];
290
+ // Own keys only: a surface that is not one has no rule, and a prototype member is not a rule.
291
+ const spec = Object.hasOwn(SURFACE_SPECS, from) ? SURFACE_SPECS[from] : undefined;
292
+ if (spec === undefined) return null;
286
293
  if (spec.mayImport.includes(to)) return null;
287
294
  if (i.typeOnly && spec.mayImportTypes.includes(to)) return null;
288
295
  // Reported above, from the site entry that reaches it — one crossing, one finding.
@@ -324,5 +331,7 @@ export function assertSurfaceBoundary(graph: ImportGraph): void {
324
331
  }
325
332
 
326
333
  export function surfaceAllows(surface: Surface, mode: RenderMode): boolean {
327
- return SURFACE_SPECS[surface].allowedModes.includes(mode);
334
+ return (
335
+ Object.hasOwn(SURFACE_SPECS, surface) && SURFACE_SPECS[surface].allowedModes.includes(mode)
336
+ );
328
337
  }