@macrostrat/feedback-components 1.1.9 → 2.0.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/CHANGELOG.md +10 -0
- package/dist/extractions/index.cjs +198 -0
- package/dist/extractions/index.cjs.map +1 -0
- package/dist/extractions/index.d.ts +30 -0
- package/dist/extractions/index.js +198 -0
- package/dist/extractions/index.js.map +1 -0
- package/dist/extractions/main.module.sass.cjs +12 -0
- package/dist/extractions/main.module.sass.cjs.map +1 -0
- package/dist/extractions/main.module.sass.js +12 -0
- package/dist/extractions/main.module.sass.js.map +1 -0
- package/dist/extractions/types.d.ts +32 -0
- package/dist/feedback/edit-state.cjs +382 -0
- package/dist/feedback/edit-state.cjs.map +1 -0
- package/dist/feedback/edit-state.d.ts +127 -0
- package/dist/feedback/edit-state.js +382 -0
- package/dist/feedback/edit-state.js.map +1 -0
- package/dist/feedback/feedback.module.sass.cjs +47 -0
- package/dist/feedback/feedback.module.sass.cjs.map +1 -0
- package/dist/feedback/feedback.module.sass.js +47 -0
- package/dist/feedback/feedback.module.sass.js.map +1 -0
- package/dist/feedback/graph.cjs +124 -0
- package/dist/feedback/graph.cjs.map +1 -0
- package/dist/feedback/graph.d.ts +9 -0
- package/dist/feedback/graph.js +124 -0
- package/dist/feedback/graph.js.map +1 -0
- package/dist/feedback/index.cjs +347 -0
- package/dist/feedback/index.cjs.map +1 -0
- package/dist/feedback/index.d.ts +15 -0
- package/dist/feedback/index.js +348 -0
- package/dist/feedback/index.js.map +1 -0
- package/dist/feedback/matches.cjs +244 -0
- package/dist/feedback/matches.cjs.map +1 -0
- package/dist/feedback/matches.d.ts +17 -0
- package/dist/feedback/matches.js +244 -0
- package/dist/feedback/matches.js.map +1 -0
- package/dist/feedback/node.cjs +63 -0
- package/dist/feedback/node.cjs.map +1 -0
- package/dist/feedback/node.d.ts +5 -0
- package/dist/feedback/node.js +63 -0
- package/dist/feedback/node.js.map +1 -0
- package/dist/feedback/text-visualizer.cjs +288 -0
- package/dist/feedback/text-visualizer.cjs.map +1 -0
- package/dist/feedback/text-visualizer.d.ts +36 -0
- package/dist/feedback/text-visualizer.js +288 -0
- package/dist/feedback/text-visualizer.js.map +1 -0
- package/dist/feedback/type-selector/index.cjs +47 -0
- package/dist/feedback/type-selector/index.cjs.map +1 -0
- package/dist/feedback/type-selector/index.d.ts +20 -0
- package/dist/feedback/type-selector/index.js +47 -0
- package/dist/feedback/type-selector/index.js.map +1 -0
- package/dist/feedback/type-selector/main.module.sass.cjs +13 -0
- package/dist/feedback/type-selector/main.module.sass.cjs.map +1 -0
- package/dist/feedback/type-selector/main.module.sass.js +13 -0
- package/dist/feedback/type-selector/main.module.sass.js.map +1 -0
- package/dist/feedback/typelist.cjs +293 -0
- package/dist/feedback/typelist.cjs.map +1 -0
- package/dist/feedback/typelist.d.ts +8 -0
- package/dist/feedback/typelist.js +293 -0
- package/dist/feedback/typelist.js.map +1 -0
- package/dist/feedback/types.d.ts +64 -0
- package/dist/feedback-components.css +343 -0
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -41
- package/src/extractions/index.ts +2 -2
- package/src/feedback/text-visualizer.ts +0 -1
- package/src/feedback/types.ts +2 -2
- package/dist/esm/feedback-components.2364179b.js +0 -287
- package/dist/esm/feedback-components.2364179b.js.map +0 -1
- package/dist/esm/feedback-components.6d32ee91.js +0 -16
- package/dist/esm/feedback-components.6d32ee91.js.map +0 -1
- package/dist/esm/feedback-components.7dd42a9f.js +0 -248
- package/dist/esm/feedback-components.7dd42a9f.js.map +0 -1
- package/dist/esm/feedback-components.7f72e5e9.js +0 -64
- package/dist/esm/feedback-components.7f72e5e9.js.map +0 -1
- package/dist/esm/feedback-components.ad9f284e.js +0 -63
- package/dist/esm/feedback-components.ad9f284e.js.map +0 -1
- package/dist/esm/feedback-components.ba79c0ef.js +0 -204
- package/dist/esm/feedback-components.ba79c0ef.js.map +0 -1
- package/dist/esm/feedback-components.bf93773c.css +0 -17
- package/dist/esm/feedback-components.bf93773c.css.map +0 -1
- package/dist/esm/feedback-components.c6e2c296.js +0 -148
- package/dist/esm/feedback-components.c6e2c296.js.map +0 -1
- package/dist/esm/feedback-components.ca78c2d4.js +0 -287
- package/dist/esm/feedback-components.ca78c2d4.js.map +0 -1
- package/dist/esm/feedback-components.d769ffa5.css +0 -205
- package/dist/esm/feedback-components.d769ffa5.css.map +0 -1
- package/dist/esm/feedback-components.e273ed5b.css +0 -14
- package/dist/esm/feedback-components.e273ed5b.css.map +0 -1
- package/dist/esm/feedback-components.e702eece.js +0 -97
- package/dist/esm/feedback-components.e702eece.js.map +0 -1
- package/dist/esm/feedback-components.edc606bb.js +0 -360
- package/dist/esm/feedback-components.edc606bb.js.map +0 -1
- package/dist/esm/feedback-components.f9850d85.js +0 -19
- package/dist/esm/feedback-components.f9850d85.js.map +0 -1
- package/dist/esm/feedback-components.fa847634.js +0 -453
- package/dist/esm/feedback-components.fa847634.js.map +0 -1
- package/dist/esm/index.d.ts +0 -96
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/node/feedback-components.1bd49bf0.js +0 -2
- package/dist/node/feedback-components.1bd49bf0.js.map +0 -1
- package/dist/node/feedback-components.2f391fa4.js +0 -2
- package/dist/node/feedback-components.2f391fa4.js.map +0 -1
- package/dist/node/feedback-components.6a4a1290.js +0 -2
- package/dist/node/feedback-components.6a4a1290.js.map +0 -1
- package/dist/node/feedback-components.70780da4.js +0 -2
- package/dist/node/feedback-components.70780da4.js.map +0 -1
- package/dist/node/feedback-components.794f429b.js +0 -2
- package/dist/node/feedback-components.794f429b.js.map +0 -1
- package/dist/node/feedback-components.83c21466.css +0 -2
- package/dist/node/feedback-components.83c21466.css.map +0 -1
- package/dist/node/feedback-components.97518e90.css +0 -2
- package/dist/node/feedback-components.97518e90.css.map +0 -1
- package/dist/node/feedback-components.9eb1d41a.css +0 -2
- package/dist/node/feedback-components.9eb1d41a.css.map +0 -1
- package/dist/node/feedback-components.acac789b.js +0 -2
- package/dist/node/feedback-components.acac789b.js.map +0 -1
- package/dist/node/feedback-components.c84ff10e.js +0 -2
- package/dist/node/feedback-components.c84ff10e.js.map +0 -1
- package/dist/node/feedback-components.db72d0e1.js +0 -2
- package/dist/node/feedback-components.db72d0e1.js.map +0 -1
- package/dist/node/feedback-components.dc76072c.js +0 -2
- package/dist/node/feedback-components.dc76072c.js.map +0 -1
- package/dist/node/feedback-components.ddd11fe8.js +0 -2
- package/dist/node/feedback-components.ddd11fe8.js.map +0 -1
- package/dist/node/feedback-components.e59a061f.js +0 -2
- package/dist/node/feedback-components.e59a061f.js.map +0 -1
- package/dist/node/feedback-components.feab0bd0.js +0 -2
- package/dist/node/feedback-components.feab0bd0.js.map +0 -1
- package/dist/node/index.js +0 -2
- package/dist/node/index.js.map +0 -1
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
import {useReducer as $abOVY$useReducer, createContext as $abOVY$createContext, useContext as $abOVY$useContext} from "react";
|
|
2
|
-
import $abOVY$immutabilityhelper from "immutability-helper";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var $b79bf29960412ca7$export$53ec42062883b2d4 = /*#__PURE__*/ function(ViewMode) {
|
|
7
|
-
ViewMode["Tree"] = "tree";
|
|
8
|
-
ViewMode["Graph"] = "graph";
|
|
9
|
-
return ViewMode;
|
|
10
|
-
}({});
|
|
11
|
-
function $b79bf29960412ca7$export$911bb4b9c8065d3d(initialTree, entityTypes, viewOnly, matchMode, autoSelect = []) {
|
|
12
|
-
// Get the first entity type
|
|
13
|
-
// issue: grabs second entity instead of selected one
|
|
14
|
-
const type = entityTypes.values().next().value;
|
|
15
|
-
let selectedNodes = [];
|
|
16
|
-
autoSelect = autoSelect.map((name)=>name.toLowerCase());
|
|
17
|
-
if (autoSelect.length > 0) // If autoSelect is provided, find the nodes with the matching names
|
|
18
|
-
selectedNodes = initialTree.flatMap((node)=>node.children ?? []).filter((node)=>autoSelect.includes(node.name.toLowerCase())).map((node)=>node.id);
|
|
19
|
-
return (0, $abOVY$useReducer)($b79bf29960412ca7$var$treeReducer, {
|
|
20
|
-
initialTree: initialTree,
|
|
21
|
-
tree: initialTree,
|
|
22
|
-
selectedNodes: selectedNodes,
|
|
23
|
-
entityTypesMap: entityTypes,
|
|
24
|
-
selectedEntityType: type,
|
|
25
|
-
lastInternalId: 0,
|
|
26
|
-
isSelectingEntityType: false,
|
|
27
|
-
viewMode: "tree",
|
|
28
|
-
viewOnly: viewOnly,
|
|
29
|
-
matchMode: matchMode
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const $b79bf29960412ca7$export$e5ce04c5b3f58533 = (0, $abOVY$createContext)(null);
|
|
33
|
-
function $b79bf29960412ca7$export$e1068f2d1c68f87e() {
|
|
34
|
-
const dispatch = (0, $abOVY$useContext)($b79bf29960412ca7$export$e5ce04c5b3f58533);
|
|
35
|
-
if (dispatch == null) throw new Error("No dispatch context available");
|
|
36
|
-
return dispatch;
|
|
37
|
-
}
|
|
38
|
-
function $b79bf29960412ca7$var$treeReducer(state, action) {
|
|
39
|
-
if (action.type === "toggle-match-mode") return {
|
|
40
|
-
...state,
|
|
41
|
-
matchMode: !state.matchMode
|
|
42
|
-
};
|
|
43
|
-
if (action.type === "toggle-view-only") return {
|
|
44
|
-
...state,
|
|
45
|
-
viewOnly: !state.viewOnly,
|
|
46
|
-
selectedNodes: []
|
|
47
|
-
};
|
|
48
|
-
if (state.viewOnly) return $b79bf29960412ca7$var$viewMode(state, action);
|
|
49
|
-
if (state.matchMode) return $b79bf29960412ca7$var$matchMode(state, action);
|
|
50
|
-
switch(action.type){
|
|
51
|
-
case "add-entity-type":
|
|
52
|
-
{
|
|
53
|
-
// Add a new entity type to the map
|
|
54
|
-
const { name: name, description: description, color: color } = action.payload;
|
|
55
|
-
const newId = state.lastInternalId - 1;
|
|
56
|
-
const newType = {
|
|
57
|
-
id: newId,
|
|
58
|
-
name: name,
|
|
59
|
-
description: description === "" ? null : description,
|
|
60
|
-
color: color
|
|
61
|
-
};
|
|
62
|
-
const newEntityTypesMap = new Map(state.entityTypesMap);
|
|
63
|
-
newEntityTypesMap.set(newId, newType);
|
|
64
|
-
return {
|
|
65
|
-
...state,
|
|
66
|
-
entityTypesMap: newEntityTypesMap,
|
|
67
|
-
selectedEntityType: newType,
|
|
68
|
-
lastInternalId: newId
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
case "update-entity-type":
|
|
72
|
-
{
|
|
73
|
-
// Update an existing entity type in the map
|
|
74
|
-
const { id: id, name: name, description: description, color: color } = action.payload;
|
|
75
|
-
const newEntityTypesMap = new Map(state.entityTypesMap);
|
|
76
|
-
const oldType = newEntityTypesMap.get(id);
|
|
77
|
-
if (!oldType) {
|
|
78
|
-
console.warn(`Entity type with id ${id} not found`);
|
|
79
|
-
return state;
|
|
80
|
-
}
|
|
81
|
-
const updatedType = {
|
|
82
|
-
...oldType,
|
|
83
|
-
name: name,
|
|
84
|
-
description: description === "" ? null : description,
|
|
85
|
-
color: color
|
|
86
|
-
};
|
|
87
|
-
newEntityTypesMap.set(id, updatedType);
|
|
88
|
-
// Update the tree to reflect the new type
|
|
89
|
-
const newTree = $b79bf29960412ca7$var$updateTreeTypes(state.tree, oldType, updatedType);
|
|
90
|
-
return {
|
|
91
|
-
...state,
|
|
92
|
-
tree: newTree,
|
|
93
|
-
entityTypesMap: newEntityTypesMap,
|
|
94
|
-
selectedEntityType: updatedType
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
case "select-range":
|
|
98
|
-
// Select a range of nodes by their IDs
|
|
99
|
-
const payloadIds = action.payload.ids;
|
|
100
|
-
const node1 = payloadIds[0];
|
|
101
|
-
const node2 = payloadIds[1];
|
|
102
|
-
// make list of nodes in order
|
|
103
|
-
const allNodes = $b79bf29960412ca7$var$flattenAndSort(state.tree);
|
|
104
|
-
// select all nodes between node1 and node2
|
|
105
|
-
const startIndex = allNodes.findIndex((node)=>node.id === node1);
|
|
106
|
-
const endIndex = allNodes.findIndex((node)=>node.id === node2);
|
|
107
|
-
const selectedNodes = allNodes.slice(startIndex, endIndex + 1);
|
|
108
|
-
console.log("Selecting range:", selectedNodes);
|
|
109
|
-
return {
|
|
110
|
-
...state,
|
|
111
|
-
selectedNodes: selectedNodes.map((node)=>node.id)
|
|
112
|
-
};
|
|
113
|
-
case "move-node":
|
|
114
|
-
// For each node in the tree, if the node is in the dragIds, remove it from the tree and collect it
|
|
115
|
-
const [newTree, removedNodes] = $b79bf29960412ca7$var$removeNodes(state.tree, action.payload.dragIds);
|
|
116
|
-
let keyPath = [];
|
|
117
|
-
if (action.payload.parentId) {
|
|
118
|
-
keyPath = $b79bf29960412ca7$var$findNode(newTree, action.payload.parentId);
|
|
119
|
-
keyPath.push("children");
|
|
120
|
-
}
|
|
121
|
-
// Add removed nodes to the new tree at the correct location
|
|
122
|
-
let updateSpec = $b79bf29960412ca7$var$buildNestedSpec(keyPath, {
|
|
123
|
-
$splice: [
|
|
124
|
-
[
|
|
125
|
-
action.payload.index,
|
|
126
|
-
0,
|
|
127
|
-
...removedNodes
|
|
128
|
-
]
|
|
129
|
-
]
|
|
130
|
-
});
|
|
131
|
-
return {
|
|
132
|
-
...state,
|
|
133
|
-
tree: (0, $abOVY$immutabilityhelper)(newTree, updateSpec)
|
|
134
|
-
};
|
|
135
|
-
case "delete-node":
|
|
136
|
-
// For each node in the tree, if the node is in the ids, remove it from the tree
|
|
137
|
-
const [newTree2, _removedNodes] = $b79bf29960412ca7$var$removeNodes(state.tree, action.payload.ids);
|
|
138
|
-
// Get children of the removed nodes
|
|
139
|
-
// If children are not present elsewhere in the tree, insert them
|
|
140
|
-
const children = _removedNodes.flatMap((node)=>node.children ?? []).filter((child)=>!$b79bf29960412ca7$var$nodeIsInTree(newTree2, child.id));
|
|
141
|
-
// Reset the selection
|
|
142
|
-
return {
|
|
143
|
-
...state,
|
|
144
|
-
tree: [
|
|
145
|
-
...newTree2,
|
|
146
|
-
...children
|
|
147
|
-
],
|
|
148
|
-
selectedNodes: state.selectedNodes.filter((id)=>!action.payload.ids.includes(id))
|
|
149
|
-
};
|
|
150
|
-
case "select-node":
|
|
151
|
-
const { ids: ids } = action.payload;
|
|
152
|
-
const type = action.payload.ids.length > 0 ? $b79bf29960412ca7$export$e64eb58334357825(state.tree, ids[0])?.type : null;
|
|
153
|
-
return {
|
|
154
|
-
...state,
|
|
155
|
-
selectedNodes: ids,
|
|
156
|
-
selectedEntityType: type
|
|
157
|
-
};
|
|
158
|
-
// otherwise fall through to toggle-node-selected for a single ID
|
|
159
|
-
case "toggle-node-selected":
|
|
160
|
-
const nodesToAdd = action.payload.ids.filter((id)=>!state.selectedNodes.includes(id));
|
|
161
|
-
const nodesToKeep = state.selectedNodes.filter((id)=>!action.payload.ids.includes(id));
|
|
162
|
-
const newType = action.payload.ids.length > 0 ? $b79bf29960412ca7$export$e64eb58334357825(state.tree, action.payload.ids[0])?.type : null;
|
|
163
|
-
return {
|
|
164
|
-
...state,
|
|
165
|
-
selectedNodes: [
|
|
166
|
-
...nodesToKeep,
|
|
167
|
-
...nodesToAdd
|
|
168
|
-
],
|
|
169
|
-
selectedEntityType: newType
|
|
170
|
-
};
|
|
171
|
-
case "create-node":
|
|
172
|
-
const newId = state.lastInternalId - 1;
|
|
173
|
-
const { text: text, start: start, end: end } = action.payload;
|
|
174
|
-
const node = {
|
|
175
|
-
id: newId,
|
|
176
|
-
name: text,
|
|
177
|
-
children: [],
|
|
178
|
-
indices: [
|
|
179
|
-
start,
|
|
180
|
-
end
|
|
181
|
-
],
|
|
182
|
-
type: state.selectedEntityType
|
|
183
|
-
};
|
|
184
|
-
return {
|
|
185
|
-
...state,
|
|
186
|
-
tree: [
|
|
187
|
-
...state.tree,
|
|
188
|
-
node
|
|
189
|
-
],
|
|
190
|
-
selectedNodes: [
|
|
191
|
-
newId
|
|
192
|
-
],
|
|
193
|
-
lastInternalId: newId
|
|
194
|
-
};
|
|
195
|
-
case "delete-entity-type":
|
|
196
|
-
{
|
|
197
|
-
// Remove the entity type from the map
|
|
198
|
-
const { id: id } = action.payload;
|
|
199
|
-
const newEntityTypesMap = new Map(state.entityTypesMap);
|
|
200
|
-
const oldType = newEntityTypesMap.get(id);
|
|
201
|
-
newEntityTypesMap.delete(id);
|
|
202
|
-
const defaultType = newEntityTypesMap.values().next().value;
|
|
203
|
-
const newTree = $b79bf29960412ca7$var$updateTreeTypes(state.tree, oldType, defaultType);
|
|
204
|
-
return {
|
|
205
|
-
...state,
|
|
206
|
-
tree: newTree,
|
|
207
|
-
entityTypesMap: newEntityTypesMap,
|
|
208
|
-
selectedNodes: []
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
/** Entity type selection */ case "toggle-entity-type-selector":
|
|
212
|
-
return {
|
|
213
|
-
...state,
|
|
214
|
-
isSelectingEntityType: action.payload ?? !state.isSelectingEntityType
|
|
215
|
-
};
|
|
216
|
-
case "select-entity-type":
|
|
217
|
-
{
|
|
218
|
-
// For each selected node, update the type
|
|
219
|
-
let newTree2 = state.tree;
|
|
220
|
-
for (let id of state.selectedNodes){
|
|
221
|
-
const keyPath = $b79bf29960412ca7$var$findNode(state.tree, id);
|
|
222
|
-
const nestedSpec = $b79bf29960412ca7$var$buildNestedSpec(keyPath, {
|
|
223
|
-
type: {
|
|
224
|
-
$set: action.payload
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
newTree2 = (0, $abOVY$immutabilityhelper)(newTree2, nestedSpec);
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
...state,
|
|
231
|
-
tree: newTree2,
|
|
232
|
-
selectedEntityType: action.payload
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
case "deselect":
|
|
236
|
-
return {
|
|
237
|
-
...state,
|
|
238
|
-
selectedNodes: []
|
|
239
|
-
};
|
|
240
|
-
case "reset":
|
|
241
|
-
return {
|
|
242
|
-
...state,
|
|
243
|
-
tree: state.initialTree,
|
|
244
|
-
selectedNodes: []
|
|
245
|
-
};
|
|
246
|
-
case "set-view-mode":
|
|
247
|
-
return {
|
|
248
|
-
...state,
|
|
249
|
-
viewMode: action.payload
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function $b79bf29960412ca7$var$nodeIsInTree(tree, id) {
|
|
254
|
-
for (let node of tree){
|
|
255
|
-
if (node.id == id) return true;
|
|
256
|
-
else if (node.children) {
|
|
257
|
-
if ($b79bf29960412ca7$var$nodeIsInTree(node.children, id)) return true;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
function $b79bf29960412ca7$var$buildNestedSpec(keyPath, innerSpec) {
|
|
263
|
-
// Build a nested object from a key path
|
|
264
|
-
let spec = innerSpec;
|
|
265
|
-
for(let i = keyPath.length - 1; i >= 0; i--)spec = {
|
|
266
|
-
[keyPath[i]]: spec
|
|
267
|
-
};
|
|
268
|
-
return spec;
|
|
269
|
-
// Since we don't have a "children" key at the root, we make the top-level spec an array
|
|
270
|
-
}
|
|
271
|
-
function $b79bf29960412ca7$var$findNode(tree, id) {
|
|
272
|
-
// Find the index of the node with the given id in the tree, returning the key path
|
|
273
|
-
for(let i = 0; i < tree.length; i++){
|
|
274
|
-
if (tree[i].id == id) return [
|
|
275
|
-
i
|
|
276
|
-
];
|
|
277
|
-
else if (tree[i].children) {
|
|
278
|
-
let path = $b79bf29960412ca7$var$findNode(tree[i].children, id);
|
|
279
|
-
if (path != null) return [
|
|
280
|
-
i,
|
|
281
|
-
"children",
|
|
282
|
-
...path
|
|
283
|
-
];
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
function $b79bf29960412ca7$var$removeNodes(tree, ids) {
|
|
289
|
-
/** Remove nodes with the given ids from the tree and return the new tree and the removed nodes */ let newTree = [];
|
|
290
|
-
let removedNodes = [];
|
|
291
|
-
for (let node of tree)if (ids.includes(node.id)) removedNodes.push(node);
|
|
292
|
-
else {
|
|
293
|
-
// Recurse into children
|
|
294
|
-
if (node.children) {
|
|
295
|
-
let [newChildren, removedChildren] = $b79bf29960412ca7$var$removeNodes(node.children, ids);
|
|
296
|
-
node = {
|
|
297
|
-
...node,
|
|
298
|
-
children: newChildren
|
|
299
|
-
};
|
|
300
|
-
removedNodes.push(...removedChildren);
|
|
301
|
-
}
|
|
302
|
-
newTree.push(node);
|
|
303
|
-
}
|
|
304
|
-
return [
|
|
305
|
-
newTree,
|
|
306
|
-
removedNodes
|
|
307
|
-
];
|
|
308
|
-
}
|
|
309
|
-
function $b79bf29960412ca7$export$8d9dbb7a64bf2a5e(tree) {
|
|
310
|
-
// Convert the tree to a graph
|
|
311
|
-
let nodes = [];
|
|
312
|
-
let edges = [];
|
|
313
|
-
const nodeMap = new Map();
|
|
314
|
-
for (let node of tree){
|
|
315
|
-
// If we've already found an instance of this node, we don't need to record
|
|
316
|
-
// it again
|
|
317
|
-
if (nodeMap.has(node.id)) continue;
|
|
318
|
-
const { indices: indices, id: id, name: name, type: type, children: children } = node;
|
|
319
|
-
const nodeData = {
|
|
320
|
-
id: id,
|
|
321
|
-
type: type.id,
|
|
322
|
-
color: type.color,
|
|
323
|
-
name: name,
|
|
324
|
-
txt_range: [
|
|
325
|
-
indices
|
|
326
|
-
],
|
|
327
|
-
reasoning: null,
|
|
328
|
-
match: node.match,
|
|
329
|
-
children: children
|
|
330
|
-
};
|
|
331
|
-
nodeMap.set(node.id, node);
|
|
332
|
-
nodes.push(nodeData);
|
|
333
|
-
if (node.children) {
|
|
334
|
-
for (let child of node.children)edges.push({
|
|
335
|
-
source: node.id,
|
|
336
|
-
dest: child.id
|
|
337
|
-
});
|
|
338
|
-
// Now process the children
|
|
339
|
-
const { nodes: childNodes, edges: childEdges } = $b79bf29960412ca7$export$8d9dbb7a64bf2a5e(node.children);
|
|
340
|
-
nodes.push(...childNodes);
|
|
341
|
-
edges.push(...childEdges);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
nodes: nodes,
|
|
346
|
-
edges: edges
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
function $b79bf29960412ca7$export$e64eb58334357825(tree, id) {
|
|
350
|
-
for (const node of tree){
|
|
351
|
-
if (node.id === id) return node;
|
|
352
|
-
if (node.children) {
|
|
353
|
-
const found = $b79bf29960412ca7$export$e64eb58334357825(node.children, id);
|
|
354
|
-
if (found) return found;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
function $b79bf29960412ca7$var$updateTreeTypes(tree, oldType, defaultType) {
|
|
360
|
-
return tree.map((node)=>$b79bf29960412ca7$var$updateNodeType(node, oldType, defaultType));
|
|
361
|
-
}
|
|
362
|
-
function $b79bf29960412ca7$var$updateNodeType(node, oldType, defaultType) {
|
|
363
|
-
const type = node.type.id === oldType.id ? defaultType : node.type;
|
|
364
|
-
return {
|
|
365
|
-
...node,
|
|
366
|
-
type: type,
|
|
367
|
-
children: node.children ? $b79bf29960412ca7$var$updateTreeTypes(node.children, oldType, defaultType) : []
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
function $b79bf29960412ca7$var$flattenAndSort(nodes) {
|
|
371
|
-
const result = [];
|
|
372
|
-
function traverse(nodeList) {
|
|
373
|
-
for (const node of nodeList){
|
|
374
|
-
result.push(node);
|
|
375
|
-
if (Array.isArray(node.children) && node.children.length > 0) traverse(node.children);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
traverse(nodes);
|
|
379
|
-
// sort by start
|
|
380
|
-
return result.sort((a, b)=>a.indices[0] - b.indices[0]);
|
|
381
|
-
}
|
|
382
|
-
function $b79bf29960412ca7$var$matchMode(state, action) {
|
|
383
|
-
if (action.type === "select-node" || action.type === "toggle-node-selected") {
|
|
384
|
-
const { ids: ids } = action.payload;
|
|
385
|
-
if (ids.length != 1) return state;
|
|
386
|
-
if (state.selectedNodes.length === 1) {
|
|
387
|
-
if (ids[0] === state.selectedNodes[0]) // If the selected node is the same as the current selection, deselect it
|
|
388
|
-
return {
|
|
389
|
-
...state,
|
|
390
|
-
selectedNodes: []
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
const type = action.payload.ids.length > 0 ? $b79bf29960412ca7$export$e64eb58334357825(state.tree, ids[0])?.type : null;
|
|
394
|
-
return {
|
|
395
|
-
...state,
|
|
396
|
-
selectedNodes: ids,
|
|
397
|
-
selectedEntityType: type
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
if (action.type === "add-match") {
|
|
401
|
-
const { id: id } = action.payload;
|
|
402
|
-
// Find the node path
|
|
403
|
-
const keyPath = $b79bf29960412ca7$var$findNode(state.tree, id);
|
|
404
|
-
if (!keyPath) {
|
|
405
|
-
console.warn(`Node with id ${id} not found`);
|
|
406
|
-
return state;
|
|
407
|
-
}
|
|
408
|
-
// Build update spec to set the `match` property
|
|
409
|
-
const matchUpdateSpec = $b79bf29960412ca7$var$buildNestedSpec(keyPath, {
|
|
410
|
-
match: {
|
|
411
|
-
$set: action.payload.payload
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
const updatedTree = (0, $abOVY$immutabilityhelper)(state.tree, matchUpdateSpec);
|
|
415
|
-
return {
|
|
416
|
-
...state,
|
|
417
|
-
tree: updatedTree
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
if (action.type === "remove-match") {
|
|
421
|
-
const { id: id } = action.payload;
|
|
422
|
-
console.log("Removing match for node with id:", id);
|
|
423
|
-
// Find the node path
|
|
424
|
-
const keyPath = $b79bf29960412ca7$var$findNode(state.tree, id);
|
|
425
|
-
if (!keyPath) {
|
|
426
|
-
console.warn(`Node with id ${id} not found`);
|
|
427
|
-
return state;
|
|
428
|
-
}
|
|
429
|
-
// Build update spec to unset the `match` property
|
|
430
|
-
const matchUpdateSpec = $b79bf29960412ca7$var$buildNestedSpec(keyPath, {
|
|
431
|
-
match: {
|
|
432
|
-
$set: null
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
const updatedTree = (0, $abOVY$immutabilityhelper)(state.tree, matchUpdateSpec);
|
|
436
|
-
return {
|
|
437
|
-
...state,
|
|
438
|
-
tree: updatedTree
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
return state;
|
|
442
|
-
}
|
|
443
|
-
function $b79bf29960412ca7$var$viewMode(state, action) {
|
|
444
|
-
if (action.type === "set-view-mode") return {
|
|
445
|
-
...state,
|
|
446
|
-
viewMode: action.payload
|
|
447
|
-
};
|
|
448
|
-
return state;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
export {$b79bf29960412ca7$export$53ec42062883b2d4 as ViewMode, $b79bf29960412ca7$export$911bb4b9c8065d3d as useUpdatableTree, $b79bf29960412ca7$export$e5ce04c5b3f58533 as TreeDispatchContext, $b79bf29960412ca7$export$e1068f2d1c68f87e as useTreeDispatch, $b79bf29960412ca7$export$e64eb58334357825 as findNodeById, $b79bf29960412ca7$export$8d9dbb7a64bf2a5e as treeToGraph};
|
|
453
|
-
//# sourceMappingURL=feedback-components.fa847634.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;AAKO,IAAA,AAAK,mEAAA;;;WAAA;;AAuDL,SAAS,0CACd,WAAuB,EACvB,WAAoC,EACpC,QAAiB,EACjB,SAAkB,EAClB,aAAuB,EAAE;IAEzB,4BAA4B;IAC5B,qDAAqD;IACrD,MAAM,OAAO,YAAY,MAAM,GAAG,IAAI,GAAG,KAAK;IAE9C,IAAI,gBAAgB,EAAE;IACtB,aAAa,WAAW,GAAG,CAAC,CAAC,OAAS,KAAK,WAAW;IAEtD,IAAI,WAAW,MAAM,GAAG,GACtB,oEAAoE;IACpE,gBAAgB,YACb,OAAO,CAAC,CAAC,OAAS,KAAK,QAAQ,IAAI,EAAE,EACrC,M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BAAqB;QACrB,MAAM,UAAU,+BAAS,MAAM,IAAI,EAAE;QACrC,IAAI,CAAC,SAAS;YACZ,QAAQ,IAAI,CAAC,CAAC,aAAa,EAAE,GAAG,UAAU,CAAC;YAC3C,OAAO;QACT;QAEA,kDAAkD;QAClD,MAAM,kBAAkB,sCAAgB,SAAS;YAC/C,OAAO;gBAAE,MAAM;YAAK;QACtB;QAEA,MAAM,cAAc,CAAA,GAAA,yBAAK,EAAE,MAAM,IAAI,EAAE;QAEvC,OAAO;YACL,GAAG,KAAK;YACR,MAAM;QACR;IACF;IAEA,OAAO;AACT;AAEA,SAAS,+BAAS,KAAK,EAAE,MAAM;IAC7B,IAAI,OAAO,IAAI,KAAK,iBAClB,OAAO;QAAE,GAAG,KAAK;QAAE,UAAU,OAAO,OAAO;IAAC;IAG9C,OAAO;AACT","sources":["packages/feedback-components/src/feedback/edit-state.ts"],"sourcesContent":["import { TreeData } from \"./types\";\nimport { createContext, Dispatch, useContext, useReducer } from \"react\";\nimport update, { Spec } from \"immutability-helper\";\nimport { EntityType } from \"../extractions/types\";\n\nexport enum ViewMode {\n Tree = \"tree\",\n Graph = \"graph\",\n}\n\ninterface TreeState {\n initialTree: TreeData[];\n tree: TreeData[];\n selectedNodes: number[];\n entityTypesMap: Map<number, EntityType>;\n selectedEntityType: EntityType;\n lastInternalId: number;\n isSelectingEntityType: boolean;\n viewMode: ViewMode;\n viewOnly: boolean;\n matchMode: boolean;\n}\n\ntype TextRange = {\n start: number;\n end: number;\n text: string;\n};\n\ntype TreeAction =\n | {\n type: \"move-node\";\n payload: { dragIds: number[]; parentId: number; index: number };\n }\n | { type: \"delete-node\"; payload: { ids: number[] } }\n | { type: \"select-node\"; payload: { ids: number[] } }\n | { type: \"toggle-node-selected\"; payload: { ids: number[] } }\n | { type: \"set-view-mode\"; payload: ViewMode }\n | { type: \"create-node\"; payload: TextRange }\n | { type: \"select-entity-type\"; payload: EntityType }\n | { type: \"toggle-entity-type-selector\"; payload?: boolean | null }\n | { type: \"deselect\" }\n | { type: \"reset\" }\n | { type: \"delete-entity-type\"; payload: { id: number } }\n | {\n type: \"add-entity-type\";\n payload: { name: string; description: string; color: string };\n }\n | {\n type: \"update-entity-type\";\n payload: { id: number; name: string; description: string; color: string };\n }\n | { type: \"select-range\"; payload: { ids: number[] } }\n | { type: \"add-match\"; payload: { id: number; payload: any } }\n | { type: \"remove-match\"; payload: { id: number } }\n | { type: \"toggle-match-mode\" }\n | { type: \"toggle-view-only\" };\n\nexport type TreeDispatch = Dispatch<TreeAction>;\n\nexport function useUpdatableTree(\n initialTree: TreeData[],\n entityTypes: Map<number, EntityType>,\n viewOnly: boolean,\n matchMode: boolean,\n autoSelect: string[] = [],\n): [TreeState, TreeDispatch] {\n // Get the first entity type\n // issue: grabs second entity instead of selected one\n const type = entityTypes.values().next().value;\n\n let selectedNodes = [];\n autoSelect = autoSelect.map((name) => name.toLowerCase());\n\n if (autoSelect.length > 0) {\n // If autoSelect is provided, find the nodes with the matching names\n selectedNodes = initialTree\n .flatMap((node) => node.children ?? [])\n .filter((node) => autoSelect.includes(node.name.toLowerCase()))\n .map((node) => node.id);\n }\n\n return useReducer(treeReducer, {\n initialTree,\n tree: initialTree,\n selectedNodes,\n entityTypesMap: entityTypes,\n selectedEntityType: type,\n lastInternalId: 0,\n isSelectingEntityType: false,\n viewMode: ViewMode.Tree,\n viewOnly,\n matchMode,\n });\n}\n\nexport const TreeDispatchContext = createContext<TreeDispatch | null>(null);\n\nexport function useTreeDispatch() {\n const dispatch = useContext(TreeDispatchContext);\n if (dispatch == null) {\n throw new Error(\"No dispatch context available\");\n }\n return dispatch;\n}\n\nfunction treeReducer(state: TreeState, action: TreeAction) {\n if (action.type === \"toggle-match-mode\") {\n return { ...state, matchMode: !state.matchMode };\n }\n\n if (action.type === \"toggle-view-only\") {\n return { ...state, viewOnly: !state.viewOnly, selectedNodes: [] };\n }\n\n if (state.viewOnly) return viewMode(state, action);\n\n if (state.matchMode) return matchMode(state, action);\n\n switch (action.type) {\n case \"add-entity-type\": {\n // Add a new entity type to the map\n const { name, description, color } = action.payload;\n const newId = state.lastInternalId - 1;\n const newType: EntityType = {\n id: newId,\n name,\n description: description === \"\" ? null : description,\n color,\n };\n\n const newEntityTypesMap = new Map(state.entityTypesMap);\n newEntityTypesMap.set(newId, newType);\n\n return {\n ...state,\n entityTypesMap: newEntityTypesMap,\n selectedEntityType: newType,\n lastInternalId: newId,\n };\n }\n case \"update-entity-type\": {\n // Update an existing entity type in the map\n const { id, name, description, color } = action.payload;\n const newEntityTypesMap = new Map(state.entityTypesMap);\n const oldType = newEntityTypesMap.get(id);\n\n if (!oldType) {\n console.warn(`Entity type with id ${id} not found`);\n return state;\n }\n\n const updatedType: EntityType = {\n ...oldType,\n name,\n description: description === \"\" ? null : description,\n color,\n };\n\n newEntityTypesMap.set(id, updatedType);\n\n // Update the tree to reflect the new type\n const newTree = updateTreeTypes(state.tree, oldType, updatedType);\n\n return {\n ...state,\n tree: newTree,\n entityTypesMap: newEntityTypesMap,\n selectedEntityType: updatedType,\n };\n }\n case \"select-range\":\n // Select a range of nodes by their IDs\n const payloadIds = action.payload.ids;\n const node1 = payloadIds[0];\n const node2 = payloadIds[1];\n\n // make list of nodes in order\n const allNodes = flattenAndSort(state.tree);\n\n // select all nodes between node1 and node2\n const startIndex = allNodes.findIndex((node) => node.id === node1);\n const endIndex = allNodes.findIndex((node) => node.id === node2);\n\n const selectedNodes = allNodes.slice(startIndex, endIndex + 1);\n\n console.log(\"Selecting range:\", selectedNodes);\n return {\n ...state,\n selectedNodes: selectedNodes.map((node) => node.id),\n };\n\n case \"move-node\":\n // For each node in the tree, if the node is in the dragIds, remove it from the tree and collect it\n const [newTree, removedNodes] = removeNodes(\n state.tree,\n action.payload.dragIds,\n );\n\n let keyPath: (number | \"children\")[] = [];\n if (action.payload.parentId) {\n keyPath = findNode(newTree, action.payload.parentId);\n keyPath.push(\"children\");\n }\n\n // Add removed nodes to the new tree at the correct location\n let updateSpec = buildNestedSpec(keyPath, {\n $splice: [[action.payload.index, 0, ...removedNodes]],\n });\n\n return { ...state, tree: update(newTree, updateSpec) };\n case \"delete-node\":\n // For each node in the tree, if the node is in the ids, remove it from the tree\n const [newTree2, _removedNodes] = removeNodes(\n state.tree,\n action.payload.ids,\n );\n // Get children of the removed nodes\n // If children are not present elsewhere in the tree, insert them\n\n const children = _removedNodes\n .flatMap((node) => node.children ?? [])\n .filter((child) => !nodeIsInTree(newTree2, child.id));\n\n // Reset the selection\n\n return {\n ...state,\n tree: [...newTree2, ...children],\n selectedNodes: state.selectedNodes.filter(\n (id) => !action.payload.ids.includes(id),\n ),\n };\n case \"select-node\":\n const { ids } = action.payload;\n\n const type =\n action.payload.ids.length > 0\n ? findNodeById(state.tree, ids[0])?.type\n : null;\n\n return { ...state, selectedNodes: ids, selectedEntityType: type };\n // otherwise fall through to toggle-node-selected for a single ID\n case \"toggle-node-selected\":\n const nodesToAdd = action.payload.ids.filter(\n (id) => !state.selectedNodes.includes(id),\n );\n const nodesToKeep = state.selectedNodes.filter(\n (id) => !action.payload.ids.includes(id),\n );\n\n const newType =\n action.payload.ids.length > 0\n ? findNodeById(state.tree, action.payload.ids[0])?.type\n : null;\n\n return {\n ...state,\n selectedNodes: [...nodesToKeep, ...nodesToAdd],\n selectedEntityType: newType,\n };\n\n case \"create-node\":\n const newId = state.lastInternalId - 1;\n const { text, start, end } = action.payload;\n const node: TreeData = {\n id: newId,\n name: text,\n children: [],\n indices: [start, end],\n type: state.selectedEntityType,\n };\n\n return {\n ...state,\n tree: [...state.tree, node],\n selectedNodes: [newId],\n lastInternalId: newId,\n };\n\n case \"delete-entity-type\": {\n // Remove the entity type from the map\n const { id } = action.payload;\n const newEntityTypesMap = new Map(state.entityTypesMap);\n const oldType = newEntityTypesMap.get(id);\n newEntityTypesMap.delete(id);\n\n const defaultType = newEntityTypesMap.values().next().value;\n const newTree = updateTreeTypes(state.tree, oldType, defaultType);\n\n return {\n ...state,\n tree: newTree,\n entityTypesMap: newEntityTypesMap,\n selectedNodes: [],\n };\n }\n\n /** Entity type selection */\n case \"toggle-entity-type-selector\":\n return {\n ...state,\n isSelectingEntityType: action.payload ?? !state.isSelectingEntityType,\n };\n case \"select-entity-type\": {\n // For each selected node, update the type\n let newTree2 = state.tree;\n for (let id of state.selectedNodes) {\n const keyPath = findNode(state.tree, id);\n const nestedSpec = buildNestedSpec(keyPath, {\n type: { $set: action.payload },\n });\n newTree2 = update(newTree2, nestedSpec);\n }\n\n return {\n ...state,\n tree: newTree2,\n selectedEntityType: action.payload,\n };\n }\n case \"deselect\":\n return { ...state, selectedNodes: [] };\n case \"reset\":\n return {\n ...state,\n tree: state.initialTree,\n selectedNodes: [],\n };\n case \"set-view-mode\":\n return { ...state, viewMode: action.payload };\n }\n}\n\nfunction nodeIsInTree(tree: TreeData[], id: number): boolean {\n for (let node of tree) {\n if (node.id == id) {\n return true;\n } else if (node.children) {\n if (nodeIsInTree(node.children, id)) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction buildNestedSpec(\n keyPath: (number | \"children\")[],\n innerSpec: Spec<any>,\n): Spec<TreeData[]> {\n // Build a nested object from a key path\n\n let spec = innerSpec;\n for (let i = keyPath.length - 1; i >= 0; i--) {\n spec = { [keyPath[i]]: spec };\n }\n return spec as any;\n // Since we don't have a \"children\" key at the root, we make the top-level spec an array\n}\n\nfunction findNode(\n tree: TreeData[],\n id: number,\n): (number | \"children\")[] | null {\n // Find the index of the node with the given id in the tree, returning the key path\n for (let i = 0; i < tree.length; i++) {\n if (tree[i].id == id) {\n return [i];\n } else if (tree[i].children) {\n let path = findNode(tree[i].children, id);\n if (path != null) {\n return [i, \"children\", ...path];\n }\n }\n }\n return null;\n}\n\nfunction removeNodes(\n tree: TreeData[],\n ids: number[],\n): [TreeData[], TreeData[]] {\n /** Remove nodes with the given ids from the tree and return the new tree and the removed nodes */\n let newTree: TreeData[] = [];\n let removedNodes: TreeData[] = [];\n\n for (let node of tree) {\n if (ids.includes(node.id)) {\n removedNodes.push(node);\n } else {\n // Recurse into children\n if (node.children) {\n let [newChildren, removedChildren] = removeNodes(node.children, ids);\n node = { ...node, children: newChildren };\n removedNodes.push(...removedChildren);\n }\n newTree.push(node);\n }\n }\n\n return [newTree, removedNodes];\n}\n\nexport interface EntityOutput {\n id: number;\n type: number | null;\n txt_range: number[][];\n name: string;\n match: any | null;\n reasoning: string | null;\n color: string | null;\n children: any[] | null;\n}\n\nexport interface GraphData {\n nodes: EntityOutput[];\n edges: { source: number; dest: number }[];\n}\n\nexport function treeToGraph(tree: TreeData[]): GraphData {\n // Convert the tree to a graph\n let nodes: EntityOutput[] = [];\n let edges: { source: number; dest: number }[] = [];\n const nodeMap = new Map<number, TreeData>();\n\n for (let node of tree) {\n // If we've already found an instance of this node, we don't need to record\n // it again\n if (nodeMap.has(node.id)) {\n continue;\n }\n\n const { indices, id, name, type, children } = node;\n\n const nodeData: EntityOutput = {\n id,\n type: type.id,\n color: type.color,\n name,\n txt_range: [indices],\n reasoning: null,\n match: node.match,\n children,\n };\n\n nodeMap.set(node.id, node);\n nodes.push(nodeData);\n\n if (node.children) {\n for (let child of node.children) {\n edges.push({ source: node.id, dest: child.id });\n }\n\n // Now process the children\n const { nodes: childNodes, edges: childEdges } = treeToGraph(\n node.children,\n );\n nodes.push(...childNodes);\n edges.push(...childEdges);\n }\n }\n\n return { nodes, edges };\n}\n\nexport function findNodeById(tree, id) {\n for (const node of tree) {\n if (node.id === id) {\n return node;\n }\n if (node.children) {\n const found = findNodeById(node.children, id);\n if (found) return found;\n }\n }\n return null;\n}\n\nfunction updateTreeTypes(tree, oldType, defaultType) {\n return tree.map((node) => updateNodeType(node, oldType, defaultType));\n}\n\nfunction updateNodeType(node, oldType, defaultType) {\n const type = node.type.id === oldType.id ? defaultType : node.type;\n\n return {\n ...node,\n type,\n children: node.children\n ? updateTreeTypes(node.children, oldType, defaultType)\n : [],\n };\n}\n\nfunction flattenAndSort(nodes) {\n const result = [];\n\n function traverse(nodeList) {\n for (const node of nodeList) {\n result.push(node);\n if (Array.isArray(node.children) && node.children.length > 0) {\n traverse(node.children);\n }\n }\n }\n\n traverse(nodes);\n\n // sort by start\n return result.sort((a, b) => a.indices[0] - b.indices[0]);\n}\n\nfunction matchMode(state, action) {\n if (action.type === \"select-node\" || action.type === \"toggle-node-selected\") {\n const { ids } = action.payload;\n\n if (ids.length != 1) return state;\n\n if (state.selectedNodes.length === 1) {\n if (ids[0] === state.selectedNodes[0]) {\n // If the selected node is the same as the current selection, deselect it\n return { ...state, selectedNodes: [] };\n }\n }\n\n const type =\n action.payload.ids.length > 0\n ? findNodeById(state.tree, ids[0])?.type\n : null;\n\n return { ...state, selectedNodes: ids, selectedEntityType: type };\n }\n\n if (action.type === \"add-match\") {\n const { id } = action.payload;\n\n // Find the node path\n const keyPath = findNode(state.tree, id);\n if (!keyPath) {\n console.warn(`Node with id ${id} not found`);\n return state;\n }\n\n // Build update spec to set the `match` property\n const matchUpdateSpec = buildNestedSpec(keyPath, {\n match: { $set: action.payload.payload },\n });\n\n const updatedTree = update(state.tree, matchUpdateSpec);\n\n return {\n ...state,\n tree: updatedTree,\n };\n }\n\n if (action.type === \"remove-match\") {\n const { id } = action.payload;\n\n console.log(\"Removing match for node with id:\", id);\n\n // Find the node path\n const keyPath = findNode(state.tree, id);\n if (!keyPath) {\n console.warn(`Node with id ${id} not found`);\n return state;\n }\n\n // Build update spec to unset the `match` property\n const matchUpdateSpec = buildNestedSpec(keyPath, {\n match: { $set: null },\n });\n\n const updatedTree = update(state.tree, matchUpdateSpec);\n\n return {\n ...state,\n tree: updatedTree,\n };\n }\n\n return state;\n}\n\nfunction viewMode(state, action) {\n if (action.type === \"set-view-mode\") {\n return { ...state, viewMode: action.payload };\n }\n\n return state;\n}\n"],"names":[],"version":3,"file":"feedback-components.fa847634.js.map"}
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, DetailedReactHTMLElement, DOMAttributes, DOMElement, FunctionComponentElement } from "react";
|
|
2
|
-
import { TagProps } from "@blueprintjs/core";
|
|
3
|
-
type EntityType = {
|
|
4
|
-
name: string;
|
|
5
|
-
color: string;
|
|
6
|
-
id: number;
|
|
7
|
-
description?: string;
|
|
8
|
-
};
|
|
9
|
-
type Match = any;
|
|
10
|
-
export interface Entity {
|
|
11
|
-
id: number;
|
|
12
|
-
name: string;
|
|
13
|
-
type?: number;
|
|
14
|
-
indices: [number, number];
|
|
15
|
-
children: Entity[];
|
|
16
|
-
match?: Match;
|
|
17
|
-
}
|
|
18
|
-
type Highlight = {
|
|
19
|
-
start: number;
|
|
20
|
-
end: number;
|
|
21
|
-
tag?: string;
|
|
22
|
-
text?: string;
|
|
23
|
-
backgroundColor?: string;
|
|
24
|
-
borderColor?: string;
|
|
25
|
-
id: number;
|
|
26
|
-
parents?: number[];
|
|
27
|
-
match?: Match;
|
|
28
|
-
};
|
|
29
|
-
export interface EntityExt extends Omit<Entity, "type" | "children"> {
|
|
30
|
-
type: EntityType;
|
|
31
|
-
children: EntityExt[];
|
|
32
|
-
parents?: number[];
|
|
33
|
-
}
|
|
34
|
-
declare namespace ThreeColumnLayout {
|
|
35
|
-
var Panels: typeof SidePanel;
|
|
36
|
-
}
|
|
37
|
-
export function buildHighlights(entities: EntityExt[], parent: EntityExt | null): Highlight[];
|
|
38
|
-
export function enhanceData(extractionData: any, models: any, entityTypes: any): any;
|
|
39
|
-
export function getTagStyle(baseColor: string, options?: {
|
|
40
|
-
highlighted?: boolean;
|
|
41
|
-
inDarkMode?: boolean;
|
|
42
|
-
active?: boolean;
|
|
43
|
-
showMatches?: boolean;
|
|
44
|
-
}): CSSProperties;
|
|
45
|
-
export function ExtractionContext({ data, entityTypes, matchComponent, }: {
|
|
46
|
-
data: any;
|
|
47
|
-
entityTypes: Map<number, EntityType>;
|
|
48
|
-
matchComponent: MatchComponent;
|
|
49
|
-
}): DetailedReactHTMLElement<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
50
|
-
export function ModelInfo({ data }: {
|
|
51
|
-
data: any;
|
|
52
|
-
}): DOMElement<DOMAttributes<Element>, Element>;
|
|
53
|
-
export type MatchComponent = (props: {
|
|
54
|
-
data: any;
|
|
55
|
-
}) => any;
|
|
56
|
-
type EntityTagProps = {
|
|
57
|
-
data: EntityExt;
|
|
58
|
-
highlighted?: boolean;
|
|
59
|
-
active?: boolean;
|
|
60
|
-
onClickType?: (type: EntityType) => void;
|
|
61
|
-
matchComponent?: MatchComponent;
|
|
62
|
-
};
|
|
63
|
-
export function EntityTag({ data, highlighted, active, onClickType, matchComponent, }: EntityTagProps): FunctionComponentElement<TagProps>;
|
|
64
|
-
export type TreeData = EntityExt;
|
|
65
|
-
interface EntityOutput {
|
|
66
|
-
id: number;
|
|
67
|
-
type: number | null;
|
|
68
|
-
txt_range: number[][];
|
|
69
|
-
name: string;
|
|
70
|
-
match: any | null;
|
|
71
|
-
reasoning: string | null;
|
|
72
|
-
color: string | null;
|
|
73
|
-
children: any[] | null;
|
|
74
|
-
}
|
|
75
|
-
export interface GraphData {
|
|
76
|
-
nodes: EntityOutput[];
|
|
77
|
-
edges: {
|
|
78
|
-
source: number;
|
|
79
|
-
dest: number;
|
|
80
|
-
}[];
|
|
81
|
-
}
|
|
82
|
-
export function treeToGraph(tree: TreeData[]): GraphData;
|
|
83
|
-
export function FeedbackComponent({ entities, text, model, entityTypes, matchComponent, onSave, allowOverlap, matchLinks, view, autoSelect, }: {
|
|
84
|
-
entities?: any[];
|
|
85
|
-
text: any;
|
|
86
|
-
model: any;
|
|
87
|
-
entityTypes: any;
|
|
88
|
-
matchComponent: any;
|
|
89
|
-
onSave: any;
|
|
90
|
-
allowOverlap: any;
|
|
91
|
-
matchLinks: any;
|
|
92
|
-
view?: boolean;
|
|
93
|
-
autoSelect?: any[];
|
|
94
|
-
}): DOMElement<DOMAttributes<Element>, Element>;
|
|
95
|
-
|
|
96
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
D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EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED,4BAA4B,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CA4CvD;AyG/ZD,kCAAkC,EAChC,QAAa,EACb,IAAI,EACJ,KAAK,EACL,WAAW,EACX,cAAc,EACd,MAAM,EACN,YAAY,EACZ,UAAU,EACV,IAAY,EACZ,UAAe,GAChB;;;;;;;;;;;CAAA,+CAwKA","sources":["packages/feedback-components/src/src/extractions/types.ts","packages/feedback-components/color-utils/src/index.ts","packages/feedback-components/ui-components/src/api/types.ts","packages/feedback-components/ui-components/src/util/query-string.ts","packages/feedback-components/ui-components/src/util/state-hooks.ts","packages/feedback-components/ui-components/src/util/layout-hooks.ts","packages/feedback-components/ui-components/src/util/local-storage.ts","packages/feedback-components/ui-components/src/util/json-view.ts","packages/feedback-components/ui-components/src/util/scroll-helpers.ts","packages/feedback-components/ui-components/src/util/migration-helpers.ts","packages/feedback-components/ui-components/src/util/box-model.ts","packages/feedback-components/ui-components/src/util/event-hooks.ts","packages/feedback-components/ui-components/src/util/flexbox.ts","packages/feedback-components/ui-components/src/util/size-aware-label.ts","packages/feedback-components/ui-components/src/util/index.ts","packages/feedback-components/ui-components/src/api/provider.ts","packages/feedback-components/ui-components/src/api/data-provider.ts","packages/feedback-components/ui-components/src/api/indexing.ts","packages/feedback-components/ui-components/src/api/frontend.ts","packages/feedback-components/ui-components/src/api/paged.ts","packages/feedback-components/ui-components/src/api/index.ts","packages/feedback-components/ui-components/src/infinite-scroll.ts","packages/feedback-components/ui-components/src/postgrest-infinite-scroll.ts","packages/feedback-components/ui-components/src/buttons/delete-button.ts","packages/feedback-components/ui-components/src/buttons/index.ts","packages/feedback-components/ui-components/src/collapse-panel/index.ts","packages/feedback-components/ui-components/src/link-card.ts","packages/feedback-components/ui-components/src/file-upload/index.ts","packages/feedback-components/ui-components/src/image.ts","packages/feedback-components/ui-components/src/model-editor.ts","packages/feedback-components/ui-components/src/toaster.ts","packages/feedback-components/ui-components/src/citations/author-list.ts","packages/feedback-components/ui-components/src/citations/index.ts","packages/feedback-components/ui-components/src/geodeepdive/reference-card.ts","packages/feedback-components/ui-components/src/geodeepdive/index.ts","packages/feedback-components/ui-components/src/text.ts","packages/feedback-components/ui-components/src/dark-mode.ts","packages/feedback-components/ui-components/src/form-controls/slider.ts","packages/feedback-components/ui-components/src/form-controls/index.ts","packages/feedback-components/ui-components/src/settings/index.ts","packages/feedback-components/ui-components/src/error-boundary.ts","packages/feedback-components/ui-components/src/patterns/composite-image.ts","packages/feedback-components/ui-components/src/patterns/index.ts","packages/feedback-components/ui-components/src/collapse-card.ts","packages/feedback-components/ui-components/src/modal-panel/draggable-overlay.ts","packages/feedback-components/ui-components/src/modal-panel/index.ts","packages/feedback-components/ui-components/src/page-layouts/index.ts","packages/feedback-components/ui-components/src/dev-panel/_inner.ts","packages/feedback-components/ui-components/src/dev-panel/index.ts","packages/feedback-components/ui-components/src/data/index.ts","packages/feedback-components/ui-components/src/index.ts","packages/feedback-components/src/src/extractions/index.ts","packages/feedback-components/src/src/feedback/types.ts","packages/feedback-components/src/src/feedback/edit-state.ts","packages/feedback-components/src/src/feedback/node.ts","packages/feedback-components/data-components/src/components/hierarchy/index.ts","packages/feedback-components/data-components/src/components/prevalent-taxa/prevalent-taxa.ts","packages/feedback-components/data-components/src/components/prevalent-taxa/index.ts","packages/feedback-components/data-components/src/components/unit-details/tag.ts","packages/feedback-components/stratigraphy-utils/src/age-ranges.ts","packages/feedback-components/stratigraphy-utils/src/measurements.ts","packages/feedback-components/stratigraphy-utils/src/index.ts","packages/feedback-components/data-components/src/components/unit-details/base.ts","packages/feedback-components/data-components/src/components/unit-details/lithology-tag.ts","packages/feedback-components/data-components/src/components/unit-details/index.ts","packages/feedback-components/data-components/src/components/index.ts","packages/feedback-components/data-components/src/dz-spectrum/gradients.ts","packages/feedback-components/data-components/src/dz-spectrum/kernel-density.ts","packages/feedback-components/data-components/src/dz-spectrum/index.ts","packages/feedback-components/mapbox-utils/src/position.ts","packages/feedback-components/mapbox-utils/src/focus-state.ts","packages/feedback-components/mapbox-utils/src/labels.ts","packages/feedback-components/mapbox-utils/src/preprocess-styles.ts","packages/feedback-components/mapbox-utils/src/utils.ts","packages/feedback-components/mapbox-utils/src/view-info.ts","packages/feedback-components/mapbox-utils/src/style-helpers.ts","packages/feedback-components/mapbox-utils/src/index.ts","packages/feedback-components/data-components/src/field-locations/base.ts","packages/feedback-components/data-components/src/field-locations/checkins.ts","packages/feedback-components/data-components/src/field-locations/spots.ts","packages/feedback-components/mapbox-react/src/context.ts","packages/feedback-components/mapbox-react/src/hooks.ts","packages/feedback-components/mapbox-react/src/controls.ts","packages/feedback-components/mapbox-react/src/terrain.ts","packages/feedback-components/mapbox-react/src/debugger.ts","packages/feedback-components/mapbox-react/src/focus-state.ts","packages/feedback-components/map-styles/src/layer-helpers/symbol-layers.ts","packages/feedback-components/map-styles/src/layer-helpers/geology-layers.ts","packages/feedback-components/map-styles/src/layer-helpers/pattern-fill.ts","packages/feedback-components/map-styles/src/layer-helpers/utils.ts","packages/feedback-components/map-styles/src/layer-helpers/point-features/symbols/index.ts","packages/feedback-components/map-styles/src/layer-helpers/point-features/icon-image.ts","packages/feedback-components/map-styles/src/layer-helpers/point-features/symbol-layer.ts","packages/feedback-components/map-styles/src/layer-helpers/point-features/index.ts","packages/feedback-components/map-styles/src/layer-helpers/cross-sections.ts","packages/feedback-components/map-styles/src/layer-helpers/index.ts","packages/feedback-components/map-styles/src/styles/line-symbols.ts","packages/feedback-components/map-styles/src/styles/layers.ts","packages/feedback-components/map-styles/src/styles/index.ts","packages/feedback-components/map-styles/src/index.ts","packages/feedback-components/mapbox-react/src/layer-managers/line-symbols.ts","packages/feedback-components/mapbox-react/src/layer-managers/map-sources.ts","packages/feedback-components/mapbox-react/src/layer-managers/index.ts","packages/feedback-components/mapbox-react/src/index.ts","packages/feedback-components/map-interface/src/context-panel/index.ts","packages/feedback-components/map-interface/src/location-info/utils.ts","packages/feedback-components/map-interface/src/location-info/hash-string.ts","packages/feedback-components/map-interface/src/location-info/index.ts","packages/feedback-components/map-interface/src/location-panel/header.ts","packages/feedback-components/map-interface/src/controls.ts","packages/feedback-components/map-interface/src/container.ts","packages/feedback-components/map-interface/src/location-panel/index.ts","packages/feedback-components/map-interface/src/dev/xray.ts","packages/feedback-components/map-interface/src/utils.ts","packages/feedback-components/map-interface/src/helpers.ts","packages/feedback-components/map-interface/src/map-view.ts","packages/feedback-components/map-interface/src/dev/tile-extent.ts","packages/feedback-components/map-interface/src/expansion-panel/headers.ts","packages/feedback-components/map-interface/src/expansion-panel/index.ts","packages/feedback-components/map-interface/src/dev/vector-tile-features.ts","packages/feedback-components/map-interface/src/dev/map-page.ts","packages/feedback-components/map-interface/src/dev/index.ts","packages/feedback-components/map-interface/src/location-details/utils/fossils.ts","packages/feedback-components/map-interface/src/location-details/utils/formatting.ts","packages/feedback-components/map-interface/src/location-details/utils/index.ts","packages/feedback-components/map-interface/src/location-details/fossil-collections/collections.tsx","packages/feedback-components/map-interface/src/location-details/fossil-collections/index.ts","packages/feedback-components/map-interface/src/location-details/xdd-panel/Article.tsx","packages/feedback-components/map-interface/src/location-details/xdd-panel/Journal.tsx","packages/feedback-components/map-interface/src/location-details/xdd-panel/index.ts","packages/feedback-components/map-interface/src/location-details/reg-strat.ts","packages/feedback-components/map-interface/src/location-details/physiography.ts","packages/feedback-components/map-interface/src/location-details/info-blocks.ts","packages/feedback-components/map-interface/src/location-details/macrostrat-linked.ts","packages/feedback-components/map-interface/src/location-details/index.ts","packages/feedback-components/map-interface/src/index.ts","packages/feedback-components/data-components/src/field-locations/rockd-checkins/index.ts","packages/feedback-components/data-components/src/field-locations/index.ts","packages/feedback-components/data-components/src/index.ts","packages/feedback-components/src/src/feedback/matches.ts","packages/feedback-components/src/stories/test-data.ts","packages/feedback-components/src/src/feedback/text-visualizer.ts","packages/feedback-components/src/src/feedback/type-selector/index.ts","packages/feedback-components/src/src/feedback/graph.ts","packages/feedback-components/data-sheet/src/components/editor-popup.ts","packages/.storybook/main.ts","packages/feedback-components/data-sheet/src/components/colors.ts","packages/feedback-components/data-sheet/src/components/text-areas.ts","packages/feedback-components/data-sheet/src/components/actions.ts","packages/feedback-components/data-sheet/src/components/index.ts","packages/feedback-components/data-sheet/src/utils/column-spec.ts","packages/feedback-components/data-sheet/src/utils/index.ts","packages/feedback-components/data-sheet/src/provider.ts","packages/feedback-components/data-sheet/src/core.ts","packages/feedback-components/data-sheet/src/postgrest-table/data-loaders.ts","packages/feedback-components/data-sheet/src/postgrest-table/index.ts","packages/feedback-components/data-sheet/src/index.ts","packages/feedback-components/src/src/feedback/typelist.ts","packages/feedback-components/src/src/feedback/index.ts","packages/feedback-components/src/src/index.ts","packages/feedback-components/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export * from \"./extractions\";\nexport * from \"./feedback\";\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/esm/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {buildHighlights as $03d8811e9c9b360d$export$c4b91360064ad200, enhanceData as $03d8811e9c9b360d$export$d60b563f571177d, getTagStyle as $03d8811e9c9b360d$export$35baa338324d8550, ExtractionContext as $03d8811e9c9b360d$export$2b07158757c249e0, ModelInfo as $03d8811e9c9b360d$export$4eb2a0ce903ce967, EntityTag as $03d8811e9c9b360d$export$117e56c71b172cde} from "./feedback-components.ba79c0ef.js";
|
|
2
|
-
import {FeedbackComponent as $71d20dff35996763$export$a90600c9da52b40c, treeToGraph as $b79bf29960412ca7$export$8d9dbb7a64bf2a5e} from "./feedback-components.edc606bb.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {$03d8811e9c9b360d$export$c4b91360064ad200 as buildHighlights, $03d8811e9c9b360d$export$d60b563f571177d as enhanceData, $03d8811e9c9b360d$export$35baa338324d8550 as getTagStyle, $03d8811e9c9b360d$export$2b07158757c249e0 as ExtractionContext, $03d8811e9c9b360d$export$4eb2a0ce903ce967 as ModelInfo, $03d8811e9c9b360d$export$117e56c71b172cde as EntityTag, $71d20dff35996763$export$a90600c9da52b40c as FeedbackComponent, $b79bf29960412ca7$export$8d9dbb7a64bf2a5e as treeToGraph};
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/feedback-components/src/index.ts"],"sourcesContent":["export * from \"./extractions\";\nexport * from \"./feedback\";\n"],"names":[],"version":3,"file":"index.js.map"}
|