@macrostrat/feedback-components 1.0.0 → 1.1.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 +13 -5
- package/dist/esm/feedback-components.4359bc80.js +70 -0
- package/dist/esm/feedback-components.4359bc80.js.map +1 -0
- package/dist/{extractions.54be85f8.js → esm/feedback-components.5df2a926.js} +52 -24
- package/dist/esm/feedback-components.5df2a926.js.map +1 -0
- package/dist/esm/feedback-components.6a6c8af5.js +552 -0
- package/dist/esm/feedback-components.6a6c8af5.js.map +1 -0
- package/dist/{main.module.ca3db294.js → esm/feedback-components.6d32ee91.js} +1 -1
- package/dist/{main.module.ca3db294.js.map → esm/feedback-components.6d32ee91.js.map} +1 -1
- package/dist/esm/feedback-components.7cd9b6cc.js +114 -0
- package/dist/esm/feedback-components.7cd9b6cc.js.map +1 -0
- package/dist/{node.30d0b8c3.js → esm/feedback-components.87533431.js} +12 -7
- package/dist/esm/feedback-components.87533431.js.map +1 -0
- package/dist/esm/feedback-components.921dcd46.js +241 -0
- package/dist/esm/feedback-components.921dcd46.js.map +1 -0
- package/dist/{type-selector.e75dd247.js → esm/feedback-components.ad9f284e.js} +11 -10
- package/dist/esm/feedback-components.ad9f284e.js.map +1 -0
- package/dist/esm/feedback-components.b7d9b015.css +156 -0
- package/dist/esm/feedback-components.b7d9b015.css.map +1 -0
- package/dist/{edit-state.e8edb13a.js → esm/feedback-components.bf5f7cf7.js} +105 -14
- package/dist/esm/feedback-components.bf5f7cf7.js.map +1 -0
- package/dist/{main.module.f9f92ece.css → esm/feedback-components.bf93773c.css} +1 -1
- package/dist/{main.module.f9f92ece.css.map → esm/feedback-components.bf93773c.css.map} +1 -1
- package/dist/{main.module.d6508c0e.css → esm/feedback-components.e273ed5b.css} +1 -1
- package/dist/{main.module.d6508c0e.css.map → esm/feedback-components.e273ed5b.css.map} +1 -1
- package/dist/{main.module.21bbfaf4.js → esm/feedback-components.f9850d85.js} +1 -1
- package/dist/{main.module.21bbfaf4.js.map → esm/feedback-components.f9850d85.js.map} +1 -1
- package/dist/{index.d.ts → esm/index.d.ts} +38 -13
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/{index.js → esm/index.js} +2 -2
- package/dist/node/feedback-components.15e1316d.js +2 -0
- package/dist/node/feedback-components.15e1316d.js.map +1 -0
- package/dist/node/feedback-components.2f391fa4.js +2 -0
- package/dist/node/feedback-components.2f391fa4.js.map +1 -0
- package/dist/node/feedback-components.65d8488e.js +2 -0
- package/dist/node/feedback-components.65d8488e.js.map +1 -0
- package/dist/node/feedback-components.6681dbde.js +2 -0
- package/dist/node/feedback-components.6681dbde.js.map +1 -0
- package/dist/node/feedback-components.77b6fc89.css +2 -0
- package/dist/node/feedback-components.77b6fc89.css.map +1 -0
- package/dist/node/feedback-components.794f429b.js +2 -0
- package/dist/node/feedback-components.794f429b.js.map +1 -0
- package/dist/node/feedback-components.7caa447a.js +2 -0
- package/dist/node/feedback-components.7caa447a.js.map +1 -0
- package/dist/node/feedback-components.83c21466.css +2 -0
- package/dist/node/feedback-components.83c21466.css.map +1 -0
- package/dist/node/feedback-components.8b03e8be.js +2 -0
- package/dist/node/feedback-components.8b03e8be.js.map +1 -0
- package/dist/node/feedback-components.9eb1d41a.css +2 -0
- package/dist/node/feedback-components.9eb1d41a.css.map +1 -0
- package/dist/node/feedback-components.acac789b.js +2 -0
- package/dist/node/feedback-components.acac789b.js.map +1 -0
- package/dist/node/feedback-components.e2f3c4b7.js +2 -0
- package/dist/node/feedback-components.e2f3c4b7.js.map +1 -0
- package/dist/node/feedback-components.e8aa70b8.js +2 -0
- package/dist/node/feedback-components.e8aa70b8.js.map +1 -0
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +29 -15
- package/src/extractions/index.ts +76 -21
- package/src/extractions/types.ts +6 -1
- package/src/feedback/edit-state.ts +146 -16
- package/src/feedback/feedback.module.sass +93 -1
- package/src/feedback/graph.ts +71 -30
- package/src/feedback/index.ts +444 -71
- package/src/feedback/node.ts +7 -1
- package/src/feedback/text-visualizer.ts +258 -47
- package/src/feedback/type-selector/index.ts +4 -2
- package/dist/edit-state.e8edb13a.js.map +0 -1
- package/dist/extractions.54be85f8.js.map +0 -1
- package/dist/feedback.46c2b5c4.js +0 -252
- package/dist/feedback.46c2b5c4.js.map +0 -1
- package/dist/feedback.module.7e16830e.css +0 -44
- package/dist/feedback.module.7e16830e.css.map +0 -1
- package/dist/feedback.module.c28cbac7.js +0 -28
- package/dist/feedback.module.c28cbac7.js.map +0 -1
- package/dist/graph.cb42b871.js +0 -83
- package/dist/graph.cb42b871.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/node.30d0b8c3.js.map +0 -1
- package/dist/text-visualizer.77af0d24.js +0 -101
- package/dist/text-visualizer.77af0d24.js.map +0 -1
- package/dist/type-selector.e75dd247.js.map +0 -1
- package/stories/feedback.stories.ts +0 -40
- package/stories/test-data.ts +0 -330
- /package/dist/{index.js.map → esm/index.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,0EAAK;AAE5B,SAAS,qCAAkB,CAAS,EAAE,CAAS;IAC7C,IAAI,EAAE,IAAI,KAAK,EAAE,IAAI,EAAE,OAAO;IAC9B,KAAK,MAAM,QAAQ,EAAG;QACpB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,OAAO;IAC3B;IACA,OAAO;AACT;AAEO,SAAS,0CAAkB,YAChC,WAAW,EAAE,QACb,IAAI,SACJ,KAAK,eACL,WAAW,kBACX,cAAc,UACd,MAAM,EACP;IACC,0BAA0B;IAE1B,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,yCAAe,EACvC,SAAS,GAAG,CAAC,sCACb;IAGF,MAAM,iBAAE,aAAa,QAAE,IAAI,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E;QACnD;QACA,UAAU;QACV,YAAW,CAAW;YACpB,OAAO,EAAE,EAAE,CAAC,QAAQ;QACtB;IACF;AACF","sources":["packages/feedback-components/src/feedback/index.ts"],"sourcesContent":["import styles from \"./feedback.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\n\nimport { Tree, TreeApi } from \"react-arborist\";\nimport Node from \"./node\";\nimport { FeedbackText } from \"./text-visualizer\";\nimport type { InternalEntity, TreeData } from \"./types\";\nimport type { Entity } from \"../extractions\";\nimport { ModelInfo } from \"../extractions\";\nimport {\n TreeDispatchContext,\n treeToGraph,\n useUpdatableTree,\n ViewMode,\n} from \"./edit-state\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { ButtonGroup, Card, SegmentedControl } from \"@blueprintjs/core\";\nimport { OmniboxSelector } from \"./type-selector\";\nimport {\n CancelButton,\n DataField,\n FlexBox,\n FlexRow,\n SaveButton,\n} from \"@macrostrat/ui-components\";\nimport useElementDimensions from \"use-element-dimensions\";\nimport { GraphView } from \"./graph\";\n\nexport type { GraphData } from \"./edit-state\";\nexport { treeToGraph } from \"./edit-state\";\nexport type { TreeData } from \"./types\";\n\nconst h = hyper.styled(styles);\n\nfunction setsAreTheSame<T>(a: Set<T>, b: Set<T>) {\n if (a.size !== b.size) return false;\n for (const item of a) {\n if (!b.has(item)) return false;\n }\n return true;\n}\n\nexport function FeedbackComponent({\n entities = [],\n text,\n model,\n entityTypes,\n matchComponent,\n onSave,\n}) {\n // Get the input arguments\n\n const [state, dispatch] = useUpdatableTree(\n entities.map(processEntity) as any,\n entityTypes\n );\n\n const { selectedNodes, tree, selectedEntityType, isSelectingEntityType } =\n state;\n\n const [{ width, height }, ref] = useElementDimensions();\n\n return h(TreeDispatchContext.Provider, { value: dispatch }, [\n h(FeedbackText, {\n text,\n dispatch,\n // @ts-ignore\n nodes: tree,\n selectedNodes,\n }),\n h(FlexRow, { alignItems: \"baseline\", justifyContent: \"space-between\" }, [\n h(ModelInfo, { data: model }),\n h(SegmentedControl, {\n options: [\n { label: \"Tree\", value: \"tree\" },\n { label: \"Graph\", value: \"graph\" },\n ],\n value: state.viewMode,\n small: true,\n onValueChange(value: ViewMode) {\n console.log(\"Setting view mode\", value);\n dispatch({ type: \"set-view-mode\", payload: value });\n },\n }),\n ]),\n h(\n \"div.entity-panel\",\n {\n ref,\n },\n [\n h(Card, { className: \"control-panel\" }, [\n h(\n ButtonGroup,\n {\n vertical: true,\n fill: true,\n minimal: true,\n alignText: \"left\",\n },\n [\n h(\n CancelButton,\n {\n icon: \"trash\",\n disabled: state.initialTree == state.tree,\n onClick() {\n dispatch({ type: \"reset\" });\n },\n },\n \"Reset\"\n ),\n h(\n SaveButton,\n {\n onClick() {\n onSave(state.tree);\n },\n disabled: state.initialTree == state.tree,\n },\n \"Save\"\n ),\n ]\n ),\n h(EntityTypeSelector, {\n entityTypes,\n selected: selectedEntityType,\n onChange(payload) {\n dispatch({ type: \"select-entity-type\", payload });\n },\n isOpen: isSelectingEntityType,\n setOpen: (isOpen: boolean) =>\n dispatch({\n type: \"toggle-entity-type-selector\",\n payload: isOpen,\n }),\n }),\n ]),\n h.if(state.viewMode == \"tree\")(ManagedSelectionTree, {\n selectedNodes,\n dispatch,\n tree,\n width,\n height,\n matchComponent,\n }),\n h.if(state.viewMode == \"graph\")(GraphView, {\n tree,\n width,\n height,\n }),\n ]\n ),\n ]);\n}\n\nfunction processEntity(entity: Entity): InternalEntity {\n // @ts-ignore\n return {\n ...entity,\n // @ts-ignore\n term_type: entity.type.name,\n txt_range: [entity.indices],\n children: entity.children?.map(processEntity) ?? [],\n };\n}\n\nfunction EntityTypeSelector({\n entityTypes,\n selected,\n isOpen,\n setOpen,\n onChange,\n}) {\n // Show all entity types when selected is null\n const _selected = selected != null ? selected : undefined;\n return h(DataField, { label: \"Entity type\", inline: true }, [\n h(\n \"code.bp5-code\",\n {\n onClick() {\n setOpen((d) => !d);\n },\n },\n selected.name\n ),\n h(OmniboxSelector, {\n isOpen,\n items: Array.from(entityTypes.values()),\n selectedItem: _selected,\n onSelectItem(item) {\n setOpen(false);\n onChange(item);\n },\n onClose() {\n setOpen(false);\n },\n }),\n ]);\n}\n\nfunction ManagedSelectionTree(props) {\n const {\n selectedNodes,\n dispatch,\n tree,\n height,\n width,\n matchComponent,\n ...rest\n } = props;\n\n const ref = useRef<TreeApi<TreeData>>();\n\n const _Node = useCallback(\n (props) => h(Node, { ...props, matchComponent }),\n [matchComponent]\n );\n\n useEffect(() => {\n if (ref.current == null) return;\n // Check if selection matches current\n const selection = new Set(selectedNodes.map((d) => d.toString()));\n const currentSelection = ref.current.selectedIds;\n if (setsAreTheSame(selection, currentSelection)) return;\n // If the selection is the same, do nothing\n\n // Set selection\n ref.current.setSelection({\n ids: selectedNodes.map((d) => d.toString()),\n anchor: null,\n mostRecent: null,\n });\n }, [selectedNodes]);\n\n return h(Tree, {\n className: \"selection-tree\",\n height,\n width,\n ref,\n data: tree,\n onMove({ dragIds, parentId, index }) {\n dispatch({\n type: \"move-node\",\n payload: {\n dragIds: dragIds.map((d) => parseInt(d)),\n parentId: parentId ? parseInt(parentId) : null,\n index,\n },\n });\n },\n onDelete({ ids }) {\n dispatch({\n type: \"delete-node\",\n payload: { ids: ids.map((d) => parseInt(d)) },\n });\n },\n onSelect(nodes) {\n let ids = nodes.map((d) => parseInt(d.id));\n if (ids.length == 1 && ids[0] == selectedNodes[0]) {\n // Deselect\n ids = [];\n }\n dispatch({ type: \"select-node\", payload: { ids } });\n },\n children: _Node,\n idAccessor(d: TreeData) {\n return d.id.toString();\n },\n });\n}\n"],"names":[],"version":3,"file":"feedback.46c2b5c4.js.map"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
.QoX8-W_feedback-component {
|
|
2
|
-
width: 800px;
|
|
3
|
-
position: relative;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.QoX8-W_feedback-component > svg {
|
|
7
|
-
width: 800px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.QoX8-W_node {
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.QoX8-W_feedback-text {
|
|
15
|
-
margin-bottom: 2em;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.QoX8-W_entity-panel {
|
|
19
|
-
max-height: 600px;
|
|
20
|
-
position: relative;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.QoX8-W_control-panel {
|
|
24
|
-
max-width: 15em;
|
|
25
|
-
padding: .2em .5em;
|
|
26
|
-
position: absolute;
|
|
27
|
-
top: 1em;
|
|
28
|
-
right: 1em;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.QoX8-W_entity-panel {
|
|
32
|
-
background: var(--panel-secondary-background-color);
|
|
33
|
-
min-height: 100px;
|
|
34
|
-
box-shadow: 0 0 0 1px var(--panel-border-color) inset;
|
|
35
|
-
border-radius: 4px;
|
|
36
|
-
flex: 1;
|
|
37
|
-
padding: 1em;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.QoX8-W_selection-tree {
|
|
41
|
-
margin: -1em 0;
|
|
42
|
-
padding: 1em 0;
|
|
43
|
-
}
|
|
44
|
-
/*# sourceMappingURL=feedback.module.7e16830e.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;AAIE;;;;AAGF;;;;AAIA;;;;AAGA;;;;;AAIA;;;;;;;;AAOA;;;;;;;;;AASA","sources":["packages/feedback-components/src/feedback/feedback.module.sass"],"sourcesContent":[".feedback-component\n position: relative\n width: 800px\n\n & > svg\n width: 800px\n\n.node\n cursor: pointer\n\n\n.feedback-text\n margin-bottom: 2em\n\n.entity-panel\n position: relative\n max-height: 600px\n\n.control-panel\n max-width: 15em\n position: absolute\n top: 1em\n right: 1em\n padding: 0.2em 0.5em\n\n.entity-panel\n flex: 1\n min-height: 100px\n padding: 1em\n background: var(--panel-secondary-background-color)\n border-radius: 4px\n // Inset box shadow\n box-shadow: 0 0 0 1px var(--panel-border-color) inset\n\n.selection-tree\n margin: -1em 0\n padding: 1em 0\n"],"names":[],"version":3,"file":"feedback.module.7e16830e.css.map"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function $parcel$export(e, n, v, s) {
|
|
3
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
-
}
|
|
5
|
-
var $49c87ee97f392268$exports = {};
|
|
6
|
-
|
|
7
|
-
$parcel$export($49c87ee97f392268$exports, "control-panel", () => $49c87ee97f392268$export$a0a23f31d5562853, (v) => $49c87ee97f392268$export$a0a23f31d5562853 = v);
|
|
8
|
-
$parcel$export($49c87ee97f392268$exports, "entity-panel", () => $49c87ee97f392268$export$38f2cd12e45697e, (v) => $49c87ee97f392268$export$38f2cd12e45697e = v);
|
|
9
|
-
$parcel$export($49c87ee97f392268$exports, "feedback-component", () => $49c87ee97f392268$export$579bd45c78bf5510, (v) => $49c87ee97f392268$export$579bd45c78bf5510 = v);
|
|
10
|
-
$parcel$export($49c87ee97f392268$exports, "feedback-text", () => $49c87ee97f392268$export$890489be1870bed5, (v) => $49c87ee97f392268$export$890489be1870bed5 = v);
|
|
11
|
-
$parcel$export($49c87ee97f392268$exports, "node", () => $49c87ee97f392268$export$35059013cd4a06db, (v) => $49c87ee97f392268$export$35059013cd4a06db = v);
|
|
12
|
-
$parcel$export($49c87ee97f392268$exports, "selection-tree", () => $49c87ee97f392268$export$3ae1b51693c80a9c, (v) => $49c87ee97f392268$export$3ae1b51693c80a9c = v);
|
|
13
|
-
var $49c87ee97f392268$export$a0a23f31d5562853;
|
|
14
|
-
var $49c87ee97f392268$export$38f2cd12e45697e;
|
|
15
|
-
var $49c87ee97f392268$export$579bd45c78bf5510;
|
|
16
|
-
var $49c87ee97f392268$export$890489be1870bed5;
|
|
17
|
-
var $49c87ee97f392268$export$35059013cd4a06db;
|
|
18
|
-
var $49c87ee97f392268$export$3ae1b51693c80a9c;
|
|
19
|
-
$49c87ee97f392268$export$a0a23f31d5562853 = `QoX8-W_control-panel`;
|
|
20
|
-
$49c87ee97f392268$export$38f2cd12e45697e = `QoX8-W_entity-panel`;
|
|
21
|
-
$49c87ee97f392268$export$579bd45c78bf5510 = `QoX8-W_feedback-component`;
|
|
22
|
-
$49c87ee97f392268$export$890489be1870bed5 = `QoX8-W_feedback-text`;
|
|
23
|
-
$49c87ee97f392268$export$35059013cd4a06db = `QoX8-W_node`;
|
|
24
|
-
$49c87ee97f392268$export$3ae1b51693c80a9c = `QoX8-W_selection-tree`;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export {$49c87ee97f392268$exports as default};
|
|
28
|
-
//# sourceMappingURL=feedback.module.c28cbac7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AALA,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,2CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAAmC,CAAC,qBAAqB,CAAC","sources":["packages/feedback-components/src/feedback/feedback.module.sass"],"sourcesContent":[".feedback-component\n position: relative\n width: 800px\n\n & > svg\n width: 800px\n\n.node\n cursor: pointer\n\n\n.feedback-text\n margin-bottom: 2em\n\n.entity-panel\n position: relative\n max-height: 600px\n\n.control-panel\n max-width: 15em\n position: absolute\n top: 1em\n right: 1em\n padding: 0.2em 0.5em\n\n.entity-panel\n flex: 1\n min-height: 100px\n padding: 1em\n background: var(--panel-secondary-background-color)\n border-radius: 4px\n // Inset box shadow\n box-shadow: 0 0 0 1px var(--panel-border-color) inset\n\n.selection-tree\n margin: -1em 0\n padding: 1em 0\n"],"names":[],"version":3,"file":"feedback.module.c28cbac7.js.map"}
|
package/dist/graph.cb42b871.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {treeToGraph as $b79bf29960412ca7$export$8d9dbb7a64bf2a5e} from "./edit-state.e8edb13a.js";
|
|
2
|
-
import $aW1K8$macrostrathyper from "@macrostrat/hyper";
|
|
3
|
-
import {forceSimulation as $aW1K8$forceSimulation, forceLink as $aW1K8$forceLink, forceManyBody as $aW1K8$forceManyBody, forceCenter as $aW1K8$forceCenter, forceCollide as $aW1K8$forceCollide} from "d3-force";
|
|
4
|
-
import {useState as $aW1K8$useState, useEffect as $aW1K8$useEffect} from "react";
|
|
5
|
-
import {Spinner as $aW1K8$Spinner} from "@blueprintjs/core";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function $ff8c3e7f2bc22925$export$6a7fe3ef90e8d566(props) {
|
|
13
|
-
// A graph view with react-flow
|
|
14
|
-
// Get positions of nodes using force simulation
|
|
15
|
-
const { tree: tree, width: width, height: height } = props;
|
|
16
|
-
const [nodes, setNodes] = (0, $aW1K8$useState)(null);
|
|
17
|
-
const [links, setLinks] = (0, $aW1K8$useState)(null);
|
|
18
|
-
(0, $aW1K8$useEffect)(()=>{
|
|
19
|
-
const { nodes: nodes, edges: edges } = (0, $b79bf29960412ca7$export$8d9dbb7a64bf2a5e)(tree);
|
|
20
|
-
const nodesMap = new Map(nodes.map((d)=>[
|
|
21
|
-
d.id,
|
|
22
|
-
d
|
|
23
|
-
]));
|
|
24
|
-
const links = edges.map((d)=>{
|
|
25
|
-
return {
|
|
26
|
-
source: nodesMap.get(d.source),
|
|
27
|
-
target: nodesMap.get(d.dest),
|
|
28
|
-
strength: 1
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
const simulation = (0, $aW1K8$forceSimulation)(nodes).force("link", (0, $aW1K8$forceLink)(links)).force("charge", (0, $aW1K8$forceManyBody)().strength(-50)).force("center", (0, $aW1K8$forceCenter)(width / 2, height / 2)).force("collide", (0, $aW1K8$forceCollide)().radius(20)).on("tick", ()=>{
|
|
32
|
-
// Update the positions of the nodes
|
|
33
|
-
// setNodes(nodes);
|
|
34
|
-
console.log("Simulation tick");
|
|
35
|
-
}).on("end", ()=>{
|
|
36
|
-
// Update the positions of the nodes
|
|
37
|
-
setNodes(nodes);
|
|
38
|
-
setLinks(links);
|
|
39
|
-
});
|
|
40
|
-
return ()=>{
|
|
41
|
-
simulation.stop();
|
|
42
|
-
};
|
|
43
|
-
}, [
|
|
44
|
-
tree,
|
|
45
|
-
width,
|
|
46
|
-
height
|
|
47
|
-
]);
|
|
48
|
-
if (nodes == null || links == null) return (0, $aW1K8$macrostrathyper)((0, $aW1K8$Spinner));
|
|
49
|
-
console.log("Graph", nodes, links);
|
|
50
|
-
return (0, $aW1K8$macrostrathyper)("div.graph-view", {
|
|
51
|
-
style: {
|
|
52
|
-
width: width,
|
|
53
|
-
height: height
|
|
54
|
-
}
|
|
55
|
-
}, [
|
|
56
|
-
(0, $aW1K8$macrostrathyper)("svg", {
|
|
57
|
-
width: width,
|
|
58
|
-
height: height
|
|
59
|
-
}, [
|
|
60
|
-
(0, $aW1K8$macrostrathyper)("g.nodes", nodes.map((d)=>{
|
|
61
|
-
return (0, $aW1K8$macrostrathyper)("circle", {
|
|
62
|
-
cx: d.x,
|
|
63
|
-
cy: d.y,
|
|
64
|
-
r: 5,
|
|
65
|
-
fill: "blue"
|
|
66
|
-
});
|
|
67
|
-
})),
|
|
68
|
-
(0, $aW1K8$macrostrathyper)("g.links", links.map((d)=>{
|
|
69
|
-
return (0, $aW1K8$macrostrathyper)("line", {
|
|
70
|
-
x1: d.source.x,
|
|
71
|
-
y1: d.source.y,
|
|
72
|
-
x2: d.target.x,
|
|
73
|
-
y2: d.target.y,
|
|
74
|
-
stroke: "black"
|
|
75
|
-
});
|
|
76
|
-
}))
|
|
77
|
-
])
|
|
78
|
-
]);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export {$ff8c3e7f2bc22925$export$6a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AO;IAExB,IAAI,SAAS,QAAQ,SAAS,MAC5B,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,cAAM;IAGjB,QAAQ,GAAG,CAAC,SAAS,OAAO;IAE5B,OAAO,CAAA,GAAA,sBAAA,EAAE,kBAAkB;QAAE,OAAO;mBAAE;oBAAO;QAAO;IAAE,GAAG;QACvD,CAAA,GAAA,sBAAA,EAAE,OAAO;mBAAE;oBAAO;QAAO,GAAG;YAC1B,CAAA,GAAA,sBAAA,EACE,WACA,MAAM,GAAG,CAAC,CAAC;gBACT,OAAO,CAAA,GAAA,sBAAA,EAAE,UAAU;oBACjB,IAAI,EAAE,CAAC;oBACP,IAAI,EAAE,CAAC;oBACP,GAAG;oBACH,MAAM;gBACR;YACF;YAEF,CAAA,GAAA,sBAAA,EACE,WACA,MAAM,GAAG,CAAC,CAAC;gBACT,OAAO,CAAA,GAAA,sBAAA,EAAE,QAAQ;oBACf,IAAI,EAAE,MAAM,CAAC,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC,CAAC;oBACd,QAAQ;gBACV;YACF;SAEH;KACF;AACH","sources":["packages/feedback-components/src/feedback/graph.ts"],"sourcesContent":["import { TreeData } from \"./types\";\nimport { treeToGraph } from \"./edit-state\";\nimport h from \"@macrostrat/hyper\";\n\nimport {\n forceSimulation,\n SimulationNodeDatum,\n SimulationLinkDatum,\n forceCenter,\n forceLink,\n forceManyBody,\n forceCollide,\n} from \"d3-force\";\nimport { useEffect, useState } from \"react\";\nimport { Spinner } from \"@blueprintjs/core\";\n\nexport function GraphView(props: {\n tree: TreeData[];\n width: number;\n height: number;\n}) {\n // A graph view with react-flow\n // Get positions of nodes using force simulation\n const { tree, width, height } = props;\n\n const [nodes, setNodes] = useState<SimulationNodeDatum[]>(null);\n const [links, setLinks] = useState<SimulationLinkDatum[]>(null);\n\n useEffect(() => {\n const { nodes, edges } = treeToGraph(tree);\n\n const nodesMap = new Map<number, SimulationNodeDatum>(\n nodes.map((d) => [d.id, d])\n );\n\n const links = edges.map((d) => {\n return {\n source: nodesMap.get(d.source),\n target: nodesMap.get(d.dest),\n strength: 1,\n };\n });\n\n const simulation = forceSimulation(nodes)\n .force(\"link\", forceLink(links))\n .force(\"charge\", forceManyBody().strength(-50))\n .force(\"center\", forceCenter(width / 2, height / 2))\n .force(\"collide\", forceCollide().radius(20))\n .on(\"tick\", () => {\n // Update the positions of the nodes\n // setNodes(nodes);\n console.log(\"Simulation tick\");\n })\n .on(\"end\", () => {\n // Update the positions of the nodes\n setNodes(nodes);\n setLinks(links);\n });\n\n return () => {\n simulation.stop();\n };\n }, [tree, width, height]);\n\n if (nodes == null || links == null) {\n return h(Spinner);\n }\n\n console.log(\"Graph\", nodes, links);\n\n return h(\"div.graph-view\", { style: { width, height } }, [\n h(\"svg\", { width, height }, [\n h(\n \"g.nodes\",\n nodes.map((d) => {\n return h(\"circle\", {\n cx: d.x,\n cy: d.y,\n r: 5,\n fill: \"blue\",\n });\n })\n ),\n h(\n \"g.links\",\n links.map((d) => {\n return h(\"line\", {\n x1: d.source.x,\n y1: d.source.y,\n x2: d.target.x,\n y2: d.target.y,\n stroke: \"black\",\n });\n })\n ),\n ]),\n ]);\n}\n"],"names":[],"version":3,"file":"graph.cb42b871.js.map"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;AAAA,kBAAkB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9D,aAAa,GAAG,CAAC;AAEjB;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,QAAQ,EAAE,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GACnD;IAAE,IAAI,EAAE,6BAA6B,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,oBAA2B,SAAS,UAAU,CAAC,CAAC;AAoNhD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;IACE,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED,4BAA4B,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CA0CvD;kBuB7IQ,kBAAkB;;;;;;yBA2KR,mBAAmB;;;kBwBpO7B,iBAAiB;;;AMtE1B,kCAAkC,EAChC,QAAa,EACb,IAAI,EACJ,KAAK,EACL,WAAW,EACX,cAAc,EACd,MAAM,GACP;;;;;;;CAAA,yDAwGA","sources":["packages/feedback-components/src/src/extractions/types.ts","packages/feedback-components/color-utils/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/src/src/feedback/text-visualizer.ts","packages/feedback-components/src/src/feedback/type-selector/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/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/feedback/graph.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,"export * from \"./extractions\";\nexport * from \"./feedback\";\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAOA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,0EAAK;AAE5B,SAAS,iCAAW,UAAoB,EAAE,QAAkB;IAC1D,OAAO,WAAW,EAAE,IAAI,SAAS,EAAE;AACnC,wEAAwE;AAC1E;AAEA,SAAS,wCAAkB,IAAuB,EAAE,IAAuB;IACzE,gFAAgF;IAChF,IAAI,KAAK,aAAa,CAAC,MAAM,IAAI,GAC/B,OAAO;IAGT,KAAK,MAAM,gBAAgB,KAAK,aAAa,CAAE;QAC7C,IAAI,iCAAW,KAAK,IAAI,EAAE,aAAa,IAAI,GACzC,OAAO;IAEX;IAEA,0CAA0C;IAC1C,IAAI,KAAK,MAAM,IAAI,QAAQ,wCAAkB,KAAK,MAAM,EAAE,OACxD,OAAO;IAGT,OAAO;AACT;AAEA,SAAS,mCAAa,IAAuB,EAAE,IAAuB;IACpE,KAAK,MAAM,gBAAgB,KAAK,aAAa,CAAE;QAC7C,IAAI,iCAAW,KAAK,IAAI,EAAE,aAAa,IAAI,GACzC,OAAO;IAEX;IACA,OAAO;AACT;AAEA,SAAS,2BAAK,QAAE,IAAI,SAAE,KAAK,cAAE,UAAU,QAAE,IAAI,kBAAE,cAAc,EAAO;IAClE,IAAI,cAAuB,wCAAkB,MAAM;IACnD,IAAI,SAAkB,mCAAa,MAAM;IAEzC,MAAM,WAAW,CAAA,GAAA,yCAAc;IAE/B,OAAO,wBACL,YACA;eAAE;QAAO,KAAK;IAAW,GACzB,wBAAE,CAAA,GAAA,yCAAQ,GAAG;QACX,MAAM,KAAK,IAAI;gBACf;qBACA;wBACA;QACA;YACE,SAAS;gBAAE,MAAM;YAA8B;QACjD;IACF;AAEJ;IAEA,2CAAe","sources":["packages/feedback-components/src/feedback/node.ts"],"sourcesContent":["import { NodeApi, TreeApi } from \"react-arborist\";\nimport { TreeData } from \"./types\";\nimport { EntityTag } from \"../extractions\";\nimport { useTreeDispatch } from \"./edit-state\";\nimport styles from \"./feedback.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\n\nconst h = hyper.styled(styles);\n\nfunction isSelected(searchNode: TreeData, treeNode: TreeData) {\n return searchNode.id == treeNode.id;\n // We could also select children of the search node here if we wanted to\n}\n\nfunction isNodeHighlighted(node: NodeApi<TreeData>, tree: TreeApi<TreeData>) {\n // We treat no selection as all nodes being active. We may add some nuance later\n if (tree.selectedNodes.length == 0) {\n return true;\n }\n\n for (const selectedNode of tree.selectedNodes) {\n if (isSelected(node.data, selectedNode.data)) {\n return true;\n }\n }\n\n // Check if the parent node is highlighted\n if (node.parent != null && isNodeHighlighted(node.parent, tree)) {\n return true;\n }\n\n return false;\n}\n\nfunction isNodeActive(node: NodeApi<TreeData>, tree: TreeApi<TreeData>) {\n for (const selectedNode of tree.selectedNodes) {\n if (isSelected(node.data, selectedNode.data)) {\n return true;\n }\n }\n return false;\n}\n\nfunction Node({ node, style, dragHandle, tree, matchComponent }: any) {\n let highlighted: boolean = isNodeHighlighted(node, tree);\n let active: boolean = isNodeActive(node, tree);\n\n const dispatch = useTreeDispatch();\n\n return h(\n \"div.node\",\n { style, ref: dragHandle },\n h(EntityTag, {\n data: node.data,\n active,\n highlighted,\n matchComponent,\n onClickType() {\n dispatch({ type: \"toggle-entity-type-selector\" });\n },\n })\n );\n}\n\nexport default Node;\n"],"names":[],"version":3,"file":"node.30d0b8c3.js.map"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import "./feedback.module.7e16830e.css";
|
|
2
|
-
import $85rLh$feedbackmodulec28cbac7js from "./feedback.module.c28cbac7.js";
|
|
3
|
-
import {getTagStyle as $03d8811e9c9b360d$export$35baa338324d8550, buildHighlights as $03d8811e9c9b360d$export$c4b91360064ad200} from "./extractions.54be85f8.js";
|
|
4
|
-
import {TextAnnotateBlend as $85rLh$TextAnnotateBlend} from "react-text-annotate-blend";
|
|
5
|
-
import $85rLh$macrostrathyper from "@macrostrat/hyper";
|
|
6
|
-
import {useCallback as $85rLh$useCallback} from "react";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function $parcel$interopDefault(a) {
|
|
10
|
-
return a && a.__esModule ? a.default : a;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const $156a3efbc315814c$var$h = (0, $85rLh$macrostrathyper).styled((0, ($parcel$interopDefault($85rLh$feedbackmodulec28cbac7js))));
|
|
18
|
-
function $156a3efbc315814c$var$buildTags(highlights, selectedNodes) {
|
|
19
|
-
let tags = [];
|
|
20
|
-
// If entity ID has already been seen, don't add it again
|
|
21
|
-
const entities = new Set();
|
|
22
|
-
for (const highlight of highlights){
|
|
23
|
-
// Don't add multiply-linked entities multiple times
|
|
24
|
-
if (entities.has(highlight.id)) continue;
|
|
25
|
-
const highlighted = $156a3efbc315814c$var$isHighlighted(highlight, selectedNodes);
|
|
26
|
-
const active = $156a3efbc315814c$var$isActive(highlight, selectedNodes);
|
|
27
|
-
tags.push({
|
|
28
|
-
markStyle: {
|
|
29
|
-
...(0, $03d8811e9c9b360d$export$35baa338324d8550)(highlight.backgroundColor, {
|
|
30
|
-
highlighted: highlighted,
|
|
31
|
-
active: active
|
|
32
|
-
}),
|
|
33
|
-
borderRadius: "0.2em",
|
|
34
|
-
padding: "0.1em",
|
|
35
|
-
borderWidth: "1.5px",
|
|
36
|
-
cursor: "pointer"
|
|
37
|
-
},
|
|
38
|
-
tagStyle: {
|
|
39
|
-
display: "none"
|
|
40
|
-
},
|
|
41
|
-
...highlight
|
|
42
|
-
});
|
|
43
|
-
entities.add(highlight.id);
|
|
44
|
-
}
|
|
45
|
-
return tags;
|
|
46
|
-
}
|
|
47
|
-
function $156a3efbc315814c$var$isActive(tag, selectedNodes) {
|
|
48
|
-
return selectedNodes.includes(tag.id);
|
|
49
|
-
}
|
|
50
|
-
function $156a3efbc315814c$var$isHighlighted(tag, selectedNodes) {
|
|
51
|
-
if (selectedNodes.length === 0) return true;
|
|
52
|
-
return (selectedNodes.includes(tag.id) || tag.parents?.some((d)=>selectedNodes.includes(d))) ?? false;
|
|
53
|
-
}
|
|
54
|
-
function $156a3efbc315814c$export$6e107db9091b8219(props) {
|
|
55
|
-
// Convert input to tags
|
|
56
|
-
const { text: text, selectedNodes: selectedNodes, nodes: nodes, dispatch: dispatch } = props;
|
|
57
|
-
let allTags = $156a3efbc315814c$var$buildTags((0, $03d8811e9c9b360d$export$c4b91360064ad200)(nodes, null), selectedNodes);
|
|
58
|
-
const onChange = (0, $85rLh$useCallback)((tags)=>{
|
|
59
|
-
// New tags
|
|
60
|
-
console.log(tags);
|
|
61
|
-
const newTags = tags.filter((d)=>!("id" in d));
|
|
62
|
-
if (newTags.length > 0) {
|
|
63
|
-
const { start: start, end: end } = newTags[0];
|
|
64
|
-
const payload = {
|
|
65
|
-
start: start,
|
|
66
|
-
end: end,
|
|
67
|
-
text: text.slice(start, end)
|
|
68
|
-
};
|
|
69
|
-
dispatch({
|
|
70
|
-
type: "create-node",
|
|
71
|
-
payload: payload
|
|
72
|
-
});
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const tagIDs = new Set(tags.map((d)=>d.id));
|
|
76
|
-
const removedIds = allTags.map((d)=>d.id).filter((d)=>!tagIDs.has(d));
|
|
77
|
-
/* Find the id that was removed: that is the one that will be selected
|
|
78
|
-
(we are hijacking the 'click to delete' functionality to select instead) */ if (removedIds.length > 0) dispatch({
|
|
79
|
-
type: "toggle-node-selected",
|
|
80
|
-
payload: {
|
|
81
|
-
ids: removedIds
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}, [
|
|
85
|
-
allTags,
|
|
86
|
-
text
|
|
87
|
-
]);
|
|
88
|
-
return $156a3efbc315814c$var$h((0, $85rLh$TextAnnotateBlend), {
|
|
89
|
-
style: {
|
|
90
|
-
fontSize: "1.2em"
|
|
91
|
-
},
|
|
92
|
-
className: "feedback-text",
|
|
93
|
-
content: text,
|
|
94
|
-
onChange: onChange,
|
|
95
|
-
value: allTags
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export {$156a3efbc315814c$export$6e107db9091b8219 as FeedbackText};
|
|
101
|
-
//# sourceMappingURL=text-visualizer.77af0d24.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AASA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,0EAAK;AAU5B,SAAS,gCACP,UAAuB,EACvB,aAAuB;IAEvB,IAAI,OAA2B,EAAE;IAEjC,yDAAyD;IACzD,MAAM,WAAW,IAAI;IAErB,KAAK,MAAM,aAAa,WAAY;QAClC,oDAAoD;QACpD,IAAI,SAAS,GAAG,CAAC,UAAU,EAAE,GAAG;QAEhC,MAAM,cAAc,oCAAc,WAAW;QAC7C,MAAM,SAAS,+BAAS,WAAW;QAEnC,KAAK,IAAI,CAAC;YACR,WAAW;gBACT,GAAG,CAAA,GAAA,yCAAU,EAAE,UAAU,eAAe,EAAE;iCACxC;4BACA;gBACF,EAAE;gBACF,cAAc;gBACd,SAAS;gBACT,aAAa;gBACb,QAAQ;YACV;YACA,UAAU;gBACR,SAAS;YACX;YACA,GAAG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AW;QAC7B;IAEJ,GACA;QAAC;QAAS;KAAK;IAGjB,OAAO,wBAAE,CAAA,GAAA,wBAAgB,GAAG;QAC1B,OAAO;YACL,UAAU;QACZ;QACA,WAAW;QACX,SAAS;kBACT;QACA,OAAO;IACT;AACF","sources":["packages/feedback-components/src/feedback/text-visualizer.ts"],"sourcesContent":["import { AnnotateBlendTag, TextAnnotateBlend } from \"react-text-annotate-blend\";\nimport { InternalEntity } from \"./types\";\nimport { TreeDispatch } from \"./edit-state\";\nimport styles from \"./feedback.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\nimport { buildHighlights, getTagStyle } from \"../extractions\";\nimport { Highlight } from \"../extractions/types\";\nimport { useCallback } from \"react\";\n\nconst h = hyper.styled(styles);\n\nexport interface FeedbackTextProps {\n text: string;\n selectedNodes: number[];\n nodes: InternalEntity[];\n updateNodes: (nodes: string[]) => void;\n dispatch: TreeDispatch;\n}\n\nfunction buildTags(\n highlights: Highlight[],\n selectedNodes: number[]\n): AnnotateBlendTag[] {\n let tags: AnnotateBlendTag[] = [];\n\n // If entity ID has already been seen, don't add it again\n const entities = new Set<number>();\n\n for (const highlight of highlights) {\n // Don't add multiply-linked entities multiple times\n if (entities.has(highlight.id)) continue;\n\n const highlighted = isHighlighted(highlight, selectedNodes);\n const active = isActive(highlight, selectedNodes);\n\n tags.push({\n markStyle: {\n ...getTagStyle(highlight.backgroundColor, {\n highlighted,\n active,\n }),\n borderRadius: \"0.2em\",\n padding: \"0.1em\",\n borderWidth: \"1.5px\",\n cursor: \"pointer\",\n },\n tagStyle: {\n display: \"none\",\n },\n ...highlight,\n });\n\n entities.add(highlight.id);\n }\n\n return tags;\n}\n\nfunction isActive(tag: Highlight, selectedNodes: number[]) {\n return selectedNodes.includes(tag.id);\n}\n\nfunction isHighlighted(tag: Highlight, selectedNodes: number[]) {\n if (selectedNodes.length === 0) return true;\n return (\n (selectedNodes.includes(tag.id) ||\n tag.parents?.some((d) => selectedNodes.includes(d))) ??\n false\n );\n}\n\nexport function FeedbackText(props: FeedbackTextProps) {\n // Convert input to tags\n const { text, selectedNodes, nodes, dispatch } = props;\n let allTags: AnnotateBlendTag[] = buildTags(\n buildHighlights(nodes, null),\n selectedNodes\n );\n\n const onChange = useCallback(\n (tags) => {\n // New tags\n console.log(tags);\n const newTags = tags.filter((d) => !(\"id\" in d));\n if (newTags.length > 0) {\n const { start, end } = newTags[0];\n const payload = { start, end, text: text.slice(start, end) };\n dispatch({ type: \"create-node\", payload });\n return;\n }\n\n const tagIDs = new Set(tags.map((d) => d.id));\n const removedIds = allTags.map((d) => d.id).filter((d) => !tagIDs.has(d));\n\n /* Find the id that was removed: that is the one that will be selected\n (we are hijacking the 'click to delete' functionality to select instead) */\n if (removedIds.length > 0) {\n dispatch({\n type: \"toggle-node-selected\",\n payload: { ids: removedIds },\n });\n }\n },\n [allTags, text]\n );\n\n return h(TextAnnotateBlend, {\n style: {\n fontSize: \"1.2em\",\n },\n className: \"feedback-text\",\n content: text,\n onChange,\n value: allTags,\n });\n}\n"],"names":[],"version":3,"file":"text-visualizer.77af0d24.js.map"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;CAEC;;;;;AAUD,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,sEAAK;AAa5B,MAAM,oCAAoD,CAAC;IACzD,sCAAsC,GACtC,IAAI,UAAE,MAAM,YAAE,QAAQ,aAAE,SAAS,YAAE,QAAQ,QAAE,IAAI,YAAE,QAAQ,EAAE,GAAG;IAChE,YAAY,CAAA,GAAA,iBAAS,EAAE;gBAAE;kBAAQ;IAAS,GAAG;IAC7C,MAAM,UAAU,IAAM,SAAS;IAE/B,OAAO,wBACL,sBACA;QACE,KAAK,KAAK,EAAE;mBACZ;iBACA;IACF,GACA;QACE,wBAAE,cAAc;YAAE,OAAO;gBAAE,iBAAiB,KAAK,KAAK;YAAC;QAAE;QACzD,wBAAE,YAAY,CAAC,GAAG,KAAK,IAAI;KAC5B;AAEL;AAWO,SAAS,0CAAmB,KAAsB;IACvD,2CAA2C,GAC3C,MAAM,gBAAE,YAAY,SAAE,KAAK,UAAE,MAAM,WAAE,OAAO,EAAE,GAAG;IAEjD,OAAO,wBAAE,CAAA,GAAA,cAAM,GAAG;QAChB,cAAc;eACd;QACA,eAAe;gBACf;iBACA;QACA,cAAa,IAAO,EAAE,eAAE,WAAW,aAAE,SAAS,EAAE;YAC9C,OAAO,wBAAE,mCAAa;gBACpB,KAAK,KAAK,EAAE;sBACZ;gBACA,UAAU;gBACV,QAAQ,UAAU,MAAM;gBACxB,UAAU,UAAU,MAAM;YAC5B;QACF;IACF;AACF","sources":["packages/feedback-components/src/feedback/type-selector/index.ts"],"sourcesContent":["/**\n * Entity type selector\n */\n\nimport styles from \"./main.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\n\nimport classNames from \"classnames\";\nimport React from \"react\";\nimport { Omnibar, OmnibarProps } from \"@blueprintjs/select\";\nimport \"@blueprintjs/select/lib/css/blueprint-select.css\";\n\nconst h = hyper.styled(styles);\n\ninterface TagItemProps<T> {\n selected: boolean;\n active: boolean;\n className?: string;\n item: T;\n\n onSelect(t: T): void;\n\n children?: React.ReactElement;\n}\n\nconst TagListItem: React.ComponentType<TagItemProps<T>> = (props) => {\n /** Render a tag for the omnibox list */\n let { active, selected, className, onSelect, item, children } = props;\n className = classNames({ active, selected }, className);\n const onClick = () => onSelect(item);\n\n return h(\n \"div.item-container\",\n {\n key: item.id,\n className,\n onClick,\n },\n [\n h(\"div.swatch\", { style: { backgroundColor: item.color } }),\n h(\"div.item\", {}, item.name),\n ]\n );\n};\n\ntype BoxLifecycleProps<T> = Pick<OmnibarProps<T>, \"onClose\" | \"isOpen\">;\n\ninterface OmniboxProps<T> extends BoxLifecycleProps<T> {\n items: T[];\n selectedItem: T;\n onSelectItem: (t: T) => void;\n listItemComponent?: React.ComponentType<TagItemProps<T>>;\n}\n\nexport function OmniboxSelector<T>(props: OmniboxProps<T>) {\n /** A general omnibox for annotation types */\n const { onSelectItem, items, isOpen, onClose } = props;\n\n return h(Omnibar, {\n onItemSelect: onSelectItem,\n items,\n resetOnSelect: false,\n isOpen,\n onClose,\n itemRenderer(item: T, { handleClick, modifiers }) {\n return h(TagListItem, {\n key: item.id,\n item,\n onSelect: handleClick,\n active: modifiers.active,\n selected: modifiers.active,\n });\n },\n });\n}\n"],"names":[],"version":3,"file":"type-selector.e75dd247.js.map"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
|
|
3
|
-
import { FeedbackComponent } from "../src";
|
|
4
|
-
import { data, entityTypes } from "./test-data";
|
|
5
|
-
import h from "@macrostrat/hyper";
|
|
6
|
-
|
|
7
|
-
function FeedbackInterface({ data, types }) {
|
|
8
|
-
const { entities = [], paragraph_text, model, model_run, source_text } = data;
|
|
9
|
-
|
|
10
|
-
return h(FeedbackComponent, {
|
|
11
|
-
entities,
|
|
12
|
-
text: paragraph_text,
|
|
13
|
-
model,
|
|
14
|
-
entityTypes: createMap(types),
|
|
15
|
-
sourceTextID: source_text,
|
|
16
|
-
runID: model_run,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
20
|
-
const meta: Meta<any> = {
|
|
21
|
-
title: "Text extractions/Text extraction",
|
|
22
|
-
component: FeedbackInterface,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
|
|
27
|
-
export const Primary: StoryObj<{}> = {
|
|
28
|
-
args: {
|
|
29
|
-
data,
|
|
30
|
-
types: entityTypes,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function createMap(arr) {
|
|
35
|
-
const out = new Map();
|
|
36
|
-
for (const d of arr) {
|
|
37
|
-
out.set(d.id, d);
|
|
38
|
-
}
|
|
39
|
-
return out;
|
|
40
|
-
}
|