Docs
in package
HTML documentation for a directory of `.dxns` schema documents -- the port of `Dextrin.Schema.Docs`, writing the same site byte for byte (Jan, 2026-10-20): a sidebar tree of every namespace and definition, the index and every namespace's page in one design, the pages a directory tree with an `index.html` per namespace, every reference a link, every version shown. It reads the documents' source, not their compiled schemas.
Names come from where a file lies under the root, by DXNS.md ยง6:
acme/shop/Customer-v2.dxns, acme/shop/Order/v1.dxns and
acme.shop.Product.dxns each hold one definition, the entry named like
the file; every other entry in such a file is internal to it.
acme.common.dxns, whose entries are not named like it, is a namespace
file: each entry is acme.common/<entry>.
Table of Contents
Methods
- bodyOf() : SyntaxNode|null
- The node a `value` holds: a collection, a struct, a tag, or a scalar's body.
- isSymbol() : bool
- Whether `$node` is a symbol: a body of one identifier.
- namespaceOf() : string
- pairsOf() : array<int, array{0: mixed, 1: mixed}>
- A map's pairs, each key as DXN has it.
- references() : array<int, string>
- The names the type `$at` refers to, as `$scope` resolves them.
- resolve() : string
- The name a bare or namespaced `$name` stands for, in a file whose entries are `$scope`.
- site() : array<int, array{0: string, 1: string}>
- The documentation of every `.dxns` file under `$root`, as pages: each its path under the output directory, and its content. `$title` names the site (the root directory's name when null). Throws, naming the file, when one cannot be read.
- text() : string
- The tokens of `$node`, written together without the trivia between them.
- tokenText() : string
- The text of the token at `$index`.
-
undoc()
: At, 1: array
} - A value node without the `{:doc T %{...}}` around it, and what the doc says: its annotations by name, each value decoded -- `[]` for a value without one. An enum's `values` are a list of each value and its own annotations by name.
- valueOf() : SyntaxNode|null
- An entry's value: its last value child.
- write() : array<int, string>
- Writes the documentation of every `.dxns` file under `$root` to `$out`; answers the paths it wrote.
- __construct() : mixed
- annotationName() : string
- An annotation's key as a name: a keyword's, a string, or anything else as DXN writes it.
- classify() : }">Field>}
- definitionsOf() : array<int, Definition>
- docText() : string
- entriesOf() : array<int, At}>
- field() : Field
- fieldsOf() : array<int, Field>
- headerVersion() : int|null
- keyOf() : string
- leadingOf() : string
- The comments before a document's value; its header's tokens stand for a line break.
- merge() : Definition
- model() : array<int, Definition>
- namedNotes() : array<string, mixed>
- Annotations keyed by name, and so are each enum value's under `values`.
- partsOf() : array<int, array{gap: string}|array{entry: true}>
- A container's inside as gaps and entries, in order.
- readFile() : At}>}
- One file: where its names come from, what it says about itself, and its entries.
- source() : string
- A node's source as written, trivia included, so it decodes as it reads.
-
stemOf()
: array{0: list
, 1: ?int} - A file's dotted stem and the version its name says.
- stringValue() : string
- structName() : string|null
- The name of a struct node: the identifier after its `%`.
Methods
bodyOf()
The node a `value` holds: a collection, a struct, a tag, or a scalar's body.
public
static bodyOf(SyntaxNode $value) : SyntaxNode|null
Parameters
- $value : SyntaxNode
Return values
SyntaxNode|nullisSymbol()
Whether `$node` is a symbol: a body of one identifier.
public
static isSymbol(At $at, SyntaxNode $node) : bool
Parameters
- $at : At
- $node : SyntaxNode
Return values
boolnamespaceOf()
public
static namespaceOf(string $name) : string
Parameters
- $name : string
Return values
stringpairsOf()
A map's pairs, each key as DXN has it.
public
static pairsOf(array<int|string, mixed>|DXNMap $map) : array<int, array{0: mixed, 1: mixed}>
Parameters
- $map : array<int|string, mixed>|DXNMap
Return values
array<int, array{0: mixed, 1: mixed}>references()
The names the type `$at` refers to, as `$scope` resolves them.
public
static references(At|null $at, array<string, string> $scope) : array<int, string>
Parameters
- $at : At|null
- $scope : array<string, string>
Return values
array<int, string>resolve()
The name a bare or namespaced `$name` stands for, in a file whose entries are `$scope`.
public
static resolve(string $name, array<string, string> $scope) : string
Parameters
- $name : string
- $scope : array<string, string>
Return values
stringsite()
The documentation of every `.dxns` file under `$root`, as pages: each its path under the output directory, and its content. `$title` names the site (the root directory's name when null). Throws, naming the file, when one cannot be read.
public
static site(string $root[, string|null $title = null ]) : array<int, array{0: string, 1: string}>
Parameters
- $root : string
- $title : string|null = null
Return values
array<int, array{0: string, 1: string}>text()
The tokens of `$node`, written together without the trivia between them.
public
static text(At $at, SyntaxNode $node) : string
Parameters
- $at : At
- $node : SyntaxNode
Return values
stringtokenText()
The text of the token at `$index`.
public
static tokenText(At $at, int $index) : string
Parameters
- $at : At
- $index : int
Return values
stringundoc()
A value node without the `{:doc T %{...}}` around it, and what the doc says: its annotations by name, each value decoded -- `[]` for a value without one. An enum's `values` are a list of each value and its own annotations by name.
public
static undoc(At|null $value) : At, 1: array}
Parameters
- $value : At|null
Return values
At, 1: arrayvalueOf()
An entry's value: its last value child.
public
static valueOf(SyntaxNode $entry) : SyntaxNode|null
Parameters
- $entry : SyntaxNode
Return values
SyntaxNode|nullwrite()
Writes the documentation of every `.dxns` file under `$root` to `$out`; answers the paths it wrote.
public
static write(string $root, string $out[, string|null $title = null ]) : array<int, string>
Parameters
- $root : string
- $out : string
- $title : string|null = null
Return values
array<int, string>__construct()
private
__construct() : mixed
annotationName()
An annotation's key as a name: a keyword's, a string, or anything else as DXN writes it.
private
static annotationName(mixed $key) : string
Parameters
- $key : mixed
Return values
stringclassify()
private
static classify(At|null $value, int|null $fileVersion) : }">Field>}
Parameters
- $value : At|null
- $fileVersion : int|null
Return values
}">Field>}definitionsOf()
private
static definitionsOf(At}>} $file) : array<int, Definition>
Parameters
- $file : At}>}
Return values
array<int, Definition>docText()
private
static docText(array{above: list, after: list}|null $c) : string
Parameters
-
$c
: array{above: list
, after: list }|null
Return values
stringentriesOf()
private
static entriesOf(At $map) : array<int, At}>
Parameters
- $map : At
Return values
array<int, At}>field()
private
static field(At $at, string $name, bool $optional, SyntaxNode|null $written, string $doc, int $position) : Field
Parameters
- $at : At
- $name : string
- $optional : bool
- $written : SyntaxNode|null
- $doc : string
- $position : int
Return values
FieldfieldsOf()
private
static fieldsOf(At $struct) : array<int, Field>
Parameters
- $struct : At
Return values
array<int, Field>headerVersion()
private
static headerVersion(At $at, SyntaxNode $struct) : int|null
Parameters
- $at : At
- $struct : SyntaxNode
Return values
int|nullkeyOf()
private
static keyOf(At $at, SyntaxNode $entry) : string
Parameters
- $at : At
- $entry : SyntaxNode
Return values
stringleadingOf()
The comments before a document's value; its header's tokens stand for a line break.
private
static leadingOf(string $source, array<int, Token> $tokens, SyntaxNode|null $header, SyntaxNode $value) : string
Parameters
- $source : string
- $tokens : array<int, Token>
- $header : SyntaxNode|null
- $value : SyntaxNode
Return values
stringmerge()
private
static merge(array<int, Definition> $parts) : Definition
Parameters
- $parts : array<int, Definition>
Return values
Definitionmodel()
private
static model(array<int, At}>}> $files) : array<int, Definition>
Parameters
- $files : array<int, At}>}>
Return values
array<int, Definition>namedNotes()
Annotations keyed by name, and so are each enum value's under `values`.
private
static namedNotes(array<int|string, mixed>|DXNMap $map) : array<string, mixed>
Parameters
- $map : array<int|string, mixed>|DXNMap
Return values
array<string, mixed>partsOf()
A container's inside as gaps and entries, in order.
private
static partsOf(At $at) : array<int, array{gap: string}|array{entry: true}>
Parameters
- $at : At
Return values
array<int, array{gap: string}|array{entry: true}>readFile()
One file: where its names come from, what it says about itself, and its entries.
private
static readFile(string $root, string $file) : At}>}
Parameters
- $root : string
- $file : string
Return values
At}>}source()
A node's source as written, trivia included, so it decodes as it reads.
private
static source(At $at, SyntaxNode $node) : string
Parameters
- $at : At
- $node : SyntaxNode
Return values
stringstemOf()
A file's dotted stem and the version its name says.
private
static stemOf(string $file) : array{0: list, 1: ?int}
Parameters
- $file : string
Return values
array{0: liststringValue()
private
static stringValue(At $at, SyntaxNode $node) : string
Parameters
- $at : At
- $node : SyntaxNode
Return values
stringstructName()
The name of a struct node: the identifier after its `%`.
private
static structName(At $at, SyntaxNode|null $node) : string|null
Parameters
- $at : At
- $node : SyntaxNode|null