@coldtea/pr-lens-renderer 0.2.6 → 0.3.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/README.md CHANGED
@@ -17,7 +17,8 @@ const doc = parseGraphDoc(json);
17
17
  // One diagram.
18
18
  const { svg, width, height } = render(doc, { lens: "architecture", theme: "dark" });
19
19
 
20
- // Every drill-down section, in both themes, plus the manifest a comment is built from.
20
+ // Every drill-down section, in the light/dark pair, plus the manifest a comment
21
+ // is built from. Pass themes: ["neutral"] for a surface that shows one image.
21
22
  const { assets, manifest } = renderAll(doc, { config });
22
23
  ```
23
24
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { RENDERER_NAME, RENDERER_VERSION } from "./version.js";
2
- export { render, renderAll, type RenderAllOptions, type RenderAllResult, type RenderedAsset, type RenderedSvg, type RenderOptions, } from "./render.js";
2
+ export { render, renderAll, type RenderAllOptions, type RenderThemes, type RenderAllResult, type RenderedAsset, type RenderedSvg, type RenderOptions, } from "./render.js";
3
3
  export { emptyAtlas, type RenderAtlas } from "./atlas.js";
4
4
  export { PrLensRenderError, type RenderErrorCode } from "./errors.js";
5
5
  export type { Box } from "./geometry.js";
6
- export { paletteFor, THEMES, type Palette, type Theme } from "./theme.js";
6
+ export { paletteFor, THEMES, THEME_PAIR, type Palette, type Theme } from "./theme.js";
7
7
  export { buildManifest, canonicalJson, contentHash, CONTENT_HASH_LENGTH, graphContentHash, renderAssetFileName, renderAssetId, type AssetAddress, } from "./manifest.js";
8
8
  export { applyCorrections } from "./corrections.js";
9
9
  export { findView, flattenViews, resolveScope, type ScopedGraph } from "./scope.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EACL,MAAM,EACN,SAAS,EACT,KAAK,gBAAgB,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AK,EAAE,MAAM,YAAY,CAAC;AAEtF,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { RENDERER_NAME, RENDERER_VERSION } from "./version.js";
2
2
  export { render, renderAll, } from "./render.js";
3
3
  export { emptyAtlas } from "./atlas.js";
4
4
  export { PrLensRenderError } from "./errors.js";
5
- export { paletteFor, THEMES } from "./theme.js";
5
+ export { paletteFor, THEMES, THEME_PAIR } from "./theme.js";
6
6
  export { buildManifest, canonicalJson, contentHash, CONTENT_HASH_LENGTH, graphContentHash, renderAssetFileName, renderAssetId, } from "./manifest.js";
7
7
  export { applyCorrections } from "./corrections.js";
8
8
  export { findView, flattenViews, resolveScope } from "./scope.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EACL,MAAM,EACN,SAAS,GAMV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAoB,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,aAAa,CAAC;AAItE,OAAO,EAAE,UAAU,EAAE,MAAM,EAA4B,MAAM,YAAY,CAAC;AAE1E,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,GAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EACL,MAAM,EACN,SAAS,GAOV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAoB,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,aAAa,CAAC;AAItE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAA4B,MAAM,YAAY,CAAC;AAEtF,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,GAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { GraphDoc, Lens, RenderAsset, RenderManifest } from "@coldtea/pr-lens-schema";
2
- import type { Theme } from "./theme.js";
2
+ import { type Theme } from "./theme.js";
3
3
  /**
4
4
  * How many hex characters of the digest an address carries. Long enough that
5
5
  * two different renders will not collide inside one repository's history,
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;;;;;GAQG;AAC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O,MAAM,aAAa,0BAA2B,YAAY,KAAG,MAC1B,CAAC;AAE3C,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,YAAa,YAAY,QAAQ,MAAM,KAAG,MACjC,CAAC;AAE1C,eAAO,MAAM,aAAa,QAAS,QAAQ,UAAU,SAAS,WAAW,EAAE,KAAG,cAU5E,CAAC"}
package/dist/manifest.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { SCHEMA_VERSION } from "@coldtea/pr-lens-schema";
3
+ import { THEMES } from "./theme.js";
3
4
  import { RENDERER_NAME, RENDERER_VERSION } from "./version.js";
4
5
  /**
5
6
  * How many hex characters of the digest an address carries. Long enough that
@@ -49,7 +50,8 @@ const FILE_NAME_ESCAPES = [
49
50
  const escapeForFileName = (id) => FILE_NAME_ESCAPES.reduce((text, [character, escape]) => text.split(character).join(escape), id);
50
51
  /** The contract's ceiling on an `Id`, which an asset id has to stay under. */
51
52
  const ASSET_ID_MAX = 128;
52
- const THEME_SUFFIX_MAX = "-light".length;
53
+ /** The longest theme name, so a stem can never push an asset id over the cap. */
54
+ const THEME_SUFFIX_MAX = Math.max(...THEMES.map((theme) => theme.length)) + "-".length;
53
55
  const STEM_MAX = ASSET_ID_MAX - THEME_SUFFIX_MAX;
54
56
  const DIGEST_LENGTH = 12;
55
57
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE,CACnD,UA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,GAAG,aAAa,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAgB,EAAU,EAAE,CAC3E,GAAG,YAAY,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;AAE3C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAqB,EAAE,IAAY,EAAU,EAAE,CACjF,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAa,EAAE,MAA8B,EAAkB,EAAE,CAAC,CAAC;IAC/F,aAAa,EAAE,cAAc;IAC7B,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG;QAChC,WAAW,EAAE,gBAAgB,CAAC,GAAG,CAAC;KACnC;IACD,QAAQ,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE;IAC5D,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;CACpB,CAAC,CAAC"}
package/dist/render.d.ts CHANGED
@@ -29,10 +29,20 @@ export type RenderedSvg = {
29
29
  * from rearranging itself between two pushes that barely changed anything.
30
30
  */
31
31
  export declare const render: (doc: GraphDoc, options: RenderOptions) => RenderedSvg;
32
+ /**
33
+ * What a render may be asked for: the `<picture>` pair, one half of it, or
34
+ * the single self-contained render.
35
+ *
36
+ * Not `readonly Theme[]`, which would admit all three at once — three assets
37
+ * per view against a view cap derived from two, so a document that validates
38
+ * could produce a manifest that does not. The contract's promise is that if
39
+ * it parses, it renders; this is the boundary that keeps it true.
40
+ */
41
+ export type RenderThemes = readonly ["light", "dark"] | readonly ["light"] | readonly ["dark"] | readonly ["neutral"];
32
42
  export type RenderAllOptions = {
33
43
  config?: Config;
34
- /** Which halves of the theme pair to produce. Both, by default. */
35
- themes?: readonly Theme[];
44
+ /** The `<picture>` pair by default; `['neutral']` for a single-image surface. */
45
+ themes?: RenderThemes;
36
46
  };
37
47
  export type RenderedAsset = RenderedSvg & {
38
48
  asset: RenderAsset;
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,EAAmB,MAAM,yBAAyB,CAAC;AAEpH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EAAsB,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAK5D,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAoCF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,QAAS,QAAQ,WAAW,aAAa,KAAG,WAwC9D,CAAC;AASF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,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AAQ,WAAW,aAAa,KAAG,WAwC9D,CAAC;AASF;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,GAC1B,SAAS,CAAC,OAAO,CAAC,GAClB,SAAS,CAAC,MAAM,CAAC,GACjB,SAAS,CAAC,SAAS,CAAC,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,QAAS,QAAQ,YAAW,gBAAgB,KAAQ,eA8DzE,CAAC"}
package/dist/render.js CHANGED
@@ -3,7 +3,7 @@ import { applyCorrections } from "./corrections.js";
3
3
  import { PrLensRenderError } from "./errors.js";
4
4
  import { buildManifest, contentHash, renderAssetFileName, renderAssetId } from "./manifest.js";
5
5
  import { findView, flattenViews, resolveScope } from "./scope.js";
6
- import { paletteFor, THEMES } from "./theme.js";
6
+ import { paletteFor, THEME_PAIR } from "./theme.js";
7
7
  import { paintArchitecture } from "./svg/architecture.js";
8
8
  import { paintDataFlow } from "./svg/dataflow.js";
9
9
  import { svgDocument } from "./svg/document.js";
@@ -81,7 +81,7 @@ const requireView = (views, id) => {
81
81
  */
82
82
  export const renderAll = (doc, options = {}) => {
83
83
  const prepared = prepare(doc, options.config);
84
- const themes = options.themes ?? THEMES;
84
+ const themes = options.themes ?? THEME_PAIR;
85
85
  const targets = prepared.views.length > 0
86
86
  ? flattenViews(prepared.views)
87
87
  .filter((view) => prepared.lenses.includes(view.lens))
@@ -1 +1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ea/pr-lens-schema";
2
2
  /**
3
- * The two halves of a GitHub `<picture>` pair. A comment ships both and the
4
- * client picks; neither half may depend on the page it lands in, because an
5
- * SVG served as an image cannot see it.
3
+ * Every theme a render can target, and the two that make a GitHub
4
+ * `<picture>` pair. A paired comment ships both halves and the client picks;
5
+ * no render may depend on the page it lands in, because an SVG served as an
6
+ * image cannot see it.
6
7
  *
7
- * The contract owns the pair, because the number of themes is one half of the
8
- * arithmetic that bounds a document's view tree. Re-exported here so a caller
9
- * rendering a diagram does not have to reach into the schema for it.
8
+ * The contract owns the pair, because its size is one half of the arithmetic
9
+ * that bounds a document's view tree. Re-exported here so a caller rendering
10
+ * a diagram does not have to reach into the schema for it.
10
11
  */
11
- export { THEMES, type Theme };
12
+ export { THEMES, THEME_PAIR, type Theme };
12
13
  /**
13
14
  * Every colour the renderer can paint, resolved to a literal before it
14
15
  * reaches the document. CSS custom properties would be shorter, but GitHub
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB;mDAC+C;IAC/C,KAAK,EAAE,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MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA+GF,eAAO,MAAM,UAAU,UAAW,KAAK,KAAG,OAWzC,CAAC"}
package/dist/theme.js CHANGED
@@ -1,14 +1,15 @@
1
- import { assertNever, THEMES } from "@coldtea/pr-lens-schema";
1
+ import { assertNever, THEMES, THEME_PAIR } from "@coldtea/pr-lens-schema";
2
2
  /**
3
- * The two halves of a GitHub `<picture>` pair. A comment ships both and the
4
- * client picks; neither half may depend on the page it lands in, because an
5
- * SVG served as an image cannot see it.
3
+ * Every theme a render can target, and the two that make a GitHub
4
+ * `<picture>` pair. A paired comment ships both halves and the client picks;
5
+ * no render may depend on the page it lands in, because an SVG served as an
6
+ * image cannot see it.
6
7
  *
7
- * The contract owns the pair, because the number of themes is one half of the
8
- * arithmetic that bounds a document's view tree. Re-exported here so a caller
9
- * rendering a diagram does not have to reach into the schema for it.
8
+ * The contract owns the pair, because its size is one half of the arithmetic
9
+ * that bounds a document's view tree. Re-exported here so a caller rendering
10
+ * a diagram does not have to reach into the schema for it.
10
11
  */
11
- export { THEMES };
12
+ export { THEMES, THEME_PAIR };
12
13
  const LIGHT = {
13
14
  background: "#f4f5f7",
14
15
  dot: "rgba(140,149,159,.5)",
@@ -65,12 +66,64 @@ const DARK = {
65
66
  neutralFill: "rgba(110,118,129,.18)",
66
67
  shadow: "rgba(0,0,0,.28)",
67
68
  };
69
+ /**
70
+ * The one render for a surface that shows a single image and cannot swap on
71
+ * the reader's theme — GitLab and Bitbucket both.
72
+ *
73
+ * Handing such a surface the light asset is what it used to do, and it put a
74
+ * glaring white rectangle in front of every dark-mode reader, with strokes
75
+ * tuned for a light ground washing out against a dark page.
76
+ *
77
+ * A transparent render does not solve it either, and the arithmetic says why:
78
+ * for any flat colour, contrast against white is `1.05 / (L + 0.05)` and
79
+ * against black is `(L + 0.05) / 0.05`, which are equal only at L ≈ 0.179,
80
+ * where both are 4.58:1. That is the ceiling for text meant to sit directly
81
+ * on either page — barely over AA in the best case, and under it against a
82
+ * near-black like #0d1117.
83
+ *
84
+ * So this render is opaque and self-contained: it brings its own ground, and
85
+ * every contrast ratio inside it is fixed regardless of where it lands. The
86
+ * ground is dimmed rather than light — on a dark page it sits naturally, and
87
+ * on a light page it reads as a deliberately dark figure, the way a
88
+ * screenshot or a code block does. Its border is visible against both, so it
89
+ * never bleeds into the page.
90
+ */
91
+ const NEUTRAL = {
92
+ background: "#22272e",
93
+ dot: "rgba(144,157,171,.2)",
94
+ lane: "rgba(144,157,171,.06)",
95
+ card: "#2d333b",
96
+ cardBorder: "#444c56",
97
+ foreground: "#cdd9e5",
98
+ muted: "#909dab",
99
+ edge: "#768390",
100
+ chip: "rgba(144,157,171,.16)",
101
+ pill: "#22272e",
102
+ pillBorder: "#373e47",
103
+ lifeline: "#444c56",
104
+ added: "#57ab5a",
105
+ addedText: "#6bc46d",
106
+ addedFill: "rgba(70,149,74,.18)",
107
+ addedBorder: "rgba(87,171,90,.45)",
108
+ modified: "#c69026",
109
+ modifiedText: "#daaa3f",
110
+ modifiedFill: "rgba(174,124,20,.18)",
111
+ modifiedBorder: "rgba(198,144,38,.45)",
112
+ removed: "#e5534b",
113
+ removedText: "#ff938a",
114
+ removedFill: "rgba(229,83,75,.14)",
115
+ removedBorder: "rgba(229,83,75,.45)",
116
+ neutralFill: "rgba(144,157,171,.16)",
117
+ shadow: "rgba(0,0,0,.3)",
118
+ };
68
119
  export const paletteFor = (theme) => {
69
120
  switch (theme) {
70
121
  case "light":
71
122
  return LIGHT;
72
123
  case "dark":
73
124
  return DARK;
125
+ case "neutral":
126
+ return NEUTRAL;
74
127
  default:
75
128
  return assertNever(theme, "Unhandled theme");
76
129
  }
package/dist/theme.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAc,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAc,CAAC;AAuC9B,MAAM,KAAK,GAAY;IACrB,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,sBAAsB;IAC3B,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,qBAAqB;IAClC,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,cAAc,EAAE,qBAAqB;IACrC,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,aAAa,EAAE,oBAAoB;IACnC,WAAW,EAAE,SAAS;IACtB,MAAM,EAAE,oBAAoB;CAC7B,CAAC;AAEF,MAAM,IAAI,GAAY;IACpB,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,uBAAuB;IAC5B,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,uBAAuB;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,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,qBAAqB;IAChC,WAAW,EAAE,qBAAqB;IAClC,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,sBAAsB;IACpC,cAAc,EAAE,sBAAsB;IACtC,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,qBAAqB;IAClC,aAAa,EAAE,qBAAqB;IACpC,WAAW,EAAE,uBAAuB;IACpC,MAAM,EAAE,gBAAgB;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAY,EAAW,EAAE;IAClD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC"}
package/dist/version.d.ts CHANGED
@@ -5,5 +5,5 @@
5
5
  * not otherwise need.
6
6
  */
7
7
  export declare const RENDERER_NAME = "@coldtea/pr-lens-renderer";
8
- export declare const RENDERER_VERSION = "0.2.6";
8
+ export declare const RENDERER_VERSION = "0.3.0";
9
9
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -5,5 +5,5 @@
5
5
  * not otherwise need.
6
6
  */
7
7
  export const RENDERER_NAME = "@coldtea/pr-lens-renderer";
8
- export const RENDERER_VERSION = "0.2.6";
8
+ export const RENDERER_VERSION = "0.3.0";
9
9
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldtea/pr-lens-renderer",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "The PR Lens renderer: a schema-valid graph document in, a self-contained animated SVG out.",
5
5
  "license": "MIT",
6
6
  "author": "Coldtea AI",
@@ -40,7 +40,7 @@
40
40
  "node": ">=20.11"
41
41
  },
42
42
  "dependencies": {
43
- "@coldtea/pr-lens-schema": "0.4.0"
43
+ "@coldtea/pr-lens-schema": "0.6.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^20.19.0",
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export {
4
4
  render,
5
5
  renderAll,
6
6
  type RenderAllOptions,
7
+ type RenderThemes,
7
8
  type RenderAllResult,
8
9
  type RenderedAsset,
9
10
  type RenderedSvg,
@@ -16,7 +17,7 @@ export { PrLensRenderError, type RenderErrorCode } from "./errors.js";
16
17
 
17
18
  export type { Box } from "./geometry.js";
18
19
 
19
- export { paletteFor, THEMES, type Palette, type Theme } from "./theme.js";
20
+ export { paletteFor, THEMES, THEME_PAIR, type Palette, type Theme } from "./theme.js";
20
21
 
21
22
  export {
22
23
  buildManifest,
package/src/manifest.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import type { GraphDoc, Lens, RenderAsset, RenderManifest } from "@coldtea/pr-lens-schema";
3
3
  import { SCHEMA_VERSION } from "@coldtea/pr-lens-schema";
4
- import type { Theme } from "./theme.js";
4
+ import { THEMES, type Theme } from "./theme.js";
5
5
  import { RENDERER_NAME, RENDERER_VERSION } from "./version.js";
6
6
 
7
7
  /**
@@ -62,7 +62,8 @@ const escapeForFileName = (id: string): string =>
62
62
 
63
63
  /** The contract's ceiling on an `Id`, which an asset id has to stay under. */
64
64
  const ASSET_ID_MAX = 128;
65
- const THEME_SUFFIX_MAX = "-light".length;
65
+ /** The longest theme name, so a stem can never push an asset id over the cap. */
66
+ const THEME_SUFFIX_MAX = Math.max(...THEMES.map((theme) => theme.length)) + "-".length;
66
67
  const STEM_MAX = ASSET_ID_MAX - THEME_SUFFIX_MAX;
67
68
  const DIGEST_LENGTH = 12;
68
69
 
package/src/render.ts CHANGED
@@ -5,7 +5,7 @@ import { applyCorrections } from "./corrections.js";
5
5
  import { PrLensRenderError } from "./errors.js";
6
6
  import { buildManifest, contentHash, renderAssetFileName, renderAssetId } from "./manifest.js";
7
7
  import { findView, flattenViews, resolveScope, type ScopedGraph } from "./scope.js";
8
- import { paletteFor, THEMES, type Theme } from "./theme.js";
8
+ import { paletteFor, THEME_PAIR, type Theme } from "./theme.js";
9
9
  import { paintArchitecture } from "./svg/architecture.js";
10
10
  import { paintDataFlow } from "./svg/dataflow.js";
11
11
  import { svgDocument } from "./svg/document.js";
@@ -122,10 +122,25 @@ const requireView = (views: readonly View[], id: string): View => {
122
122
  return view;
123
123
  };
124
124
 
125
+ /**
126
+ * What a render may be asked for: the `<picture>` pair, one half of it, or
127
+ * the single self-contained render.
128
+ *
129
+ * Not `readonly Theme[]`, which would admit all three at once — three assets
130
+ * per view against a view cap derived from two, so a document that validates
131
+ * could produce a manifest that does not. The contract's promise is that if
132
+ * it parses, it renders; this is the boundary that keeps it true.
133
+ */
134
+ export type RenderThemes =
135
+ | readonly ["light", "dark"]
136
+ | readonly ["light"]
137
+ | readonly ["dark"]
138
+ | readonly ["neutral"];
139
+
125
140
  export type RenderAllOptions = {
126
141
  config?: Config;
127
- /** Which halves of the theme pair to produce. Both, by default. */
128
- themes?: readonly Theme[];
142
+ /** The `<picture>` pair by default; `['neutral']` for a single-image surface. */
143
+ themes?: RenderThemes;
129
144
  };
130
145
 
131
146
  export type RenderedAsset = RenderedSvg & { asset: RenderAsset };
@@ -144,7 +159,7 @@ export type RenderAllResult = {
144
159
  */
145
160
  export const renderAll = (doc: GraphDoc, options: RenderAllOptions = {}): RenderAllResult => {
146
161
  const prepared = prepare(doc, options.config);
147
- const themes = options.themes ?? THEMES;
162
+ const themes = options.themes ?? THEME_PAIR;
148
163
 
149
164
  const targets: { lens: Lens; view: View | undefined }[] =
150
165
  prepared.views.length > 0
package/src/theme.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { assertNever, THEMES, type Theme } from "@coldtea/pr-lens-schema";
1
+ import { assertNever, THEMES, THEME_PAIR, type Theme } from "@coldtea/pr-lens-schema";
2
2
 
3
3
  /**
4
- * The two halves of a GitHub `<picture>` pair. A comment ships both and the
5
- * client picks; neither half may depend on the page it lands in, because an
6
- * SVG served as an image cannot see it.
4
+ * Every theme a render can target, and the two that make a GitHub
5
+ * `<picture>` pair. A paired comment ships both halves and the client picks;
6
+ * no render may depend on the page it lands in, because an SVG served as an
7
+ * image cannot see it.
7
8
  *
8
- * The contract owns the pair, because the number of themes is one half of the
9
- * arithmetic that bounds a document's view tree. Re-exported here so a caller
10
- * rendering a diagram does not have to reach into the schema for it.
9
+ * The contract owns the pair, because its size is one half of the arithmetic
10
+ * that bounds a document's view tree. Re-exported here so a caller rendering
11
+ * a diagram does not have to reach into the schema for it.
11
12
  */
12
- export { THEMES, type Theme };
13
+ export { THEMES, THEME_PAIR, type Theme };
13
14
 
14
15
  /**
15
16
  * Every colour the renderer can paint, resolved to a literal before it
@@ -106,12 +107,65 @@ const DARK: Palette = {
106
107
  shadow: "rgba(0,0,0,.28)",
107
108
  };
108
109
 
110
+ /**
111
+ * The one render for a surface that shows a single image and cannot swap on
112
+ * the reader's theme — GitLab and Bitbucket both.
113
+ *
114
+ * Handing such a surface the light asset is what it used to do, and it put a
115
+ * glaring white rectangle in front of every dark-mode reader, with strokes
116
+ * tuned for a light ground washing out against a dark page.
117
+ *
118
+ * A transparent render does not solve it either, and the arithmetic says why:
119
+ * for any flat colour, contrast against white is `1.05 / (L + 0.05)` and
120
+ * against black is `(L + 0.05) / 0.05`, which are equal only at L ≈ 0.179,
121
+ * where both are 4.58:1. That is the ceiling for text meant to sit directly
122
+ * on either page — barely over AA in the best case, and under it against a
123
+ * near-black like #0d1117.
124
+ *
125
+ * So this render is opaque and self-contained: it brings its own ground, and
126
+ * every contrast ratio inside it is fixed regardless of where it lands. The
127
+ * ground is dimmed rather than light — on a dark page it sits naturally, and
128
+ * on a light page it reads as a deliberately dark figure, the way a
129
+ * screenshot or a code block does. Its border is visible against both, so it
130
+ * never bleeds into the page.
131
+ */
132
+ const NEUTRAL: Palette = {
133
+ background: "#22272e",
134
+ dot: "rgba(144,157,171,.2)",
135
+ lane: "rgba(144,157,171,.06)",
136
+ card: "#2d333b",
137
+ cardBorder: "#444c56",
138
+ foreground: "#cdd9e5",
139
+ muted: "#909dab",
140
+ edge: "#768390",
141
+ chip: "rgba(144,157,171,.16)",
142
+ pill: "#22272e",
143
+ pillBorder: "#373e47",
144
+ lifeline: "#444c56",
145
+ added: "#57ab5a",
146
+ addedText: "#6bc46d",
147
+ addedFill: "rgba(70,149,74,.18)",
148
+ addedBorder: "rgba(87,171,90,.45)",
149
+ modified: "#c69026",
150
+ modifiedText: "#daaa3f",
151
+ modifiedFill: "rgba(174,124,20,.18)",
152
+ modifiedBorder: "rgba(198,144,38,.45)",
153
+ removed: "#e5534b",
154
+ removedText: "#ff938a",
155
+ removedFill: "rgba(229,83,75,.14)",
156
+ removedBorder: "rgba(229,83,75,.45)",
157
+ neutralFill: "rgba(144,157,171,.16)",
158
+ shadow: "rgba(0,0,0,.3)",
159
+ };
160
+
109
161
  export const paletteFor = (theme: Theme): Palette => {
110
162
  switch (theme) {
111
163
  case "light":
112
164
  return LIGHT;
113
165
  case "dark":
114
166
  return DARK;
167
+ case "neutral":
168
+ return NEUTRAL;
115
169
  default:
116
170
  return assertNever(theme, "Unhandled theme");
117
171
  }
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  */
7
7
  export const RENDERER_NAME = "@coldtea/pr-lens-renderer";
8
8
 
9
- export const RENDERER_VERSION = "0.2.6";
9
+ export const RENDERER_VERSION = "0.3.0";