@disusered/okf-cli 1.2.0 → 1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AASpD,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAwDD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAsIvE"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAgBpD,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAwDD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAsJvE"}
package/dist/generate.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { toVisualizationGraph } from "okf-viz";
2
+ import { DARK_THEME, graphStylesheet, layoutOptions, LIGHT_THEME, nodeClasses, } from "okf-viz/browser";
2
3
  import { PAGE_SCRIPT } from "./page/script.js";
3
4
  import { PAGE_STYLE } from "./page/style.js";
4
5
  import { CYTOSCAPE_SOURCE, CYTOSCAPE_VERSION } from "./vendor/cytoscape.js";
@@ -82,7 +83,23 @@ export function generateVisualization(input) {
82
83
  }
83
84
  }
84
85
  const graph = toVisualizationGraph(input.analysis);
85
- const payload = jsonForScript({ bundle: input.bundle, evaluatedAt, graph });
86
+ /*
87
+ * The graph's encoding comes from `okf-viz`, computed here and applied by the page.
88
+ *
89
+ * The page used to build the Cytoscape stylesheet and the node classes itself, which meant
90
+ * two implementations of what a node looks like and no way to keep them agreeing. Both are
91
+ * plain data, and this runs in Node, so the library decides and the page obeys.
92
+ *
93
+ * Two stylesheets travel with the page because the authorship ring is chosen at view time,
94
+ * not here: a near-black ring is invisible on a dark background.
95
+ */
96
+ const encoding = {
97
+ classes: Object.fromEntries(graph.nodes.map((node) => [node.id, nodeClasses(node)])),
98
+ layout: layoutOptions("cose"),
99
+ muted: { dark: DARK_THEME.muted, light: LIGHT_THEME.muted },
100
+ style: { dark: graphStylesheet(DARK_THEME), light: graphStylesheet(LIGHT_THEME) },
101
+ };
102
+ const payload = jsonForScript({ bundle: input.bundle, encoding, evaluatedAt, graph });
86
103
  const title = escapeText(`${input.bundle} — OKF graph`);
87
104
  return `<!DOCTYPE html>
88
105
  <html lang="en">
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAA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AAE,EAAE,IAAI,EAAE,eAAe,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,EAAE;KAClF,CAAC;IACF,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,KAAK,CAAC,MAAM,cAAc,CAAC,CAAC;IAExD,OAAO;;;;;sDAK6C,UAAU,CAAC,GAAG,CAAC;SAC5D,KAAK;SACL,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA0F8B,OAAO;uCACjB,iBAAiB,YAAY,cAAc;OAC3E,iBAAiB;UACd,gBAAgB;UAChB,aAAa;UACb,gBAAgB;UAChB,WAAW;;;CAGpB,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/page/script.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,QAm+BvB,CAAC"}
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/page/script.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,QA04BvB,CAAC"}
@@ -127,29 +127,17 @@ export const PAGE_SCRIPT = String.raw `
127
127
  }).run();
128
128
  }
129
129
 
130
+ // The encoding is okf-viz's, computed when the page was generated and applied here. Two
131
+ // stylesheets travel with the page because the authorship ring is chosen at view time: a
132
+ // near-black ring is invisible on a dark background, and that ring is a signal that must
133
+ // always read. Neither the rules nor the node classes are decided in this file any more,
134
+ // so the graph is drawn one way by one implementation.
130
135
  var dark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
131
- var MUTED = dark ? "#94a3b8" : "#64748b";
132
- // Ring and warning colours are chosen at view time, not build time: a near-black ring is
133
- // invisible on a dark background, and the authorship ring is a signal that must always read.
134
- var RING = dark ? "#e2e8f0" : "#0f172a";
135
- var STALE = dark ? "#f87171" : "#b91c1c";
136
- var ATTESTED = dark ? "#c4b5fd" : "#6d28d9";
136
+ var MUTED = dark ? payload.encoding.muted.dark : payload.encoding.muted.light;
137
137
 
