@ksp-gonogo/uplink-tools 1.0.0-rc.47 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PAGE_WRITE_ENV
3
- } from "./chunk-DQATZYFD.js";
3
+ } from "./chunk-EBBMJNMG.js";
4
4
  import {
5
5
  CheckUnableError,
6
6
  createClientProgram,
@@ -661,7 +661,7 @@ var PROBES = [
661
661
  {
662
662
  group: MINSIZE_GROUP,
663
663
  // Imported when asked for: it loads the render harness.
664
- run: async (dir) => (await import("./minsize-HZ3GKMFO.js")).checkMinSize(dir)
664
+ run: async (dir) => (await import("./minsize-KU6NBZ4V.js")).checkMinSize(dir)
665
665
  }
666
666
  ];
667
667
  var PROBE_GROUPS = PROBES.map((p) => p.group);
@@ -10807,7 +10807,7 @@ async function run(argv) {
10807
10807
  return await command(argv.slice(1));
10808
10808
  }
10809
10809
  if (verb === "story") {
10810
- const { storyCommand } = await import("./story-2ITDTL5S.js");
10810
+ const { storyCommand } = await import("./story-OTUTTZGI.js");
10811
10811
  await storyCommand(argv.slice(1));
10812
10812
  return 0;
10813
10813
  }
@@ -10816,7 +10816,7 @@ async function run(argv) {
10816
10816
  console.log(usageOf(verb));
10817
10817
  return 0;
10818
10818
  }
10819
- const { renderOrDocs } = await import("./cli-OPH57363.js").catch(
10819
+ const { renderOrDocs } = await import("./cli-FAY33Q5H.js").catch(
10820
10820
  (err) => {
10821
10821
  if (typeof err === "object" && err !== null && Reflect.get(err, "code") === "ERR_MODULE_NOT_FOUND") {
10822
10822
  throw new Error(
@@ -10843,4 +10843,4 @@ ${err instanceof Error ? err.message : String(err)}`);
10843
10843
  export {
10844
10844
  run
10845
10845
  };
10846
- //# sourceMappingURL=chunk-CJNDFCUZ.js.map
10846
+ //# sourceMappingURL=chunk-DSA2DIHM.js.map
@@ -4,4 +4,4 @@ var PAGE_WRITE_ENV = "GONOGO_UPLINK_PAGE_WRITE";
4
4
  export {
5
5
  PAGE_WRITE_ENV
6
6
  };
7
- //# sourceMappingURL=chunk-DQATZYFD.js.map
7
+ //# sourceMappingURL=chunk-EBBMJNMG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/page-write-env.ts"],"sourcesContent":["/**\n * The environment variable that makes the page check write the page instead of\n * comparing it. `uplink-tools page` sets it to `1` for the one test run in\n * which it writes. Useful for letting a scaffold\n * made inside CI write its first page. Read by the page check in\n * `page-check.ts`.\n *\n * Unlike the update switch a person sets by hand, which is refused under CI,\n * this one is honoured on any machine.\n */\nexport const PAGE_WRITE_ENV = \"GONOGO_UPLINK_PAGE_WRITE\";\n"],"mappings":";AAUO,IAAM,iBAAiB;","names":[]}
@@ -7,7 +7,7 @@ import {
7
7
  jetbrainsMonoFace,
8
8
  payloadFor,
9
9
  themeTokensCss
10
- } from "./chunk-I2U7BD63.js";
10
+ } from "./chunk-VDIP7LC6.js";
11
11
 
12
12
  // ../../node_modules/.pnpm/gifenc@1.0.3/node_modules/gifenc/dist/gifenc.esm.js
13
13
  var X = { signature: "GIF", version: "89a", trailer: 59, extensionIntroducer: 33, applicationExtensionLabel: 255, graphicControlExtensionLabel: 249, imageSeparator: 44, signatureSize: 3, versionSize: 3, globalColorTableFlagMask: 128, colorResolutionMask: 112, sortFlagMask: 8, globalColorTableSizeMask: 7, applicationIdentifierSize: 8, applicationAuthCodeSize: 3, disposalMethodMask: 28, userInputFlagMask: 2, transparentColorFlagMask: 1, localColorTableFlagMask: 128, interlaceFlagMask: 64, idSortFlagMask: 32, localColorTableSizeMask: 7 };
@@ -1713,4 +1713,4 @@ export {
1713
1713
  readUplinkScenes,
1714
1714
  renderUplink
1715
1715
  };
1716
- //# sourceMappingURL=chunk-TQLCAGYP.js.map
1716
+ //# sourceMappingURL=chunk-IXUPEUNQ.js.map
@@ -640,4 +640,4 @@ export {
640
640
  buildScenes,
641
641
  assertEveryWidgetCovered
642
642
  };
643
- //# sourceMappingURL=chunk-I2U7BD63.js.map
643
+ //# sourceMappingURL=chunk-VDIP7LC6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/render/context.ts","../src/render/probe-global.ts","../src/render/sceneModel.ts","../src/render/scenes.ts"],"sourcesContent":["import { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\n/**\n * Where the tool is running and what it found there. Everything resolved once,\n * so no other module reaches for a path.\n *\n * Every lookup here goes through a published specifier or the invoking package's\n * own tree. The four hand-copied harnesses this replaces did not: two drivers\n * read `../../../../packages/theme/src/tokens.css` and\n * `../../../../packages/app/src/styles/global.css`, neither of which exists\n * outside this repository, and one of those files had stopped carrying a `:root`\n * block at all so the render threw. A repo-relative path is not an import, so the\n * isolation ratchet could never see either of them: having one harness rather\n * than nine is the fix, and resolving through published subpaths is what makes\n * the one harness runnable by someone else.\n */\n\nconst require = createRequire(import.meta.url);\nconst HERE = dirname(fileURLToPath(import.meta.url));\n\n/**\n * An Uplink client package: its directory, name, version, entry, render setup\n * and fixtures. Useful for telling the renderer and the page check what to\n * mount and where its fixtures are. Returned by {@link resolveUplinkPackage}\n * and taken by the render driver.\n *\n * @category Rendering scenes\n */\nexport interface UplinkPackage {\n /** The directory the tool was invoked in. Holds `package.json`. */\n dir: string;\n /** The package's name. */\n name: string;\n /** The package's version. */\n version: string;\n /** The client entry esbuild bundles: `--entry`, else `src/index.ts`, `src/index.tsx`, then `package.json`'s `main`. */\n entry: string;\n /** `gonogo-render.setup.ts`, when the author wrote one. */\n setup?: string;\n /** Fixture files, sorted, `<dir>/src/**\\/__fixtures__/*.json`. */\n fixtures: string[];\n /** The `package.json` `gonogo.renderWith` entries, resolved: a relative path made absolute, a package specifier kept as written. */\n renderWith: string[];\n}\n\n/**\n * A JSON file's top-level object, or an error naming the file and what it held\n * instead. Every caller narrows the fields it reads off the result. Useful for\n * telling the author which file is malformed. Used when reading an Uplink's\n * `package.json` and its scene fixtures.\n */\nexport function readJsonObject(file: string): Record<string, unknown> {\n const parsed: unknown = JSON.parse(readFileSync(file, \"utf8\"));\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new Error(`uplink-tools: ${file} does not hold a JSON object.`);\n }\n return parsed as Record<string, unknown>;\n}\n\nfunction exists(file: string): boolean {\n try {\n statSync(file);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The module esbuild bundles to make the Uplink's registrations happen.\n *\n * Source first, `main` second. An author iterating wants the file they are\n * editing, and a built `dist/index.js` renders whatever the last build contained,\n * which is a screenshot of a stale widget with nothing to say it is stale.\n */\nfunction resolveEntry(dir: string, pkg: { main?: string }, override?: string) {\n if (override) return resolve(dir, override);\n for (const candidate of [\"src/index.ts\", \"src/index.tsx\"]) {\n const full = join(dir, candidate);\n if (exists(full)) return full;\n }\n if (pkg.main) {\n const full = resolve(dir, pkg.main);\n if (exists(full)) return full;\n }\n throw new Error(\n `uplink-tools: cannot find this Uplink client's entry module in ${dir}. ` +\n 'Looked for src/index.ts, src/index.tsx, then package.json \"main\". ' +\n \"Name it with --entry <path>.\",\n );\n}\n\nfunction findFixtures(root: string): string[] {\n const out: string[] = [];\n const walk = (dir: string) => {\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n for (const entry of entries) {\n if (entry === \"node_modules\" || entry === \"dist\") continue;\n const full = join(dir, entry);\n if (statSync(full).isDirectory()) {\n walk(full);\n continue;\n }\n if (entry.endsWith(\".json\") && dirname(full).endsWith(\"__fixtures__\")) {\n out.push(full);\n }\n }\n };\n walk(join(root, \"src\"));\n return out.sort();\n}\n\n/**\n * Extra modules whose registrations belong in the page, declared once.\n *\n * A scene naming `_scene.hostWidget` needs that host widget in the bundle, and a\n * host widget ships with the app, in a package no Uplink may import. `--with`\n * can name one per run, but a render that only works when someone remembers a\n * flag is a render nobody runs: the first Uplink to use `_scene.hostWidget` shipped a\n * plain `uplink-tools render` script beside a fixture naming a host, which\n * cannot succeed. So the modules are a fact about the package, beside\n * `minAppVersion` in the same `gonogo` block:\n *\n * \"gonogo\": { \"renderWith\": [\"../../../packages/components/src/index.ts\"] }\n * \"gonogo\": { \"renderWith\": [\"@ksp-gonogo/uplink-tools/widgets\"] }\n *\n * An entry is either a path relative to the client directory, or a bare module\n * specifier. The two are the same registrations reached two ways, and which one\n * an Uplink writes is decided by where it lives rather than by preference: a\n * path only exists inside this repository, so an Uplink here names one; an\n * Uplink that has left names `@ksp-gonogo/uplink-tools/widgets`, the package that\n * carries the app's widgets prebuilt for exactly this.\n *\n * A specifier was once refused, on the ground that reaching a host would\n * mean a dependency the isolation rules forbid. That was true while the only\n * module was `packages/components`, which is `private: true` and unpublished.\n * It stopped being true when `@ksp-gonogo/uplink-tools/widgets` shipped: a published\n * package, named in devDependencies rather than dependencies, imported from no\n * source file. `uplink-isolation.test.ts` is what holds that line now, which is\n * a check rather than the absence of a feature.\n */\nfunction resolveRenderWith(dir: string, gonogo: unknown): string[] {\n const declared =\n typeof gonogo === \"object\" && gonogo !== null && \"renderWith\" in gonogo\n ? gonogo.renderWith\n : undefined;\n if (declared === undefined) return [];\n if (!Array.isArray(declared)) {\n throw new Error(\n `uplink-tools: \"gonogo.renderWith\" in ${join(dir, \"package.json\")} must ` +\n `be an array of module paths or specifiers, got ${typeof declared}.`,\n );\n }\n return declared.map((entry) => {\n if (typeof entry !== \"string\") {\n throw new Error(\n `uplink-tools: every \"gonogo.renderWith\" entry must be a path or a ` +\n `specifier string, got ${JSON.stringify(entry)}.`,\n );\n }\n return resolveRenderModule(dir, '\"gonogo.renderWith\"', entry);\n });\n}\n\n/** A specifier is anything that is not a relative or absolute path. */\nfunction isBareSpecifier(entry: string): boolean {\n return !entry.startsWith(\".\") && !entry.startsWith(\"/\");\n}\n\n/** Every `node_modules` from `dir` up to the filesystem root, nearest first. */\nfunction nodeModulesChain(dir: string): string[] {\n const chain: string[] = [];\n let at = resolve(dir);\n for (;;) {\n chain.push(join(at, \"node_modules\"));\n const up = dirname(at);\n if (up === at) return chain;\n at = up;\n }\n}\n\n/**\n * The package name at the head of a specifier, subpath dropped.\n *\n * `@ksp-gonogo/uplink-tools/render-probe` is the package `@ksp-gonogo/uplink-tools`: a\n * scope carries a slash of its own, so the split is at the second slash when\n * the name is scoped and at the first when it is not.\n */\nfunction packageNameOf(specifier: string): string {\n const parts = specifier.split(\"/\");\n return specifier.startsWith(\"@\") ? parts.slice(0, 2).join(\"/\") : parts[0];\n}\n\n/**\n * One `renderWith` entry or one `--with` value, as esbuild should receive it.\n * Useful for naming the declaration when a host widget module is not\n * installed. Used for the `gonogo.renderWith` entries of an Uplink package and\n * for the `--with` flag of the `render` and `docs` commands.\n *\n * A bare specifier is returned as written, for esbuild to resolve from the\n * client's own directory when it builds the page, after a check that the\n * package is installed. A relative entry is returned as an absolute path.\n */\nexport function resolveRenderModule(\n dir: string,\n where: string,\n entry: string,\n): string {\n if (!isBareSpecifier(entry)) {\n const full = resolve(dir, entry);\n if (!exists(full)) {\n throw new Error(\n `uplink-tools: ${where} names \"${entry}\", which resolves to ${full} ` +\n \"and does not exist. An entry starting with . or / is a path \" +\n \"relative to the client package; drop the leading dots to name an \" +\n \"installed package instead.\",\n );\n }\n return full;\n }\n // `node_modules` walked up from the client directory, and NOTHING else. It is\n // the one layout pnpm's symlink farm and npm's flat tree agree on, and it is\n // what esbuild will do when it resolves this for real.\n //\n // `require.resolve.paths` is the obvious way to get that chain and is WRONG\n // here, measured rather than reasoned: it appends `NODE_PATH`, and vitest\n // sets `NODE_PATH` to pnpm's private `node_modules/.pnpm/node_modules`. Every\n // package in the monorepo is present there, so the check answered \"installed\"\n // for a package the Uplink had never declared, the same hoisting that\n // `uplink-isolation.test.ts` exists to stop anyone relying on. A check that\n // passes because of the store it happens to be run beside is not a check.\n const pkg = packageNameOf(entry);\n if (!nodeModulesChain(dir).some((root) => exists(join(root, pkg)))) {\n throw new Error(\n `uplink-tools: ${where} names \"${entry}\", and \"${pkg}\" is not ` +\n `installed under ${dir}. Add it to devDependencies: it is a render-` +\n \"time module, not something the Uplink imports. For the app's own \" +\n 'widgets that package is \"@ksp-gonogo/uplink-tools/widgets\".',\n );\n }\n return entry;\n}\n\n/**\n * Reads the Uplink client package in `dir`: its name, version, entry, render\n * setup and fixtures. Throws with a message saying what to fix when the package\n * is not one. Useful for finding what to render without the author listing it.\n * Used by the `render` and `docs` commands and by the page check.\n *\n * @category Rendering scenes\n */\nexport function resolveUplinkPackage(\n dir: string,\n opts: { entry?: string } = {},\n): UplinkPackage {\n const manifestPath = join(dir, \"package.json\");\n if (!exists(manifestPath)) {\n throw new Error(\n `uplink-tools: no package.json in ${dir}. Run it from your Uplink ` +\n \"client package directory, or pass --root <dir>.\",\n );\n }\n const pkg = readJsonObject(manifestPath);\n const { name, version, main } = pkg;\n if (typeof name !== \"string\" || typeof version !== \"string\") {\n throw new Error(\n `uplink-tools: ${manifestPath} needs a string \"name\" and \"version\".`,\n );\n }\n const setup = [\"gonogo-render.setup.ts\", \"gonogo-render.setup.tsx\"]\n .map((f) => join(dir, f))\n .find(exists);\n return {\n dir,\n name,\n version,\n entry: resolveEntry(\n dir,\n { main: typeof main === \"string\" ? main : undefined },\n opts.entry,\n ),\n setup,\n fixtures: findFixtures(dir),\n renderWith: resolveRenderWith(dir, pkg.gonogo),\n };\n}\n\n/**\n * The installed ui-kit's `tokens.css`, whole: the design tokens plus the\n * box-sizing reset and form-control styles the kit's components are drawn\n * against, as the app loads them. Useful for drawing a widget in the same theme\n * the operator sees. Used by the page the renderer builds for each Uplink.\n *\n * @category Rendering scenes\n */\nexport function themeTokensCss(): string {\n const candidates = [\n () => require.resolve(\"@ksp-gonogo/ui-kit/tokens.css\"),\n () => join(HERE, \"tokens.css\"),\n () => join(HERE, \"..\", \"tokens.css\"),\n ];\n const tried: string[] = [];\n for (const candidate of candidates) {\n let file: string;\n try {\n file = candidate();\n } catch {\n continue;\n }\n tried.push(file);\n if (!exists(file)) continue;\n const css = readFileSync(file, \"utf8\");\n if (!/:root\\s*\\{/.test(css)) {\n throw new Error(\n `uplink-tools: ${file} carries no \":root\" block, so a render would ` +\n \"have no colours. The kit publishes its tokens from \" +\n \"@ksp-gonogo/ui-kit/tokens.css; a file with no :root block is the \" +\n \"wrong file.\",\n );\n }\n return css;\n }\n throw new Error(\n \"uplink-tools: cannot resolve @ksp-gonogo/ui-kit/tokens.css. Tried:\\n \" +\n `${tried.join(\"\\n \") || \"(nothing resolved)\"}\\n` +\n \"The kit copies it into its own dist during build, so an in-repo run \" +\n \"needs `pnpm --filter @ksp-gonogo/ui-kit build` first.\",\n );\n}\n\n/**\n * Which font a render used: `locked` is JetBrains Mono, the app's own font;\n * `fallback` is the machine's own monospace. Useful for telling the author\n * whether a picture can be compared pixel for pixel. Carried by\n * {@link FontFace}.\n *\n * @category Rendering scenes\n */\nexport type FontMode = \"locked\" | \"fallback\";\n\n/**\n * The font a render uses, as CSS to inject into the page, with the\n * {@link FontMode} it is in. Useful for drawing pictures in the app's font.\n * Returned by {@link jetbrainsMonoFace} and injected into the page the renderer\n * builds for each Uplink.\n *\n * @category Rendering scenes\n */\nexport interface FontFace {\n /** Which font this is. */\n mode: FontMode;\n /** The `@font-face` rules to inject into the render page. */\n css: string;\n /** Set when the locked font is unavailable, ready to print. */\n advice?: string;\n}\n\n/**\n * The JetBrains Mono weights the app self-hosts. Each names an @fontsource\n * `<weight>.css`, which declares one face per subset with that subset's\n * `unicode-range`, so Greek, Cyrillic and Latin Extended text is drawn in the\n * locked font. Useful for drawing pictures with every weight the app uses.\n * Used by {@link jetbrainsMonoFace}.\n */\nexport const JETBRAINS_MONO_WEIGHTS = [400, 600, 700] as const;\n\n/**\n * JetBrains Mono, the app's font, inlined as data URIs. It is an optional peer:\n * without it the result is `mode: \"fallback\"` with `advice` saying what to\n * install, and renders use the machine's own monospace, which suits a docs\n * picture and not a pixel comparison. Useful for drawing pictures in the font\n * the operator sees. Used by the page the renderer builds for each Uplink.\n *\n * @category Rendering scenes\n */\nexport function jetbrainsMonoFace(): FontFace {\n let sheets: { weight: number; css: string }[];\n try {\n sheets = JETBRAINS_MONO_WEIGHTS.map((weight) => ({\n weight,\n css: readFileSync(\n require.resolve(`@fontsource/jetbrains-mono/${weight}.css`),\n \"utf8\",\n ),\n }));\n } catch {\n return {\n mode: \"fallback\",\n css: \"\",\n advice:\n \"@fontsource/jetbrains-mono is not installed, so this render uses \" +\n \"the machine's fallback monospace font. Fine for a docs \" +\n \"screenshot, not comparable across machines. Install it with \" +\n \"`pnpm add -D @fontsource/jetbrains-mono`.\",\n };\n }\n const faces: string[] = [];\n for (const { weight, css } of sheets) {\n for (const [, block] of css.matchAll(/@font-face\\s*\\{([^}]*)\\}/g)) {\n const file = /url\\(\\.\\/files\\/([\\w.-]+\\.woff2)\\)/.exec(block)?.[1];\n if (!file) {\n throw new Error(\n `uplink-tools: an @font-face in @fontsource/jetbrains-mono/${weight}.css has no woff2 src`,\n );\n }\n const range = /unicode-range:\\s*([^;]+);/.exec(block)?.[1];\n const b64 = readFileSync(\n require.resolve(`@fontsource/jetbrains-mono/files/${file}`),\n ).toString(\"base64\");\n faces.push(\n `@font-face{font-family:\"JetBrains Mono\";font-weight:${weight};` +\n `font-style:normal;src:url(data:font/woff2;base64,${b64}) format(\"woff2\");` +\n `${range ? `unicode-range:${range.trim()};` : \"\"}}`,\n );\n }\n }\n return { mode: \"locked\", css: faces.join(\"\\n\") };\n}\n\n/**\n * A path as it should appear in a message: relative to the package, with\n * forward slashes. Useful for naming a file to the author the same way on every\n * machine. Used by the page check and the scene reader.\n *\n * @category Rendering scenes\n */\nexport function display(dir: string, file: string): string {\n return relative(dir, file).split(\"\\\\\").join(\"/\");\n}\n\n/**\n * A resolved `renderWith` value as a URL that `import()` can load. A relative\n * entry arrives as an absolute path; a bare specifier arrives as written and is\n * resolved from `dir`, the client, through the package's `exports` map. Useful\n * for letting a test import the host widget modules an Uplink declares, where\n * there is no bundler to resolve them. Used by {@link loadHostWidgets}.\n *\n * It resolves from `dir` and never from this module, and it reads the\n * `exports` map without `require.resolve`, because these packages publish an\n * `import`-only map that a CommonJS resolver refuses.\n */\nexport function renderModuleUrl(dir: string, entry: string): string {\n if (!isBareSpecifier(entry)) return pathToFileURL(entry).href;\n\n const pkg = packageNameOf(entry);\n const subpath = entry === pkg ? \".\" : `.${entry.slice(pkg.length)}`;\n for (const root of nodeModulesChain(dir)) {\n const pkgDir = join(root, pkg);\n const manifest = join(pkgDir, \"package.json\");\n if (!exists(manifest)) continue;\n const exported = readJsonObject(manifest);\n const file = exportedEntryPoint(exported.exports, subpath);\n if (!file) {\n throw new Error(\n `uplink-tools: ${pkg} at ${pkgDir} exports no \"${subpath}\", so ` +\n `\"${entry}\" cannot be loaded. Upgrade it:\\n npm i -D ${pkg}@latest`,\n );\n }\n return pathToFileURL(join(pkgDir, file)).href;\n }\n throw new Error(\n `uplink-tools: \"${entry}\" names \"${pkg}\", which is not installed under ` +\n `${dir}. Add it to devDependencies.`,\n );\n}\n\n/**\n * The file an `exports` map serves for `subpath`, reading the conditional form's\n * `import` then `default`, or `undefined` when the map does not serve it.\n */\nfunction exportedEntryPoint(\n exports: unknown,\n subpath: string,\n): string | undefined {\n if (typeof exports !== \"object\" || exports === null) return undefined;\n if (!(subpath in exports)) return undefined;\n const entryPoint: unknown = Reflect.get(exports, subpath);\n if (typeof entryPoint === \"string\") return entryPoint;\n if (typeof entryPoint !== \"object\" || entryPoint === null) return undefined;\n for (const condition of [\"import\", \"default\"]) {\n const value: unknown = Reflect.get(entryPoint, condition);\n if (typeof value === \"string\") return value;\n }\n return undefined;\n}\n","// Its own module, importing nothing: the Node half needs this value, and importing it from `../render-probe` would pull React and the sdk into the Node bundle.\n/**\n * The `window` key the render probe installs itself under (`__gonogoRenderProbe`).\n * Useful for a Node-side driver that needs to reach the probe's API inside the\n * rendered page. Used by the renderer behind `uplink-tools docs`.\n *\n * @category Rendering scenes\n */\nexport const RENDER_PROBE_GLOBAL = \"__gonogoRenderProbe\";\n\n/**\n * The attribute marking text the harness drew, not the subject.\n *\n * A stand-in host is a `Panel` with a title, and that title sits inside `#root`\n * like everything else, so every check that reads the page reads it too. The\n * attribute lets those checks skip it: without it, `paints: [\"FUEL\"]` matched\n * \"FUEL STATUS (stand-in host)\" while the augment drew nothing, and\n * `expectsEmpty` accepted the stand-in's own title as an empty state.\n */\nexport const PROBE_CHROME_ATTR = \"data-probe-chrome\";\n\n/**\n * The attribute on the box-less wrapper a highlighted augment renders inside,\n * which the probe's stylesheet outlines the children of. The wrapper is the\n * harness's own element, so the held comparison leaves it out of the subject's\n * render.\n */\nexport const SUPPLIED_ATTR = \"data-uplink-supplied\";\n\n/**\n * The contribution segments a stand-in host can actually draw, so a scene that\n * names one needs no `_scene.hostWidget`.\n *\n * `Panel` renders every host's `<id>.badges` aside itself, through\n * `renderWidget`'s `WidgetBadges`, so a badge lands in a stand-in exactly as it\n * lands in the real widget. Other segments are drawn by a widget's own body:\n * a hostless `vessel-schematic.part-meters` scene renders a blank frame, and `meters`\n * and `filters` are placed by the widget (a `<Meter>` per entry, `<FilterList>`),\n * not by the framework.\n */\nexport const HOST_DRAWN_CONTRIBUTION_SEGMENTS = [\"badges\"] as const;\n\n/**\n * The segments the framework aggregates for every widget on top of the slots it\n * declares, so a widget that places `<FilterList>` or draws the meters in its\n * body receives `<id>.filters` / `<id>.meters` contributions without listing\n * the slot. A scene naming such a host is buildable although the host's\n * `contributionSlots` does not carry the slot.\n *\n * A copy of the kit's `COMPONENT_SLOT_SEGMENTS`, for the reason given on\n * {@link HOST_DRAWN_CONTRIBUTION_SEGMENTS}; a test reads the kit's source and\n * fails if the two lists differ.\n */\nexport const FRAMEWORK_SLOT_SEGMENTS = [\"badges\", \"filters\", \"meters\"] as const;\n\n/**\n * The tag the probe appends to an element drawn as held (`data-held`)\n * that {@link announcesHeld} says is silent: a mark a reader can see and a\n * screen reader is told nothing about.\n */\nexport const UNANNOUNCED_MARK = \"(held, unannounced)\";\n\n/**\n * Whether an element drawn held says so to a screen reader: through a\n * `data-unit-currency` caption inside it, the way `Unit` does, through its\n * own accessible name, which the kit's instruments end with the caption and\n * stamp `data-currency-in-name`, or through the caption `ModelledAlongside`\n * draws beside the marked figure it wraps.\n */\nexport function announcesHeld(el: Element): boolean {\n return (\n el.hasAttribute(\"data-currency-in-name\") ||\n el.querySelector(\"[data-unit-currency]\") !== null ||\n el\n .closest(\"[data-modelled-alongside]\")\n ?.querySelector(\":scope > [data-unit-currency]\") != null\n );\n}\n\n/**\n * The subject's render as a list of elements, for the held comparison.\n *\n * Finer than the probe's size-outline signature on purpose. A widget that\n * says a figure is held often changes nothing a size outline can see: a colour, a\n * `data-held` attribute, a dimmed class. So every attribute is kept,\n * `class` included, which is stable here because one page renders every scene\n * and an identical style always hashes to the identical class.\n *\n * React ids are folded to one token rather than renumbered: the comparison\n * that reads these lines subtracts one render from another, and an id counter\n * that shifted because a guest mounted before an element would otherwise make\n * the host's own element look changed.\n *\n * A widget that strips the colons from a `useId`, as an SVG id and its\n * `url(#...)` need, leaves a bare `r` and counter. That form is folded too, but\n * only where an id is: as an `id`, an id reference, or inside `url(#...)`.\n *\n * A class token a library numbers per instance is folded when it is on\n * {@link INSTANCE_COUNTER_CLASSES}, and compared as written when it is not.\n *\n * A `data-held` element that does not {@link announcesHeld} is tagged\n * {@link UNANNOUNCED_MARK}: the dot is drawn, and nothing tells a screen reader\n * the figure is held.\n */\nexport function describeElements(host: HTMLElement): string[] {\n const lines: string[] = [];\n for (const el of Array.from(host.querySelectorAll(\"*\"))) {\n if (el.closest(`[${PROBE_CHROME_ATTR}]`)) continue;\n if (el.hasAttribute(SUPPLIED_ATTR)) continue;\n if (el.tagName === \"STYLE\" || el.tagName === \"SCRIPT\") continue;\n const attributes = Array.from(el.attributes)\n .map((a) => `${a.name}=\"${foldAttribute(a.name, a.value)}\"`)\n .sort();\n const own = Array.from(el.childNodes)\n .filter((n) => n.nodeType === Node.TEXT_NODE)\n .map((n) => n.textContent ?? \"\")\n .join(\"\")\n .replace(/\\s+/g, \" \")\n .trim();\n let line = `<${el.tagName.toLowerCase()} ${attributes.join(\" \")}> ${own}`;\n if (el.hasAttribute(\"data-held\") && !announcesHeld(el)) {\n line += ` ${UNANNOUNCED_MARK}`;\n }\n lines.push(line);\n }\n return lines;\n}\n\n/** A `useId` as React 18 and 19 mint it, colons or guillemets included. */\nconst REACT_ID = /:r[0-9a-z]+:|«r[0-9a-z]+»/g;\n\n/**\n * A `useId` with its colons stripped: `r` and a base-32 counter, standing as a\n * whole hyphen- or underscore-separated segment. It is also an ordinary word\n * (`r1`, `rad`), which is why it is only folded where an id is.\n */\nconst BARE_REACT_ID = /(^|[-_])r[0-9a-v]+(?=$|[-_])/g;\n\n/** Attributes whose whole value is an id or a list of ids. */\nconst ID_ATTRIBUTES = new Set([\n \"id\",\n \"for\",\n \"form\",\n \"list\",\n \"headers\",\n \"aria-activedescendant\",\n \"aria-controls\",\n \"aria-describedby\",\n \"aria-details\",\n \"aria-errormessage\",\n \"aria-flowto\",\n \"aria-labelledby\",\n \"aria-owns\",\n]);\n\nfunction foldBareId(id: string): string {\n return id.replace(BARE_REACT_ID, \"$1:r:\");\n}\n\nfunction foldReactIds(name: string, value: string): string {\n const folded = value\n .replace(REACT_ID, \":r:\")\n .replace(/url\\(#([^)]*)\\)/g, (_, id: string) => `url(#${foldBareId(id)})`);\n const fragment =\n (name === \"href\" || name === \"xlink:href\") && folded.startsWith(\"#\");\n if (!ID_ATTRIBUTES.has(name) && !fragment) return folded;\n return folded.replace(/[^\\s#]+/g, foldBareId);\n}\n\n/**\n * Class tokens a third-party library numbers from a module-level counter, so\n * two mounts of one state carry different ones. Each names its library. A\n * numbered token not listed here is a difference like any other.\n */\nconst INSTANCE_COUNTER_CLASSES: readonly { library: string; token: RegExp }[] =\n [\n {\n library: \"xterm.js DomRenderer\",\n token: /^(xterm-dom-renderer-owner-)\\d+$/,\n },\n ];\n\nfunction foldAttribute(name: string, value: string): string {\n if (name !== \"class\") return foldReactIds(name, value);\n const tokens = value.split(/\\s+/).map((token) => {\n const known = INSTANCE_COUNTER_CLASSES.find((c) => c.token.test(token));\n return known ? token.replace(known.token, \"$1<n>\") : token;\n });\n return foldReactIds(name, tokens.join(\" \"));\n}\n","import { gridToPixels } from \"@ksp-gonogo/ui-kit/grid\";\nimport type {\n InventoryMode,\n SceneEmit,\n ScenePayload,\n SceneStep,\n SceneTarget,\n UplinkInventory,\n} from \"../render-probe\";\nimport {\n FRAMEWORK_SLOT_SEGMENTS,\n HOST_DRAWN_CONTRIBUTION_SEGMENTS,\n} from \"./probe-global\";\n\n/*\n * What one fixture's `_scene` block describes, resolved against the Uplink's\n * inventory. Browser-safe: the fixture arrives already parsed, so a page can\n * build the same scene the render driver builds from the same file.\n */\n\n/** The file's name without its directory or `.json`, as a scene is named. */\nfunction sceneName(file: string): string {\n const base = file.slice(file.lastIndexOf(\"/\") + 1);\n return base.endsWith(\".json\") ? base.slice(0, -\".json\".length) : base;\n}\n\n/**\n * A fixture file, as an author writes it: one JSON file under a registration's\n * `__fixtures__/` folder, describing one scene the harness mounts and draws.\n * Useful for staging the readings a widget, augment or contribution shows in the\n * pictures of an Uplink's generated page. Read by `uplink-tools docs` and `page`\n * through {@link sceneFromFixture}.\n *\n * The harness feeds a scene nothing by default, so everything its target reads\n * has to be sent in `_stream`.\n *\n * @example\n * ```json\n * {\n * \"_scene\": { \"widget\": \"example-heartbeat\", \"hero\": true, \"caption\": \"42 ticks since load\" },\n * \"_stream\": {\n * \"pinnedUt\": 1000000,\n * \"emits\": [{ \"topic\": \"example.heartbeat\", \"payload\": { \"ut\": 1000000, \"ticks\": 42 } }]\n * }\n * }\n * ```\n *\n * @category Rendering scenes\n */\nexport interface FixtureFile {\n /** Notes for whoever reads the file next. Nothing reads it. */\n _meta?: { notes?: string };\n /** What to mount and how to picture it. */\n _scene: FixtureScene;\n /** What arrives on the stream while it is mounted. */\n _stream?: FixtureStream;\n}\n\n/**\n * The `_scene` block of a {@link FixtureFile}: what the scene mounts, at which\n * sizes, and what its picture is held to. Exactly one of `widget`, `augment`\n * and `contribution` names the target. Useful for choosing which registration a\n * fixture pictures and what the renderer checks about the picture. Read by\n * {@link sceneFromFixture}.\n *\n * @category Rendering scenes\n */\nexport interface FixtureScene {\n /** The id of the registered widget to mount. */\n widget?: string;\n /** The id of the registered augment to mount, in a stand-in panel unless `hostWidget` names a real one. */\n augment?: string;\n /** The id of the registered contribution to mount. */\n contribution?: string;\n /**\n * A registered widget to mount this augment inside, rather than the stand-in\n * `Panel`. An overlay augment draws in its host's projection, so it needs a\n * host to draw against. The scene is then sized and fed as the host, since\n * that is what is on screen.\n */\n hostWidget?: string;\n /**\n * Outline what this augment draws inside its host, so a picture of the whole\n * host shows which part the Uplink supplied. Only for an augment hosted by a\n * real widget. Drawn as an outline, which moves no layout.\n */\n highlight?: true;\n /** What the picture shows, in a sentence. It is the image's alt text on the generated page. */\n caption?: string;\n /** The widget's saved settings for this scene, as its config form would save them. */\n config?: Record<string, unknown>;\n /** The props the host passes an augment's slot, for a scene with no real host to pass them. */\n slotProps?: Record<string, unknown>;\n /** Which of the target's sizes to draw, by name, such as `\"default\"` and `\"min\"`. Absent, every size it declares. */\n modes?: string[];\n /**\n * The tile to render in, overriding what would be derived.\n *\n * For a stand-in augment or contribution scene it is the size, since a slot\n * has no size of its own. For a hosted one it overrides the host's size.\n */\n size?: { w: number; h: number };\n /** The data source id the fixture's bare top-level keys feed, for a widget still reading a `DataSource`. Absent, `data`. */\n dataSourceId?: string;\n /**\n * This scene's subject is an empty state, with the reason.\n *\n * This exempts the scene from the starved-render comparison. It takes a\n * sentence and not a boolean, so the claim that the widget has nothing to draw\n * can be checked later. A scene with this set must still render some visible\n * text.\n */\n expectsEmpty?: string;\n /**\n * This scene is one of the README's picture(s) of its target.\n *\n * Any number of a target's scenes may carry it, and every one that does is\n * shown. `uplink-tools docs` refuses a target with scenes and none marked.\n */\n hero?: true;\n /**\n * Why this scene draws exactly the same once the stream stops arriving.\n *\n * This exempts the scene from the held comparison, and takes a sentence for\n * the same reason `expectsEmpty` does. It is for a subject that draws no\n * figure an operator could take for current: a vocabulary, a control, a label.\n * A subject that draws a reading does not qualify, however small the reading.\n *\n * A scene carrying it whose held render does change fails, so the exemption\n * has to come off once it is no longer needed.\n */\n unchangedWhenHeld?: string;\n /**\n * Text this scene must actually paint, each in a box wider and taller than\n * nothing.\n *\n * The fed-versus-starved check covers the whole picture; this covers one named\n * element. A label squeezed to zero width by a neighbour that wrapped passes\n * the starve check because the rest of the picture still moved, yet is\n * invisible on screen.\n *\n * Checked at every mode the scene renders. A widget that legitimately drops a\n * label at one size narrows `_scene.modes`.\n */\n paints?: string[];\n /** Things done to the mounted target before it is photographed. */\n before?: SceneAct[];\n /** The steps of a motion scene, which is drawn as a GIF at its first size. */\n steps?: SceneStep[];\n /** How a motion scene is played back: frames per second, and whether it runs forwards then backwards. */\n motion?: { fps?: number; pingPong?: boolean };\n}\n\n/**\n * One thing done to the mounted widget before it is photographed: a press, a\n * hover or a rest. Some surfaces have nothing to show until they are used, such\n * as a plan composer with no plan in it or a video feed whose controls appear on\n * hover. Performed by the Node driver through real input events, so a hover\n * reaches CSS and a click reaches a handler that reads the event.\n */\nexport interface SceneAct {\n /** Click the control with this accessible name. */\n press?: string;\n /** Move the pointer over the first element matching this CSS selector. */\n hover?: string;\n /** Move the pointer off everything, for the resting half of a hover pair. */\n rest?: true;\n}\n\n/**\n * The `_stream` block of a {@link FixtureFile}: the Topic samples the scene is\n * fed, the instant it is drawn at and the delay between the vessel and the\n * command centre. Useful for staging a widget's readings, live or held. Read by\n * {@link sceneFromFixture}.\n *\n * @category Rendering scenes\n */\nexport interface FixtureStream {\n /**\n * The operator's view time, which the scene is drawn at when it has no\n * `delaySeconds`. Absent, `1000000`.\n */\n pinnedUt?: number;\n /**\n * The one-way signal delay between the vessel and the command centre, in seconds. Each\n * emit is delivered that long after its `validAt`, the view time is the\n * newest `validAt` delivered, and every reading is reckoned to the vessel's\n * present as it is in the app, so a scene can show a modelled figure beside\n * the observed one. Absent or `0`, nothing is carried across.\n */\n delaySeconds?: number;\n /**\n * What is sent, replayed once the scene has subscribed: in the order\n * written, or in the order sent under `delaySeconds`. An entry with no\n * `validAt` was sent at `pinnedUt`. A `payload` of `null` is the game\n * confirming there is no value.\n */\n emits?: SceneEmit[];\n /**\n * Drop the transport once every emit has landed, so the picture shows figures\n * that are held. Absent, the scene is live.\n */\n stopsArriving?: boolean;\n}\n\n/**\n * One scene of an Uplink, built from a fixture: what to mount, the Topic samples\n * to feed it, the sizes to draw it at and the steps to run. Useful for listing\n * the pictures an Uplink's page shows. Returned by {@link sceneFromFixture} and\n * used by {@link payloadFor}, the page generator and the renderer.\n *\n * @category Rendering scenes\n * @categoryDescription Rendering scenes\n * Rendering an Uplink's widgets in a real browser: the scenes to draw, the\n * engine and fonts they are drawn with, the pictures and GIFs written, and the\n * widgets found too small for what they hold.\n */\nexport interface Scene {\n /** The fixture file the scene was built from. */\n file: string;\n /** The file's name without its directory or `.json`, which names the picture it writes. */\n name: string;\n /** The widget, augment or contribution mounted. */\n target: SceneTarget;\n /** The widget an augment or contribution is mounted inside, from `_scene.hostWidget`. */\n host?: string;\n /** What the picture shows, from `_scene.caption`. */\n caption?: string;\n /** Why an empty state is this scene's subject, from `_scene.expectsEmpty`. */\n expectsEmpty?: string;\n /** Why the scene draws the same once the stream stops arriving, from `_scene.unchangedWhenHeld`. */\n unchangedWhenHeld?: string;\n /** Whether the README shows this scene, from `_scene.hero`. */\n hero: boolean;\n /** Whether the augment is outlined inside its host, from `_scene.highlight`. */\n highlight?: true;\n /** Text the render must paint at every mode, from `_scene.paints`. */\n paints: string[];\n /** Acts performed on the mounted target before it is photographed, from `_scene.before`. */\n before: SceneAct[];\n /** The instant the scene is drawn at, from `_stream.pinnedUt`. */\n pinnedUt: number;\n /** The one-way signal delay staged between the vessel and the command centre, from `_stream.delaySeconds`. */\n delaySeconds?: number;\n /** What is sent on the stream, each with its `validAt` filled in. */\n emits: SceneEmit[];\n /** Whether the transport is dropped once every emit has landed, from `_stream.stopsArriving`. */\n stopsArriving?: boolean;\n /** The target's saved settings, from `_scene.config`. Empty when the fixture sets none. */\n config: Record<string, unknown>;\n /** The props handed to an augment's slot, from `_scene.slotProps`. Empty when the fixture sets none. */\n slotProps: Record<string, unknown>;\n /** The fixture's bare top-level keys, grouped under the data source id they feed. */\n dataSources: Record<string, Record<string, unknown>>;\n /** Every Topic the target's registration declares, which an emit is checked against. */\n declaredTopics: string[];\n /** The sizes the scene is drawn at, narrowed by `_scene.modes`. */\n modes: InventoryMode[];\n /** The steps of a motion scene, from `_scene.steps`. Absent, the scene is a still. */\n steps?: SceneStep[];\n /** How a motion scene plays back, from `_scene.motion`, with the defaults filled in. */\n motion: { fps: number; pingPong: boolean };\n}\n\n/** The pinned instant used when a fixture names none. Only its stability matters. */\nconst DEFAULT_PINNED_UT = 1_000_000;\n\n/** The tile an augment or contribution scene is drawn in, absent `_scene.size`.\n * There is no `defaultSize` to derive one from: a slot's size belongs to its\n * host, which lives in a package the author cannot import. */\nconst STANDIN_SIZE = { w: 13, h: 12 } as const;\n\nconst DEFAULT_FPS = 12;\n\n/**\n * The {@link Scene} one fixture describes, or a failure naming the file when its\n * `_scene` block is missing or names no target the inventory holds. Useful for\n * turning a fixture file into something the renderer can mount. Used by\n * `buildScenes`.\n *\n * @category Scenes\n */\nexport function sceneFromFixture(\n where: string,\n file: string,\n raw: Record<string, unknown>,\n inventory: UplinkInventory,\n): Scene {\n const sceneBlock = raw._scene;\n if (typeof sceneBlock !== \"object\" || sceneBlock === null) {\n throw new Error(\n `${where}: no \"_scene\" block, so nothing says what this fixture is a ` +\n \"fixture OF. Add one naming its target:\\n\" +\n ` \"_scene\": { \"widget\": \"${inventory.widgets[0]?.id ?? \"<widget-id>\"}\" }\\n` +\n 'or \"augment\" / \"contribution\" with the registered id.',\n );\n }\n return oneScene(where, file, raw, sceneBlock as FixtureScene, inventory);\n}\n\nfunction oneScene(\n where: string,\n file: string,\n raw: Record<string, unknown>,\n scene: FixtureScene,\n inventory: UplinkInventory,\n): Scene {\n if (\"host\" in scene) {\n throw new Error(\n `${where}: \"_scene.host\" is not read any more; the key was renamed to ` +\n '\"_scene.hostWidget\". Rename the key in this fixture.',\n );\n }\n\n const named = ([\"widget\", \"augment\", \"contribution\"] as const).filter(\n (k) => scene[k] !== undefined,\n );\n if (named.length !== 1) {\n throw new Error(\n `${where}: \"_scene\" must name exactly one of widget / augment / ` +\n `contribution; it names ${named.length === 0 ? \"none\" : named.join(\" and \")}.`,\n );\n }\n const kind = named[0];\n const id = scene[kind] as string;\n const target: SceneTarget = { kind, id };\n\n const streamBlock = raw._stream;\n const stream: FixtureStream =\n typeof streamBlock === \"object\" && streamBlock !== null\n ? (streamBlock as FixtureStream)\n : {};\n const pinnedUt = stream.pinnedUt ?? DEFAULT_PINNED_UT;\n const emits = (stream.emits ?? []).map((e) => ({\n ...e,\n validAt: e.validAt ?? pinnedUt,\n }));\n\n const legacy: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(raw)) {\n if (key.startsWith(\"_\")) continue;\n legacy[key] = value;\n }\n const dataSources: Record<string, Record<string, unknown>> = {};\n if (Object.keys(legacy).length > 0) {\n dataSources[scene.dataSourceId ?? \"data\"] = legacy;\n }\n\n if (scene.highlight !== undefined) {\n if (scene.highlight !== true) {\n throw new Error(\n `${where}: \"_scene.highlight\" is either true or absent, got ` +\n `${JSON.stringify(scene.highlight)}.`,\n );\n }\n if (kind !== \"augment\" || scene.hostWidget === undefined) {\n throw new Error(\n `${where}: \"_scene.highlight\" outlines an augment inside the real ` +\n \"widget that hosts it, so it needs an augment target and a \" +\n '\"_scene.hostWidget\". A widget scene has nothing to tell apart, a ' +\n \"stand-in host holds nothing but the augment, and a contribution is \" +\n \"drawn by its host's own markup, which the harness cannot find.\",\n );\n }\n }\n\n if (scene.hostWidget !== undefined && kind === \"widget\") {\n throw new Error(\n `${where}: \"_scene.hostWidget\" is only meaningful for an augment or a ` +\n \"contribution scene, which are drawn INSIDE another widget. This one \" +\n \"names a widget, so there is nothing for it to be drawn inside.\",\n );\n }\n // A contribution is DATA somebody else draws, so a scene that names no host\n // widget has to show that SOMETHING will draw it. The framework draws one\n // segment for every widget, `<id>.badges`, so the probe's stand-in renders a\n // badge exactly as the real widget would; every other slot is drawn by a\n // widget's own body, and a stand-in has none.\n if (scene.hostWidget === undefined && kind === \"contribution\") {\n const slot = contributionSlot(where, id, inventory);\n if (!isHostDrawnSlot(slot)) {\n throw new Error(\n `${where}: this contribution goes on \"${slot}\", which its host ` +\n 'widget draws itself, so \"_scene.hostWidget\" must name a widget ' +\n \"that declares it. Without one there is nothing to draw the \" +\n \"contribution and the render is a blank frame that reports \" +\n `success. The one exception is a ` +\n `\"${HOST_DRAWN_CONTRIBUTION_SEGMENTS.join('\" / \"')}\" segment, ` +\n \"which the framework renders for every widget.\",\n );\n }\n }\n\n // A named host has to declare the slot too: mounting a widget that never\n // reads it draws nothing and reports success. The framework-universal\n // segments are the exception: every widget receives them undeclared.\n if (scene.hostWidget !== undefined && kind === \"contribution\") {\n const slot = contributionSlot(where, id, inventory);\n const host = hostWidget(where, scene.hostWidget, inventory);\n if (!isFrameworkSlot(slot) && !host.contributionSlots.includes(slot)) {\n throw new Error(\n `${where}: \"_scene.hostWidget\" names \"${scene.hostWidget}\", which ` +\n `does not declare the \"${slot}\" contribution slot, so it would ` +\n \"mount and never draw this contribution. Widgets that declare it: \" +\n `${\n [...inventory.hosts, ...inventory.widgets]\n .filter((w) => w.contributionSlots.includes(slot))\n .map((w) => w.id)\n .sort()\n .join(\", \") || \"(none in this bundle)\"\n }.`,\n );\n }\n }\n\n return {\n file,\n name: sceneName(file),\n target,\n host: scene.hostWidget,\n caption: scene.caption,\n expectsEmpty: scene.expectsEmpty,\n unchangedWhenHeld: unchangedWhenHeldFor(where, scene, stream),\n hero: scene.hero === true,\n ...(scene.highlight === true ? { highlight: true as const } : {}),\n paints: paintsFor(where, scene),\n before: beforeFor(where, scene),\n pinnedUt,\n ...delayFor(where, stream, scene),\n emits,\n stopsArriving: stream.stopsArriving,\n config: scene.config ?? {},\n slotProps: scene.slotProps ?? {},\n dataSources,\n declaredTopics: declaredTopicsFor(\n where,\n target,\n inventory,\n scene.hostWidget,\n ),\n modes: modesFor(where, scene, target, inventory),\n steps: scene.steps,\n motion: {\n fps: scene.motion?.fps ?? DEFAULT_FPS,\n pingPong: scene.motion?.pingPong ?? false,\n },\n };\n}\n\n/**\n * `_stream.delaySeconds`, refused where it could not stage a signal delay.\n *\n * Zero is left out rather than carried, so a scene with no signal delay renders\n * down exactly the path a scene without the key does. Under a delay the view\n * clock only moves forward, as the received edge does, so an `advanceUt` step\n * that runs it back is refused rather than silently ignored.\n */\nfunction delayFor(\n where: string,\n stream: FixtureStream,\n scene: FixtureScene,\n): { delaySeconds?: number } {\n const delay = stream.delaySeconds;\n if (delay === undefined) return {};\n if (typeof delay !== \"number\" || !Number.isFinite(delay) || delay < 0) {\n throw new Error(\n `${where}: \"_stream.delaySeconds\" must be a one-way light time in ` +\n `seconds, zero or more; got ${JSON.stringify(delay)}.`,\n );\n }\n if (delay === 0) return {};\n if ((scene.steps ?? []).some((step) => (step.advanceUt ?? 0) < 0)) {\n throw new Error(\n `${where}: a step with a negative \"advanceUt\" cannot run under ` +\n '\"_stream.delaySeconds\": a delayed clock follows what has been ' +\n \"received, and nothing is received from the past. Drop the delay \" +\n \"or make every advance forward.\",\n );\n }\n return { delaySeconds: delay };\n}\n\n/**\n * `_scene.unchangedWhenHeld`, refused where it could not be read: it has to be\n * a reason, and a scene with no stream or an empty state is never compared.\n */\nfunction unchangedWhenHeldFor(\n where: string,\n scene: FixtureScene,\n stream: FixtureStream,\n): string | undefined {\n const why = scene.unchangedWhenHeld;\n if (why === undefined) return undefined;\n if (typeof why !== \"string\" || why.trim() === \"\") {\n throw new Error(\n `${where}: \"_scene.unchangedWhenHeld\" must say why this scene draws ` +\n \"the same with the link dropped; a blank reason is not one.\",\n );\n }\n if ((stream.emits ?? []).length === 0 || scene.expectsEmpty !== undefined) {\n throw new Error(\n `${where}: \"_scene.unchangedWhenHeld\" is set on a scene the held ` +\n \"check never compares (it emits nothing on the stream, or it is an \" +\n \"empty state), so it excuses nothing. Remove it.\",\n );\n }\n return why;\n}\n\n/**\n * `_scene.paints`, validated at parse time rather than at render time.\n *\n * An empty string matches every element, so a stray one in the list would pass\n * silently and read as a check nobody wrote. Refusing it here means the author\n * finds out before Chromium starts.\n */\nfunction paintsFor(where: string, scene: FixtureScene): string[] {\n const paints = scene.paints ?? [];\n if (!Array.isArray(paints)) {\n throw new Error(\n `${where}: \"_scene.paints\" must be an array of strings, got ` +\n `${typeof paints}.`,\n );\n }\n for (const text of paints) {\n if (typeof text !== \"string\" || text.trim() === \"\") {\n throw new Error(\n `${where}: every \"_scene.paints\" entry must be non-blank text the ` +\n `render has to show; got ${JSON.stringify(text)}. An empty string ` +\n \"matches every element on the page, so it would assert nothing.\",\n );\n }\n }\n // A motion scene has no one moment for \"is this on screen\" to be about: what\n // it exists to show is text arriving and leaving. Refused rather than checked\n // at an arbitrary frame, which would fail scenes that are working.\n if (paints.length > 0 && scene.steps && scene.steps.length > 0) {\n throw new Error(\n `${where}: \"_scene.paints\" and \"_scene.steps\" cannot both be set. A ` +\n \"motion scene's content changes frame to frame, so there is no single \" +\n \"moment the text has to be on screen in. Assert the paint on a still \" +\n \"scene of the same state.\",\n );\n }\n return [...paints];\n}\n\n/** `_scene.before`, validated at parse time so a typo is not a silent no-op. */\nfunction beforeFor(where: string, scene: FixtureScene): SceneAct[] {\n const acts = scene.before ?? [];\n if (!Array.isArray(acts)) {\n throw new Error(\n `${where}: \"_scene.before\" must be an array of acts, got ${typeof acts}.`,\n );\n }\n for (const act of acts) {\n const named = ([\"press\", \"hover\", \"rest\"] as const).filter(\n (k) => act?.[k] !== undefined,\n );\n if (named.length !== 1) {\n throw new Error(\n `${where}: every \"_scene.before\" act names exactly one of press / ` +\n `hover / rest; got ${JSON.stringify(act)}.`,\n );\n }\n }\n return [...acts];\n}\n\n/**\n * Every topic the target's registration declares, which is what an emit is\n * checked against when nothing read it. A Topic family is carried as its\n * pattern, such as `trackingStation.vessel.<vessel>.link`.\n *\n * Every domain any registered augment or contribution gates on is added too,\n * whatever the target is: `<AugmentSlot>`'s `requires` gate reads a store fed\n * from `<domain>.available`.\n */\nfunction declaredTopicsFor(\n where: string,\n target: SceneTarget,\n inventory: UplinkInventory,\n host?: string,\n): string[] {\n const declared = new Set<string>();\n // A hosted augment scene pictures its host, so the host's own topics count too.\n if (host) {\n const def = hostWidget(where, host, inventory);\n for (const topic of [\n ...def.channels,\n ...def.optionalChannels,\n ...def.channelFamilies,\n ...def.optionalChannelFamilies,\n ...def.dataRequirements,\n ]) {\n declared.add(topic);\n }\n }\n const addAvailability = () => {\n for (const augment of inventory.augments) {\n if (augment.requires) declared.add(`${augment.requires}.available`);\n }\n for (const contribution of inventory.contributions) {\n if (contribution.requires) {\n declared.add(`${contribution.requires}.available`);\n }\n }\n };\n addAvailability();\n\n const addTargetTopics = () => {\n if (target.kind === \"widget\") {\n const def = inventory.widgets.find((w) => w.id === target.id);\n if (!def) throw unknownTarget(where, target, inventory);\n for (const topic of [\n ...def.channels,\n ...def.optionalChannels,\n ...def.channelFamilies,\n ...def.optionalChannelFamilies,\n ...def.dataRequirements,\n ]) {\n declared.add(topic);\n }\n return;\n }\n if (target.kind === \"augment\") {\n const def = inventory.augments.find((a) => a.id === target.id);\n if (!def) throw unknownTarget(where, target, inventory);\n for (const topic of def.channels) declared.add(topic);\n return;\n }\n const def = inventory.contributions.find((c) => c.id === target.id);\n if (!def) throw unknownTarget(where, target, inventory);\n for (const dep of def.deps) {\n // A Processor dep names no topic of its own, so its OWN topic deps are what the contribution reads.\n if (dep.startsWith(\"processor:\")) {\n const id = dep.slice(\"processor:\".length);\n for (const topic of inventory.processorTopicDeps[id] ?? []) {\n declared.add(topic);\n }\n } else {\n declared.add(dep);\n }\n }\n };\n addTargetTopics();\n return [...declared].sort();\n}\n\n/**\n * The registration of a widget this Uplink does not own, named as a scene's\n * host. Absent means it is not in the bundle at all, which for a first-party\n * host means the run did not supply it with `--with`.\n */\nfunction hostWidget(\n where: string,\n host: string,\n inventory: UplinkInventory,\n): (typeof inventory.hosts)[number] {\n const found =\n inventory.hosts.find((w) => w.id === host) ??\n inventory.widgets.find((w) => w.id === host);\n if (!found) {\n throw new Error(\n `${where}: \"_scene.hostWidget\" names \"${host}\", which no widget in ` +\n \"this bundle registers. A widget that ships with the app has to be \" +\n 'supplied to the run: declare \"@ksp-gonogo/uplink-tools/widgets\" in ' +\n `package.json's \"gonogo.renderWith\", or pass ` +\n \"--with <module that registers it> for a one-off. \" +\n \"Widgets in the bundle: \" +\n `${\n [...inventory.hosts, ...inventory.widgets]\n .map((w) => w.id)\n .sort()\n .join(\", \") || \"(none)\"\n }.`,\n );\n }\n return found;\n}\n\n/**\n * Whether a stand-in host would actually draw this slot.\n *\n * The same test `render-probe.tsx` makes, from the same constant, and the two\n * have to agree: a rule stricter here makes a scene the probe would have served\n * unbuildable, and a rule looser here builds a scene the probe photographs\n * blank.\n */\nfunction isHostDrawnSlot(slot: string): boolean {\n const segment = slot.slice(slot.indexOf(\".\") + 1);\n return (\n slot.includes(\".\") &&\n (HOST_DRAWN_CONTRIBUTION_SEGMENTS as readonly string[]).includes(segment)\n );\n}\n\nfunction isFrameworkSlot(slot: string): boolean {\n const segment = slot.slice(slot.indexOf(\".\") + 1);\n return (\n slot.includes(\".\") &&\n (FRAMEWORK_SLOT_SEGMENTS as readonly string[]).includes(segment)\n );\n}\n\nfunction contributionSlot(\n where: string,\n id: string,\n inventory: UplinkInventory,\n): string {\n const found = inventory.contributions.find((c) => c.id === id);\n if (!found)\n throw unknownTarget(where, { kind: \"contribution\", id }, inventory);\n return found.contributes;\n}\n\nfunction unknownTarget(\n where: string,\n target: SceneTarget,\n inventory: UplinkInventory,\n): Error {\n const known =\n target.kind === \"widget\"\n ? inventory.widgets.map((w) => w.id)\n : target.kind === \"augment\"\n ? inventory.augments.map((a) => a.id)\n : inventory.contributions.map((c) => c.id);\n // \"Registered <kind> ids\" rather than pluralising the interpolation: `${x}s` reads to the hand-typed-unit guard as a seconds symbol next to a value.\n return new Error(\n `${where}: \"${target.id}\" is not a registered ${target.kind} of Uplink ` +\n `\"${inventory.id}\". Registered ${target.kind} ids: ` +\n `${known.sort().join(\", \") || \"(none)\"}.`,\n );\n}\n\nfunction resolveAllModes(\n where: string,\n scene: FixtureScene,\n target: SceneTarget,\n inventory: UplinkInventory,\n): InventoryMode[] {\n if (target.kind === \"widget\") {\n const def = inventory.widgets.find((w) => w.id === target.id);\n if (!def) throw unknownTarget(where, target, inventory);\n return def.modes;\n }\n if (scene.hostWidget) {\n const host = hostWidget(where, scene.hostWidget, inventory);\n // The host's own sizes, because the host is what is on screen. A stand-in\n // tile would render the real widget at a shape nobody ever sees it in.\n //\n // Unless the scene names a size, which is not the stand-in escape returning\n // by the back door. A host's `defaultSize` is chosen for the host ALONE,\n // and an operator who has added three sections to it has resized it: the\n // first section rendered this way came out at the host's 6-column default\n // with its facility names ellipsised to \"V...\", a picture of a tile nobody\n // running that Uplink is using. The host still mounts and still supplies\n // the layout; only the tile it is given is the scene's.\n return scene.size\n ? [\n {\n ...host.modes[0],\n ...scene.size,\n ...gridToPixels(scene.size.w, scene.size.h),\n },\n ]\n : host.modes;\n }\n const size = scene.size ?? STANDIN_SIZE;\n return [{ name: \"default\", ...size, ...gridToPixels(size.w, size.h) }];\n}\n\nfunction modesFor(\n where: string,\n scene: FixtureScene,\n target: SceneTarget,\n inventory: UplinkInventory,\n): InventoryMode[] {\n const all = resolveAllModes(where, scene, target, inventory);\n if (!scene.modes) return all;\n const chosen: InventoryMode[] = [];\n for (const name of scene.modes) {\n const found = all.find((m) => m.name === name);\n if (!found && name === \"min\" && target.kind === \"widget\") {\n throw new Error(\n `${where}: \"_scene.modes\" names \"min\", and this widget has no separate ` +\n \"smallest size to draw: its minSize is absent or equal to its \" +\n 'defaultSize, so \"default\" already is the smallest. Remove \"min\" from ' +\n `\"_scene.modes\" in ${where}, or give the widget a minSize smaller ` +\n \"than its defaultSize.\",\n );\n }\n if (!found) {\n throw new Error(\n `${where}: \"_scene.modes\" names \"${name}\", which is not a mode this ` +\n `target has. Available: ${all.map((m) => m.name).join(\", \")}. ` +\n \"Modes are derived from the registration's defaultSize / minSize, so \" +\n \"a fixture may narrow the set and cannot add to it.\",\n );\n }\n chosen.push(found);\n }\n return chosen;\n}\n\n/**\n * The {@link ScenePayload} the page mounts for one scene at one mode, with\n * `starve` set for the render that is fed nothing. Useful for handing a scene to\n * the render probe. Used by the renderer, which draws each scene fed and starved.\n *\n * @category Scenes\n */\nexport function payloadFor(\n scene: Scene,\n mode: { name: string; w: number; h: number; pxW: number; pxH: number },\n starve: boolean,\n): ScenePayload {\n return {\n target: scene.target,\n fixture: scene.name,\n pinnedUt: scene.pinnedUt,\n ...(scene.delaySeconds === undefined\n ? {}\n : { delaySeconds: scene.delaySeconds }),\n declaredTopics: scene.declaredTopics,\n emits: scene.emits,\n stopsArriving: scene.stopsArriving,\n config: scene.config,\n slotProps: scene.slotProps,\n host: scene.host,\n ...(scene.highlight === true ? { highlight: true as const } : {}),\n dataSources: scene.dataSources,\n w: mode.w,\n h: mode.h,\n pxW: mode.pxW,\n pxH: mode.pxH,\n starve,\n steps: scene.steps,\n };\n}\n","import type { UplinkInventory } from \"../render-probe\";\nimport { display, readJsonObject, type UplinkPackage } from \"./context\";\nimport { type Scene, sceneFromFixture } from \"./sceneModel\";\n\nexport type { Scene, SceneAct } from \"./sceneModel\";\n\n/**\n * One scene per fixture file found under the client package's\n * `src/**\\/__fixtures__/`. A fixture does not carry the Topics its target reads\n * or the size to render at: both come from the target's own registration.\n * Useful for drawing every widget of an Uplink in a known state. Used by the\n * render driver and the page check.\n *\n * @category Rendering scenes\n */\nexport function buildScenes(\n pkg: UplinkPackage,\n inventory: UplinkInventory,\n): Scene[] {\n const scenes: Scene[] = [];\n for (const file of pkg.fixtures) {\n const where = display(pkg.dir, file);\n scenes.push(sceneFromFixture(where, file, readJsonObject(file), inventory));\n }\n return scenes;\n}\n\n/**\n * Throws, naming each one, when a registered widget has no scene. Useful for\n * stopping the generated page from leaving a widget out without saying so.\n * Used by the render driver and the page check.\n *\n * Augments and contributions need no scene, because some cannot be pictured\n * outside their host (an overlay drawn in a map's projection renders blank in a\n * stand-in). Their ids are returned as `unpreviewed`, and the page lists them\n * without a picture.\n *\n * @category Rendering scenes\n */\nexport function assertEveryWidgetCovered(\n scenes: Scene[],\n inventory: UplinkInventory,\n): { unpreviewed: string[] } {\n const covered = new Set(scenes.map((s) => `${s.target.kind}:${s.target.id}`));\n const missing = inventory.widgets\n .filter((w) => !covered.has(`widget:${w.id}`))\n .map((w) => w.id);\n if (missing.length > 0) {\n throw new Error(\n `uplink-tools: ${missing.length} widget(s) have no fixture, so the ` +\n \"generated page would show no picture of them:\\n \" +\n `${missing.join(\"\\n \")}\\n` +\n 'Add a fixture under src/<Name>/__fixtures__/ with a \"_scene\" block ' +\n \"naming the widget id.\",\n );\n }\n return {\n unpreviewed: [\n ...inventory.augments\n .filter((a) => !covered.has(`augment:${a.id}`))\n .map((a) => `augment:${a.id}`),\n ...inventory.contributions\n .filter((c) => !covered.has(`contribution:${c.id}`))\n .map((c) => `contribution:${c.id}`),\n ],\n };\n}\n"],"mappings":";AAAA,SAAS,aAAa,cAAc,gBAAgB;AACpD,SAAS,qBAAqB;AAC9B,SAAS,SAAS,MAAM,UAAU,eAAe;AACjD,SAAS,eAAe,qBAAqB;AAiB7C,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,OAAO,QAAQ,cAAc,YAAY,GAAG,CAAC;AAiC5C,SAAS,eAAe,MAAuC;AACpE,QAAM,SAAkB,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;AAC7D,MAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,MAAM,QAAQ,MAAM,GAAG;AAC1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MACX,GAAG,UAAU,SACV,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,WAAW,EAAE,EAAE,EAAE,CAAC,EAC7C,IAAI,CAAC,MAAM,WAAW,EAAE,EAAE,EAAE;AAAA,MAC/B,GAAG,UAAU,cACV,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,gBAAgB,EAAE,EAAE,EAAE,CAAC,EAClD,IAAI,CAAC,MAAM,gBAAgB,EAAE,EAAE,EAAE;AAAA,IACtC;AAAA,EACF;AACF;","names":["require","def"]}
@@ -30,13 +30,13 @@ import {
30
30
  recordedRenders,
31
31
  renderUplink,
32
32
  writeShapeRecord
33
- } from "./chunk-TQLCAGYP.js";
33
+ } from "./chunk-IXUPEUNQ.js";
34
34
  import {
35
35
  display,
36
36
  readJsonObject,
37
37
  resolveRenderModule,
38
38
  resolveUplinkPackage
39
- } from "./chunk-I2U7BD63.js";
39
+ } from "./chunk-VDIP7LC6.js";
40
40
 
41
41
  // src/render/cli.ts
42
42
  import { existsSync } from "fs";
@@ -554,4 +554,4 @@ export {
554
554
  warnWidgetsInDependencies,
555
555
  wholePageRestyle
556
556
  };
557
- //# sourceMappingURL=cli-OPH57363.js.map
557
+ //# sourceMappingURL=cli-FAY33Q5H.js.map
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-CJNDFCUZ.js";
4
- import "./chunk-DQATZYFD.js";
3
+ } from "./chunk-DSA2DIHM.js";
4
+ import "./chunk-EBBMJNMG.js";
5
5
  import "./chunk-QBETEFM7.js";
6
6
  import "./chunk-M2PT57EP.js";
7
7
  import "./chunk-RIB2IDDC.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-CJNDFCUZ.js";
4
- import "./chunk-DQATZYFD.js";
3
+ } from "./chunk-DSA2DIHM.js";
4
+ import "./chunk-EBBMJNMG.js";
5
5
  import "./chunk-QBETEFM7.js";
6
6
  import {
7
7
  SPEC_FILE,
@@ -29,13 +29,13 @@ import {
29
29
  describeStale,
30
30
  readShapeRecord,
31
31
  renderUplink
32
- } from "./chunk-TQLCAGYP.js";
32
+ } from "./chunk-IXUPEUNQ.js";
33
33
  import {
34
34
  RENDER_PROBE_GLOBAL,
35
35
  assertEveryWidgetCovered,
36
36
  buildScenes,
37
37
  resolveUplinkPackage
38
- } from "./chunk-I2U7BD63.js";
38
+ } from "./chunk-VDIP7LC6.js";
39
39
 
40
40
  // src/index.ts
41
41
  import { gridToPixels } from "@ksp-gonogo/ui-kit/grid";
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  buildProbePage,
6
6
  engine
7
- } from "./chunk-TQLCAGYP.js";
7
+ } from "./chunk-IXUPEUNQ.js";
8
8
  import {
9
9
  RENDER_PROBE_GLOBAL,
10
10
  resolveUplinkPackage
11
- } from "./chunk-I2U7BD63.js";
11
+ } from "./chunk-VDIP7LC6.js";
12
12
 
13
13
  // src/check/probes/minsize.ts
14
14
  import { rmSync, writeFileSync } from "fs";
@@ -216,4 +216,4 @@ export {
216
216
  checkMinSize,
217
217
  sweepMinSize
218
218
  };
219
- //# sourceMappingURL=minsize-HZ3GKMFO.js.map
219
+ //# sourceMappingURL=minsize-KU6NBZ4V.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PAGE_WRITE_ENV
3
- } from "./chunk-DQATZYFD.js";
3
+ } from "./chunk-EBBMJNMG.js";
4
4
  import {
5
5
  SPEC_FILE,
6
6
  WIDGET_RECORDS_FILE,
@@ -25,7 +25,7 @@ import {
25
25
  display,
26
26
  renderModuleUrl,
27
27
  resolveUplinkPackage
28
- } from "./chunk-I2U7BD63.js";
28
+ } from "./chunk-VDIP7LC6.js";
29
29
 
30
30
  // src/page-check.ts
31
31
  import { mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";