aontu 0.62.0 → 0.64.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 +7 -7
- package/dist/agentsmd.js +0 -27
- package/dist/agentsmd.js.map +1 -1
- package/dist/alias.js.map +1 -1
- package/dist/allow.js +0 -92
- package/dist/allow.js.map +1 -1
- package/dist/aontu.d.ts +3 -3
- package/dist/aontu.js +4 -84
- package/dist/aontu.js.map +1 -1
- package/dist/aontumodel.d.ts +4 -0
- package/dist/aontumodel.js +27 -0
- package/dist/aontumodel.js.map +1 -0
- package/dist/casing.d.ts +5 -0
- package/dist/casing.js +90 -0
- package/dist/casing.js.map +1 -0
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +228 -935
- package/dist/cli.js.map +1 -1
- package/dist/ctx.js +0 -48
- package/dist/ctx.js.map +1 -1
- package/dist/diff.js +0 -32
- package/dist/diff.js.map +1 -1
- package/dist/err.js +0 -40
- package/dist/err.js.map +1 -1
- package/dist/escape.js +0 -45
- package/dist/escape.js.map +1 -1
- package/dist/exactjson.d.ts +0 -35
- package/dist/exactjson.js +0 -131
- package/dist/exactjson.js.map +1 -1
- package/dist/format.js +13 -203
- package/dist/format.js.map +1 -1
- package/dist/grammar.d.ts +9 -0
- package/dist/grammar.js +54 -0
- package/dist/grammar.js.map +1 -0
- package/dist/graph.js +0 -26
- package/dist/graph.js.map +1 -1
- package/dist/hcanon.js +0 -82
- package/dist/hcanon.js.map +1 -1
- package/dist/helpdoc.js +2 -2
- package/dist/helpdoc.js.map +1 -1
- package/dist/hints.d.ts +0 -6
- package/dist/hints.js +57 -55
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.js +0 -114
- package/dist/jsonschema.js.map +1 -1
- package/dist/keyorder.d.ts +0 -7
- package/dist/keyorder.js +0 -41
- package/dist/keyorder.js.map +1 -1
- package/dist/lang.js +17 -915
- package/dist/lang.js.map +1 -1
- package/dist/lsp-server.js +0 -16
- package/dist/lsp-server.js.map +1 -1
- package/dist/lsp.d.ts +1 -1
- package/dist/lsp.js +12 -159
- package/dist/lsp.js.map +1 -1
- package/dist/mcp-server.js +0 -26
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp.js +0 -149
- package/dist/mcp.js.map +1 -1
- package/dist/mod-tool.js +16 -131
- package/dist/mod-tool.js.map +1 -1
- package/dist/mod.js +0 -162
- package/dist/mod.js.map +1 -1
- package/dist/patch.js +0 -217
- package/dist/patch.js.map +1 -1
- package/dist/profile.d.ts +9 -0
- package/dist/profile.js +28 -0
- package/dist/profile.js.map +1 -0
- package/dist/provenance.js +0 -140
- package/dist/provenance.js.map +1 -1
- package/dist/query.js +0 -75
- package/dist/query.js.map +1 -1
- package/dist/reach.js +0 -43
- package/dist/reach.js.map +1 -1
- package/dist/relation.js +0 -61
- package/dist/relation.js.map +1 -1
- package/dist/report-sarif.d.ts +0 -11
- package/dist/report-sarif.js +0 -28
- package/dist/report-sarif.js.map +1 -1
- package/dist/sig.js +0 -35
- package/dist/sig.js.map +1 -1
- package/dist/sigdecl.js +1 -1
- package/dist/sigdecl.js.map +1 -1
- package/dist/siggate.js +0 -4
- package/dist/siggate.js.map +1 -1
- package/dist/site.js +3 -29
- package/dist/site.js.map +1 -1
- package/dist/subsume.d.ts +0 -10
- package/dist/subsume.js +0 -137
- package/dist/subsume.js.map +1 -1
- package/dist/template.d.ts +2 -1
- package/dist/template.js +58 -138
- package/dist/template.js.map +1 -1
- package/dist/trace.d.ts +21 -0
- package/dist/trace.js +107 -0
- package/dist/trace.js.map +1 -0
- package/dist/trim.js +0 -41
- package/dist/trim.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.js.map +1 -1
- package/dist/unify.js +13 -248
- package/dist/unify.js.map +1 -1
- package/dist/utility.js +0 -22
- package/dist/utility.js.map +1 -1
- package/dist/val/AbnfFuncVal.d.ts +18 -0
- package/dist/val/AbnfFuncVal.js +132 -0
- package/dist/val/AbnfFuncVal.js.map +1 -0
- package/dist/val/AbsentVal.d.ts +11 -0
- package/dist/val/AbsentVal.js +30 -0
- package/dist/val/AbsentVal.js.map +1 -0
- package/dist/val/AggFuncVal.d.ts +10 -1
- package/dist/val/AggFuncVal.js +104 -116
- package/dist/val/AggFuncVal.js.map +1 -1
- package/dist/val/ArithFuncVal.js +0 -12
- package/dist/val/ArithFuncVal.js.map +1 -1
- package/dist/val/BagVal.js +1 -78
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/BigDecimalVal.js +0 -16
- package/dist/val/BigDecimalVal.js.map +1 -1
- package/dist/val/BigIntegerVal.js +0 -16
- package/dist/val/BigIntegerVal.js.map +1 -1
- package/dist/val/CloseFuncVal.js +0 -9
- package/dist/val/CloseFuncVal.js.map +1 -1
- package/dist/val/CmpFuncVal.d.ts +2 -0
- package/dist/val/CmpFuncVal.js +49 -72
- package/dist/val/CmpFuncVal.js.map +1 -1
- package/dist/val/ConjunctVal.js +0 -29
- package/dist/val/ConjunctVal.js.map +1 -1
- package/dist/val/ConstraintVal.js +0 -500
- package/dist/val/ConstraintVal.js.map +1 -1
- package/dist/val/ContainerKindVal.js +0 -2
- package/dist/val/ContainerKindVal.js.map +1 -1
- package/dist/val/CopyFuncVal.js +0 -3
- package/dist/val/CopyFuncVal.js.map +1 -1
- package/dist/val/Decimal.js +0 -179
- package/dist/val/Decimal.js.map +1 -1
- package/dist/val/DeprecateFuncVal.js.map +1 -1
- package/dist/val/DisjunctVal.js +0 -152
- package/dist/val/DisjunctVal.js.map +1 -1
- package/dist/val/EachFuncVal.js +0 -3
- package/dist/val/EachFuncVal.js.map +1 -1
- package/dist/val/EmitFuncVal.d.ts +1 -1
- package/dist/val/EmitFuncVal.js +6 -119
- package/dist/val/EmitFuncVal.js.map +1 -1
- package/dist/val/ExpectVal.js +0 -62
- package/dist/val/ExpectVal.js.map +1 -1
- package/dist/val/FilterFuncVal.js +0 -25
- package/dist/val/FilterFuncVal.js.map +1 -1
- package/dist/val/FuncBaseVal.d.ts +1 -0
- package/dist/val/FuncBaseVal.js +7 -127
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/GraphAtomVal.js +0 -15
- package/dist/val/GraphAtomVal.js.map +1 -1
- package/dist/val/HideFuncVal.js +0 -13
- package/dist/val/HideFuncVal.js.map +1 -1
- package/dist/val/IntegerVal.js +0 -61
- package/dist/val/IntegerVal.js.map +1 -1
- package/dist/val/JunctionVal.js +0 -20
- package/dist/val/JunctionVal.js.map +1 -1
- package/dist/val/KeyFuncVal.js +0 -46
- package/dist/val/KeyFuncVal.js.map +1 -1
- package/dist/val/ListVal.js +0 -57
- package/dist/val/ListVal.js.map +1 -1
- package/dist/val/LowerFuncVal.js +0 -11
- package/dist/val/LowerFuncVal.js.map +1 -1
- package/dist/val/MapVal.js +0 -151
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/MatchFuncVal.js +0 -27
- package/dist/val/MatchFuncVal.js.map +1 -1
- package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
- package/dist/val/MaybeFuncVal.js +50 -0
- package/dist/val/MaybeFuncVal.js.map +1 -0
- package/dist/val/MoveFuncVal.js +0 -18
- package/dist/val/MoveFuncVal.js.map +1 -1
- package/dist/val/NilVal.js +0 -60
- package/dist/val/NilVal.js.map +1 -1
- package/dist/val/NomFuncVal.js +18 -54
- package/dist/val/NomFuncVal.js.map +1 -1
- package/dist/val/NumberVal.js +0 -15
- package/dist/val/NumberVal.js.map +1 -1
- package/dist/val/OpBaseVal.d.ts +1 -0
- package/dist/val/OpBaseVal.js +3 -15
- package/dist/val/OpBaseVal.js.map +1 -1
- package/dist/val/PackFuncVal.js +0 -34
- package/dist/val/PackFuncVal.js.map +1 -1
- package/dist/val/PathFuncVal.js +0 -6
- package/dist/val/PathFuncVal.js.map +1 -1
- package/dist/val/PathVal.js +0 -41
- package/dist/val/PathVal.js.map +1 -1
- package/dist/val/PlaceVal.js +0 -25
- package/dist/val/PlaceVal.js.map +1 -1
- package/dist/val/PlusOpVal.d.ts +1 -7
- package/dist/val/PlusOpVal.js +13 -74
- package/dist/val/PlusOpVal.js.map +1 -1
- package/dist/val/PrefFuncVal.js +0 -1
- package/dist/val/PrefFuncVal.js.map +1 -1
- package/dist/val/PrefVal.js +0 -167
- package/dist/val/PrefVal.js.map +1 -1
- package/dist/val/RecurseVal.js +0 -55
- package/dist/val/RecurseVal.js.map +1 -1
- package/dist/val/RefVal.js +0 -282
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/ReferFuncVal.js +3 -232
- package/dist/val/ReferFuncVal.js.map +1 -1
- package/dist/val/ScalarKindVal.js +0 -49
- package/dist/val/ScalarKindVal.js.map +1 -1
- package/dist/val/ScalarVal.js +0 -11
- package/dist/val/ScalarVal.js.map +1 -1
- package/dist/val/StrFuncVal.js +0 -18
- package/dist/val/StrFuncVal.js.map +1 -1
- package/dist/val/SuperFuncVal.js +0 -32
- package/dist/val/SuperFuncVal.js.map +1 -1
- package/dist/val/TopVal.js +0 -1
- package/dist/val/TopVal.js.map +1 -1
- package/dist/val/TranslateFuncVal.js +1 -3
- package/dist/val/TranslateFuncVal.js.map +1 -1
- package/dist/val/UpperFuncVal.js +0 -11
- package/dist/val/UpperFuncVal.js.map +1 -1
- package/dist/val/Val.d.ts +1 -0
- package/dist/val/Val.js +2 -133
- package/dist/val/Val.js.map +1 -1
- package/dist/val/VarVal.js +0 -12
- package/dist/val/VarVal.js.map +1 -1
- package/dist/val/arith.js +0 -37
- package/dist/val/arith.js.map +1 -1
- package/dist/val/caserange.js +0 -61
- package/dist/val/caserange.js.map +1 -1
- package/dist/val/members.js +0 -6
- package/dist/val/members.js.map +1 -1
- package/dist/val/numcmp.js +0 -11
- package/dist/val/numcmp.js.map +1 -1
- package/dist/val/numkind.js +0 -145
- package/dist/val/numkind.js.map +1 -1
- package/dist/val/valutil.js +0 -16
- package/dist/val/valutil.js.map +1 -1
- package/dist/vet.js +0 -461
- package/dist/vet.js.map +1 -1
- package/dist/view.js +0 -414
- package/dist/view.js.map +1 -1
- package/dist/walk.js +0 -41
- package/dist/walk.js.map +1 -1
- package/grammar/aontu.abnf +8 -6
- package/grammar/aontu.gbnf +4 -4
- package/grammar/aontu.lark +4 -4
- package/grammar/aontu.tmLanguage.json +1 -1
- package/package.json +4 -2
- package/skill/tasks.md +9 -7
- package/src/agentsmd.ts +0 -35
- package/src/alias.ts +0 -39
- package/src/allow.ts +1 -96
- package/src/aontu.ts +4 -116
- package/src/aontumodel.ts +26 -0
- package/src/casing.ts +95 -0
- package/src/cli.ts +258 -1024
- package/src/ctx.ts +0 -103
- package/src/diff.ts +0 -40
- package/src/err.ts +0 -40
- package/src/escape.ts +0 -46
- package/src/exactjson.ts +0 -131
- package/src/format.ts +14 -257
- package/src/grammar.ts +72 -0
- package/src/graph.ts +0 -61
- package/src/hcanon.ts +0 -82
- package/src/helpdoc.ts +2 -2
- package/src/hints.ts +69 -57
- package/src/jsonschema.ts +0 -123
- package/src/keyorder.ts +0 -42
- package/src/lang.ts +19 -931
- package/src/lsp-server.ts +0 -16
- package/src/lsp.ts +12 -180
- package/src/mcp-server.ts +0 -31
- package/src/mcp.ts +0 -169
- package/src/mod-tool.ts +18 -159
- package/src/mod.ts +0 -178
- package/src/patch.ts +0 -232
- package/src/profile.ts +42 -0
- package/src/provenance.ts +0 -183
- package/src/query.ts +0 -84
- package/src/reach.ts +0 -53
- package/src/relation.ts +0 -84
- package/src/report-sarif.ts +0 -48
- package/src/sig.ts +0 -35
- package/src/sigdecl.ts +1 -1
- package/src/siggate.ts +0 -30
- package/src/site.ts +3 -29
- package/src/subsume.ts +1 -161
- package/src/template.ts +69 -140
- package/src/trace.ts +157 -0
- package/src/trim.ts +0 -53
- package/src/type.ts +2 -45
- package/src/unify.ts +14 -257
- package/src/utility.ts +0 -31
- package/src/val/AbnfFuncVal.ts +181 -0
- package/src/val/AbsentVal.ts +54 -0
- package/src/val/AggFuncVal.ts +152 -188
- package/src/val/ArithFuncVal.ts +0 -20
- package/src/val/BagVal.ts +1 -78
- package/src/val/BigDecimalVal.ts +0 -16
- package/src/val/BigIntegerVal.ts +0 -16
- package/src/val/CloseFuncVal.ts +0 -9
- package/src/val/CmpFuncVal.ts +68 -184
- package/src/val/ConjunctVal.ts +0 -33
- package/src/val/ConstraintVal.ts +2 -537
- package/src/val/ContainerKindVal.ts +0 -18
- package/src/val/CopyFuncVal.ts +0 -5
- package/src/val/Decimal.ts +1 -185
- package/src/val/DeprecateFuncVal.ts +0 -10
- package/src/val/DisjunctVal.ts +0 -157
- package/src/val/EachFuncVal.ts +0 -40
- package/src/val/EmitFuncVal.ts +8 -208
- package/src/val/ExpectVal.ts +0 -62
- package/src/val/FilterFuncVal.ts +0 -55
- package/src/val/FuncBaseVal.ts +9 -130
- package/src/val/GraphAtomVal.ts +0 -42
- package/src/val/HideFuncVal.ts +0 -15
- package/src/val/IntegerVal.ts +0 -61
- package/src/val/JunctionVal.ts +0 -20
- package/src/val/KeyFuncVal.ts +0 -48
- package/src/val/ListVal.ts +0 -59
- package/src/val/LowerFuncVal.ts +0 -12
- package/src/val/MapVal.ts +0 -151
- package/src/val/MatchFuncVal.ts +0 -59
- package/src/val/MaybeFuncVal.ts +86 -0
- package/src/val/MoveFuncVal.ts +0 -20
- package/src/val/NilVal.ts +0 -60
- package/src/val/NomFuncVal.ts +10 -99
- package/src/val/NumberVal.ts +0 -16
- package/src/val/OpBaseVal.ts +4 -17
- package/src/val/PackFuncVal.ts +0 -63
- package/src/val/PathFuncVal.ts +0 -32
- package/src/val/PathVal.ts +0 -66
- package/src/val/PlaceVal.ts +0 -45
- package/src/val/PlusOpVal.ts +18 -75
- package/src/val/PrefFuncVal.ts +0 -1
- package/src/val/PrefVal.ts +0 -179
- package/src/val/RecurseVal.ts +0 -81
- package/src/val/RefVal.ts +1 -285
- package/src/val/ReferFuncVal.ts +4 -255
- package/src/val/ScalarKindVal.ts +0 -50
- package/src/val/ScalarVal.ts +0 -12
- package/src/val/StrFuncVal.ts +0 -44
- package/src/val/SuperFuncVal.ts +0 -42
- package/src/val/TopVal.ts +0 -1
- package/src/val/TranslateFuncVal.ts +1 -51
- package/src/val/UpperFuncVal.ts +0 -12
- package/src/val/Val.ts +3 -192
- package/src/val/VarVal.ts +0 -15
- package/src/val/arith.ts +0 -92
- package/src/val/caserange.ts +0 -62
- package/src/val/members.ts +0 -23
- package/src/val/numcmp.ts +1 -27
- package/src/val/numkind.ts +0 -149
- package/src/val/valutil.ts +0 -16
- package/src/vet.ts +1 -582
- package/src/view.ts +0 -507
- package/src/walk.ts +0 -41
- package/dist/lower.d.ts +0 -23
- package/dist/lower.js +0 -578
- package/dist/lower.js.map +0 -1
- package/dist/render.d.ts +0 -53
- package/dist/render.js +0 -547
- package/dist/render.js.map +0 -1
- package/dist/std.d.ts +0 -3
- package/dist/std.js +0 -672
- package/dist/std.js.map +0 -1
- package/dist/val/FormFuncVal.js +0 -55
- package/dist/val/FormFuncVal.js.map +0 -1
- package/dist/val/NamerFuncVal.d.ts +0 -12
- package/dist/val/NamerFuncVal.js +0 -176
- package/dist/val/NamerFuncVal.js.map +0 -1
- package/src/lower.ts +0 -636
- package/src/render.ts +0 -732
- package/src/std.ts +0 -683
package/dist/view.js
CHANGED
|
@@ -5,46 +5,6 @@ exports.viewDefaultProfile = viewDefaultProfile;
|
|
|
5
5
|
exports.view = view;
|
|
6
6
|
exports.viewTree = viewTree;
|
|
7
7
|
exports.viewSet = viewSet;
|
|
8
|
-
// THE VIEWS (docs/design/VIEWS.0.md and VIEWS-ORDER.0.md): figures of
|
|
9
|
-
// an evaluated document, drawn as deterministic text a golden diff can
|
|
10
|
-
// check. Nine kinds:
|
|
11
|
-
//
|
|
12
|
-
// doc the shape of the document itself
|
|
13
|
-
// lattice the language's value lattice, with the document's own
|
|
14
|
-
// values placed on it
|
|
15
|
-
// tree the dependency tree of one relation
|
|
16
|
-
// matrix the dependency matrix over one relation, in canon or
|
|
17
|
-
// partition order, with closure and the unmirrored mark
|
|
18
|
-
// graph the node-link drawing, as Mermaid, DOT or an ER diagram
|
|
19
|
-
// layer the architecture layers: stacked bands, one per value of
|
|
20
|
-
// a field, with the relation's upward edges called out
|
|
21
|
-
// sets the set-intersection panel over a named set family
|
|
22
|
-
// layers which document contributed which path (provenance)
|
|
23
|
-
// ladder the meet ladder at one path (the `why` record, drawn)
|
|
24
|
-
// poset the subsumption order over a set of documents
|
|
25
|
-
//
|
|
26
|
-
// A view consumes a REPORT, never the Val tree: the edge set `graphOf`
|
|
27
|
-
// derives (ts/src/graph.ts), the relation declarations, the generated
|
|
28
|
-
// value, the provenance record, the subsumption verdict. That is what
|
|
29
|
-
// keeps the two ports at parity -- Go's exported Val interface is five
|
|
30
|
-
// methods, and a Val-walking view would be TypeScript-only on the day
|
|
31
|
-
// it landed.
|
|
32
|
-
//
|
|
33
|
-
// Everything here is deterministic: nodes and edges are sorted by code
|
|
34
|
-
// point before emission, nothing iterates a map in insertion order, no
|
|
35
|
-
// coordinate is computed and no number is formatted beyond its decimal
|
|
36
|
-
// digits. The Go twin is go/view.go; what the two ports must agree on
|
|
37
|
-
// -- the rendered text, the loss report and the refusals -- is
|
|
38
|
-
// test/spec/view.tsv.
|
|
39
|
-
//
|
|
40
|
-
// EVERY RUN CARRIES A LOSS REPORT: what the figure could not draw, or
|
|
41
|
-
// drew differently from the model, aggregated by code with a count.
|
|
42
|
-
// Three codes are informational -- `edges_deduped` (several written
|
|
43
|
-
// positions, one fact), `inverse_suppressed` (a declared mirror,
|
|
44
|
-
// implied by the edge drawn) and `crossings` (a property of the
|
|
45
|
-
// emitted order, not of the model) -- and leave the verdict `rendered`. Every
|
|
46
|
-
// other code makes it `lossy`, which `--strict` refuses: a figure that
|
|
47
|
-
// quietly omits things is the failure this capability exists to avoid.
|
|
48
8
|
const node_path_1 = require("node:path");
|
|
49
9
|
const aontu_1 = require("./aontu");
|
|
50
10
|
const vet_1 = require("./vet");
|
|
@@ -54,9 +14,6 @@ const provenance_1 = require("./provenance");
|
|
|
54
14
|
const query_1 = require("./query");
|
|
55
15
|
const subsume_1 = require("./subsume");
|
|
56
16
|
const utility_1 = require("./utility");
|
|
57
|
-
// The text profile's mechanism: the eight named colours, `bold` and
|
|
58
|
-
// `dim`, and nothing else. `label` is unstyled -- an entity's own name
|
|
59
|
-
// is the figure's content, not a mark about it.
|
|
60
17
|
const SGR = {
|
|
61
18
|
label: '', muted: '2', rule: '2', direct: '1', closure: '36',
|
|
62
19
|
unmirrored: '33', upward: '31', repeat: '2', bar: '36', hole: '2',
|
|
@@ -65,10 +22,6 @@ const PLAIN = (_role, text) => text;
|
|
|
65
22
|
const ANSI = (role, text) => '' === SGR[role] || '' === text
|
|
66
23
|
? text : `\x1b[${SGR[role]}m${text}\x1b[0m`;
|
|
67
24
|
const painter = (style) => 'ansi' === style ? ANSI : PLAIN;
|
|
68
|
-
// The style a figure gets when the caller named none. An SVG carries
|
|
69
|
-
// its stylesheet, which is what makes it standalone and what every
|
|
70
|
-
// pinned golden holds; everything else carries no mechanism, since a
|
|
71
|
-
// library cannot see whether its output is a terminal.
|
|
72
25
|
const styleOf = (style, as) => style ?? ('svg' === as ? 'css' : 'none');
|
|
73
26
|
// Each kind's profiles, the first being its default. There is no
|
|
74
27
|
// global default, because there is no sensible text form of a
|
|
@@ -109,18 +62,9 @@ function finding(code, cls, path, message, note) {
|
|
|
109
62
|
...(undefined === note ? {} : { note }),
|
|
110
63
|
};
|
|
111
64
|
}
|
|
112
|
-
// A relation that draws nothing is a typo, and is refused for the same
|
|
113
|
-
// reason a misspelled root is: an empty figure and a misspelled name
|
|
114
|
-
// are the same file on disk, so the one that means nothing must not be
|
|
115
|
-
// renderable. NOT `refer_unresolved`: a relation name is not an
|
|
116
|
-
// address.
|
|
117
65
|
function relationFinding(relation, have) {
|
|
118
66
|
return finding('view_relation_unknown', 'reference', '$', `${relation} names no relation with edges in this document.`, 'relations with edges: ' + have.join(', '));
|
|
119
67
|
}
|
|
120
|
-
// A root is a node of the DRAWN graph, the rule the node set follows:
|
|
121
|
-
// a path that exists in the document but takes no part in the relation
|
|
122
|
-
// is not in the drawing, and a root naming it is refused rather than
|
|
123
|
-
// drawn as an empty tree.
|
|
124
68
|
function rootFinding(root, relation, nodes) {
|
|
125
69
|
return finding('refer_unresolved', 'reference', '$', `${root} is not a node of the ` +
|
|
126
70
|
`${undefined === relation ? '' : relation + ' '}graph.`, 0 === nodes.length ? undefined : 'nodes in the graph: ' + nodes.join(', '));
|
|
@@ -141,20 +85,6 @@ function lineBreakFinding(path) {
|
|
|
141
85
|
function under(path, at) {
|
|
142
86
|
return undefined === at || path === at || path.startsWith(at + '.');
|
|
143
87
|
}
|
|
144
|
-
// The deduplicated edge set, with the hidden contributions and the
|
|
145
|
-
// out-of-scope edges removed and the loss report told.
|
|
146
|
-
//
|
|
147
|
-
// `graphOf` emits one edge per WRITTEN POSITION by design, because each
|
|
148
|
-
// `at` is an editable site, and an identity-merged model declares each
|
|
149
|
-
// entity at two positions. Deduplication is part of the extraction
|
|
150
|
-
// contract, not a renderer's private cleverness, and the count is
|
|
151
|
-
// reported so nobody has to guess which number they are looking at.
|
|
152
|
-
//
|
|
153
|
-
// A HIDDEN edge -- one written inside a `hide()`-marked subtree -- is
|
|
154
|
-
// not drawn. A figure is committed to a repository, so anything drawn
|
|
155
|
-
// is disclosed, and the subtree's whole purpose is to say "not
|
|
156
|
-
// output". It is reported with its path instead, and `--strict`
|
|
157
|
-
// refuses the figure.
|
|
158
88
|
function triplesOf(graph, at, loss) {
|
|
159
89
|
const edges = graph.edges;
|
|
160
90
|
const hidden = [];
|
|
@@ -177,10 +107,6 @@ function triplesOf(graph, at, loss) {
|
|
|
177
107
|
detail: hidden.sort(keyorder_1.cmpCodePoint),
|
|
178
108
|
});
|
|
179
109
|
}
|
|
180
|
-
// A link under an UNRESOLVED DISJUNCTION is not an edge (ADR-007),
|
|
181
|
-
// and the figure says so rather than dropping it in silence: the
|
|
182
|
-
// document has not decided, and a drawing that quietly picked an arm
|
|
183
|
-
// would be inventing the decision.
|
|
184
110
|
const undecided = (graph.disjunct ?? []).filter((p) => under(p, at));
|
|
185
111
|
if (0 < undecided.length) {
|
|
186
112
|
loss.push({
|
|
@@ -211,21 +137,6 @@ function nodesOf(triples) {
|
|
|
211
137
|
}
|
|
212
138
|
return [...ns].sort(keyorder_1.cmpCodePoint);
|
|
213
139
|
}
|
|
214
|
-
// THE SHORTEST SUFFIX THAT IS STILL UNIQUE, as a node's visible label.
|
|
215
|
-
//
|
|
216
|
-
// A node's name IS its path (ADR-014), and the paths in a real model
|
|
217
|
-
// are long: eight nodes labelled `$.catalog.domains.identity.services.auth`
|
|
218
|
-
// and its siblings is a correct diagram nobody can read. The label is
|
|
219
|
-
// therefore the fewest trailing segments that still tell this node from
|
|
220
|
-
// every other in the same drawing -- `auth` where that is unambiguous,
|
|
221
|
-
// `identity.auth` where it is not.
|
|
222
|
-
//
|
|
223
|
-
// The rule is a function of the node SET, so a drawing is deterministic
|
|
224
|
-
// while two drawings of different slices may label the same node
|
|
225
|
-
// differently -- which is correct, because uniqueness is a property of
|
|
226
|
-
// the set being drawn. The search is unbounded on purpose: at the full
|
|
227
|
-
// segment count the candidate is the whole path, which no other node
|
|
228
|
-
// shares, so it always ends.
|
|
229
140
|
function labelsOf(nodes) {
|
|
230
141
|
const segs = new Map(nodes.map((n) => [n, n.replace(/^\$\.?/, '').split('.')]));
|
|
231
142
|
const out = new Map();
|
|
@@ -272,13 +183,6 @@ const lpad = (s, n) => ' '.repeat(Math.max(0, n - s.length)) + s;
|
|
|
272
183
|
const widest = (ss) => ss.reduce((w, s) => Math.max(w, s.length), 0);
|
|
273
184
|
// ---------------------------------------------------------------------
|
|
274
185
|
// Identifiers and escapes (VIEWS.0.md, "The renderers and the profiles")
|
|
275
|
-
// Injective by construction, with two disjoint prefixes and one
|
|
276
|
-
// predicate: `n_` + the name when its first code point is an ASCII
|
|
277
|
-
// letter and every code point is an ASCII letter, digit or `_`;
|
|
278
|
-
// otherwise `nq_` + the name with every other code point replaced by
|
|
279
|
-
// `_` and its lower-case hex. A code-point class test, not a regular
|
|
280
|
-
// expression: pattern matching is the one subsystem with a stated
|
|
281
|
-
// RE2-versus-RegExp divergence, and an encoder runs on every name.
|
|
282
186
|
function ident(name) {
|
|
283
187
|
const letter = (c) => (65 <= c && c <= 90) || (97 <= c && c <= 122);
|
|
284
188
|
const digit = (c) => 48 <= c && c <= 57;
|
|
@@ -295,11 +199,6 @@ function ident(name) {
|
|
|
295
199
|
}
|
|
296
200
|
return out;
|
|
297
201
|
}
|
|
298
|
-
// One pass, per code point, from a table keyed by DECIMAL CODE POINT.
|
|
299
|
-
// Mermaid: numeric entities only, never HTML names, so there is no
|
|
300
|
-
// name table to diverge; 124 is in it because `|` is the edge-label
|
|
301
|
-
// delimiter. DOT: the two escapes that also make it impossible for user
|
|
302
|
-
// text to forge DOT's own `\n` / `\l` / `\r` justification escapes.
|
|
303
202
|
const MERMAID_ESC = {
|
|
304
203
|
34: '#34;', 35: '#35;', 38: '#38;', 60: '#60;', 62: '#62;',
|
|
305
204
|
123: '#123;', 124: '#124;', 125: '#125;',
|
|
@@ -313,21 +212,9 @@ function escape(text, table) {
|
|
|
313
212
|
}
|
|
314
213
|
return out;
|
|
315
214
|
}
|
|
316
|
-
// U+000A, U+000D, U+2028 and U+2029: the four code points that end a
|
|
317
|
-
// line somewhere.
|
|
318
215
|
function hasLineBreak(text) {
|
|
319
216
|
return /[\n\r\u2028\u2029]/.test(text);
|
|
320
217
|
}
|
|
321
|
-
// ---------------------------------------------------------------------
|
|
322
|
-
// SVG (VIEWS.0.md, "No SVG in v1" -- the phase after the text kinds)
|
|
323
|
-
//
|
|
324
|
-
// The cell-based kinds draw into SVG under the INTEGER RULE: every
|
|
325
|
-
// coordinate is a whole number of a fixed cell -- 8 units per
|
|
326
|
-
// character, 20 per line -- from the same counts that lay the text
|
|
327
|
-
// figure out, so no font is measured and both ports emit the same
|
|
328
|
-
// bytes. The reader's browser shapes the text; the geometry is ours.
|
|
329
|
-
// A figure is standalone (its own style block, with default colours)
|
|
330
|
-
// and themeable (every colour a CSS variable a host page can set).
|
|
331
218
|
const CH = 8;
|
|
332
219
|
const LH = 20;
|
|
333
220
|
const PAD = 8;
|
|
@@ -353,11 +240,6 @@ const svgEsc = (s) => escape(s, SVG_ESC);
|
|
|
353
240
|
// The document: a viewBox the size of the figure, the style, and the
|
|
354
241
|
// parts, one per line, so the bytes read as a figure and diff as one.
|
|
355
242
|
function svgDoc(w, h, about, parts, style) {
|
|
356
|
-
// The CLASSES are structure and are always written -- a rect that
|
|
357
|
-
// does not say whether it is a direct cell or a closure cell is not
|
|
358
|
-
// a figure. What `--style none` drops is the STYLESHEET, for a host
|
|
359
|
-
// page that has already bound the variables and would otherwise
|
|
360
|
-
// carry one copy of these rules per embedded figure.
|
|
361
243
|
return [
|
|
362
244
|
`<svg xmlns="http://www.w3.org/2000/svg" class="av" viewBox="0 0 ${w} ${h}" ` +
|
|
363
245
|
`width="${w}" height="${h}" role="img" aria-label="${svgEsc(about)}">`,
|
|
@@ -381,17 +263,6 @@ function svgRect(x, y, w, h, cls) {
|
|
|
381
263
|
function svgPath(d, cls) {
|
|
382
264
|
return `<path d="${d}" class="${cls}"/>`;
|
|
383
265
|
}
|
|
384
|
-
// THE EDGE SET WITH DECLARED INVERSE PAIRS COLLAPSED to one logical
|
|
385
|
-
// edge, the tree's way: a relation with a declared inverse arrives
|
|
386
|
-
// twice -- once per direction -- and drawing it raw doubles every such
|
|
387
|
-
// relation.
|
|
388
|
-
//
|
|
389
|
-
// WHAT IS NOT COLLAPSED IS A MUTUAL RELATION: `a dependsOn b` and `b
|
|
390
|
-
// dependsOn a` are two facts under ONE key, and folding them into a
|
|
391
|
-
// single undirected edge erases the shortest cycle a model can have.
|
|
392
|
-
// The collapse is therefore per KEY PAIR rather than per node pair --
|
|
393
|
-
// two keys facing each other are an inverse, one key facing itself is
|
|
394
|
-
// a loop -- which is what makes `acyclic()`'s refusal drawable.
|
|
395
266
|
function collapse(triples, relation) {
|
|
396
267
|
const pairs = new Map();
|
|
397
268
|
for (const e of triples) {
|
|
@@ -406,15 +277,6 @@ function collapse(triples, relation) {
|
|
|
406
277
|
}
|
|
407
278
|
const out = [];
|
|
408
279
|
for (const group of pairs.values()) {
|
|
409
|
-
// ONE KEY WINS THE PAIR, and every edge written under it stands.
|
|
410
|
-
// The named relation wins; otherwise the code-point-least key,
|
|
411
|
-
// which is arbitrary but stable. Keeping every edge under the
|
|
412
|
-
// winner is what preserves a MUTUAL relation, while the losing keys
|
|
413
|
-
// are the declared inverses, implied by the winner and not drawn
|
|
414
|
-
// again. With a relation named, its inverse is implied and naming
|
|
415
|
-
// both would double the label; without one, every key is shown,
|
|
416
|
-
// because picking silently would hide that two predicates are in
|
|
417
|
-
// play.
|
|
418
280
|
const keys = keysOf(group);
|
|
419
281
|
const named = undefined !== relation && keys.includes(relation);
|
|
420
282
|
const winner = named ? relation : keys[0];
|
|
@@ -430,11 +292,6 @@ function collapse(triples, relation) {
|
|
|
430
292
|
}
|
|
431
293
|
function drawTree(all, relation, roots, max, as, style) {
|
|
432
294
|
const paint = painter(style);
|
|
433
|
-
// With a relation named, the tree is OVER THAT RELATION. A node-link
|
|
434
|
-
// diagram can label each edge and so draw every relation at once; a
|
|
435
|
-
// tree cannot without becoming unreadable, and walking two relations
|
|
436
|
-
// as though they were one would draw a containment the model does
|
|
437
|
-
// not state.
|
|
438
295
|
const kept = undefined === relation
|
|
439
296
|
? all : all.filter((e) => e.label === relation);
|
|
440
297
|
if (undefined !== relation && 0 === kept.length && 0 < all.length) {
|
|
@@ -459,10 +316,6 @@ function drawTree(all, relation, roots, max, as, style) {
|
|
|
459
316
|
for (const list of kids.values()) {
|
|
460
317
|
list.sort((x, y) => (0, keyorder_1.cmpCodePoint)(label(x.to), label(y.to)));
|
|
461
318
|
}
|
|
462
|
-
// The relation is named on the branch only where more than one is
|
|
463
|
-
// drawn. Naming the single relation on every line of a tree that has
|
|
464
|
-
// exactly one is noise; leaving it off where there are two would
|
|
465
|
-
// hide which edge was walked.
|
|
466
319
|
const many = 1 < new Set(kept.map((e) => e.label)).size;
|
|
467
320
|
const byLabel = (a, b) => (0, keyorder_1.cmpCodePoint)(label(a), label(b));
|
|
468
321
|
let named;
|
|
@@ -474,10 +327,6 @@ function drawTree(all, relation, roots, max, as, style) {
|
|
|
474
327
|
named = [...new Set(roots)].sort(byLabel);
|
|
475
328
|
}
|
|
476
329
|
else {
|
|
477
|
-
// A root is a node nothing depends on. A SELF-EDGE does not make a
|
|
478
|
-
// node depended upon for this purpose: a module that names itself
|
|
479
|
-
// would otherwise stop being a root and take its whole subtree out
|
|
480
|
-
// of the drawing.
|
|
481
330
|
const depended = new Set(kept.filter((e) => e.to !== e.from).map((e) => e.to));
|
|
482
331
|
named = nodes.filter((n) => !depended.has(n)).sort(byLabel);
|
|
483
332
|
}
|
|
@@ -492,11 +341,6 @@ function drawTree(all, relation, roots, max, as, style) {
|
|
|
492
341
|
out.push(label(root));
|
|
493
342
|
rows.push({ depth: 0, text: label(root), mark: '', parent: rows.length });
|
|
494
343
|
expanded.add(root);
|
|
495
|
-
// ITERATIVE, with the ancestor chain carried as a set that is added
|
|
496
|
-
// to on the way down and removed from on the way up. A recursive
|
|
497
|
-
// walk is O(depth) stack frames and a deep dependency chain is a
|
|
498
|
-
// real shape, so the drawing of a model must not depend on how deep
|
|
499
|
-
// the interpreter lets it go.
|
|
500
344
|
const chain = new Set([root]);
|
|
501
345
|
const stack = [{ node: root, prefix: '', at: 0, row: rows.length - 1 }];
|
|
502
346
|
while (0 < stack.length) {
|
|
@@ -533,13 +377,6 @@ function drawTree(all, relation, roots, max, as, style) {
|
|
|
533
377
|
for (const root of named) {
|
|
534
378
|
draw(root);
|
|
535
379
|
}
|
|
536
|
-
// EVERY NODE IS DRAWN. A component whose nodes all depend on each
|
|
537
|
-
// other has no node nothing depends on, so the derived roots miss it
|
|
538
|
-
// entirely -- and a graph with roots elsewhere would drop it in
|
|
539
|
-
// silence, which is the one thing a drawing must not do. The
|
|
540
|
-
// least-labelled node left is taken as a root of its own, until
|
|
541
|
-
// nothing is left. An explicitly named root is a request for one
|
|
542
|
-
// subtree and is left alone.
|
|
543
380
|
if (0 === roots.length) {
|
|
544
381
|
for (const n of nodes) {
|
|
545
382
|
if (!expanded.has(n)) {
|
|
@@ -553,10 +390,6 @@ function drawTree(all, relation, roots, max, as, style) {
|
|
|
553
390
|
: out.join('\n'),
|
|
554
391
|
};
|
|
555
392
|
}
|
|
556
|
-
// The tree as SVG: one line per row, each node indented one unit per
|
|
557
|
-
// depth, joined to its parent by a path that drops from the parent's
|
|
558
|
-
// row and turns in to the child. The marks are muted text after the
|
|
559
|
-
// label.
|
|
560
393
|
function treeSvg(rows, about, style) {
|
|
561
394
|
const U = 24;
|
|
562
395
|
const parts = [];
|
|
@@ -581,40 +414,6 @@ function treeSvg(rows, about, style) {
|
|
|
581
414
|
}
|
|
582
415
|
// ---------------------------------------------------------------------
|
|
583
416
|
// The document tree
|
|
584
|
-
// THE SHAPE OF THE MODEL ITSELF, which no other kind draws. Every
|
|
585
|
-
// other figure here reads a REPORT -- the edge set, the provenance
|
|
586
|
-
// record, the subsumption order -- and so can only draw a document
|
|
587
|
-
// that has links, contributions or peers. A reader meeting a model for
|
|
588
|
-
// the first time wants the plainer thing first: what is in it, and how
|
|
589
|
-
// it is arranged.
|
|
590
|
-
//
|
|
591
|
-
// This is `get --keys --types` as a picture, and it reads the same
|
|
592
|
-
// walk: map keys in code-point order, list indices in order, and a
|
|
593
|
-
// leaf's KIND rather than its value -- the canon of a scalar's type,
|
|
594
|
-
// not the scalar. Values are what the document is for; the shape is
|
|
595
|
-
// what a reader needs before any of them mean anything.
|
|
596
|
-
//
|
|
597
|
-
// DEPTH IS A BOUND, NOT AN ELISION MARK. Below it the subtree is not
|
|
598
|
-
// drawn and the row says how many keys were not drawn, because a tree
|
|
599
|
-
// that stops without saying so is the one thing a structural drawing
|
|
600
|
-
// must not be.
|
|
601
|
-
// ---------------------------------------------------------------------
|
|
602
|
-
// THE VALUE LATTICE, and where this document's values sit on it.
|
|
603
|
-
//
|
|
604
|
-
// THE SCAFFOLD IS THE LANGUAGE'S, NOT THE DOCUMENT'S: `top` at the
|
|
605
|
-
// join, the four kind families under it, `path()` under `string`, the
|
|
606
|
-
// four numeric leaves under `number`, and `nil` at the meet. Every
|
|
607
|
-
// Aontu document is drawn against the SAME shape, which is what makes
|
|
608
|
-
// two of these figures comparable -- and what makes this a view of the
|
|
609
|
-
// language that a document annotates, rather than a picture assembled
|
|
610
|
-
// out of whatever the document happened to contain.
|
|
611
|
-
//
|
|
612
|
-
// See docs/unification.md for what the ordering means.
|
|
613
|
-
// The scaffold: each kind and the one above it. The ENGINE decides
|
|
614
|
-
// which kind sits under which -- kindParent in ts/src/val/ScalarKindVal.ts,
|
|
615
|
-
// and its twin in go/scalar.go -- and a test in each port holds this
|
|
616
|
-
// table to it, so adding a kind to the engine makes the figure grow a
|
|
617
|
-
// node rather than quietly leave one out.
|
|
618
417
|
const LATTICE_PARENT = [
|
|
619
418
|
['string', 'top'],
|
|
620
419
|
['path()', 'string'],
|
|
@@ -626,12 +425,6 @@ const LATTICE_PARENT = [
|
|
|
626
425
|
['boolean', 'top'],
|
|
627
426
|
['null', 'top'],
|
|
628
427
|
];
|
|
629
|
-
// The columns, left to right: the MINIMAL kinds, the ones with nothing
|
|
630
|
-
// under them. Everything else is drawn centred over the columns it
|
|
631
|
-
// covers, so this list alone fixes the figure's horizontal order -- and
|
|
632
|
-
// it puts the kinds that reach the bottom from higher up (`boolean`,
|
|
633
|
-
// `null`) on the outside, where their lines pass the numeric fan
|
|
634
|
-
// rather than crossing it.
|
|
635
428
|
const LATTICE_COLS = ['path()', 'integer', 'float', 'biginteger', 'bigdecimal', 'boolean',
|
|
636
429
|
'null'];
|
|
637
430
|
// The rows, top to bottom. `top` and `nil` are the endpoints and are
|
|
@@ -656,10 +449,6 @@ function latticeAncestors(name) {
|
|
|
656
449
|
}
|
|
657
450
|
return out;
|
|
658
451
|
}
|
|
659
|
-
// The columns one node covers: its own if it is minimal, otherwise
|
|
660
|
-
// every column beneath it. `nil` is beneath everything and above
|
|
661
|
-
// nothing, so the walk finds no column under it and the whole width is
|
|
662
|
-
// its span -- which is where it belongs.
|
|
663
452
|
function latticeSpan(name) {
|
|
664
453
|
const own = LATTICE_COLS.indexOf(name);
|
|
665
454
|
if (-1 !== own) {
|
|
@@ -670,27 +459,11 @@ function latticeSpan(name) {
|
|
|
670
459
|
.filter((i) => -1 !== i);
|
|
671
460
|
return 0 === under.length ? LATTICE_COLS.map((_, i) => i) : under;
|
|
672
461
|
}
|
|
673
|
-
// True when `parent` is immediately above `child`. NIL IS COVERED BY
|
|
674
|
-
// EVERY MINIMAL KIND: it is the meet of all of them, and the only node
|
|
675
|
-
// the parent table does not name, because nothing in the engine ever
|
|
676
|
-
// answers `nil` as a superior.
|
|
677
462
|
function latticeCovers(parent, child) {
|
|
678
463
|
return 'nil' === child
|
|
679
464
|
? -1 !== LATTICE_COLS.indexOf(parent)
|
|
680
465
|
: LATTICE_PARENT.some(([c, p]) => c === child && p === parent);
|
|
681
466
|
}
|
|
682
|
-
// WHERE ONE VALUE SITS, or undefined for a value that is not at a
|
|
683
|
-
// single point. The answers are the kinds of thing a document holds:
|
|
684
|
-
//
|
|
685
|
-
// a CONCRETE scalar sits at its kind -- `8080` is an `integer`, and
|
|
686
|
-
// `superior()` is the lattice's own answer to which;
|
|
687
|
-
// a KIND MARKER sits AT that kind -- `integer` written as a schema
|
|
688
|
-
// is the node itself, not a value under it;
|
|
689
|
-
// everything else -- a constraint, an unresolved disjunction, a
|
|
690
|
-
// reference -- is not one point. `integer & min(1)` is a REGION of
|
|
691
|
-
// the lattice and `*8080 | integer` is two places at once, so
|
|
692
|
-
// drawing either at a node would be a claim the figure cannot
|
|
693
|
-
// support. Both are counted into the loss report instead.
|
|
694
467
|
function latticePoint(v) {
|
|
695
468
|
const node = throughDoc(v);
|
|
696
469
|
if (true === node?.isNil) {
|
|
@@ -699,10 +472,6 @@ function latticePoint(v) {
|
|
|
699
472
|
if (true === node?.isTop) {
|
|
700
473
|
return 'top';
|
|
701
474
|
}
|
|
702
|
-
// A kind marker names its own node; a concrete scalar names the node
|
|
703
|
-
// above it. Either way the name has to BE one of the figure's: a
|
|
704
|
-
// kind the scaffold does not draw has nowhere to go, and saying so
|
|
705
|
-
// through the loss report is the only honest answer.
|
|
706
475
|
const name = true === node?.isScalarKind ? String(node.canon)
|
|
707
476
|
: true === node?.isScalar ? String(node.superior?.().canon) : '';
|
|
708
477
|
return LATTICE_NODES.includes(name) ? name : undefined;
|
|
@@ -749,21 +518,10 @@ function latticeCensus(root, at) {
|
|
|
749
518
|
unplaced.sort(keyorder_1.cmpCodePoint);
|
|
750
519
|
return { counts, unplaced };
|
|
751
520
|
}
|
|
752
|
-
// What one node is written as: its name, and the count of the
|
|
753
|
-
// document's values that landed on it. A node with nothing at it is
|
|
754
|
-
// still drawn -- the shape is the language's, and a figure that left
|
|
755
|
-
// the empty nodes out would be a different lattice for every document.
|
|
756
521
|
function latticeCell(counts, name) {
|
|
757
522
|
const n = (counts.get(name) ?? []).length;
|
|
758
523
|
return 0 === n ? name : `${name} (${n})`;
|
|
759
524
|
}
|
|
760
|
-
// The horizontal layout, in characters: one column per minimal kind,
|
|
761
|
-
// each as wide as the widest cell drawn over it plus a gutter, and the
|
|
762
|
-
// centre of each. The spanning nodes are narrower than the span they
|
|
763
|
-
// cover, so none of them needs a width of its own. The gutter is THREE
|
|
764
|
-
// because the SVG draws a box a character wider than its text: two of
|
|
765
|
-
// those characters are the box's own padding and the third is the gap
|
|
766
|
-
// between one box and the next.
|
|
767
525
|
const LATTICE_GUTTER = 3;
|
|
768
526
|
function latticeCols(counts) {
|
|
769
527
|
const w = LATTICE_COLS.map((col) => LATTICE_GUTTER + Math.max(...LATTICE_ROWS.flat()
|
|
@@ -785,23 +543,12 @@ function latticeAt(name, cx) {
|
|
|
785
543
|
const span = latticeSpan(name);
|
|
786
544
|
return Math.round((cx[span[0]] + cx[span[span.length - 1]]) / 2);
|
|
787
545
|
}
|
|
788
|
-
// The box-drawing glyph for one column of a rule, from the four facts
|
|
789
|
-
// that meet there: whether the rule continues left and right, and
|
|
790
|
-
// whether a stem leaves upward and downward. Deciding it this way is
|
|
791
|
-
// what lets `number` -- which is BOTH one of the many under `top` and
|
|
792
|
-
// the one above the numeric leaves -- come out as the join it is,
|
|
793
|
-
// without a case written for it. The table is total, so no column has
|
|
794
|
-
// to be asked whether it has a glyph.
|
|
795
546
|
const LATTICE_GLYPH = {
|
|
796
547
|
'....': '─', '...d': '│', '..u.': '│', '..ud': '│',
|
|
797
548
|
'.r..': '─', '.r.d': '┌', '.ru.': '└', '.rud': '├',
|
|
798
549
|
'l...': '─', 'l..d': '┐', 'l.u.': '┘', 'l.ud': '┤',
|
|
799
550
|
'lr..': '─', 'lr.d': '┬', 'lru.': '┴', 'lrud': '┼',
|
|
800
551
|
};
|
|
801
|
-
// The figure is PAINTED rather than assembled from padded strings: the
|
|
802
|
-
// nodes have to line up with the rules that join them, and a count
|
|
803
|
-
// changes a cell's width -- so the geometry is settled first, in
|
|
804
|
-
// columns, and every glyph is then written at a place already known.
|
|
805
552
|
function latticeText(counts, style) {
|
|
806
553
|
const paint = painter(style);
|
|
807
554
|
const { cx, width } = latticeCols(counts);
|
|
@@ -817,9 +564,6 @@ function latticeText(counts, style) {
|
|
|
817
564
|
roles[y][x + i] = role;
|
|
818
565
|
}
|
|
819
566
|
};
|
|
820
|
-
// A cell is its name and, where the document reached it, the count:
|
|
821
|
-
// two roles, so a terminal can mute the second without touching the
|
|
822
|
-
// first.
|
|
823
567
|
const cell = (y, name) => {
|
|
824
568
|
const text = latticeCell(counts, name);
|
|
825
569
|
const left = latticeAt(name, cx) - Math.floor(text.length / 2);
|
|
@@ -844,9 +588,6 @@ function latticeText(counts, style) {
|
|
|
844
588
|
}
|
|
845
589
|
stems(y, by);
|
|
846
590
|
};
|
|
847
|
-
// Four node rows and three joins. `open` is every node whose line
|
|
848
|
-
// downward has not been drawn yet, which is what carries `boolean`
|
|
849
|
-
// and `null` past the numeric row to the bottom rule.
|
|
850
591
|
let open = [];
|
|
851
592
|
let y = 0;
|
|
852
593
|
for (let r = 0; r < LATTICE_ROWS.length; r++) {
|
|
@@ -880,14 +621,6 @@ function latticeText(counts, style) {
|
|
|
880
621
|
return out;
|
|
881
622
|
}).join('\n');
|
|
882
623
|
}
|
|
883
|
-
// The same figure as SVG, off the same column layout, so the two
|
|
884
|
-
// profiles are one drawing in two grammars rather than two drawings.
|
|
885
|
-
// A node the document REACHES is drawn with the ordinary rule stroke
|
|
886
|
-
// (`av-box`) and one it does not with the faint one (`av-cell`),
|
|
887
|
-
// because every node is drawn whether this document reaches it or not
|
|
888
|
-
// and a reader has to see which is which without counting. NO NEW
|
|
889
|
-
// CLASS: those two already mean a box and a faint box, so a host page
|
|
890
|
-
// that themed the other figures gets this one for nothing.
|
|
891
624
|
function latticeSvg(counts, at, style) {
|
|
892
625
|
const ROWH = 3 * LH;
|
|
893
626
|
const BOXH = 26;
|
|
@@ -897,11 +630,6 @@ function latticeSvg(counts, at, style) {
|
|
|
897
630
|
LATTICE_ROWS.forEach((row, r) => row.forEach((name) => rowOf.set(name, r)));
|
|
898
631
|
const x = (name) => PAD + latticeAt(name, cx) * CH;
|
|
899
632
|
const y = (name) => PAD + BOXH / 2 + rowOf.get(name) * ROWH;
|
|
900
|
-
// Edges first, so a box always sits over the lines that reach it.
|
|
901
|
-
// The horizontal jog is placed just above the CHILD rather than
|
|
902
|
-
// halfway down, which is what keeps `boolean` and `null` -- three
|
|
903
|
-
// rows from `top` to `nil` with nothing between -- clear of the
|
|
904
|
-
// numeric row they pass.
|
|
905
633
|
const edges = [...LATTICE_PARENT,
|
|
906
634
|
...LATTICE_COLS.map((col) => ['nil', col])];
|
|
907
635
|
for (const [child, parent] of edges) {
|
|
@@ -913,9 +641,6 @@ function latticeSvg(counts, at, style) {
|
|
|
913
641
|
const text = latticeCell(counts, name);
|
|
914
642
|
const w = (text.length + 2) * CH;
|
|
915
643
|
parts.push(svgRect(x(name) - w / 2, y(name) - BOXH / 2, w, BOXH, name === text ? 'av-cell' : 'av-box'));
|
|
916
|
-
// The name and the count in ONE text element, as the tree does it:
|
|
917
|
-
// two runs on one baseline, so the count is muted without the
|
|
918
|
-
// figure having to place it.
|
|
919
644
|
parts.push(`<text x="${x(name)}" y="${y(name) + 5}" text-anchor="middle">` +
|
|
920
645
|
`<tspan class="av-t">${svgEsc(name)}</tspan>` +
|
|
921
646
|
`<tspan class="av-m">${svgEsc(text.slice(name.length))}</tspan></text>`);
|
|
@@ -923,11 +648,6 @@ function latticeSvg(counts, at, style) {
|
|
|
923
648
|
const placed = [...counts.values()].reduce((n, p) => n + p.length, 0);
|
|
924
649
|
return svgDoc(width * CH + 2 * PAD, 2 * PAD + BOXH + (LATTICE_ROWS.length - 1) * ROWH, `Value lattice at ${at}: ${placed} value(s) placed`, parts, style);
|
|
925
650
|
}
|
|
926
|
-
// The figure. The row count is fixed -- the lattice is the language's,
|
|
927
|
-
// and no option makes it smaller -- so `--max-rows` below it is still a
|
|
928
|
-
// refusal, because a figure that quietly overran a stated bound is the
|
|
929
|
-
// thing every other kind here refuses to be; the message says raise
|
|
930
|
-
// rather than narrow.
|
|
931
651
|
const LATTICE_LINES = 3 * LATTICE_ROWS.length - 2;
|
|
932
652
|
function drawLattice(root, o, max, loss) {
|
|
933
653
|
const at = o.at ?? '$';
|
|
@@ -966,13 +686,6 @@ const DEFAULT_DOC_DEPTH = 3;
|
|
|
966
686
|
function docKids(v) {
|
|
967
687
|
const node = throughDoc(v);
|
|
968
688
|
if (true === node?.isMap) {
|
|
969
|
-
// AN ALIAS DECLARATION IS NOT PART OF THE DOCUMENT
|
|
970
|
-
// (docs/reference-language.md, "Aliases"): it does not generate
|
|
971
|
-
// and it does not appear in canon. It IS a key of the root map in
|
|
972
|
-
// the value tree, which `get --keys` reports and this does not --
|
|
973
|
-
// a figure of the document's shape that showed `%Cents` beside
|
|
974
|
-
// `customers` would be drawing the declaration as data
|
|
975
|
-
// (use-cases/BUGS.md 74).
|
|
976
689
|
return Object.keys(node.peg)
|
|
977
690
|
.filter((k) => !k.startsWith('%')).sort(keyorder_1.cmpCodePoint);
|
|
978
691
|
}
|
|
@@ -995,13 +708,6 @@ function throughDoc(v) {
|
|
|
995
708
|
// is the constraint and for a scalar its value. Long canons are cut,
|
|
996
709
|
// since the figure is the shape and not the data.
|
|
997
710
|
function docLeaf(v) {
|
|
998
|
-
// A CONTAINER WITH NOTHING IN IT IS NOT A LEAF, and calling it one
|
|
999
|
-
// by writing nothing after the key would make it read as a value the
|
|
1000
|
-
// figure declined to describe. Its canon says what it is -- `{}`,
|
|
1001
|
-
// `[]`, or a template a spread wrote and no member filled.
|
|
1002
|
-
//
|
|
1003
|
-
// `canon` is a string on every Val, so there is no other-type arm to
|
|
1004
|
-
// take; the cut is the only decision here.
|
|
1005
711
|
const canon = throughDoc(v).canon;
|
|
1006
712
|
return 32 < canon.length ? canon.slice(0, 29) + '...' : canon;
|
|
1007
713
|
}
|
|
@@ -1037,11 +743,6 @@ function drawDoc(root, o, max, loss) {
|
|
|
1037
743
|
const child = throughDoc(throughDoc(frame.node).peg[key]);
|
|
1038
744
|
const kids = docKids(child);
|
|
1039
745
|
const under = stack.length < depth;
|
|
1040
|
-
// A container the depth bound stops at says how many keys are not
|
|
1041
|
-
// drawn; a leaf says what it is.
|
|
1042
|
-
// A leaf says what it is and a stopped container says how many
|
|
1043
|
-
// keys it holds; both are written after the key with one space,
|
|
1044
|
-
// and neither is ever empty (a canon has at least one character).
|
|
1045
746
|
const mark = 0 === kids.length ? ' ' + docLeaf(child)
|
|
1046
747
|
: under ? '' : ` (${kids.length})`;
|
|
1047
748
|
if (0 < kids.length && !under) {
|
|
@@ -1074,15 +775,6 @@ function drawDoc(root, o, max, loss) {
|
|
|
1074
775
|
}
|
|
1075
776
|
// ---------------------------------------------------------------------
|
|
1076
777
|
// The matrix (Ghoniem et al. 2004; Sangal et al. 2005)
|
|
1077
|
-
// THE PARTITION ORDER: leaves first. Repeatedly take every unplaced
|
|
1078
|
-
// node whose every successor is placed, in label order, as the next
|
|
1079
|
-
// layer. That is a topological sort with a canonical tiebreak, and on
|
|
1080
|
-
// an acyclic relation it yields a perfect lower triangle -- which IS
|
|
1081
|
-
// the acyclicity proof, in the picture's own shape. Where nothing can
|
|
1082
|
-
// be placed the relation has a cycle: the least unplaced node is
|
|
1083
|
-
// placed alone, the strongly connected component it sits in is
|
|
1084
|
-
// reported as `cycle_block`, and the walk continues -- the cycle's
|
|
1085
|
-
// above-diagonal cell is then the acyclicity violation, drawn.
|
|
1086
778
|
function partition(nodes, succ, reach, label, loss) {
|
|
1087
779
|
const order = nodes.slice().sort((a, b) => (0, keyorder_1.cmpCodePoint)(label(a), label(b)));
|
|
1088
780
|
const placed = new Set();
|
|
@@ -1111,9 +803,6 @@ function partition(nodes, succ, reach, label, loss) {
|
|
|
1111
803
|
}
|
|
1112
804
|
return out;
|
|
1113
805
|
}
|
|
1114
|
-
// The relation a matrix draws: the one named, else the only one with
|
|
1115
|
-
// edges, else a refusal -- a matrix over two predicates at once would
|
|
1116
|
-
// draw a containment the model does not state.
|
|
1117
806
|
function pickRelation(relation, keys) {
|
|
1118
807
|
if (undefined !== relation) {
|
|
1119
808
|
return keys.includes(relation) || 0 === keys.length
|
|
@@ -1205,11 +894,6 @@ const CELL_CLASS = {
|
|
|
1205
894
|
X: 'av-direct', '!': 'av-unmirrored', '+': 'av-closure',
|
|
1206
895
|
'.': 'av-cell', '\\': 'av-cell',
|
|
1207
896
|
};
|
|
1208
|
-
// The same five states as ROLES, for the text profile. One table per
|
|
1209
|
-
// mechanism rather than one shared one, because the two vocabularies
|
|
1210
|
-
// are not in step: SVG needs a class for the empty cell (it draws a
|
|
1211
|
-
// rect there) and the text profile has nothing to say about a `.`
|
|
1212
|
-
// beyond that it is not a mark.
|
|
1213
897
|
const CELL_ROLE = {
|
|
1214
898
|
X: 'direct', '!': 'unmirrored', '+': 'closure',
|
|
1215
899
|
'.': 'muted', '\\': 'rule',
|
|
@@ -1342,9 +1026,6 @@ function drawGraph(triples, decls, root, o, max, loss) {
|
|
|
1342
1026
|
const drawn = edges.slice().sort((a, b) => (0, keyorder_1.cmpCodePoint)(node(a.from).label, node(b.from).label)
|
|
1343
1027
|
|| (0, keyorder_1.cmpCodePoint)(node(a.to).label, node(b.to).label)
|
|
1344
1028
|
|| (0, keyorder_1.cmpCodePoint)(a.key, b.key));
|
|
1345
|
-
// Crossings in the emitted order: two edges cross when their spans
|
|
1346
|
-
// interleave. A count, not a layout -- the consumer lays the picture
|
|
1347
|
-
// out, and this says how tangled the order it is handed is.
|
|
1348
1029
|
let crossings = 0;
|
|
1349
1030
|
const span = (e) => {
|
|
1350
1031
|
const a = at.get(e.from);
|
|
@@ -1401,14 +1082,6 @@ function drawGraph(triples, decls, root, o, max, loss) {
|
|
|
1401
1082
|
out.push('}');
|
|
1402
1083
|
}
|
|
1403
1084
|
else {
|
|
1404
|
-
// Entity relationships, as Mermaid's own erDiagram. Cardinality is
|
|
1405
|
-
// not something the model states, so every relationship is drawn
|
|
1406
|
-
// many-to-many and the label carries the predicate: drawing a
|
|
1407
|
-
// cardinality the model does not assert would be an invention. An
|
|
1408
|
-
// erDiagram has no separate label -- the identifier IS what the
|
|
1409
|
-
// reader sees -- so it is the encoded label, unique by the label
|
|
1410
|
-
// rule. Every node is in some relationship, since the node set is
|
|
1411
|
-
// what the edges connect.
|
|
1412
1085
|
const esc = (s) => escape(s, MERMAID_ESC);
|
|
1413
1086
|
out.push('erDiagram');
|
|
1414
1087
|
for (const e of drawn) {
|
|
@@ -1417,19 +1090,6 @@ function drawGraph(triples, decls, root, o, max, loss) {
|
|
|
1417
1090
|
}
|
|
1418
1091
|
return { text: out.join('\n') };
|
|
1419
1092
|
}
|
|
1420
|
-
// THE LAYER DIAGRAM every architecture document has a hand-drawn
|
|
1421
|
-
// version of: one band per layer, the layers stacked with the one
|
|
1422
|
-
// nothing depends on at the top, each module in its band, and the
|
|
1423
|
-
// rule -- dependencies point DOWN -- read off the bands. The band a
|
|
1424
|
-
// node belongs to is the value of `--group-by`; the order of the
|
|
1425
|
-
// bands is DERIVED from the relation, as the partition order over the
|
|
1426
|
-
// layer-level graph (a layer depends on the layers its modules depend
|
|
1427
|
-
// on), so it is a function of the model and not of a list somebody has
|
|
1428
|
-
// to keep in step with it -- unless the model has an upward edge, when
|
|
1429
|
-
// the layer graph is cyclic and no order is derivable, which is what
|
|
1430
|
-
// `--layers` (top first) is for. A sideways edge (within one band) is
|
|
1431
|
-
// ordinary engineering and counted; an UPWARD edge is the violation
|
|
1432
|
-
// the drawing exists to show, and is named under the figure.
|
|
1433
1093
|
function drawLayer(triples, root, o, max, loss) {
|
|
1434
1094
|
if (undefined === o.groupBy) {
|
|
1435
1095
|
return {
|
|
@@ -1536,9 +1196,6 @@ function drawLayer(triples, root, o, max, loss) {
|
|
|
1536
1196
|
}
|
|
1537
1197
|
const out = [];
|
|
1538
1198
|
if ('svg' === o.as) {
|
|
1539
|
-
// The description says WHAT WAS DRAWN, because two layer figures of
|
|
1540
|
-
// one model on one page differ by exactly that, and a reader who
|
|
1541
|
-
// cannot see them has only this to tell them apart.
|
|
1542
1199
|
const drew = 'all' === edges
|
|
1543
1200
|
? `${shown.length} edges drawn, ${upward} of them upward`
|
|
1544
1201
|
: 'none' === edges
|
|
@@ -1590,14 +1247,6 @@ function drawLayer(triples, root, o, max, loss) {
|
|
|
1590
1247
|
}
|
|
1591
1248
|
return { text: out.join('\n') };
|
|
1592
1249
|
}
|
|
1593
|
-
// The layers as SVG: one band per row, its modules as boxes laid left
|
|
1594
|
-
// to right, and every SHOWN edge drawn between them -- an upward one
|
|
1595
|
-
// dashed and alert-coloured, because it is the violation the bands
|
|
1596
|
-
// cannot show on their own; a downward one straight down from the
|
|
1597
|
-
// bottom of its box to the top of the one it names; a sideways one
|
|
1598
|
-
// dipped below the boxes, since two modules of one band sit on the
|
|
1599
|
-
// same line and a straight edge between them would cross whatever
|
|
1600
|
-
// stands between.
|
|
1601
1250
|
function layerSvg(bands, shown, footer, about, style) {
|
|
1602
1251
|
const BH = 44;
|
|
1603
1252
|
const gutter = widest(bands.map((b) => b.name)) * CH + 16;
|
|
@@ -1886,20 +1535,10 @@ function docName(file, entry) {
|
|
|
1886
1535
|
? (0, node_path_1.relative)((0, node_path_1.dirname)((0, node_path_1.resolve)(entry)), file) : file;
|
|
1887
1536
|
}
|
|
1888
1537
|
function drawLayers(prov, root, entry, o, max, loss) {
|
|
1889
|
-
// Every path something met at AND THE DOCUMENT HAS A VALUE AT,
|
|
1890
|
-
// mapped to the documents that met there. A meet can happen at a
|
|
1891
|
-
// position the finished document does not have -- a template's own
|
|
1892
|
-
// child, folded into each key it is spread over -- and the panel is
|
|
1893
|
-
// about the document, so only its paths are rows. A path is shown
|
|
1894
|
-
// as `a.b.c`; the root as `$`.
|
|
1895
1538
|
const members = new Map();
|
|
1896
1539
|
const paths = [];
|
|
1897
1540
|
const atParts = undefined === o.at ? [] : (0, query_1.pathParts)(o.at);
|
|
1898
1541
|
for (const [key, rec] of prov.paths) {
|
|
1899
|
-
// A record at a position the document does not have is the Go
|
|
1900
|
-
// recorder's template ghost (use-cases/BUGS.md 70); this port's
|
|
1901
|
-
// recorder does not write one, and the two ports must skip the
|
|
1902
|
-
// same rows.
|
|
1903
1542
|
if (0 === rec.conjuncts.length || null == (0, vet_1.anchorAt)(root, '$.' + key)) {
|
|
1904
1543
|
continue;
|
|
1905
1544
|
}
|
|
@@ -1947,13 +1586,6 @@ function drawLayers(prov, root, entry, o, max, loss) {
|
|
|
1947
1586
|
}
|
|
1948
1587
|
// ---------------------------------------------------------------------
|
|
1949
1588
|
// The meet ladder (VIEWS-ORDER.0.md)
|
|
1950
|
-
// The descent from `top` through each contribution to the resolved
|
|
1951
|
-
// value, one rung per conjunct. Where the contributions are ranked
|
|
1952
|
-
// preferences the ladder IS the arbitration: fewer stars win, so the
|
|
1953
|
-
// rungs read weakest-first and the winner is the last before the
|
|
1954
|
-
// value. `why`'s record is in source order, which is not rank order,
|
|
1955
|
-
// so the rungs are SORTED -- an emitter that trusted the record would
|
|
1956
|
-
// draw an arbitration that did not happen.
|
|
1957
1589
|
function drawLadder(src, options, as, max) {
|
|
1958
1590
|
if (undefined === options.at) {
|
|
1959
1591
|
return {
|
|
@@ -2075,11 +1707,6 @@ function drawPoset(docs, options, as, max, loss, compare) {
|
|
|
2075
1707
|
if (!closure[lo][hi]) {
|
|
2076
1708
|
continue;
|
|
2077
1709
|
}
|
|
2078
|
-
// A pair the closure implies but the checker measured as
|
|
2079
|
-
// `does_not_subsume` is reported rather than absorbed: the
|
|
2080
|
-
// measured relation is a conservative under-approximation, and
|
|
2081
|
-
// an under-approximation of a transitive relation need not be
|
|
2082
|
-
// transitive.
|
|
2083
1710
|
if ('does_not_subsume' === verdict[rep(hi)][rep(lo)]) {
|
|
2084
1711
|
intransitive.push(`${classes[lo].label} < ${classes[hi].label}`);
|
|
2085
1712
|
}
|
|
@@ -2220,12 +1847,6 @@ function view(src, opts, hooks) {
|
|
|
2220
1847
|
errors: [finding('view_profile_unknown', 'reference', '$', `The ${kind} figure does not render as ${as}.`, `profiles: ${profiles.join(', ')}`)],
|
|
2221
1848
|
});
|
|
2222
1849
|
}
|
|
2223
|
-
// ONE MECHANISM PER PROFILE (VIEWS.0.md, "7. Styling"). `ansi` is
|
|
2224
|
-
// the text profile's and `css` the SVG's; asking for one on a
|
|
2225
|
-
// profile that has no way to carry it is a usage error rather than a
|
|
2226
|
-
// silent no-op, so a script that asks for colour and gets none is
|
|
2227
|
-
// told why. `none` is always available -- it is the absence of a
|
|
2228
|
-
// mechanism.
|
|
2229
1850
|
const style = styleOf(options.style, as);
|
|
2230
1851
|
const carrier = { ansi: 'text', css: 'svg' };
|
|
2231
1852
|
if (undefined !== carrier[style] && carrier[style] !== as) {
|
|
@@ -2260,13 +1881,6 @@ function view(src, opts, hooks) {
|
|
|
2260
1881
|
}
|
|
2261
1882
|
return done(drawLoaded(loaded.root, loaded.ctx, undefined, prov, kind, as, options, max, loss));
|
|
2262
1883
|
}
|
|
2263
|
-
// THE KINDS THAT DRAW FROM A LOADED MODEL, so a view document can load
|
|
2264
|
-
// once and draw N figures from the one evaluation. `gen` is the
|
|
2265
|
-
// generated value where the caller already holds it -- a view document
|
|
2266
|
-
// reads its own declarations out of one -- and undefined where the set
|
|
2267
|
-
// panel must generate its own. It is a BOX rather than the value, so
|
|
2268
|
-
// that a document generating `undefined` is still a value the panel
|
|
2269
|
-
// has rather than one it must recompute.
|
|
2270
1884
|
function drawLoaded(root, ctx, gen, prov, kind, as, options, max, loss) {
|
|
2271
1885
|
const style = styleOf(options.style, as);
|
|
2272
1886
|
if ('doc' === kind) {
|
|
@@ -2332,19 +1946,6 @@ function drawLoaded(root, ctx, gen, prov, kind, as, options, max, loss) {
|
|
|
2332
1946
|
function viewTree(src, opts) {
|
|
2333
1947
|
return view(src, { ...(opts ?? {}), kind: 'tree' });
|
|
2334
1948
|
}
|
|
2335
|
-
// ---------------------------------------------------------------------
|
|
2336
|
-
// The view document (VIEWS.0.md, "6. The view document")
|
|
2337
|
-
//
|
|
2338
|
-
// A projection that runs in CI belongs in a file. A view document is an
|
|
2339
|
-
// ORDINARY document that includes the model and declares its figures as
|
|
2340
|
-
// data; `views` is the AUTHOR's key and nothing here knows the name
|
|
2341
|
-
// (ADR-010), which is why `--views` names the path.
|
|
2342
|
-
//
|
|
2343
|
-
// The declaration keys ARE the library's option names, which are the
|
|
2344
|
-
// CLI's flag names without the dashes: one vocabulary, three doors. A
|
|
2345
|
-
// declaration must name its `kind` and its `out` -- a figure in a file
|
|
2346
|
-
// that a review reads should say what it draws and where it goes,
|
|
2347
|
-
// rather than inheriting a default from whoever ran the verb.
|
|
2348
1949
|
const DECL_TEXT = [
|
|
2349
1950
|
'kind', 'as', 'out', 'at', 'relation', 'order', 'groupBy', 'label',
|
|
2350
1951
|
'sets', 'member', 'universe', 'edges',
|
|
@@ -2419,9 +2020,6 @@ function planOf(name, decl, at) {
|
|
|
2419
2020
|
errors.push(documentFinding(`${where}.kind`, `${kind} is not a figure kind.`, 'kinds: ' + Object.keys(PROFILES).join(', ')));
|
|
2420
2021
|
}
|
|
2421
2022
|
else if ('poset' === kind) {
|
|
2422
|
-
// The poset is an order over SEVERAL documents, and a view document
|
|
2423
|
-
// declares figures of the one it includes. `aontu view poset` draws
|
|
2424
|
-
// it, naming the documents on the command line.
|
|
2425
2023
|
errors.push(documentFinding(`${where}.kind`, 'A view document draws figures of one document; ' +
|
|
2426
2024
|
'the poset compares several.'));
|
|
2427
2025
|
}
|
|
@@ -2448,13 +2046,6 @@ function planOf(name, decl, at) {
|
|
|
2448
2046
|
errors: [],
|
|
2449
2047
|
};
|
|
2450
2048
|
}
|
|
2451
|
-
// N FIGURES OF ONE DOCUMENT. The document is evaluated ONCE, with the
|
|
2452
|
-
// provenance recorder on, and every figure but the ladder draws from
|
|
2453
|
-
// that one root; the ladder re-runs `why` by construction.
|
|
2454
|
-
//
|
|
2455
|
-
// The caller writes the files, and only when the whole set rendered:
|
|
2456
|
-
// N figures of one model are only meaningful together, so a set whose
|
|
2457
|
-
// third figure refuses must not leave the first two on disk.
|
|
2458
2049
|
function viewSet(src, opts, hooks) {
|
|
2459
2050
|
const options = opts ?? {};
|
|
2460
2051
|
const at = options.views;
|
|
@@ -2465,11 +2056,6 @@ function viewSet(src, opts, hooks) {
|
|
|
2465
2056
|
'the map that declares the figures; name it with --views.')],
|
|
2466
2057
|
};
|
|
2467
2058
|
}
|
|
2468
|
-
// ONE EVALUATION, and it is INSTRUMENTED: the layers panel reads the
|
|
2469
|
-
// provenance record, which is written during unification, so a set
|
|
2470
|
-
// that declares one would otherwise need a second run. Recording it
|
|
2471
|
-
// always costs a little and makes the one-evaluation claim true for
|
|
2472
|
-
// every kind but the ladder, which re-runs `why` by construction.
|
|
2473
2059
|
const prov = (hooks?.provenance ?? (() => new provenance_1.Provenance()))();
|
|
2474
2060
|
const loaded = load(src, options.path, options, prov);
|
|
2475
2061
|
if (undefined !== loaded.errors) {
|