data-navigator 2.3.1 → 2.4.1
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 +118 -64
- package/dist/index.d.cts +265 -0
- package/dist/index.d.ts +265 -0
- package/dist/index.js +118 -64
- package/dist/structure.cjs +1 -1
- package/dist/structure.js +1 -1
- package/dist/text-chat.cjs +13 -13
- package/dist/text-chat.js +8 -8
- package/package.json +5 -5
- package/text-chat.css +2 -2
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,
|
|
@@ -621,16 +626,25 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
621
626
|
let node = values[valueKeys[index]];
|
|
622
627
|
let value = node[s];
|
|
623
628
|
if (value <= i) {
|
|
624
|
-
|
|
629
|
+
const leafId = typeof options.idKey === "function" ? options.idKey(node) : node[options.idKey];
|
|
630
|
+
dimension.divisions[divisionId].values[leafId] = node;
|
|
631
|
+
index++;
|
|
625
632
|
} else {
|
|
626
|
-
i += interval;
|
|
627
633
|
limit = true;
|
|
628
634
|
}
|
|
629
|
-
index++;
|
|
630
635
|
}
|
|
636
|
+
prevBound = i;
|
|
631
637
|
divisionCount++;
|
|
632
638
|
}
|
|
633
|
-
|
|
639
|
+
if (lastDivisionId && index < valueKeys.length) {
|
|
640
|
+
while (index < valueKeys.length) {
|
|
641
|
+
let node = values[valueKeys[index]];
|
|
642
|
+
const leafId = typeof options.idKey === "function" ? options.idKey(node) : node[options.idKey];
|
|
643
|
+
dimension.divisions[lastDivisionId].values[leafId] = node;
|
|
644
|
+
index++;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
delete divisions[dimension.nodeId];
|
|
634
648
|
}
|
|
635
649
|
} else if (typeof ((_e = dimension.operations) == null ? void 0 : _e.sortFunction) === "function") {
|
|
636
650
|
dimension.divisions = Object.fromEntries(
|
|
@@ -681,7 +695,7 @@ var scaffoldDimensions = (options, nodes) => {
|
|
|
681
695
|
}
|
|
682
696
|
}
|
|
683
697
|
});
|
|
684
|
-
if (options.dimensions.adjustDimensions) {
|
|
698
|
+
if ((_c = options.dimensions) == null ? void 0 : _c.adjustDimensions) {
|
|
685
699
|
dimensions = options.dimensions.adjustDimensions(dimensions);
|
|
686
700
|
}
|
|
687
701
|
return dimensions;
|
|
@@ -796,6 +810,22 @@ var buildEdges = (options, nodes, dimensions) => {
|
|
|
796
810
|
"source"
|
|
797
811
|
);
|
|
798
812
|
}
|
|
813
|
+
const findNextNonEmptyDivIdx = (fromIdx) => {
|
|
814
|
+
for (let step = 1; step < divisionKeys.length; step++) {
|
|
815
|
+
const idx = (fromIdx + step) % divisionKeys.length;
|
|
816
|
+
if (Object.keys(dimension.divisions[divisionKeys[idx]].values).length > 0)
|
|
817
|
+
return idx;
|
|
818
|
+
}
|
|
819
|
+
return null;
|
|
820
|
+
};
|
|
821
|
+
const findPrevNonEmptyDivIdx = (fromIdx) => {
|
|
822
|
+
for (let step = 1; step < divisionKeys.length; step++) {
|
|
823
|
+
const idx = (fromIdx - step + divisionKeys.length) % divisionKeys.length;
|
|
824
|
+
if (Object.keys(dimension.divisions[divisionKeys[idx]].values).length > 0)
|
|
825
|
+
return idx;
|
|
826
|
+
}
|
|
827
|
+
return null;
|
|
828
|
+
};
|
|
799
829
|
let j = 0;
|
|
800
830
|
divisionKeys.forEach((d) => {
|
|
801
831
|
let division = dimension.divisions[d];
|
|
@@ -818,13 +848,15 @@ var buildEdges = (options, nodes, dimensions) => {
|
|
|
818
848
|
} else {
|
|
819
849
|
createEdge(division.id, dimension.nodeId, dimension.navigationRules.parent_child, "source");
|
|
820
850
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
851
|
+
if (valueKeys.length > 0) {
|
|
852
|
+
const firstChildId = typeof options.idKey === "function" ? options.idKey(division.values[valueKeys[0]]) : options.idKey;
|
|
853
|
+
createEdge(
|
|
854
|
+
division.id,
|
|
855
|
+
division.values[valueKeys[0]][firstChildId],
|
|
856
|
+
dimension.navigationRules.parent_child,
|
|
857
|
+
"source"
|
|
858
|
+
);
|
|
859
|
+
}
|
|
828
860
|
let i = 0;
|
|
829
861
|
if (valueKeys.length >= 1) {
|
|
830
862
|
valueKeys.forEach((vk) => {
|
|
@@ -845,22 +877,13 @@ var buildEdges = (options, nodes, dimensions) => {
|
|
|
845
877
|
dimension.navigationRules.sibling_sibling
|
|
846
878
|
);
|
|
847
879
|
} else if (i === valueKeys.length - 1 && extents2 === "bridgedCousins") {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
dimension.navigationRules.sibling_sibling
|
|
856
|
-
);
|
|
857
|
-
} else {
|
|
858
|
-
const targetId = typeof options.idKey === "function" ? options.idKey(dimension.divisions[divisionKeys[0]].values[valueKeys[0]]) : options.idKey;
|
|
859
|
-
createEdge(
|
|
860
|
-
v[id],
|
|
861
|
-
dimension.divisions[divisionKeys[0]].values[valueKeys[0]][targetId],
|
|
862
|
-
dimension.navigationRules.sibling_sibling
|
|
863
|
-
);
|
|
880
|
+
const nextIdx = findNextNonEmptyDivIdx(j);
|
|
881
|
+
if (nextIdx !== null) {
|
|
882
|
+
const nextDivValues = dimension.divisions[divisionKeys[nextIdx]].values;
|
|
883
|
+
const nextDivValueKeys = Object.keys(nextDivValues);
|
|
884
|
+
const targetDatum = nextDivValues[nextDivValueKeys[0]];
|
|
885
|
+
const targetId = typeof options.idKey === "function" ? options.idKey(targetDatum) : options.idKey;
|
|
886
|
+
createEdge(v[id], targetDatum[targetId], dimension.navigationRules.sibling_sibling);
|
|
864
887
|
}
|
|
865
888
|
} else if (i === valueKeys.length - 1 && extents2 === "bridgedCustom") {
|
|
866
889
|
createEdge(
|
|
@@ -877,24 +900,13 @@ var buildEdges = (options, nodes, dimensions) => {
|
|
|
877
900
|
);
|
|
878
901
|
}
|
|
879
902
|
if (!i && extents2 === "bridgedCousins") {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
dimension.navigationRules.sibling_sibling
|
|
888
|
-
);
|
|
889
|
-
} else {
|
|
890
|
-
const targetId = typeof options.idKey === "function" ? options.idKey(
|
|
891
|
-
dimension.divisions[divisionKeys[divisionKeys.length - 1]].values[valueKeys[valueKeys.length - 1]]
|
|
892
|
-
) : options.idKey;
|
|
893
|
-
createEdge(
|
|
894
|
-
dimension.divisions[divisionKeys[divisionKeys.length - 1]].values[valueKeys[valueKeys.length - 1]][targetId],
|
|
895
|
-
v[id],
|
|
896
|
-
dimension.navigationRules.sibling_sibling
|
|
897
|
-
);
|
|
903
|
+
const prevIdx = findPrevNonEmptyDivIdx(j);
|
|
904
|
+
if (prevIdx !== null) {
|
|
905
|
+
const prevDivValues = dimension.divisions[divisionKeys[prevIdx]].values;
|
|
906
|
+
const prevDivValueKeys = Object.keys(prevDivValues);
|
|
907
|
+
const targetDatum = prevDivValues[prevDivValueKeys[prevDivValueKeys.length - 1]];
|
|
908
|
+
const targetId = typeof options.idKey === "function" ? options.idKey(targetDatum) : options.idKey;
|
|
909
|
+
createEdge(targetDatum[targetId], v[id], dimension.navigationRules.sibling_sibling);
|
|
898
910
|
}
|
|
899
911
|
} else if (!i && extents2 === "bridgedCustom") {
|
|
900
912
|
createEdge(
|
|
@@ -1492,9 +1504,7 @@ var fuzzyMatch = (input, candidates, labels = {}) => {
|
|
|
1492
1504
|
const exactName = candidates.find((c) => c.toLowerCase() === lower);
|
|
1493
1505
|
if (exactName)
|
|
1494
1506
|
return { match: exactName, ambiguous: [] };
|
|
1495
|
-
const exactLabel = candidates.find(
|
|
1496
|
-
(c) => labels[c] && labels[c].toLowerCase() === lower
|
|
1497
|
-
);
|
|
1507
|
+
const exactLabel = candidates.find((c) => labels[c] && labels[c].toLowerCase() === lower);
|
|
1498
1508
|
if (exactLabel)
|
|
1499
1509
|
return { match: exactLabel, ambiguous: [] };
|
|
1500
1510
|
const namePrefix = candidates.filter((c) => c.toLowerCase().startsWith(lower));
|
|
@@ -1588,6 +1598,8 @@ var text_chat_default = (options) => {
|
|
|
1588
1598
|
commandLabels = {},
|
|
1589
1599
|
onNavigate,
|
|
1590
1600
|
onExit,
|
|
1601
|
+
onClick,
|
|
1602
|
+
onHover,
|
|
1591
1603
|
llm,
|
|
1592
1604
|
data
|
|
1593
1605
|
} = options;
|
|
@@ -1752,12 +1764,16 @@ var text_chat_default = (options) => {
|
|
|
1752
1764
|
}
|
|
1753
1765
|
});
|
|
1754
1766
|
if (llm) {
|
|
1755
|
-
addSystemMessage(
|
|
1756
|
-
|
|
1767
|
+
addSystemMessage(
|
|
1768
|
+
'Text navigation ready. Type "enter" to begin navigating, "help" for commands, or ask a question about the data.'
|
|
1769
|
+
);
|
|
1770
|
+
addSystemMessage(
|
|
1771
|
+
'Note: AI-generated answers may be inaccurate. You can ask the model to "verify" any answer \u2014 it will attempt to provide a Python script that checks the claim against the dataset. If a claim cannot be verified with code, it should be verified externally.'
|
|
1772
|
+
);
|
|
1757
1773
|
} else {
|
|
1758
1774
|
addSystemMessage('Text navigation ready. Type "enter" to begin or "help" for available commands.');
|
|
1759
1775
|
}
|
|
1760
|
-
const specialCommands = ["enter", "help", "more", "more help", "clear"];
|
|
1776
|
+
const specialCommands = ["enter", "help", "more", "more help", "clear", "click", "select", "hover", "inspect"];
|
|
1761
1777
|
const moveToNode = (nodeId) => {
|
|
1762
1778
|
const node = inputHandler.moveTo(nodeId);
|
|
1763
1779
|
if (node) {
|
|
@@ -1808,15 +1824,51 @@ var text_chat_default = (options) => {
|
|
|
1808
1824
|
}
|
|
1809
1825
|
if (lower === "help") {
|
|
1810
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(", ")}.` : "";
|
|
1811
1833
|
if (!currentNodeId) {
|
|
1812
1834
|
addResponse(
|
|
1813
|
-
'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
|
|
1814
1836
|
);
|
|
1815
1837
|
} else {
|
|
1816
1838
|
const node = structure.nodes[currentNodeId];
|
|
1817
1839
|
const available = getAvailableRules(currentNodeId, node, structure);
|
|
1818
1840
|
const formatted = available.map((r) => formatRule(r, commandLabels));
|
|
1819
|
-
addResponse(`Available: ${formatted.join(", ")}, move to <search>.` + llmHint);
|
|
1841
|
+
addResponse(`Available: ${formatted.join(", ")}, move to <search>.` + interactionSuffix + llmHint);
|
|
1842
|
+
}
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
if (lower === "click" || lower === "select") {
|
|
1846
|
+
if (!currentNodeId) {
|
|
1847
|
+
addResponse('Not in the structure. Type "enter" to begin.');
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
const node = structure.nodes[currentNodeId];
|
|
1851
|
+
if (onClick && node) {
|
|
1852
|
+
onClick(node);
|
|
1853
|
+
addResponse(`Clicked: ${describeNode2(node)}`);
|
|
1854
|
+
} else {
|
|
1855
|
+
addResponse(onClick ? "Nothing to click here." : "Click interaction is not enabled for this chart.");
|
|
1856
|
+
}
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
if (lower === "hover" || lower === "inspect") {
|
|
1860
|
+
if (!currentNodeId) {
|
|
1861
|
+
addResponse('Not in the structure. Type "enter" to begin.');
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
1864
|
+
const node = structure.nodes[currentNodeId];
|
|
1865
|
+
if (onHover && node) {
|
|
1866
|
+
onHover(node);
|
|
1867
|
+
addResponse(`Hovering over: ${describeNode2(node)}`);
|
|
1868
|
+
} else {
|
|
1869
|
+
addResponse(
|
|
1870
|
+
onHover ? "Nothing to hover over here." : "Hover interaction is not enabled for this chart."
|
|
1871
|
+
);
|
|
1820
1872
|
}
|
|
1821
1873
|
return;
|
|
1822
1874
|
}
|
|
@@ -1853,7 +1905,9 @@ var text_chat_default = (options) => {
|
|
|
1853
1905
|
return;
|
|
1854
1906
|
}
|
|
1855
1907
|
const llmHint = llm ? " Enter an API key above to ask questions about the data." : "";
|
|
1856
|
-
addResponse(
|
|
1908
|
+
addResponse(
|
|
1909
|
+
'Type "enter" to begin navigating the structure, or "move to <search>" to jump to a node.' + llmHint
|
|
1910
|
+
);
|
|
1857
1911
|
return;
|
|
1858
1912
|
}
|
|
1859
1913
|
const allRules = getAllRuleNames(structure);
|
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 };
|