data-navigator 2.3.0 → 2.4.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/dist/index.cjs +99 -34
- package/dist/index.d.cts +265 -0
- package/dist/index.d.ts +265 -0
- package/dist/index.js +99 -34
- package/dist/structure.cjs +1 -1
- package/dist/structure.js +1 -1
- package/dist/text-chat.cjs +12 -12
- package/dist/text-chat.js +13 -13
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -461,7 +461,7 @@ var buildNodes = (options) => {
|
|
|
461
461
|
return nodes;
|
|
462
462
|
};
|
|
463
463
|
var scaffoldDimensions = (options, nodes) => {
|
|
464
|
-
var _a, _b;
|
|
464
|
+
var _a, _b, _c;
|
|
465
465
|
let dimensions = {};
|
|
466
466
|
if ((_b = (_a = options.dimensions) == null ? void 0 : _a.parentOptions) == null ? void 0 : _b.addLevel0) {
|
|
467
467
|
let level0 = options.dimensions.parentOptions.addLevel0;
|
|
@@ -475,10 +475,11 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
475
475
|
dim.numericalExtents[1] = max > val ? max : val;
|
|
476
476
|
};
|
|
477
477
|
options.data.forEach((d) => {
|
|
478
|
-
|
|
478
|
+
var _a2;
|
|
479
|
+
let ods = ((_a2 = options.dimensions) == null ? void 0 : _a2.values) || [];
|
|
479
480
|
let i = 0;
|
|
480
481
|
ods.forEach((dim) => {
|
|
481
|
-
var
|
|
482
|
+
var _a3, _b2, _c2, _d, _e, _f, _g, _h;
|
|
482
483
|
if (!dim.dimensionKey) {
|
|
483
484
|
console.error(
|
|
484
485
|
`Building nodes, parsing dimensions. Each dimension in options.dimensions must contain a dimensionKey. This dimension has no key: ${JSON.stringify(
|
|
@@ -489,7 +490,7 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
489
490
|
}
|
|
490
491
|
if (dim.dimensionKey in d) {
|
|
491
492
|
let value = d[dim.dimensionKey];
|
|
492
|
-
let keepValue = typeof ((
|
|
493
|
+
let keepValue = typeof ((_a3 = dim.operations) == null ? void 0 : _a3.filterFunction) === "function" ? dim.operations.filterFunction(d, dim) : true;
|
|
493
494
|
if (value !== void 0 && keepValue) {
|
|
494
495
|
if (!dim.type) {
|
|
495
496
|
dim.type = typeof value === "bigint" || typeof value === "number" ? "numerical" : "categorical";
|
|
@@ -505,7 +506,7 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
505
506
|
type: dim.type,
|
|
506
507
|
operations: {
|
|
507
508
|
compressSparseDivisions: ((_b2 = dim.operations) == null ? void 0 : _b2.compressSparseDivisions) || false,
|
|
508
|
-
sortFunction: ((
|
|
509
|
+
sortFunction: ((_c2 = dim.operations) == null ? void 0 : _c2.sortFunction) || void 0
|
|
509
510
|
},
|
|
510
511
|
behavior: dim.behavior || {
|
|
511
512
|
extents: "circular"
|
|
@@ -579,7 +580,7 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
579
580
|
});
|
|
580
581
|
});
|
|
581
582
|
Object.keys(dimensions).forEach((s) => {
|
|
582
|
-
var _a2, _b2,
|
|
583
|
+
var _a2, _b2, _c2, _d, _e;
|
|
583
584
|
let dimension = dimensions[s];
|
|
584
585
|
let divisions = dimension.divisions;
|
|
585
586
|
if (dimension.type === "numerical") {
|
|
@@ -598,14 +599,18 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
598
599
|
let i = dimension.numericalExtents[0] + interval;
|
|
599
600
|
let divisionCount = 0;
|
|
600
601
|
let index = 0;
|
|
602
|
+
let lastDivisionId = null;
|
|
603
|
+
let prevBound = dimension.numericalExtents[0];
|
|
601
604
|
for (i = dimension.numericalExtents[0] + interval; i <= dimension.numericalExtents[1]; i += interval) {
|
|
602
|
-
let divisionId = typeof ((_a2 = dimension.divisionOptions) == null ? void 0 : _a2.divisionNodeIds) === "function" ? dimension.divisionOptions.divisionNodeIds(s, i, i) : dimension.nodeId + "_" + i;
|
|
605
|
+
let divisionId = typeof ((_a2 = dimension.divisionOptions) == null ? void 0 : _a2.divisionNodeIds) === "function" ? dimension.divisionOptions.divisionNodeIds(s, i, i) : createValidId(dimension.nodeId + "_" + i);
|
|
606
|
+
lastDivisionId = divisionId;
|
|
603
607
|
dimension.divisions[divisionId] = {
|
|
604
608
|
id: divisionId,
|
|
605
609
|
sortFunction: ((_b2 = dimension.divisionOptions) == null ? void 0 : _b2.sortFunction) || void 0,
|
|
606
|
-
values: {}
|
|
610
|
+
values: {},
|
|
611
|
+
numericalExtents: [prevBound, i]
|
|
607
612
|
};
|
|
608
|
-
let divisionRenderId = typeof ((
|
|
613
|
+
let divisionRenderId = typeof ((_c2 = dimension.divisionOptions) == null ? void 0 : _c2.divisionRenderIds) === "function" ? dimension.divisionOptions.divisionRenderIds(s, i, i) : divisionId;
|
|
609
614
|
nodes[divisionId] = {
|
|
610
615
|
id: divisionId,
|
|
611
616
|
renderId: divisionRenderId,
|
|
@@ -622,14 +627,21 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
622
627
|
let value = node[s];
|
|
623
628
|
if (value <= i) {
|
|
624
629
|
dimension.divisions[divisionId].values[node.id] = node;
|
|
630
|
+
index++;
|
|
625
631
|
} else {
|
|
626
|
-
i += interval;
|
|
627
632
|
limit = true;
|
|
628
633
|
}
|
|
629
|
-
index++;
|
|
630
634
|
}
|
|
635
|
+
prevBound = i;
|
|
631
636
|
divisionCount++;
|
|
632
637
|
}
|
|
638
|
+
if (lastDivisionId && index < valueKeys.length) {
|
|
639
|
+
while (index < valueKeys.length) {
|
|
640
|
+
let node = values[valueKeys[index]];
|
|
641
|
+
dimension.divisions[lastDivisionId].values[node.id] = node;
|
|
642
|
+
index++;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
633
645
|
delete divisions[s];
|
|
634
646
|
}
|
|
635
647
|
} else if (typeof ((_e = dimension.operations) == null ? void 0 : _e.sortFunction) === "function") {
|
|
@@ -681,7 +693,7 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
681
693
|
}
|
|
682
694
|
}
|
|
683
695
|
});
|
|
684
|
-
if (options.dimensions.adjustDimensions) {
|
|
696
|
+
if ((_c = options.dimensions) == null ? void 0 : _c.adjustDimensions) {
|
|
685
697
|
dimensions = options.dimensions.adjustDimensions(dimensions);
|
|
686
698
|
}
|
|
687
699
|
return dimensions;
|
|
@@ -818,13 +830,15 @@ var buildEdges = (options, nodes, dimensions) => {
|
|
|
818
830
|
} else {
|
|
819
831
|
createEdge(division.id, dimension.nodeId, dimension.navigationRules.parent_child, "source");
|
|
820
832
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
833
|
+
if (valueKeys.length > 0) {
|
|
834
|
+
const firstChildId = typeof options.idKey === "function" ? options.idKey(division.values[valueKeys[0]]) : options.idKey;
|
|
835
|
+
createEdge(
|
|
836
|
+
division.id,
|
|
837
|
+
division.values[valueKeys[0]][firstChildId],
|
|
838
|
+
dimension.navigationRules.parent_child,
|
|
839
|
+
"source"
|
|
840
|
+
);
|
|
841
|
+
}
|
|
828
842
|
let i = 0;
|
|
829
843
|
if (valueKeys.length >= 1) {
|
|
830
844
|
valueKeys.forEach((vk) => {
|
|
@@ -1460,22 +1474,31 @@ var getAllRuleNames = (structure) => {
|
|
|
1460
1474
|
return [];
|
|
1461
1475
|
return Object.keys(structure.navigationRules);
|
|
1462
1476
|
};
|
|
1463
|
-
var
|
|
1477
|
+
var damerauLevenshtein = (a, b) => {
|
|
1464
1478
|
const m = a.length;
|
|
1465
1479
|
const n = b.length;
|
|
1466
|
-
const dp = Array(n + 1);
|
|
1480
|
+
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
1481
|
+
for (let i = 0; i <= m; i++)
|
|
1482
|
+
dp[i][0] = i;
|
|
1467
1483
|
for (let j = 0; j <= n; j++)
|
|
1468
|
-
dp[j] = j;
|
|
1484
|
+
dp[0][j] = j;
|
|
1469
1485
|
for (let i = 1; i <= m; i++) {
|
|
1470
|
-
let prev = dp[0];
|
|
1471
|
-
dp[0] = i;
|
|
1472
1486
|
for (let j = 1; j <= n; j++) {
|
|
1473
|
-
const
|
|
1474
|
-
dp[
|
|
1475
|
-
|
|
1487
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
1488
|
+
dp[i][j] = Math.min(
|
|
1489
|
+
dp[i - 1][j] + 1,
|
|
1490
|
+
// deletion
|
|
1491
|
+
dp[i][j - 1] + 1,
|
|
1492
|
+
// insertion
|
|
1493
|
+
dp[i - 1][j - 1] + cost
|
|
1494
|
+
// substitution
|
|
1495
|
+
);
|
|
1496
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
1497
|
+
dp[i][j] = Math.min(dp[i][j], dp[i - 2][j - 2] + cost);
|
|
1498
|
+
}
|
|
1476
1499
|
}
|
|
1477
1500
|
}
|
|
1478
|
-
return dp[n];
|
|
1501
|
+
return dp[m][n];
|
|
1479
1502
|
};
|
|
1480
1503
|
var maxTypoDistance = (len) => len <= 4 ? 1 : 2;
|
|
1481
1504
|
var fuzzyMatch = (input, candidates, labels = {}) => {
|
|
@@ -1509,7 +1532,7 @@ var fuzzyMatch = (input, candidates, labels = {}) => {
|
|
|
1509
1532
|
const typoMatches = [];
|
|
1510
1533
|
for (let i = 0; i < candidates.length; i++) {
|
|
1511
1534
|
const c = candidates[i];
|
|
1512
|
-
const nameDist =
|
|
1535
|
+
const nameDist = damerauLevenshtein(lower, c.toLowerCase());
|
|
1513
1536
|
if (nameDist <= threshold) {
|
|
1514
1537
|
typoMatches.push({ candidate: c, dist: nameDist });
|
|
1515
1538
|
continue;
|
|
@@ -1517,8 +1540,8 @@ var fuzzyMatch = (input, candidates, labels = {}) => {
|
|
|
1517
1540
|
if (labels[c]) {
|
|
1518
1541
|
const words = labels[c].toLowerCase().split(/\s+/);
|
|
1519
1542
|
for (let w = 0; w < words.length; w++) {
|
|
1520
|
-
if (
|
|
1521
|
-
typoMatches.push({ candidate: c, dist:
|
|
1543
|
+
if (damerauLevenshtein(lower, words[w]) <= threshold) {
|
|
1544
|
+
typoMatches.push({ candidate: c, dist: damerauLevenshtein(lower, words[w]) });
|
|
1522
1545
|
break;
|
|
1523
1546
|
}
|
|
1524
1547
|
}
|
|
@@ -1579,6 +1602,8 @@ var text_chat_default = (options) => {
|
|
|
1579
1602
|
commandLabels = {},
|
|
1580
1603
|
onNavigate,
|
|
1581
1604
|
onExit,
|
|
1605
|
+
onClick,
|
|
1606
|
+
onHover,
|
|
1582
1607
|
llm,
|
|
1583
1608
|
data
|
|
1584
1609
|
} = options;
|
|
@@ -1748,7 +1773,7 @@ var text_chat_default = (options) => {
|
|
|
1748
1773
|
} else {
|
|
1749
1774
|
addSystemMessage('Text navigation ready. Type "enter" to begin or "help" for available commands.');
|
|
1750
1775
|
}
|
|
1751
|
-
const specialCommands = ["enter", "help", "more", "more help", "clear"];
|
|
1776
|
+
const specialCommands = ["enter", "help", "more", "more help", "clear", "click", "select", "hover", "inspect"];
|
|
1752
1777
|
const moveToNode = (nodeId) => {
|
|
1753
1778
|
const node = inputHandler.moveTo(nodeId);
|
|
1754
1779
|
if (node) {
|
|
@@ -1799,15 +1824,55 @@ var text_chat_default = (options) => {
|
|
|
1799
1824
|
}
|
|
1800
1825
|
if (lower === "help") {
|
|
1801
1826
|
const llmHint = llm ? " You can also type any question about the data." : "";
|
|
1827
|
+
const interactionHints = [];
|
|
1828
|
+
if (onClick)
|
|
1829
|
+
interactionHints.push('"click" or "select"');
|
|
1830
|
+
if (onHover)
|
|
1831
|
+
interactionHints.push('"hover" or "inspect"');
|
|
1832
|
+
const interactionSuffix = interactionHints.length ? ` Interaction: ${interactionHints.join(", ")}.` : "";
|
|
1802
1833
|
if (!currentNodeId) {
|
|
1803
1834
|
addResponse(
|
|
1804
|
-
'Not yet in the structure. Type "enter" to begin navigating, or "move to <search>" to jump to a node.' + llmHint
|
|
1835
|
+
'Not yet in the structure. Type "enter" to begin navigating, or "move to <search>" to jump to a node.' + interactionSuffix + llmHint
|
|
1805
1836
|
);
|
|
1806
1837
|
} else {
|
|
1807
1838
|
const node = structure.nodes[currentNodeId];
|
|
1808
1839
|
const available = getAvailableRules(currentNodeId, node, structure);
|
|
1809
1840
|
const formatted = available.map((r) => formatRule(r, commandLabels));
|
|
1810
|
-
addResponse(
|
|
1841
|
+
addResponse(
|
|
1842
|
+
`Available: ${formatted.join(", ")}, move to <search>.` + interactionSuffix + llmHint
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
return;
|
|
1846
|
+
}
|
|
1847
|
+
if (lower === "click" || lower === "select") {
|
|
1848
|
+
if (!currentNodeId) {
|
|
1849
|
+
addResponse('Not in the structure. Type "enter" to begin.');
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
const node = structure.nodes[currentNodeId];
|
|
1853
|
+
if (onClick && node) {
|
|
1854
|
+
onClick(node);
|
|
1855
|
+
addResponse(`Clicked: ${describeNode2(node)}`);
|
|
1856
|
+
} else {
|
|
1857
|
+
addResponse(
|
|
1858
|
+
onClick ? "Nothing to click here." : "Click interaction is not enabled for this chart."
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
if (lower === "hover" || lower === "inspect") {
|
|
1864
|
+
if (!currentNodeId) {
|
|
1865
|
+
addResponse('Not in the structure. Type "enter" to begin.');
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
const node = structure.nodes[currentNodeId];
|
|
1869
|
+
if (onHover && node) {
|
|
1870
|
+
onHover(node);
|
|
1871
|
+
addResponse(`Hovering over: ${describeNode2(node)}`);
|
|
1872
|
+
} else {
|
|
1873
|
+
addResponse(
|
|
1874
|
+
onHover ? "Nothing to hover over here." : "Hover interaction is not enabled for this chart."
|
|
1875
|
+
);
|
|
1811
1876
|
}
|
|
1812
1877
|
return;
|
|
1813
1878
|
}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
type StructureOptions = {
|
|
2
|
+
data: GenericDataset;
|
|
3
|
+
idKey: DynamicNodeIdKey;
|
|
4
|
+
renderIdKey?: DynamicRenderIdKey;
|
|
5
|
+
dimensions?: DimensionOptions;
|
|
6
|
+
genericEdges?: EdgeOptions;
|
|
7
|
+
useDirectedEdges?: boolean;
|
|
8
|
+
dataType?: DataType;
|
|
9
|
+
addIds?: boolean;
|
|
10
|
+
keysForIdGeneration?: KeyList;
|
|
11
|
+
navigationRules?: NavigationRules;
|
|
12
|
+
};
|
|
13
|
+
type InputOptions = {
|
|
14
|
+
structure: Structure;
|
|
15
|
+
navigationRules: NavigationRules;
|
|
16
|
+
entryPoint?: NodeId;
|
|
17
|
+
exitPoint?: RenderId;
|
|
18
|
+
};
|
|
19
|
+
type RenderingOptions = {
|
|
20
|
+
elementData: ElementData | Nodes;
|
|
21
|
+
suffixId: string;
|
|
22
|
+
root: RootObject;
|
|
23
|
+
defaults?: RenderObject;
|
|
24
|
+
entryButton?: EntryObject;
|
|
25
|
+
exitElement?: ExitObject;
|
|
26
|
+
};
|
|
27
|
+
type DimensionOptions = {
|
|
28
|
+
values: DimensionList;
|
|
29
|
+
parentOptions?: {
|
|
30
|
+
level1Options?: {
|
|
31
|
+
order: AddOrReferenceNodeList;
|
|
32
|
+
behavior?: Level1Behavior;
|
|
33
|
+
navigationRules?: DimensionNavigationRules;
|
|
34
|
+
};
|
|
35
|
+
addLevel0?: NodeObject;
|
|
36
|
+
};
|
|
37
|
+
adjustDimensions?: AdjustingFunction;
|
|
38
|
+
};
|
|
39
|
+
type Structure = {
|
|
40
|
+
nodes: Nodes;
|
|
41
|
+
edges: Edges;
|
|
42
|
+
dimensions?: Dimensions;
|
|
43
|
+
navigationRules?: NavigationRules;
|
|
44
|
+
elementData?: ElementData;
|
|
45
|
+
};
|
|
46
|
+
type Nodes = Record<NodeId, NodeObject>;
|
|
47
|
+
type Edges = Record<EdgeId, EdgeObject>;
|
|
48
|
+
type Dimensions = Record<DimensionKey, DimensionObject>;
|
|
49
|
+
type NavigationRules = Record<NavId, NavObject>;
|
|
50
|
+
type ElementData = Record<RenderId, RenderObject>;
|
|
51
|
+
type DimensionDivisions = Record<NodeId, DivisionObject>;
|
|
52
|
+
type AddOrReferenceNodeList = Array<NodeToAddOrReference>;
|
|
53
|
+
type EdgeList = Array<EdgeId>;
|
|
54
|
+
type GenericDataset = Array<DatumObject>;
|
|
55
|
+
type NavigationList = Array<NavId>;
|
|
56
|
+
type DimensionNavigationPair = [NavId, NavId];
|
|
57
|
+
type NumericalExtentsPair = [number, number];
|
|
58
|
+
type DimensionList = Array<DimensionDatum>;
|
|
59
|
+
type EdgeOptions = Array<EdgeDatum>;
|
|
60
|
+
type KeyList = Array<string>;
|
|
61
|
+
type Semantics = ((RenderObject?: any, DatumObject?: any) => SemanticsObject) | SemanticsObject;
|
|
62
|
+
type SpatialProperties = ((RenderObject?: any, DatumObject?: any) => SpatialObject) | SpatialObject;
|
|
63
|
+
type Attributes = ((RenderObject?: any, DatumObject?: any) => AttributesObject) | AttributesObject;
|
|
64
|
+
type NodeObject = {
|
|
65
|
+
id: NodeId;
|
|
66
|
+
edges: EdgeList;
|
|
67
|
+
renderId?: RenderId;
|
|
68
|
+
renderingStrategy?: RenderingStrategy;
|
|
69
|
+
derivedNode?: DerivedNode;
|
|
70
|
+
dimensionLevel?: DimensionLevel;
|
|
71
|
+
[key: string | number]: any;
|
|
72
|
+
};
|
|
73
|
+
type EdgeObject = {
|
|
74
|
+
source: ((d: DatumObject, currentFocus: NodeId) => NodeId) | NodeId;
|
|
75
|
+
target: ((d: DatumObject, currentFocus: NodeId) => NodeId) | NodeId;
|
|
76
|
+
navigationRules: NavigationList;
|
|
77
|
+
edgeId?: EdgeId;
|
|
78
|
+
};
|
|
79
|
+
type EdgeDatum = {
|
|
80
|
+
edgeId: EdgeId;
|
|
81
|
+
edge: EdgeObject;
|
|
82
|
+
conditional?: ConditionalFunction;
|
|
83
|
+
};
|
|
84
|
+
type DimensionObject = {
|
|
85
|
+
nodeId: NodeId;
|
|
86
|
+
dimensionKey: DimensionKey;
|
|
87
|
+
divisions: DimensionDivisions;
|
|
88
|
+
operations: {
|
|
89
|
+
compressSparseDivisions: boolean;
|
|
90
|
+
sortFunction?: SortingFunction;
|
|
91
|
+
};
|
|
92
|
+
behavior?: DimensionBehavior;
|
|
93
|
+
navigationRules?: DimensionNavigationRules;
|
|
94
|
+
type?: DimensionType;
|
|
95
|
+
numericalExtents?: NumericalExtentsPair;
|
|
96
|
+
subdivisions?: NumericallySubdivide;
|
|
97
|
+
divisionOptions?: DivisionOptions;
|
|
98
|
+
};
|
|
99
|
+
type DimensionDatum = {
|
|
100
|
+
dimensionKey: DimensionKey;
|
|
101
|
+
behavior?: DimensionBehavior;
|
|
102
|
+
navigationRules?: DimensionNavigationRules;
|
|
103
|
+
type?: DimensionType;
|
|
104
|
+
operations?: DimensionOperations;
|
|
105
|
+
nodeId?: DynamicDimensionId;
|
|
106
|
+
renderId?: DynamicDimensionRenderId;
|
|
107
|
+
renderingStrategy?: RenderingStrategy;
|
|
108
|
+
divisionOptions?: DivisionOptions;
|
|
109
|
+
};
|
|
110
|
+
type DimensionNavigationRules = {
|
|
111
|
+
sibling_sibling: DimensionNavigationPair;
|
|
112
|
+
parent_child: DimensionNavigationPair;
|
|
113
|
+
};
|
|
114
|
+
type DivisionOptions = {
|
|
115
|
+
sortFunction?: SortingFunction;
|
|
116
|
+
divisionNodeIds?: (dimensionKey: DimensionKey, keyValue: any, i: number) => string;
|
|
117
|
+
divisionRenderIds?: (dimensionKey: DimensionKey, keyValue: any, i: number) => string;
|
|
118
|
+
renderingStrategy?: RenderingStrategy;
|
|
119
|
+
};
|
|
120
|
+
type DimensionOperations = {
|
|
121
|
+
filterFunction?: FilteringFunction;
|
|
122
|
+
sortFunction?: SortingFunction;
|
|
123
|
+
createNumericalSubdivisions?: NumericallySubdivide;
|
|
124
|
+
compressSparseDivisions?: boolean;
|
|
125
|
+
};
|
|
126
|
+
type DivisionObject = {
|
|
127
|
+
id: NodeId;
|
|
128
|
+
values: Nodes;
|
|
129
|
+
sortFunction?: SortingFunction;
|
|
130
|
+
numericalExtents?: NumericalExtentsPair;
|
|
131
|
+
};
|
|
132
|
+
type NavObject = {
|
|
133
|
+
direction: Direction;
|
|
134
|
+
key?: string;
|
|
135
|
+
};
|
|
136
|
+
type RenderObject = {
|
|
137
|
+
cssClass?: DynamicString;
|
|
138
|
+
spatialProperties?: SpatialProperties;
|
|
139
|
+
semantics?: Semantics;
|
|
140
|
+
parentSemantics?: Semantics;
|
|
141
|
+
existingElement?: ExistingElement;
|
|
142
|
+
showText?: boolean;
|
|
143
|
+
};
|
|
144
|
+
type RootObject = {
|
|
145
|
+
id: string;
|
|
146
|
+
cssClass?: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
width?: string | number;
|
|
149
|
+
height?: string | number;
|
|
150
|
+
};
|
|
151
|
+
type EntryObject = {
|
|
152
|
+
include: boolean;
|
|
153
|
+
callbacks?: EntryCallbacks;
|
|
154
|
+
};
|
|
155
|
+
type ExitObject = {
|
|
156
|
+
include: boolean;
|
|
157
|
+
callbacks?: ExitCallbacks;
|
|
158
|
+
};
|
|
159
|
+
type SemanticsObject = {
|
|
160
|
+
label?: DynamicString;
|
|
161
|
+
elementType?: DynamicString;
|
|
162
|
+
role?: DynamicString;
|
|
163
|
+
attributes?: Attributes;
|
|
164
|
+
};
|
|
165
|
+
type SpatialObject = {
|
|
166
|
+
x?: DynamicNumber;
|
|
167
|
+
y?: DynamicNumber;
|
|
168
|
+
width?: DynamicNumber;
|
|
169
|
+
height?: DynamicNumber;
|
|
170
|
+
path?: DynamicString;
|
|
171
|
+
};
|
|
172
|
+
type DimensionBehavior = {
|
|
173
|
+
extents: ExtentType;
|
|
174
|
+
customBridgePrevious?: NodeId;
|
|
175
|
+
customBridgePost?: NodeId;
|
|
176
|
+
childmostNavigation?: ChildmostNavigationStrategy;
|
|
177
|
+
childmostMatching?: ChildmostMatchingStrategy;
|
|
178
|
+
};
|
|
179
|
+
type Level1Behavior = {
|
|
180
|
+
extents: Level0ExtentType;
|
|
181
|
+
customBridgePrevious?: NodeId;
|
|
182
|
+
customBridgePost?: NodeId;
|
|
183
|
+
};
|
|
184
|
+
type DescriptionOptions = {
|
|
185
|
+
omitKeyNames?: boolean;
|
|
186
|
+
semanticLabel?: string;
|
|
187
|
+
};
|
|
188
|
+
type ExistingElement = {
|
|
189
|
+
useForSpatialProperties: boolean;
|
|
190
|
+
spatialProperties?: SpatialProperties;
|
|
191
|
+
};
|
|
192
|
+
type EntryCallbacks = {
|
|
193
|
+
focus?: Function;
|
|
194
|
+
click?: Function;
|
|
195
|
+
};
|
|
196
|
+
type ExitCallbacks = {
|
|
197
|
+
focus?: Function;
|
|
198
|
+
blur?: Function;
|
|
199
|
+
};
|
|
200
|
+
type DatumObject = {
|
|
201
|
+
[key: string | number]: any;
|
|
202
|
+
};
|
|
203
|
+
type AttributesObject = {
|
|
204
|
+
[key: string]: string;
|
|
205
|
+
};
|
|
206
|
+
type DynamicNumber = ((r?: RenderObject, d?: DatumObject) => number) | number;
|
|
207
|
+
type DynamicString = ((r?: RenderObject, d?: DatumObject) => string) | string;
|
|
208
|
+
type DynamicNodeId = ((d?: DatumObject, dim?: DimensionDatum) => NodeId) | NodeId;
|
|
209
|
+
type DynamicRenderId = ((d?: DatumObject) => RenderId) | RenderId;
|
|
210
|
+
type DynamicNodeIdKey = ((d?: DatumObject) => string) | string;
|
|
211
|
+
type DynamicRenderIdKey = ((d?: DatumObject) => string) | string;
|
|
212
|
+
type DynamicDimensionId = ((d?: DimensionDatum, a?: GenericDataset) => NodeId) | NodeId;
|
|
213
|
+
type DynamicDimensionRenderId = ((d?: DimensionDatum, a?: GenericDataset) => RenderId) | RenderId;
|
|
214
|
+
type NumericallySubdivide = ((d?: DimensionKey, n?: Nodes) => number) | number;
|
|
215
|
+
type ChildmostMatchingStrategy = (index?: number, currentDivisionChild?: DatumObject, currentDivision?: DivisionObject, nextDivision?: DivisionObject) => DatumObject | undefined;
|
|
216
|
+
type AdjustingFunction = (d: Dimensions) => Dimensions;
|
|
217
|
+
type SortingFunction = (a: DatumObject, b: DatumObject, c?: any) => number;
|
|
218
|
+
type FilteringFunction = (a: DatumObject, b?: any) => boolean;
|
|
219
|
+
type ConditionalFunction = (n: NodeObject, d: EdgeDatum) => boolean;
|
|
220
|
+
type NodeId = string;
|
|
221
|
+
type EdgeId = string;
|
|
222
|
+
type RenderId = string;
|
|
223
|
+
type NavId = string;
|
|
224
|
+
type DimensionId = string;
|
|
225
|
+
type DimensionKey = string;
|
|
226
|
+
type NodeToAddOrReference = NodeObject | NodeId;
|
|
227
|
+
type Direction = 'target' | 'source';
|
|
228
|
+
type RenderingStrategy = 'outlineEach' | 'convexHull' | 'singleSquare' | 'custom';
|
|
229
|
+
type DimensionType = 'numerical' | 'categorical';
|
|
230
|
+
type ExtentType = 'circular' | 'terminal' | 'bridgedCousins' | 'bridgedCustom';
|
|
231
|
+
type ChildmostNavigationStrategy = 'within' | 'across';
|
|
232
|
+
type Level0ExtentType = 'circular' | 'terminal' | 'bridgedCustom';
|
|
233
|
+
type DataType = 'vega-lite' | 'vl' | 'Vega-Lite' | 'generic' | 'default';
|
|
234
|
+
type DimensionLevel = 0 | 1 | 2 | 3;
|
|
235
|
+
type DerivedNode = string;
|
|
236
|
+
type LLMMessage = {
|
|
237
|
+
role: 'user' | 'assistant' | 'system';
|
|
238
|
+
content: string;
|
|
239
|
+
};
|
|
240
|
+
type TextChatOptions = {
|
|
241
|
+
structure: Structure;
|
|
242
|
+
container: string | HTMLElement;
|
|
243
|
+
entryPoint?: NodeId;
|
|
244
|
+
describeNode?: (node: NodeObject) => string;
|
|
245
|
+
commandLabels?: Record<string, string>;
|
|
246
|
+
onNavigate?: (node: NodeObject) => void;
|
|
247
|
+
onExit?: () => void;
|
|
248
|
+
onClick?: (node: NodeObject) => void;
|
|
249
|
+
onHover?: (node: NodeObject) => void;
|
|
250
|
+
llm?: (messages: LLMMessage[]) => Promise<string | null>;
|
|
251
|
+
data?: Record<string, unknown>[];
|
|
252
|
+
};
|
|
253
|
+
type TextChatInstance = {
|
|
254
|
+
destroy: () => void;
|
|
255
|
+
getCurrentNode: () => NodeObject | null;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
declare const _default: {
|
|
259
|
+
structure: (options: StructureOptions) => Structure;
|
|
260
|
+
input: (options: InputOptions) => any;
|
|
261
|
+
rendering: (options: RenderingOptions) => any;
|
|
262
|
+
textChat: (options: TextChatOptions) => TextChatInstance;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export { type AddOrReferenceNodeList, type AdjustingFunction, type Attributes, type AttributesObject, type ChildmostMatchingStrategy, type ChildmostNavigationStrategy, type ConditionalFunction, type DataType, type DatumObject, type DerivedNode, type DescriptionOptions, type DimensionBehavior, type DimensionDatum, type DimensionDivisions, type DimensionId, type DimensionKey, type DimensionLevel, type DimensionList, type DimensionNavigationPair, type DimensionNavigationRules, type DimensionObject, type DimensionOperations, type DimensionOptions, type DimensionType, type Dimensions, type Direction, type DivisionObject, type DivisionOptions, type DynamicDimensionId, type DynamicDimensionRenderId, type DynamicNodeId, type DynamicNodeIdKey, type DynamicNumber, type DynamicRenderId, type DynamicRenderIdKey, type DynamicString, type EdgeDatum, type EdgeId, type EdgeList, type EdgeObject, type EdgeOptions, type Edges, type ElementData, type EntryCallbacks, type EntryObject, type ExistingElement, type ExitCallbacks, type ExitObject, type ExtentType, type FilteringFunction, type GenericDataset, type InputOptions, type KeyList, type LLMMessage, type Level0ExtentType, type Level1Behavior, type NavId, type NavObject, type NavigationList, type NavigationRules, type NodeId, type NodeObject, type NodeToAddOrReference, type Nodes, type NumericalExtentsPair, type NumericallySubdivide, type RenderId, type RenderObject, type RenderingOptions, type RenderingStrategy, type RootObject, type Semantics, type SemanticsObject, type SortingFunction, type SpatialObject, type SpatialProperties, type Structure, type StructureOptions, type TextChatInstance, type TextChatOptions, _default as default };
|