structured-context-map-views 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/definition-Cft28YUA.js +616 -0
- package/dist/definition-Cft28YUA.js.map +1 -0
- package/dist/index.js +1045 -0
- package/dist/index.js.map +1 -0
- package/dist/node.js +106 -0
- package/dist/node.js.map +1 -0
- package/dist/styles.css +528 -0
- package/dist/types/core/annotations.d.ts +47 -0
- package/dist/types/core/definition.d.ts +117 -0
- package/dist/types/core/format/definition-schema.d.ts +181 -0
- package/dist/types/core/format/index.d.ts +450 -0
- package/dist/types/core/format/landscape-layout.d.ts +102 -0
- package/dist/types/core/format/param-ref.d.ts +10 -0
- package/dist/types/core/format/schema-url.d.ts +7 -0
- package/dist/types/core/format/settings.d.ts +41 -0
- package/dist/types/core/format/tree-layout.d.ts +40 -0
- package/dist/types/core/format/xy-layout.d.ts +94 -0
- package/dist/types/core/graph.d.ts +16 -0
- package/dist/types/core/landscape.d.ts +44 -0
- package/dist/types/core/occurrence.d.ts +11 -0
- package/dist/types/core/tree.d.ts +45 -0
- package/dist/types/core/xy.d.ts +43 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/layouts/EdgeOverlay.d.ts +36 -0
- package/dist/types/layouts/LandscapeLayout.d.ts +8 -0
- package/dist/types/layouts/MapView.d.ts +18 -0
- package/dist/types/layouts/NodeCard.d.ts +16 -0
- package/dist/types/layouts/ParameterControls.d.ts +13 -0
- package/dist/types/layouts/ParameterInputs.d.ts +21 -0
- package/dist/types/layouts/TreeLayout.d.ts +16 -0
- package/dist/types/layouts/XYLayout.d.ts +9 -0
- package/dist/types/layouts/annotations-context.d.ts +4 -0
- package/dist/types/layouts/useParameterControls.d.ts +13 -0
- package/dist/types/node/bundled-definitions.d.ts +1 -0
- package/dist/types/node/index.d.ts +17 -0
- package/package.json +69 -4
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Settings of the landscape layout: nested containers following an authored grouping. */
|
|
2
|
+
export declare const landscapeLayoutSchema: {
|
|
3
|
+
readonly $schema: 'https://json-schema.org/draft/2020-12/schema';
|
|
4
|
+
readonly $id: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/landscape.json";
|
|
5
|
+
readonly title: 'Landscape layout';
|
|
6
|
+
readonly description: 'Nested containers: each grouping level becomes containers inside the level above, and the last level is drawn as nodes.';
|
|
7
|
+
readonly type: 'object';
|
|
8
|
+
readonly required: readonly ['type', 'group'];
|
|
9
|
+
readonly additionalProperties: false;
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly type: {
|
|
12
|
+
readonly const: 'landscape';
|
|
13
|
+
};
|
|
14
|
+
readonly orientation: {
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly default: "horizontal";
|
|
17
|
+
readonly anyOf: readonly [{
|
|
18
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/orientation";
|
|
19
|
+
}, {
|
|
20
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
21
|
+
}];
|
|
22
|
+
};
|
|
23
|
+
readonly group: {
|
|
24
|
+
readonly type: 'array';
|
|
25
|
+
readonly minItems: 1;
|
|
26
|
+
readonly description: 'Grouping levels, outermost first. The last level is drawn as nodes; the others as containers. Adjacent node levels are joined by any edge between their types, in either direction.';
|
|
27
|
+
readonly items: {
|
|
28
|
+
readonly type: 'object';
|
|
29
|
+
readonly if: {
|
|
30
|
+
readonly type: 'object';
|
|
31
|
+
readonly required: readonly ['field'];
|
|
32
|
+
};
|
|
33
|
+
readonly then: {
|
|
34
|
+
readonly type: 'object';
|
|
35
|
+
readonly description: "Containers labelled by the values of a field of the next node level's nodes. A node with several values appears under each.";
|
|
36
|
+
readonly required: readonly ['field'];
|
|
37
|
+
readonly additionalProperties: false;
|
|
38
|
+
readonly properties: {
|
|
39
|
+
readonly field: {
|
|
40
|
+
readonly type: 'string';
|
|
41
|
+
readonly minLength: 1;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly else: {
|
|
46
|
+
readonly type: 'object';
|
|
47
|
+
readonly description: 'A level of nodes of one type.';
|
|
48
|
+
readonly required: readonly ['type'];
|
|
49
|
+
readonly additionalProperties: false;
|
|
50
|
+
readonly properties: {
|
|
51
|
+
readonly type: {
|
|
52
|
+
readonly description: 'Node type at this level.';
|
|
53
|
+
readonly anyOf: readonly [{
|
|
54
|
+
readonly type: 'string';
|
|
55
|
+
readonly minLength: 1;
|
|
56
|
+
}, {
|
|
57
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
58
|
+
}];
|
|
59
|
+
};
|
|
60
|
+
readonly edge: {
|
|
61
|
+
readonly type: 'object';
|
|
62
|
+
readonly description: 'Which edges join this level to the node level above (or to the last `via` type). By default, any edge between the two types.';
|
|
63
|
+
readonly required: readonly ['field'];
|
|
64
|
+
readonly additionalProperties: false;
|
|
65
|
+
readonly properties: {
|
|
66
|
+
readonly field: {
|
|
67
|
+
readonly type: 'string';
|
|
68
|
+
readonly minLength: 1;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
readonly via: {
|
|
73
|
+
readonly type: 'array';
|
|
74
|
+
readonly minItems: 1;
|
|
75
|
+
readonly description: 'Types skipped between the node level above and this one, in order. Nodes are joined through a chain of edges across them. Ignored on the first level, which has no level above.';
|
|
76
|
+
readonly items: {
|
|
77
|
+
readonly type: 'string';
|
|
78
|
+
readonly minLength: 1;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly intermediate: {
|
|
82
|
+
readonly description: string;
|
|
83
|
+
readonly default: "hidden";
|
|
84
|
+
readonly anyOf: readonly [{
|
|
85
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/landscape.json#/$defs/intermediate";
|
|
86
|
+
}, {
|
|
87
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
88
|
+
}];
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
readonly $defs: {
|
|
96
|
+
readonly intermediate: {
|
|
97
|
+
readonly title: 'Skipped levels';
|
|
98
|
+
readonly description: 'hidden: not shown. breadcrumb: listed on each node reached through them.';
|
|
99
|
+
readonly enum: readonly ['hidden', 'breadcrumb'];
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `$ref` target for a setting whose value comes from a declared parameter. */
|
|
2
|
+
export declare const PARAM_REF: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
3
|
+
/** A setting that takes either a fixed value matching `valueSchema` or a `{ $param }` binding. */
|
|
4
|
+
export declare function parameterisable<const S extends object, const D>(valueSchema: S, defaultValue: D, description: string): {
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly default: D;
|
|
7
|
+
readonly anyOf: readonly [S, {
|
|
8
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
9
|
+
}];
|
|
10
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the format schemas are published. `latest` follows the newest format; a release that changes it
|
|
3
|
+
* freezes a copy under its own version folder (`bun run generate:schemas --release`).
|
|
4
|
+
*/
|
|
5
|
+
export declare const SCHEMA_BASE_URL = "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated";
|
|
6
|
+
/** Base of the `$id`s the sources use: the `latest` folder. */
|
|
7
|
+
export declare const SCHEMA_URL: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Reusable setting definitions. Parameters can `$ref` these and narrow them, e.g. with `allOf` and `enum`. */
|
|
2
|
+
export declare const settingsSchema: {
|
|
3
|
+
readonly $schema: 'https://json-schema.org/draft/2020-12/schema';
|
|
4
|
+
readonly $id: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json";
|
|
5
|
+
readonly title: 'Shared map view settings';
|
|
6
|
+
readonly description: 'Reusable setting definitions. Parameters can $ref these and narrow them, e.g. with allOf and enum.';
|
|
7
|
+
readonly $defs: {
|
|
8
|
+
readonly orientation: {
|
|
9
|
+
readonly title: 'Orientation';
|
|
10
|
+
readonly enum: readonly ['vertical', 'horizontal'];
|
|
11
|
+
};
|
|
12
|
+
readonly nodeStyle: {
|
|
13
|
+
readonly title: 'Node style';
|
|
14
|
+
readonly description: 'card: a box with the title and selected fields. shape: a compact marker with a tooltip.';
|
|
15
|
+
readonly enum: readonly ['card', 'shape'];
|
|
16
|
+
};
|
|
17
|
+
readonly validationLevel: {
|
|
18
|
+
readonly title: 'Validation overlay';
|
|
19
|
+
readonly description: 'The lowest severity of validation result shown on nodes, or off. error: only errors. warning: errors and warnings. info: everything.';
|
|
20
|
+
readonly enum: readonly ['off', 'error', 'warning', 'info'];
|
|
21
|
+
};
|
|
22
|
+
readonly validationSources: {
|
|
23
|
+
readonly title: 'Validation sources';
|
|
24
|
+
readonly description: 'Which kinds of validation result are shown. schema: a node failing its schema. hierarchy: a node under a parent type it is not allowed under. rule: a schema rule violation.';
|
|
25
|
+
readonly type: 'array';
|
|
26
|
+
readonly items: {
|
|
27
|
+
readonly enum: readonly ['schema', 'hierarchy', 'rule'];
|
|
28
|
+
};
|
|
29
|
+
readonly uniqueItems: true;
|
|
30
|
+
};
|
|
31
|
+
readonly fieldList: {
|
|
32
|
+
readonly title: 'Fields';
|
|
33
|
+
readonly type: 'array';
|
|
34
|
+
readonly items: {
|
|
35
|
+
readonly type: 'string';
|
|
36
|
+
readonly minLength: 1;
|
|
37
|
+
};
|
|
38
|
+
readonly uniqueItems: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Settings of the tree layout: a tree over the schema's hierarchy. */
|
|
2
|
+
export declare const treeLayoutSchema: {
|
|
3
|
+
readonly $schema: 'https://json-schema.org/draft/2020-12/schema';
|
|
4
|
+
readonly $id: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/tree.json";
|
|
5
|
+
readonly title: 'Tree layout';
|
|
6
|
+
readonly description: "A tree over the schema's hierarchy: root-type nodes at the top, children via hierarchy edges.";
|
|
7
|
+
readonly type: 'object';
|
|
8
|
+
readonly required: readonly ['type'];
|
|
9
|
+
readonly additionalProperties: false;
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly type: {
|
|
12
|
+
readonly const: 'tree';
|
|
13
|
+
};
|
|
14
|
+
readonly orientation: {
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly default: "vertical";
|
|
17
|
+
readonly anyOf: readonly [{
|
|
18
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/orientation";
|
|
19
|
+
}, {
|
|
20
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
21
|
+
}];
|
|
22
|
+
};
|
|
23
|
+
readonly dag: {
|
|
24
|
+
readonly description: string;
|
|
25
|
+
readonly default: "repeat";
|
|
26
|
+
readonly anyOf: readonly [{
|
|
27
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/tree.json#/$defs/dag";
|
|
28
|
+
}, {
|
|
29
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
30
|
+
}];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly $defs: {
|
|
34
|
+
readonly dag: {
|
|
35
|
+
readonly title: 'Nodes with several parents';
|
|
36
|
+
readonly description: 'repeat: the node appears under each parent, its subtree shown once. cross-edge: the node appears under its first parent, with extra connectors from the others.';
|
|
37
|
+
readonly enum: readonly ['repeat', 'cross-edge'];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Settings of the XY layout: nodes positioned by two numeric fields. */
|
|
2
|
+
export declare const xyLayoutSchema: {
|
|
3
|
+
readonly $schema: 'https://json-schema.org/draft/2020-12/schema';
|
|
4
|
+
readonly $id: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/xy.json";
|
|
5
|
+
readonly title: 'XY layout';
|
|
6
|
+
readonly description: 'Nodes positioned on two axes by numeric fields. Nodes of the plotted types without a usable value on both axes are listed beside the plot, not dropped.';
|
|
7
|
+
readonly type: 'object';
|
|
8
|
+
readonly required: readonly ['type', 'x', 'y'];
|
|
9
|
+
readonly additionalProperties: false;
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly type: {
|
|
12
|
+
readonly const: 'xy';
|
|
13
|
+
};
|
|
14
|
+
readonly x: {
|
|
15
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/xy.json#/$defs/axis";
|
|
16
|
+
};
|
|
17
|
+
readonly y: {
|
|
18
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/xy.json#/$defs/axis";
|
|
19
|
+
};
|
|
20
|
+
readonly types: {
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly default: readonly [];
|
|
23
|
+
readonly anyOf: readonly [{
|
|
24
|
+
readonly type: "array";
|
|
25
|
+
readonly items: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly minLength: 1;
|
|
28
|
+
};
|
|
29
|
+
readonly uniqueItems: true;
|
|
30
|
+
}, {
|
|
31
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
32
|
+
}];
|
|
33
|
+
};
|
|
34
|
+
readonly edgeFields: {
|
|
35
|
+
readonly description: string;
|
|
36
|
+
readonly default: readonly [];
|
|
37
|
+
readonly anyOf: readonly [{
|
|
38
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/settings.json#/$defs/fieldList";
|
|
39
|
+
}, {
|
|
40
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
41
|
+
}];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly $defs: {
|
|
45
|
+
readonly axis: {
|
|
46
|
+
readonly title: 'Axis';
|
|
47
|
+
readonly type: 'object';
|
|
48
|
+
readonly required: readonly ['field'];
|
|
49
|
+
readonly additionalProperties: false;
|
|
50
|
+
readonly properties: {
|
|
51
|
+
readonly field: {
|
|
52
|
+
readonly description: 'Numeric field giving the position.';
|
|
53
|
+
readonly anyOf: readonly [{
|
|
54
|
+
readonly type: 'string';
|
|
55
|
+
readonly minLength: 1;
|
|
56
|
+
}, {
|
|
57
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
58
|
+
}];
|
|
59
|
+
};
|
|
60
|
+
readonly domain: {
|
|
61
|
+
readonly description: 'Values at the two ends of the axis: [min, max], or "data" for the smallest and largest plotted values. Nodes outside a fixed domain are listed as unplaced.';
|
|
62
|
+
readonly default: 'data';
|
|
63
|
+
readonly anyOf: readonly [{
|
|
64
|
+
readonly const: 'data';
|
|
65
|
+
}, {
|
|
66
|
+
readonly type: 'array';
|
|
67
|
+
readonly items: {
|
|
68
|
+
readonly type: 'number';
|
|
69
|
+
};
|
|
70
|
+
readonly minItems: 2;
|
|
71
|
+
readonly maxItems: 2;
|
|
72
|
+
}];
|
|
73
|
+
};
|
|
74
|
+
readonly direction: {
|
|
75
|
+
readonly description: string;
|
|
76
|
+
readonly default: "ascending";
|
|
77
|
+
readonly anyOf: readonly [{
|
|
78
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/layouts/xy.json#/$defs/direction";
|
|
79
|
+
}, {
|
|
80
|
+
readonly $ref: "https://raw.githubusercontent.com/mindsocket/structured-context-map-views/main/schemas/generated/latest/definition.json#/$defs/paramRef";
|
|
81
|
+
}];
|
|
82
|
+
};
|
|
83
|
+
readonly label: {
|
|
84
|
+
readonly type: 'string';
|
|
85
|
+
readonly description: 'Axis title. Defaults to the field name.';
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
readonly direction: {
|
|
90
|
+
readonly title: 'Axis direction';
|
|
91
|
+
readonly enum: readonly ['ascending', 'descending'];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Hierarchy, SpaceGraph, SpaceNode } from 'structured-context/api';
|
|
2
|
+
type NodeId = SpaceNode['id'];
|
|
3
|
+
/** A directed parent → child edge of a space graph, carrying the metadata of the reference it came from. */
|
|
4
|
+
export type Edge = SpaceGraph['parentEdges'] extends ReadonlyMap<string, readonly (infer E)[]> ? E : never;
|
|
5
|
+
/**
|
|
6
|
+
* Edges to a node's parents, in the order the node declares them. A graph narrowed by a filter keeps
|
|
7
|
+
* edges to parents outside it; those are left out.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parentEdges(graph: SpaceGraph, id: NodeId): readonly Edge[];
|
|
10
|
+
/** Edges to a node's children, in graph order of the children. */
|
|
11
|
+
export declare function childEdges(graph: SpaceGraph, id: NodeId): readonly Edge[];
|
|
12
|
+
/** Every edge whose parent and child are both in the graph. */
|
|
13
|
+
export declare function edgesWithin(graph: SpaceGraph): Edge[];
|
|
14
|
+
/** Whether an edge belongs to the given hierarchy (as opposed to a relationship or another hierarchy). */
|
|
15
|
+
export declare function isHierarchyEdge(edge: Edge, hierarchy: Hierarchy | undefined): boolean;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SpaceGraph, SpaceNode } from 'structured-context/api';
|
|
2
|
+
import type { LandscapeLayoutConfig } from './definition';
|
|
3
|
+
/** One rendered container or node in a landscape. */
|
|
4
|
+
export type LandscapeOccurrence = {
|
|
5
|
+
/** Path-based key, unique within the map view (see {@link occurrenceKey}). */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Index of the grouping level this occurrence belongs to. */
|
|
8
|
+
level: number;
|
|
9
|
+
/** A node, or a field value shared by the nodes inside (`null`: the field is empty). */
|
|
10
|
+
item: {
|
|
11
|
+
kind: 'node';
|
|
12
|
+
node: SpaceNode;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'value';
|
|
15
|
+
field: string;
|
|
16
|
+
value: string | null;
|
|
17
|
+
};
|
|
18
|
+
/** Nodes on the `via` chain that joined this node to the node level above, one entry per skipped type. */
|
|
19
|
+
via: ViaStep[];
|
|
20
|
+
/** Key of the node's first occurrence when this is a repeat. Repeats are rendered in full. */
|
|
21
|
+
repeatOf?: string;
|
|
22
|
+
children: LandscapeOccurrence[];
|
|
23
|
+
};
|
|
24
|
+
export type ViaStep = {
|
|
25
|
+
type: string;
|
|
26
|
+
nodes: SpaceNode[];
|
|
27
|
+
};
|
|
28
|
+
export type Landscape = {
|
|
29
|
+
groups: LandscapeOccurrence[];
|
|
30
|
+
/**
|
|
31
|
+
* Nodes of a grouped level that no container above reaches (e.g. an Activity with no
|
|
32
|
+
* Outcome when grouping by Outcomes), each with its own contents.
|
|
33
|
+
*/
|
|
34
|
+
ungrouped: LandscapeOccurrence[];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Lay a space out as nested containers following the layout's grouping levels.
|
|
38
|
+
*
|
|
39
|
+
* Adjacent node levels are joined by any edge between their types, in either direction, or only
|
|
40
|
+
* edges from `edge.field`. A `via` chain joins them through the skipped types. A field level
|
|
41
|
+
* splits the next node level by that field's values. A node reached from several containers
|
|
42
|
+
* appears in each, in full: the levels are finite, so repeating contents can't recurse.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildLandscape(graph: SpaceGraph, regionId: string, layout: LandscapeLayoutConfig): Landscape;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One step of an occurrence path: a node title, a `[field, value]` group, or `null` for the
|
|
3
|
+
* ungrouped area. Encoded distinctly, so a field group can't collide with a node of the same name.
|
|
4
|
+
*/
|
|
5
|
+
export type PathSegment = string | readonly [field: string, value: string | null] | null;
|
|
6
|
+
/**
|
|
7
|
+
* Path-based key for one occurrence of a node: region, then the steps from the outermost
|
|
8
|
+
* container down to the node. Unique within a map view even when a node appears several times.
|
|
9
|
+
* Hosts can render several map views at once, so layouts scope keys to the map view instance.
|
|
10
|
+
*/
|
|
11
|
+
export declare function occurrenceKey(regionId: string, path: readonly PathSegment[]): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SpaceGraph, SpaceNode } from 'structured-context/api';
|
|
2
|
+
import type { DagMode } from './definition';
|
|
3
|
+
/** One rendered appearance of a node in a tree. */
|
|
4
|
+
export type TreeOccurrence = {
|
|
5
|
+
/** Path-based key, unique within the map view (see {@link occurrenceKey}). */
|
|
6
|
+
key: string;
|
|
7
|
+
node: SpaceNode;
|
|
8
|
+
children: TreeOccurrence[];
|
|
9
|
+
/**
|
|
10
|
+
* Key of the node's primary occurrence when this is a repeat. A node with several parents
|
|
11
|
+
* appears under each of them, but its subtree is only rendered at its first occurrence.
|
|
12
|
+
*/
|
|
13
|
+
repeatOf?: string;
|
|
14
|
+
};
|
|
15
|
+
export type Tree = {
|
|
16
|
+
roots: TreeOccurrence[];
|
|
17
|
+
/**
|
|
18
|
+
* Hierarchy-typed nodes not reachable from a root, rendered as extra roots: nodes with no
|
|
19
|
+
* hierarchy parent in the space, then entry points into otherwise unreachable cycles.
|
|
20
|
+
*/
|
|
21
|
+
orphans: TreeOccurrence[];
|
|
22
|
+
/** Key of each node's primary (first, fully rendered) occurrence. */
|
|
23
|
+
primary: ReadonlyMap<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* In cross-edge mode, links from a node's other parents to its primary occurrence, which
|
|
26
|
+
* replace repeat occurrences. Empty in repeat mode.
|
|
27
|
+
*/
|
|
28
|
+
crossLinks: TreeLink[];
|
|
29
|
+
};
|
|
30
|
+
export type TreeLink = {
|
|
31
|
+
from: string;
|
|
32
|
+
to: string;
|
|
33
|
+
kind: 'tree' | 'cross';
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Lay a space out as a tree over its hierarchy.
|
|
37
|
+
*
|
|
38
|
+
* Roots are root-type nodes with no hierarchy parent. Traversal is depth-first in space order,
|
|
39
|
+
* so a node's primary occurrence is under the parent reached first. Under its other parents a
|
|
40
|
+
* node is either repeated without its subtree (`repeat`), or left out and linked by a cross-edge
|
|
41
|
+
* (`cross-edge`). Either way traversal stops there, which also keeps cycles from recursing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildTree(graph: SpaceGraph, regionId: string, dag?: DagMode): Tree;
|
|
44
|
+
/** Parent → child pairs of occurrence keys: one per rendered parent-child link, then cross-links. */
|
|
45
|
+
export declare function treeLinks(tree: Tree): TreeLink[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SpaceGraph, SpaceNode } from 'structured-context/api';
|
|
2
|
+
import type { XYLayoutConfig } from './definition';
|
|
3
|
+
/** A plotted node. `x` and `y` run from 0 to 1 across the plot, left to right and bottom to top. */
|
|
4
|
+
export type XYPoint = {
|
|
5
|
+
key: string;
|
|
6
|
+
node: SpaceNode;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
/** Why a node of a plotted type couldn't be placed, per axis. */
|
|
11
|
+
export type Unplaced = {
|
|
12
|
+
key: string;
|
|
13
|
+
node: SpaceNode;
|
|
14
|
+
reasons: string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* An edge between plotted nodes. `lane` separates edges joining the same two nodes: 0 when
|
|
18
|
+
* there's one, otherwise centred around 0 (e.g. -0.5 and 0.5), for layouts to draw side by side.
|
|
19
|
+
*/
|
|
20
|
+
export type XYLink = {
|
|
21
|
+
from: string;
|
|
22
|
+
to: string;
|
|
23
|
+
field: string;
|
|
24
|
+
hierarchy: boolean;
|
|
25
|
+
lane: number;
|
|
26
|
+
};
|
|
27
|
+
export type XYPlot = {
|
|
28
|
+
points: XYPoint[];
|
|
29
|
+
unplaced: Unplaced[];
|
|
30
|
+
/** Edges between plotted nodes. */
|
|
31
|
+
links: XYLink[];
|
|
32
|
+
/** Each axis's [min, max]; `direction` says which end is drawn where. */
|
|
33
|
+
domains: {
|
|
34
|
+
x: readonly [number, number];
|
|
35
|
+
y: readonly [number, number];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Position nodes by two numeric fields. Every node of a plotted type appears once: on the plot
|
|
40
|
+
* when both its values are numbers inside the axes' domains, otherwise in `unplaced` with the
|
|
41
|
+
* reason. Positions are normalised; layouts decide the plot's size.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildXYPlot(graph: SpaceGraph, regionId: string, layout: XYLayoutConfig): XYPlot;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package's public surface. Everything else (layouts, node cards, the edge overlay, the projections)
|
|
3
|
+
* is internal; add an export here when a host needs it.
|
|
4
|
+
*/
|
|
5
|
+
export { type AnnotationIndex, type AnnotationSource, annotationsFrom, type NodeAnnotation, type Severity, type UnattachedAnnotation, type ValidationInput, worstSeverity, } from './core/annotations';
|
|
6
|
+
export { MAP_VIEW_SCHEMAS, type MapViewDefinition, MapViewDefinitionError, mapViewsForSchema, type Parameter, type ParameterControl, type ParameterValues, parseMapViewDefinition, resolveParameterValues, selectionFilter, viewValidationLevel, } from './core/definition';
|
|
7
|
+
export { MapView } from './layouts/MapView';
|
|
8
|
+
export { ParameterControls } from './layouts/ParameterControls';
|
|
9
|
+
export { MultiSelectParameterInput, ParameterInput, SelectParameterInput, ToggleParameterInput, } from './layouts/ParameterInputs';
|
|
10
|
+
export { type ParameterControlState, useParameterControls } from './layouts/useParameterControls';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Orientation } from '../core/definition';
|
|
2
|
+
/**
|
|
3
|
+
* A connector between two occurrences. `cross` links (e.g. extra parents) are drawn dashed.
|
|
4
|
+
* `id` tells apart several links between the same occurrences; straight links between the same
|
|
5
|
+
* pair are drawn side by side, `lane` apart (0: on the line between centres).
|
|
6
|
+
*/
|
|
7
|
+
export type Link = {
|
|
8
|
+
from: string;
|
|
9
|
+
to: string;
|
|
10
|
+
kind?: 'tree' | 'cross';
|
|
11
|
+
id?: string;
|
|
12
|
+
lane?: number;
|
|
13
|
+
};
|
|
14
|
+
type Props = {
|
|
15
|
+
links: readonly Link[];
|
|
16
|
+
/** Rendered element of each occurrence, by occurrence key. */
|
|
17
|
+
elements: ReadonlyMap<string, HTMLElement>;
|
|
18
|
+
/**
|
|
19
|
+
* Positioned element the overlay covers; coordinates are relative to it. Passed as an element,
|
|
20
|
+
* not a ref: the overlay sits inside it, and React runs a child's layout effects before
|
|
21
|
+
* attaching the parent's ref.
|
|
22
|
+
*/
|
|
23
|
+
container: HTMLElement | null;
|
|
24
|
+
/** Curves leaving along the tree's orientation, or straight lines between centres (drawn under the nodes). */
|
|
25
|
+
routing: Orientation | 'straight';
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* SVG layer drawing connectors between rendered occurrences.
|
|
29
|
+
*
|
|
30
|
+
* Measures occurrence elements after layout and redraws when the container or any occurrence
|
|
31
|
+
* resizes, so it follows embedded panes that resize independently of the window, and reflows
|
|
32
|
+
* such as late font loads. The SVG fills the container instead of being sized from it, so it
|
|
33
|
+
* never holds the container open after the layout shrinks.
|
|
34
|
+
*/
|
|
35
|
+
export declare function EdgeOverlay({ links, elements, container, routing }: Props): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LandscapeLayoutConfig } from '../core/definition';
|
|
2
|
+
import type { LayoutProps } from './TreeLayout';
|
|
3
|
+
/**
|
|
4
|
+
* Nested containers following the layout's grouping levels; the last level is drawn as nodes.
|
|
5
|
+
* Flexbox does the nesting and wrapping. Containment shows the grouping edges, so no connectors
|
|
6
|
+
* are drawn. PROTOTYPE: `edges.show` has no effect here; other edges aren't drawn yet.
|
|
7
|
+
*/
|
|
8
|
+
export declare function LandscapeLayout({ graph, region, instanceId, onNodeSelect }: LayoutProps<LandscapeLayoutConfig>): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SpaceGraph, SpaceNode } from 'structured-context/api';
|
|
2
|
+
import { type AnnotationIndex } from '../core/annotations';
|
|
3
|
+
import { type MapViewDefinition, type ParameterValues } from '../core/definition';
|
|
4
|
+
type Props = {
|
|
5
|
+
definition: MapViewDefinition;
|
|
6
|
+
graph: SpaceGraph;
|
|
7
|
+
/** Current parameter values (host-owned session state); missing values use defaults. */
|
|
8
|
+
values?: ParameterValues;
|
|
9
|
+
/**
|
|
10
|
+
* Validation results by node (see `annotationsFrom`). Which of them show, and at what severity, is
|
|
11
|
+
* the region's `nodes.validation` setting; with none supplied, nothing is drawn.
|
|
12
|
+
*/
|
|
13
|
+
annotations?: AnnotationIndex;
|
|
14
|
+
onNodeSelect?: (node: SpaceNode) => void;
|
|
15
|
+
};
|
|
16
|
+
/** Renders a map view definition against a space. Sizes to its container and scrolls within it. */
|
|
17
|
+
export declare function MapView({ definition, graph, values, annotations, onNodeSelect }: Props): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SpaceNode } from 'structured-context/api';
|
|
2
|
+
import type { NodesConfig } from '../core/definition';
|
|
3
|
+
type Props = {
|
|
4
|
+
node: SpaceNode;
|
|
5
|
+
/** The node's subtree is rendered at another occurrence. */
|
|
6
|
+
repeat: boolean;
|
|
7
|
+
nodes: NodesConfig;
|
|
8
|
+
onSelect?: (node: SpaceNode) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A clickable node, drawn as a card (title plus selected fields) or a compact shape with a
|
|
12
|
+
* tooltip. Deliberately a `div` with button semantics rather than a `<button>`: hosts style
|
|
13
|
+
* native form controls globally (Obsidian fixes button height and disables wrapping).
|
|
14
|
+
*/
|
|
15
|
+
export declare function NodeCard({ node, repeat, nodes, onSelect }: Props): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MapViewDefinition, ParameterValues } from '../core/definition';
|
|
2
|
+
type Props = {
|
|
3
|
+
definition: MapViewDefinition;
|
|
4
|
+
/** Host-owned values; missing or stale ones show as the default, matching what renders. */
|
|
5
|
+
values: ParameterValues;
|
|
6
|
+
onChange: (name: string, value: unknown) => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Default layout for a map view's parameter controls: a wrapping row. Hosts wanting their own layout
|
|
10
|
+
* use `useParameterControls` with `ParameterInput` (or the typed inputs) instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ParameterControls({ definition, values, onChange }: Props): import("react").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Parameter, ParameterControl } from '../core/definition';
|
|
2
|
+
type InputProps<Kind extends ParameterControl['kind']> = {
|
|
3
|
+
parameter: Parameter & {
|
|
4
|
+
control: Extract<ParameterControl, {
|
|
5
|
+
kind: Kind;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
value: unknown;
|
|
9
|
+
onChange: (value: unknown) => void;
|
|
10
|
+
};
|
|
11
|
+
/** A checkbox for a boolean parameter, labelled with the parameter's title. */
|
|
12
|
+
export declare function ToggleParameterInput({ parameter, value, onChange }: InputProps<'toggle'>): import("react").JSX.Element;
|
|
13
|
+
/** A dropdown for a parameter with one of several options. */
|
|
14
|
+
export declare function SelectParameterInput({ parameter, value, onChange }: InputProps<'select'>): import("react").JSX.Element;
|
|
15
|
+
/** A checkbox group for a parameter taking any subset of its options. */
|
|
16
|
+
export declare function MultiSelectParameterInput({ parameter, value, onChange }: InputProps<'multiselect'>): import("react").JSX.Element;
|
|
17
|
+
/** The input matching a parameter's control kind. */
|
|
18
|
+
export declare function ParameterInput({ parameter, value, onChange, }: Omit<InputProps<ParameterControl['kind']>, 'parameter'> & {
|
|
19
|
+
parameter: Parameter;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SpaceGraph, SpaceNode } from 'structured-context/api';
|
|
2
|
+
import type { LayoutConfig, Region, TreeLayoutConfig } from '../core/definition';
|
|
3
|
+
export type LayoutProps<L extends LayoutConfig = LayoutConfig> = {
|
|
4
|
+
graph: SpaceGraph;
|
|
5
|
+
/** The region with parameter values applied, narrowed to the layout's own settings. */
|
|
6
|
+
region: Region & {
|
|
7
|
+
layout: L;
|
|
8
|
+
};
|
|
9
|
+
/** Scopes occurrence ids when several map views render in one document. */
|
|
10
|
+
instanceId: string;
|
|
11
|
+
onNodeSelect?: (node: SpaceNode) => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Tree over the schema's hierarchy. Flexbox does the branching; the SVG overlay draws connectors.
|
|
15
|
+
*/
|
|
16
|
+
export declare function TreeLayout({ graph, region, instanceId, onNodeSelect }: LayoutProps<TreeLayoutConfig>): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { XYLayoutConfig } from '../core/definition';
|
|
2
|
+
import type { LayoutProps } from './TreeLayout';
|
|
3
|
+
/**
|
|
4
|
+
* Nodes positioned by two numeric fields, with straight connectors between them. Positions are
|
|
5
|
+
* percentages of the plot area, which fills the container (scrolling below a minimum size). Nodes that can't be
|
|
6
|
+
* placed are listed under the plot with the reason.
|
|
7
|
+
* PROTOTYPE: labels may overlap where nodes sit close together; no collision handling.
|
|
8
|
+
*/
|
|
9
|
+
export declare function XYLayout({ graph, region, instanceId, onNodeSelect }: LayoutProps<XYLayoutConfig>): import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnnotationIndex } from '../core/annotations';
|
|
2
|
+
/** The annotations a map view shows, already narrowed by its validation settings. Read by node cards. */
|
|
3
|
+
export declare const AnnotationsContext: import("react").Context<AnnotationIndex>;
|
|
4
|
+
export declare const useAnnotations: () => AnnotationIndex;
|