138
138
  var cy = cytoscape({
139
139
  container: document.getElementById("graph"),
140
140
  elements: graph.nodes.map(function (node) {
141
- // Four channels, each carrying one thing: fill and shape are the type, the border is who
142
- // wrote the page, and opacity is whether a person ever checked it. The reader's metadata
143
- // table still spells all of it out, because a graph cannot carry a key.
144
- var classes = ["author-" + node.authorKind];
145
- if (node.pending) {
146
- classes.push("pending");
147
- } else {
148
- // The tier is derived by okf-core; anything short of human-reviewed is a weaker claim.
149
- if (node.trustTier !== "human-reviewed") { classes.push("unchecked"); }
150
- if (node.status === "deprecated") { classes.push("deprecated"); }
151
- if (node.stale === true) { classes.push("stale"); }
152
- }
153
141
  return {
154
142
  data: {
155
143
  id: node.id,
@@ -158,7 +146,7 @@ export const PAGE_SCRIPT = String.raw `
158
146
  size: node.size,
159
147
  shape: node.shape
160
148
  },
161
- classes: classes.join(" ")
149
+ classes: (payload.encoding.classes[node.id] || []).join(" ")
162
150
  };
163
151
  }).concat(graph.edges.map(function (edge) {
164
152
  return {
@@ -166,86 +154,9 @@ export const PAGE_SCRIPT = String.raw `
166
154
  classes: edge.attested ? "attested" : ""
167
155
  };
168
156
  })),
169
- style: [
170
- {
171
- selector: "node",
172
- style: {
173
- "background-color": "data(color)",
174
- "label": "data(label)",
175
- "color": MUTED,
176
- "font-size": 10,
177
- "text-valign": "bottom",
178
- "text-margin-y": 5,
179
- "text-wrap": "wrap",
180
- "text-max-width": 110,
181
- "text-overflow-wrap": "anywhere",
182
- "text-background-color": dark ? "#0b1120" : "#f8fafc",
183
- "text-background-opacity": 0.85,
184
- "text-background-padding": 2,
185
- "shape": "data(shape)",
186
- "width": "data(size)",
187
- "height": "data(size)"
188
- }
189
- },
190
- // Border style is the authorship channel, so it stays independent of fill and shape: a
191
- // solid ring for a person, dashes for an agent, a doubled ring for an automated process,
192
- // and no ring at all when nothing was recorded. Absence must look like absence.
193
- { selector: "node.author-human", style: { "border-width": 3, "border-style": "solid", "border-color": RING } },
194
- { selector: "node.author-agent", style: { "border-width": 3, "border-style": "dashed", "border-color": RING } },
195
- { selector: "node.author-process", style: { "border-width": 4, "border-style": "double", "border-color": RING } },
196
- { selector: "node.author-unknown", style: { "border-width": 0 } },
197
- // No person has checked it, or it has been retired: draw it as the weaker claim it is.
198
- { selector: "node.unchecked", style: { "opacity": 0.55 } },
199
- { selector: "node.deprecated", style: { "opacity": 0.45 } },
200
- // Stale is louder than either fade, on purpose, and so it must sit after both: a page that
201
- // has passed its own date is a warning rather than a footnote. Only the colour changes, so
202
- // the border still says who wrote it.
203
- { selector: "node.stale", style: { "opacity": 1, "border-width": 5, "border-color": STALE } },
204
- { selector: "node.pending", style: { "opacity": 0.5, "border-width": 1, "border-style": "dotted", "border-color": "#94a3b8" } },
205
- { selector: "node:selected", style: { "border-width": 4, "border-color": "#b45309" } },
206
- {
207
- selector: "edge",
208
- style: {
209
- "width": 1.4,
210
- "line-color": "#cbd5e1",
211
- "target-arrow-color": "#cbd5e1",
212
- "target-arrow-shape": "triangle",
213
- "curve-style": "bezier",
214
- "arrow-scale": 0.8
215
- }
216
- },
217
- { selector: 'edge[relation = "source"]', style: { "line-style": "dashed" } },
218
- { selector: 'edge[relation = "pending"]', style: { "line-style": "dotted", "opacity": 0.6 } },
219
- // An edge into an Attested Computation is drawn as its own thing, so a reader can trace
220
- // which pages rest on a sanctioned run rather than on prose. It comes after the relation
221
- // rules because leaning on a computation outranks how the reference was written.
222
- {
223
- selector: "edge.attested",
224
- style: {
225
- "width": 2.6,
226
- "line-style": "solid",
227
- "line-color": ATTESTED,
228
- "target-arrow-color": ATTESTED,
229
- "target-arrow-shape": "triangle-backcurve",
230
- "arrow-scale": 1.1,
231
- "opacity": 1
232
- }
233
- },
234
- { selector: "edge:selected", style: { "line-color": "#b45309", "target-arrow-color": "#b45309", "width": 2.4 } },
235
- { selector: ".dim", style: { "opacity": 0.12 } }
236
- ],
157
+ style: dark ? payload.encoding.style.dark : payload.encoding.style.light,
237
158
  // Labels sit below their node, so the default packing overlaps them. Give the layout room.
238
- layout: {
239
- name: "cose",
240
- animate: false,
241
- padding: 36,
242
- nodeRepulsion: 6000,
243
- idealEdgeLength: 100,
244
- componentSpacing: 80,
245
- nodeOverlap: 20
246
- // No stop hook here: it would fire during construction, before the cy variable is
247
- // assigned, and the throw would abort the rest of this script. cose fits on its own.
248
- }
159
+ layout: payload.encoding.layout
249
160
  });
250
161
 
251
162
  // Layout preferences live in localStorage, keyed generically so the page carries no origin.
@@ -1 +1 @@
1
- {"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/page/script.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA04BpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disusered/okf-cli",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Command line for OKF bundles, including the self-contained HTML page",
5
5
  "type": "module",
6
6
  "repository": {
@@ -32,10 +32,10 @@
32
32
  "THIRD_PARTY_NOTICES.md"
33
33
  ],
34
34
  "dependencies": {
35
- "okf-core": "1.1.0",
36
- "okf-viz": "2.0.0",
37
35
  "okf-contracts": "1.1.0",
38
- "okf-node": "1.1.0"
36
+ "okf-core": "1.1.0",
37
+ "okf-node": "1.1.0",
38
+ "okf-viz": "2.1.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "24.13.3",