@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {treeToGraph as $b79bf29960412ca7$export$8d9dbb7a64bf2a5e} from "./feedback-components.bf5f7cf7.js";
|
|
2
|
+
import {getTagStyle as $03d8811e9c9b360d$export$35baa338324d8550} from "./feedback-components.5df2a926.js";
|
|
3
|
+
import $phGch$macrostrathyper from "@macrostrat/hyper";
|
|
4
|
+
import {forceSimulation as $phGch$forceSimulation, forceLink as $phGch$forceLink, forceManyBody as $phGch$forceManyBody, forceCenter as $phGch$forceCenter, forceCollide as $phGch$forceCollide} from "d3-force";
|
|
5
|
+
import {useState as $phGch$useState, useEffect as $phGch$useEffect} from "react";
|
|
6
|
+
import {Spinner as $phGch$Spinner} from "@blueprintjs/core";
|
|
7
|
+
import {ErrorBoundary as $phGch$ErrorBoundary} from "@macrostrat/ui-components";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function $ff8c3e7f2bc22925$export$6a7fe3ef90e8d566(props) {
|
|
17
|
+
// A graph view with react-flow
|
|
18
|
+
// Get positions of nodes using force simulation
|
|
19
|
+
const { tree: tree, width: width, height: height, dispatch: dispatch, selectedNodes: selectedNodes } = props;
|
|
20
|
+
const [nodes, setNodes] = (0, $phGch$useState)(null);
|
|
21
|
+
const [links, setLinks] = (0, $phGch$useState)(null);
|
|
22
|
+
(0, $phGch$useEffect)(()=>{
|
|
23
|
+
const { nodes: nodes, edges: edges } = (0, $b79bf29960412ca7$export$8d9dbb7a64bf2a5e)(tree);
|
|
24
|
+
const nodesMap = new Map(nodes.map((d)=>[
|
|
25
|
+
d.id,
|
|
26
|
+
d
|
|
27
|
+
]));
|
|
28
|
+
const links = edges.map((d)=>{
|
|
29
|
+
return {
|
|
30
|
+
source: nodesMap.get(d.source),
|
|
31
|
+
target: nodesMap.get(d.dest),
|
|
32
|
+
strength: 1
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const simulation = (0, $phGch$forceSimulation)(nodes).force("link", (0, $phGch$forceLink)(links)).force("charge", (0, $phGch$forceManyBody)().strength(-50)).force("center", (0, $phGch$forceCenter)(width / 2, height / 2)).force("collide", (0, $phGch$forceCollide)().radius(20)).on("tick", ()=>{
|
|
36
|
+
// Update the positions of the nodes
|
|
37
|
+
// setNodes(nodes);
|
|
38
|
+
console.log("Simulation tick");
|
|
39
|
+
}).on("end", ()=>{
|
|
40
|
+
// Update the positions of the nodes
|
|
41
|
+
setNodes(nodes);
|
|
42
|
+
setLinks(links);
|
|
43
|
+
});
|
|
44
|
+
return ()=>{
|
|
45
|
+
simulation.stop();
|
|
46
|
+
};
|
|
47
|
+
}, [
|
|
48
|
+
tree,
|
|
49
|
+
width,
|
|
50
|
+
height
|
|
51
|
+
]);
|
|
52
|
+
if (nodes == null || links == null) return (0, $phGch$macrostrathyper)((0, $phGch$Spinner));
|
|
53
|
+
console.log("Graph", nodes, links, selectedNodes);
|
|
54
|
+
return (0, $phGch$macrostrathyper)((0, $phGch$ErrorBoundary), {
|
|
55
|
+
description: "An error occurred while rendering the graph view."
|
|
56
|
+
}, (0, $phGch$macrostrathyper)("div.graph-view", {
|
|
57
|
+
style: {
|
|
58
|
+
width: width,
|
|
59
|
+
height: height
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
(0, $phGch$macrostrathyper)("svg", {
|
|
63
|
+
width: width,
|
|
64
|
+
height: height
|
|
65
|
+
}, [
|
|
66
|
+
(0, $phGch$macrostrathyper)("g.links", links.map((d)=>{
|
|
67
|
+
return (0, $phGch$macrostrathyper)("line", {
|
|
68
|
+
x1: d.source.x,
|
|
69
|
+
y1: d.source.y,
|
|
70
|
+
x2: d.target.x,
|
|
71
|
+
y2: d.target.y,
|
|
72
|
+
stroke: "black"
|
|
73
|
+
});
|
|
74
|
+
})),
|
|
75
|
+
(0, $phGch$macrostrathyper)("g.nodes", nodes.map((d)=>{
|
|
76
|
+
const active = selectedNodes.includes(d.id);
|
|
77
|
+
const stroke = active ? "white" : "black";
|
|
78
|
+
const highlighted = $ff8c3e7f2bc22925$var$isHighlighted(d.id, selectedNodes, nodes);
|
|
79
|
+
const style = (0, $03d8811e9c9b360d$export$35baa338324d8550)(d.color, {
|
|
80
|
+
highlighted: highlighted,
|
|
81
|
+
active: active
|
|
82
|
+
});
|
|
83
|
+
return (0, $phGch$macrostrathyper)("circle", {
|
|
84
|
+
cx: d.x,
|
|
85
|
+
cy: d.y,
|
|
86
|
+
r: 5,
|
|
87
|
+
fill: style.backgroundColor || "blue",
|
|
88
|
+
onClick: (e)=>{
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
dispatch({
|
|
91
|
+
type: "toggle-node-selected",
|
|
92
|
+
payload: {
|
|
93
|
+
ids: [
|
|
94
|
+
d.id
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
className: active ? "selected" : "",
|
|
100
|
+
stroke: stroke,
|
|
101
|
+
strokeWidth: 2
|
|
102
|
+
}, (0, $phGch$macrostrathyper)("title", d.name || `Node ${d.id}`));
|
|
103
|
+
}))
|
|
104
|
+
])
|
|
105
|
+
]));
|
|
106
|
+
}
|
|
107
|
+
function $ff8c3e7f2bc22925$var$isHighlighted(id, selectedNodes, nodes) {
|
|
108
|
+
if (selectedNodes.length === 0) return true;
|
|
109
|
+
return selectedNodes.includes(id) || nodes.some((node)=>selectedNodes.includes(node.id) && node.children.some((child)=>child.id === id));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
export {$ff8c3e7f2bc22925$export$6a7fe3ef90e8d566 as GraphView};
|
|
114
|
+
//# sourceMappingURL=feedback-components.7cd9b6cc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAkBO,SAAS,0CAAU,KAMzB;IACC,+BAA+B;IAC/B,gDAAgD;IAChD,MAAM,QAAE,IAAI,SAAE,KAAK,UAAE,MAAM,YAAE,QAAQ,iBAAE,aAAa,EAAE,GAAG;IAEzD,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,eAAO,EAAyB;IAC1D,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,eAAO,EAAyB;IAE1D,CAAA,GAAA,gBAAQ,EAAE;QACR,MAAM,SAAE,KAAK,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAU,EAAE;QAErC,MAAM,WAAW,IAAI,IACnB,MAAM,GAAG,CAAC,CAAC,IAAM;gBAAC,EAAE,EAAE;gBAAE;aAAE;QAG5B,MAAM,QAAQ,MAAM,GAAG,CAAC,CAAC;YACvB,OAAO;gBACL,QAAQ,SAAS,GAAG,CAAC,EAAE,MAAM;gBAC7B,QAAQ,SAAS,GAAG,CAAC,EAAE,IAAI;gBAC3B,UAAU;YACZ;QACF;QAEA,MAAM,aAAa,CAAA,GAAA,sBAAc,EAAE,OAChC,KAA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AM,cAAc,oCAAc,EAAE,EAAE,EAAE,eAAe;gBACvD,MAAM,QAAQ,CAAA,GAAA,yCAAU,EAAE,EAAE,KAAK,EAAE;iCAAE;4BAAa;gBAAO;gBAEzD,OAAO,CAAA,GAAA,sBAAA,EACL,UACA;oBACE,IAAI,EAAE,CAAC;oBACP,IAAI,EAAE,CAAC;oBACP,GAAG;oBACH,MAAM,MAAM,eAAe,IAAI;oBAC/B,SAAS,CAAC;wBACR,EAAE,eAAe;wBACjB,SAAS;4BACP,MAAM;4BACN,SAAS;gCAAE,KAAK;oCAAC,EAAE,EAAE;iCAAC;4BAAC;wBACzB;oBACF;oBACA,WAAW,SAAS,aAAa;4BACjC;oBACA,aAAa;gBACf,GACA,CAAA,GAAA,sBAAA,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YAEvC;SAEH;KACF;AAEL;AAEA,SAAS,oCAAc,EAAU,EAAE,aAAuB,EAAE,KAAiB;IAC3E,IAAI,cAAc,MAAM,KAAK,GAAG,OAAO;IACvC,OACE,cAAc,QAAQ,CAAC,OACvB,MAAM,IAAI,CACR,CAAC,OACC,cAAc,QAAQ,CAAC,KAAK,EAAE,KAC9B,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAU,MAAM,EAAE,KAAK;AAGnD","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, Popover } from \"@blueprintjs/core\";\nimport { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { getTagStyle } from \"../extractions\";\n\nexport function GraphView(props: {\n tree: TreeData[];\n width: number;\n height: number;\n dispatch: (action: any) => void;\n selectedNodes: number[];\n}) {\n // A graph view with react-flow\n // Get positions of nodes using force simulation\n const { tree, width, height, dispatch, selectedNodes } = 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, selectedNodes);\n\n return h(\n ErrorBoundary,\n {\n description: \"An error occurred while rendering the graph view.\",\n },\n h(\"div.graph-view\", { style: { width, height } }, [\n h(\"svg\", { width, height }, [\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 h(\n \"g.nodes\",\n nodes.map((d) => {\n const active = selectedNodes.includes(d.id);\n const stroke = active ? \"white\" : \"black\";\n const highlighted = isHighlighted(d.id, selectedNodes, nodes);\n const style = getTagStyle(d.color, { highlighted, active });\n\n return h(\n \"circle\",\n {\n cx: d.x,\n cy: d.y,\n r: 5,\n fill: style.backgroundColor || \"blue\",\n onClick: (e) => {\n e.stopPropagation();\n dispatch({\n type: \"toggle-node-selected\",\n payload: { ids: [d.id] },\n });\n },\n className: active ? \"selected\" : \"\",\n stroke,\n strokeWidth: 2,\n },\n h(\"title\", d.name || `Node ${d.id}`),\n );\n }),\n ),\n ]),\n ]),\n );\n}\n\nfunction isHighlighted(id: number, selectedNodes: number[], nodes: TreeData[]) {\n if (selectedNodes.length === 0) return true;\n return (\n selectedNodes.includes(id) ||\n nodes.some(\n (node) =>\n selectedNodes.includes(node.id) &&\n node.children.some((child) => child.id === id),\n )\n );\n}\n"],"names":[],"version":3,"file":"feedback-components.7cd9b6cc.js.map"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {EntityTag as $03d8811e9c9b360d$export$117e56c71b172cde} from "./
|
|
2
|
-
import {useTreeDispatch as $b79bf29960412ca7$export$e1068f2d1c68f87e} from "./
|
|
3
|
-
import "./feedback.
|
|
4
|
-
import $
|
|
5
|
-
import $
|
|
1
|
+
import {EntityTag as $03d8811e9c9b360d$export$117e56c71b172cde} from "./feedback-components.5df2a926.js";
|
|
2
|
+
import {useTreeDispatch as $b79bf29960412ca7$export$e1068f2d1c68f87e} from "./feedback-components.bf5f7cf7.js";
|
|
3
|
+
import "./feedback-components.b7d9b015.css";
|
|
4
|
+
import $gIldz$feedbackcomponents4359bc80js from "./feedback-components.4359bc80.js";
|
|
5
|
+
import $gIldz$macrostrathyper from "@macrostrat/hyper";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
function $parcel$interopDefault(a) {
|
|
@@ -12,7 +12,7 @@ function $parcel$interopDefault(a) {
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
const $b6b9741bf83336eb$var$h = (0, $
|
|
15
|
+
const $b6b9741bf83336eb$var$h = (0, $gIldz$macrostrathyper).styled((0, ($parcel$interopDefault($gIldz$feedbackcomponents4359bc80js))));
|
|
16
16
|
function $b6b9741bf83336eb$var$isSelected(searchNode, treeNode) {
|
|
17
17
|
return searchNode.id == treeNode.id;
|
|
18
18
|
// We could also select children of the search node here if we wanted to
|
|
@@ -37,6 +37,11 @@ function $b6b9741bf83336eb$var$Node({ node: node, style: style, dragHandle: drag
|
|
|
37
37
|
let highlighted = $b6b9741bf83336eb$var$isNodeHighlighted(node, tree);
|
|
38
38
|
let active = $b6b9741bf83336eb$var$isNodeActive(node, tree);
|
|
39
39
|
const dispatch = (0, $b79bf29960412ca7$export$e1068f2d1c68f87e)();
|
|
40
|
+
// console.log("Node render", node.data, highlighted, active);
|
|
41
|
+
if (!node.data?.type) node.data.type = {
|
|
42
|
+
name: "lith",
|
|
43
|
+
color: "rgb(107, 255, 91)"
|
|
44
|
+
};
|
|
40
45
|
return $b6b9741bf83336eb$var$h("div.node", {
|
|
41
46
|
style: style,
|
|
42
47
|
ref: dragHandle
|
|
@@ -56,4 +61,4 @@ var $b6b9741bf83336eb$export$2e2bcd8739ae039 = $b6b9741bf83336eb$var$Node;
|
|
|
56
61
|
|
|
57
62
|
|
|
58
63
|
export {$b6b9741bf83336eb$export$2e2bcd8739ae039 as default};
|
|
59
|
-
//# sourceMappingURL=
|
|
64
|
+
//# sourceMappingURL=feedback-components.87533431.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAOA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,8EAAK;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,8DAA8D;IAE9D,IAAI,CAAC,KAAK,IAAI,EAAE,MACd,KAAK,IAAI,CAAC,IAAI,GAAG;QAAE,MAAM;QAAQ,OAAO;IAAoB;IAG9D,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 // console.log(\"Node render\", node.data, highlighted, active);\n\n if (!node.data?.type) {\n node.data.type = { name: \"lith\", color: \"rgb(107, 255, 91)\" };\n }\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":"feedback-components.87533431.js.map"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import "./feedback-components.b7d9b015.css";
|
|
2
|
+
import $aogpP$feedbackcomponents4359bc80js from "./feedback-components.4359bc80.js";
|
|
3
|
+
import {buildHighlights as $03d8811e9c9b360d$export$c4b91360064ad200, getTagStyle as $03d8811e9c9b360d$export$35baa338324d8550} from "./feedback-components.5df2a926.js";
|
|
4
|
+
import $aogpP$macrostrathyper from "@macrostrat/hyper";
|
|
5
|
+
import {useRef as $aogpP$useRef, useEffect as $aogpP$useEffect} from "react";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const $156a3efbc315814c$var$h = (0, $aogpP$macrostrathyper).styled((0, ($parcel$interopDefault($aogpP$feedbackcomponents4359bc80js))));
|
|
16
|
+
function $156a3efbc315814c$var$buildTags(highlights, selectedNodes) {
|
|
17
|
+
let tags = [];
|
|
18
|
+
// If entity ID has already been seen, don't add it again
|
|
19
|
+
const entities = new Set();
|
|
20
|
+
for (const highlight of highlights){
|
|
21
|
+
// Don't add multiply-linked entities multiple times
|
|
22
|
+
if (entities.has(highlight.id)) continue;
|
|
23
|
+
const highlighted = $156a3efbc315814c$var$isHighlighted(highlight, selectedNodes);
|
|
24
|
+
const active = $156a3efbc315814c$var$isActive(highlight, selectedNodes);
|
|
25
|
+
const tagStyle = (0, $03d8811e9c9b360d$export$35baa338324d8550)(highlight.backgroundColor, {
|
|
26
|
+
highlighted: highlighted,
|
|
27
|
+
active: active
|
|
28
|
+
});
|
|
29
|
+
const tag = {
|
|
30
|
+
color: tagStyle.color,
|
|
31
|
+
tagStyle: {
|
|
32
|
+
display: "none"
|
|
33
|
+
},
|
|
34
|
+
markStyle: {
|
|
35
|
+
backgroundColor: tagStyle.backgroundColor
|
|
36
|
+
},
|
|
37
|
+
...highlight,
|
|
38
|
+
backgroundColor: tagStyle.backgroundColor
|
|
39
|
+
};
|
|
40
|
+
tags.push(tag);
|
|
41
|
+
entities.add(highlight.id);
|
|
42
|
+
}
|
|
43
|
+
return tags;
|
|
44
|
+
}
|
|
45
|
+
function $156a3efbc315814c$var$isActive(tag, selectedNodes) {
|
|
46
|
+
return selectedNodes.includes(tag.id);
|
|
47
|
+
}
|
|
48
|
+
function $156a3efbc315814c$var$isHighlighted(tag, selectedNodes) {
|
|
49
|
+
if (selectedNodes.length === 0) return true;
|
|
50
|
+
return (selectedNodes.includes(tag.id) || tag.parents?.some((d)=>selectedNodes.includes(d))) ?? false;
|
|
51
|
+
}
|
|
52
|
+
function $156a3efbc315814c$export$6e107db9091b8219(props) {
|
|
53
|
+
// Convert input to tags
|
|
54
|
+
const { text: text, selectedNodes: selectedNodes, nodes: nodes, dispatch: dispatch, lineHeight: lineHeight, allowOverlap: allowOverlap } = props;
|
|
55
|
+
const allTags = $156a3efbc315814c$var$buildTags((0, $03d8811e9c9b360d$export$c4b91360064ad200)(nodes, null), selectedNodes);
|
|
56
|
+
return $156a3efbc315814c$var$h("div.feedback-text-wrapper", {
|
|
57
|
+
tabIndex: 0,
|
|
58
|
+
onKeyDown: (e)=>{
|
|
59
|
+
if (e.key === "Backspace") dispatch({
|
|
60
|
+
type: "delete-node",
|
|
61
|
+
payload: {
|
|
62
|
+
ids: selectedNodes
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, $156a3efbc315814c$var$h($156a3efbc315814c$export$190465bec6b893be, {
|
|
67
|
+
text: text,
|
|
68
|
+
allTags: allTags,
|
|
69
|
+
lineHeight: lineHeight,
|
|
70
|
+
allowOverlap: allowOverlap,
|
|
71
|
+
dispatch: dispatch,
|
|
72
|
+
selectedNodes: selectedNodes
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
function $156a3efbc315814c$var$createTagFromSelection({ container: container }) {
|
|
76
|
+
const selection = window.getSelection();
|
|
77
|
+
if (!selection || selection.isCollapsed || selection.rangeCount === 0 || !container) return null;
|
|
78
|
+
const range = selection.getRangeAt(0);
|
|
79
|
+
if (!container.contains(range.startContainer) || !container.contains(range.endContainer)) return null;
|
|
80
|
+
const preRange = document.createRange();
|
|
81
|
+
preRange.setStart(container, 0);
|
|
82
|
+
preRange.setEnd(range.startContainer, range.startOffset);
|
|
83
|
+
const start = preRange.toString().length;
|
|
84
|
+
const selectedText = range.toString();
|
|
85
|
+
const end = start + selectedText.length;
|
|
86
|
+
return {
|
|
87
|
+
start: start,
|
|
88
|
+
end: end,
|
|
89
|
+
text: selectedText
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function $156a3efbc315814c$var$addTag({ tag: tag, dispatch: dispatch, text: text, allTags: allTags, allowOverlap: allowOverlap }) {
|
|
93
|
+
const { start: start, end: end } = tag;
|
|
94
|
+
let payload = {
|
|
95
|
+
start: start,
|
|
96
|
+
end: end,
|
|
97
|
+
text: text.slice(start, end)
|
|
98
|
+
};
|
|
99
|
+
if (payload.text.trim() === "") {
|
|
100
|
+
console.log("Blank tag found, ignoring");
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const duplicate = allTags.find((t)=>t.start === payload.start && (t.end === payload.end || t.end === payload.end - 1));
|
|
104
|
+
if (duplicate) {
|
|
105
|
+
console.log("Duplicate tag found, ignoring");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (payload.text.endsWith(" ")) {
|
|
109
|
+
payload.text = payload.text.slice(0, -1);
|
|
110
|
+
payload.end -= 1;
|
|
111
|
+
}
|
|
112
|
+
const inside = allTags.some((t)=>t.start <= payload.start && t.end >= payload.end);
|
|
113
|
+
const overlap = allTags.some((t)=>t.start < payload.end && t.end > payload.start);
|
|
114
|
+
if ((inside || overlap) && !allowOverlap) {
|
|
115
|
+
console.log("Tag is inside another tag, ignoring");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
dispatch({
|
|
119
|
+
type: "create-node",
|
|
120
|
+
payload: payload
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function $156a3efbc315814c$var$nestHighlights(text, tags) {
|
|
124
|
+
const events = [];
|
|
125
|
+
for (const tag of tags){
|
|
126
|
+
events.push({
|
|
127
|
+
pos: tag.start,
|
|
128
|
+
type: "start",
|
|
129
|
+
tag: tag
|
|
130
|
+
});
|
|
131
|
+
events.push({
|
|
132
|
+
pos: tag.end,
|
|
133
|
+
type: "end",
|
|
134
|
+
tag: tag
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
events.sort((a, b)=>{
|
|
138
|
+
if (a.pos !== b.pos) return a.pos - b.pos;
|
|
139
|
+
if (a.type === "end" && b.type === "start") return -1;
|
|
140
|
+
if (a.type === "start" && b.type === "end") return 1;
|
|
141
|
+
return 0;
|
|
142
|
+
});
|
|
143
|
+
const root = {
|
|
144
|
+
children: [],
|
|
145
|
+
textStart: 0
|
|
146
|
+
};
|
|
147
|
+
const stack = [
|
|
148
|
+
root
|
|
149
|
+
];
|
|
150
|
+
let lastPos = 0;
|
|
151
|
+
for (const { pos: pos, type: type, tag: tag } of events){
|
|
152
|
+
const parent = stack[stack.length - 1];
|
|
153
|
+
if (pos > lastPos) {
|
|
154
|
+
const slice = text.slice(lastPos, pos);
|
|
155
|
+
parent.children.push(slice);
|
|
156
|
+
}
|
|
157
|
+
if (type === "start") {
|
|
158
|
+
const newNode = {
|
|
159
|
+
tag: tag,
|
|
160
|
+
children: [],
|
|
161
|
+
textStart: pos
|
|
162
|
+
};
|
|
163
|
+
parent.children.push(newNode);
|
|
164
|
+
stack.push(newNode);
|
|
165
|
+
} else stack.pop();
|
|
166
|
+
lastPos = pos;
|
|
167
|
+
}
|
|
168
|
+
if (lastPos < text.length) stack[stack.length - 1].children.push(text.slice(lastPos));
|
|
169
|
+
return root;
|
|
170
|
+
}
|
|
171
|
+
function $156a3efbc315814c$var$renderNode(node, dispatch, selectedNodes, parentSelected) {
|
|
172
|
+
if (typeof node === "string") return node;
|
|
173
|
+
const { tag: tag, children: children } = node;
|
|
174
|
+
const isSelected = selectedNodes?.includes(tag.id);
|
|
175
|
+
const style = {
|
|
176
|
+
...tag,
|
|
177
|
+
zIndex: parentSelected ? -1 : 1
|
|
178
|
+
};
|
|
179
|
+
let moveText = [];
|
|
180
|
+
if (isSelected) {
|
|
181
|
+
for(const key in children)if (Object.prototype.hasOwnProperty.call(children, key)) {
|
|
182
|
+
const child = children[key];
|
|
183
|
+
if (child?.tag) moveText.push(child.children[0]);
|
|
184
|
+
else moveText.push(child);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return $156a3efbc315814c$var$h("span", {
|
|
188
|
+
className: "highlight",
|
|
189
|
+
style: style,
|
|
190
|
+
onClick: (e)=>{
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
dispatch({
|
|
193
|
+
type: "toggle-node-selected",
|
|
194
|
+
payload: {
|
|
195
|
+
ids: [
|
|
196
|
+
tag.id
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}, isSelected ? moveText.flat() : children.map((child, i)=>$156a3efbc315814c$var$renderNode(child, dispatch, selectedNodes, isSelected)));
|
|
202
|
+
}
|
|
203
|
+
function $156a3efbc315814c$export$190465bec6b893be(props) {
|
|
204
|
+
const { text: text, allTags: allTags = [], lineHeight: lineHeight, dispatch: dispatch, selectedNodes: selectedNodes, allowOverlap: allowOverlap } = props;
|
|
205
|
+
const tree = $156a3efbc315814c$var$nestHighlights(text, allTags);
|
|
206
|
+
const spanRef = (0, $aogpP$useRef)(null);
|
|
207
|
+
(0, $aogpP$useEffect)(()=>{
|
|
208
|
+
const handleMouseUp = ()=>{
|
|
209
|
+
const tag = $156a3efbc315814c$var$createTagFromSelection({
|
|
210
|
+
container: spanRef.current
|
|
211
|
+
});
|
|
212
|
+
if (!tag) return;
|
|
213
|
+
$156a3efbc315814c$var$addTag({
|
|
214
|
+
tag: tag,
|
|
215
|
+
dispatch: dispatch,
|
|
216
|
+
text: text,
|
|
217
|
+
allTags: allTags,
|
|
218
|
+
allowOverlap: allowOverlap
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
222
|
+
return ()=>{
|
|
223
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
224
|
+
};
|
|
225
|
+
}, [
|
|
226
|
+
text,
|
|
227
|
+
allTags,
|
|
228
|
+
dispatch,
|
|
229
|
+
allowOverlap
|
|
230
|
+
]);
|
|
231
|
+
return $156a3efbc315814c$var$h("span", {
|
|
232
|
+
style: {
|
|
233
|
+
lineHeight: lineHeight
|
|
234
|
+
},
|
|
235
|
+
ref: spanRef
|
|
236
|
+
}, tree.children.map((child, i)=>$156a3efbc315814c$var$renderNode(child, dispatch, selectedNodes, false)));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
export {$156a3efbc315814c$export$6e107db9091b8219 as FeedbackText, $156a3efbc315814c$export$190465bec6b893be as HighlightedText};
|
|
241
|
+
//# sourceMapping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BAAE,KAAK;wBAAC,IAAI,EAAE;qBAAC;gBAAC;YAC3B;QACF;IACF,GACA,aACI,SAAS,IAAI,KACb,SAAS,GAAG,CAAC,CAAC,OAAY,IACxB,iCAAW,OAAO,UAAU,eAAe;AAGrD;AAEO,SAAS,0CAAgB,KAO/B;IACC,MAAM,QACJ,IAAI,WACJ,UAAU,EAAE,cACZ,UAAU,YACV,QAAQ,iBACR,aAAa,gBACb,YAAY,EACb,GAAG;IAEJ,MAAM,OAAO,qCAAe,MAAM;IAElC,MAAM,UAAU,CAAA,GAAA,aAAK,EAAmB;IAExC,CAAA,GAAA,gBAAQ,EAAE;QACR,MAAM,gBAAgB;YACpB,MAAM,MAAM,6CAAuB;gBAAE,WAAW,QAAQ,OAAO;YAAC;YAChE,IAAI,CAAC,KAAK;YACV,6BAAO;qBAAE;0BAAK;sBAAU;yBAAM;8BAAS;YAAa;QACtD;QAEA,SAAS,gBAAgB,CAAC,WAAW;QACrC,OAAO;YACL,SAAS,mBAAmB,CAAC,WAAW;QAC1C;IACF,GAAG;QAAC;QAAM;QAAS;QAAU;KAAa;IAE1C,OAAO,wBACL,QACA;QAAE,OAAO;wBAAE;QAAW;QAAG,KAAK;IAAQ,GACtC,KAAK,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAY,IAC7B,iCAAW,OAAO,UAAU,eAAe;AAGjD","sources":["packages/feedback-components/src/feedback/text-visualizer.ts"],"sourcesContent":["import { AnnotateBlendTag } 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 { useEffect, useRef } 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 lineHeight: string;\n allowOverlap?: boolean;\n}\n\nfunction buildTags(\n highlights: Highlight[],\n selectedNodes: number[],\n): AnnotateBlendTag[] {\n let tags: AnnotateBlendTag[] = [];\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 const tagStyle = getTagStyle(highlight.backgroundColor, {\n highlighted,\n active,\n });\n\n const tag = {\n color: tagStyle.color,\n tagStyle: {\n display: \"none\",\n },\n markStyle: {\n backgroundColor: tagStyle.backgroundColor,\n },\n ...highlight,\n backgroundColor: tagStyle.backgroundColor,\n };\n\n tags.push(tag);\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, lineHeight, allowOverlap } =\n props;\n const allTags: AnnotateBlendTag[] = buildTags(\n buildHighlights(nodes, null),\n selectedNodes,\n );\n\n return h(\n \"div.feedback-text-wrapper\",\n {\n tabIndex: 0,\n onKeyDown: (e) => {\n if (e.key === \"Backspace\") {\n dispatch({\n type: \"delete-node\",\n payload: { ids: selectedNodes },\n });\n }\n },\n },\n h(HighlightedText, {\n text,\n allTags,\n lineHeight,\n allowOverlap,\n dispatch,\n selectedNodes,\n }),\n );\n}\n\nfunction createTagFromSelection({\n container,\n}: {\n container: HTMLElement | null;\n}) {\n const selection = window.getSelection();\n if (\n !selection ||\n selection.isCollapsed ||\n selection.rangeCount === 0 ||\n !container\n )\n return null;\n\n const range = selection.getRangeAt(0);\n\n if (\n !container.contains(range.startContainer) ||\n !container.contains(range.endContainer)\n ) {\n return null;\n }\n\n const preRange = document.createRange();\n preRange.setStart(container, 0);\n preRange.setEnd(range.startContainer, range.startOffset);\n const start = preRange.toString().length;\n\n const selectedText = range.toString();\n const end = start + selectedText.length;\n\n return {\n start,\n end,\n text: selectedText,\n };\n}\n\nfunction addTag({ tag, dispatch, text, allTags, allowOverlap }) {\n const { start, end } = tag;\n let payload = { start, end, text: text.slice(start, end) };\n\n if (payload.text.trim() === \"\") {\n console.log(\"Blank tag found, ignoring\");\n return;\n }\n\n const duplicate = allTags.find(\n (t) =>\n t.start === payload.start &&\n (t.end === payload.end || t.end === payload.end - 1),\n );\n\n if (duplicate) {\n console.log(\"Duplicate tag found, ignoring\");\n return;\n }\n\n if (payload.text.endsWith(\" \")) {\n payload.text = payload.text.slice(0, -1);\n payload.end -= 1;\n }\n\n const inside = allTags.some(\n (t) => t.start <= payload.start && t.end >= payload.end,\n );\n\n const overlap = allTags.some(\n (t) => t.start < payload.end && t.end > payload.start,\n );\n\n if ((inside || overlap) && !allowOverlap) {\n console.log(\"Tag is inside another tag, ignoring\");\n return;\n }\n\n dispatch({ type: \"create-node\", payload });\n}\n\nfunction nestHighlights(text: string, tags: AnnotateBlendTag[]) {\n const events: Array<{\n pos: number;\n type: \"start\" | \"end\";\n tag: AnnotateBlendTag;\n }> = [];\n\n for (const tag of tags) {\n events.push({ pos: tag.start, type: \"start\", tag });\n events.push({ pos: tag.end, type: \"end\", tag });\n }\n\n events.sort((a, b) => {\n if (a.pos !== b.pos) return a.pos - b.pos;\n if (a.type === \"end\" && b.type === \"start\") return -1;\n if (a.type === \"start\" && b.type === \"end\") return 1;\n return 0;\n });\n\n const root = { children: [], textStart: 0 };\n const stack = [root];\n let lastPos = 0;\n\n for (const { pos, type, tag } of events) {\n const parent = stack[stack.length - 1];\n\n if (pos > lastPos) {\n const slice = text.slice(lastPos, pos);\n parent.children.push(slice);\n }\n\n if (type === \"start\") {\n const newNode = { tag, children: [], textStart: pos };\n parent.children.push(newNode);\n stack.push(newNode);\n } else {\n stack.pop();\n }\n\n lastPos = pos;\n }\n\n if (lastPos < text.length) {\n stack[stack.length - 1].children.push(text.slice(lastPos));\n }\n\n return root;\n}\n\nfunction renderNode(\n node: any,\n dispatch: TreeDispatch,\n selectedNodes: number[],\n parentSelected: boolean,\n): any {\n if (typeof node === \"string\") return node;\n\n const { tag, children } = node;\n const isSelected = selectedNodes?.includes(tag.id);\n\n const style = {\n ...tag,\n zIndex: parentSelected ? -1 : 1,\n };\n\n let moveText = [];\n if (isSelected) {\n for (const key in children) {\n if (Object.prototype.hasOwnProperty.call(children, key)) {\n const child = children[key];\n if (child?.tag) {\n moveText.push(child.children[0]);\n } else {\n moveText.push(child);\n }\n }\n }\n }\n\n return h(\n \"span\",\n {\n className: \"highlight\",\n style,\n onClick: (e: MouseEvent) => {\n e.stopPropagation();\n dispatch({\n type: \"toggle-node-selected\",\n payload: { ids: [tag.id] },\n });\n },\n },\n isSelected\n ? moveText.flat()\n : children.map((child: any, i: number) =>\n renderNode(child, dispatch, selectedNodes, isSelected),\n ),\n );\n}\n\nexport function HighlightedText(props: {\n text: string;\n allTags: AnnotateBlendTag[];\n lineHeight: string;\n allowOverlap?: boolean;\n dispatch: TreeDispatch;\n selectedNodes: number[];\n}) {\n const {\n text,\n allTags = [],\n lineHeight,\n dispatch,\n selectedNodes,\n allowOverlap,\n } = props;\n\n const tree = nestHighlights(text, allTags);\n\n const spanRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const handleMouseUp = () => {\n const tag = createTagFromSelection({ container: spanRef.current });\n if (!tag) return;\n addTag({ tag, dispatch, text, allTags, allowOverlap });\n };\n\n document.addEventListener(\"mouseup\", handleMouseUp);\n return () => {\n document.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [text, allTags, dispatch, allowOverlap]);\n\n return h(\n \"span\",\n { style: { lineHeight }, ref: spanRef },\n tree.children.map((child: any, i: number) =>\n renderNode(child, dispatch, selectedNodes, false),\n ),\n );\n}\n"],"names":[],"version":3,"file":"feedback-components.921dcd46.js.map"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import $
|
|
3
|
-
import $
|
|
4
|
-
import $
|
|
5
|
-
import {Omnibar as $
|
|
1
|
+
import "./feedback-components.bf93773c.css";
|
|
2
|
+
import $N2zU5$feedbackcomponentsf9850d85js from "./feedback-components.f9850d85.js";
|
|
3
|
+
import $N2zU5$macrostrathyper from "@macrostrat/hyper";
|
|
4
|
+
import $N2zU5$classnames from "classnames";
|
|
5
|
+
import {Omnibar as $N2zU5$Omnibar} from "@blueprintjs/select";
|
|
6
6
|
import "@blueprintjs/select/lib/css/blueprint-select.css";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -16,10 +16,10 @@ function $parcel$interopDefault(a) {
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
const $fda9ef5406c1cfb4$var$h = (0, $
|
|
19
|
+
const $fda9ef5406c1cfb4$var$h = (0, $N2zU5$macrostrathyper).styled((0, ($parcel$interopDefault($N2zU5$feedbackcomponentsf9850d85js))));
|
|
20
20
|
const $fda9ef5406c1cfb4$var$TagListItem = (props)=>{
|
|
21
21
|
/** Render a tag for the omnibox list */ let { active: active, selected: selected, className: className, onSelect: onSelect, item: item, children: children } = props;
|
|
22
|
-
className = (0, $
|
|
22
|
+
className = (0, $N2zU5$classnames)({
|
|
23
23
|
active: active,
|
|
24
24
|
selected: selected
|
|
25
25
|
}, className);
|
|
@@ -38,10 +38,11 @@ const $fda9ef5406c1cfb4$var$TagListItem = (props)=>{
|
|
|
38
38
|
]);
|
|
39
39
|
};
|
|
40
40
|
function $fda9ef5406c1cfb4$export$d8660660a589068c(props) {
|
|
41
|
-
/** A general omnibox for annotation types */ const { onSelectItem: onSelectItem, items: items, isOpen: isOpen, onClose: onClose } = props;
|
|
42
|
-
return $fda9ef5406c1cfb4$var$h((0, $
|
|
41
|
+
/** A general omnibox for annotation types */ const { onSelectItem: onSelectItem, items: items, isOpen: isOpen, onClose: onClose, onQueryChange: onQueryChange } = props;
|
|
42
|
+
return $fda9ef5406c1cfb4$var$h((0, $N2zU5$Omnibar), {
|
|
43
43
|
onItemSelect: onSelectItem,
|
|
44
44
|
items: items,
|
|
45
|
+
onQueryChange: onQueryChange,
|
|
45
46
|
resetOnSelect: false,
|
|
46
47
|
isOpen: isOpen,
|
|
47
48
|
onClose: onClose,
|
|
@@ -59,4 +60,4 @@ function $fda9ef5406c1cfb4$export$d8660660a589068c(props) {
|
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
export {$fda9ef5406c1cfb4$export$d8660660a589068c as OmniboxSelector};
|
|
62
|
-
//# sourceMappingURL=
|
|
63
|
+
//# sourceMappingURL=feedback-components.ad9f284e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;CAEC;;;;;AAUD,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,8EAAK;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;AAYO,SAAS,0CAAmB,KAAsB;IACvD,2CAA2C,GAC3C,MAAM,gBAAE,YAAY,SAAE,KAAK,UAAE,MAAM,WAAE,OAAO,iBAAE,aAAa,EAAE,GAAG;IAEhE,OAAO,wBAAE,CAAA,GAAA,cAAM,GAAG;QAChB,cAAc;eACd;uBACA;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 onQueryChange: (query: string) => 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, onQueryChange } = props;\n\n return h(Omnibar, {\n onItemSelect: onSelectItem,\n items,\n onQueryChange,\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":"feedback-components.ad9f284e.js.map"}
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
circle {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
border: 1px solid #000;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.QoX8-W_selected {
|
|
20
|
+
border: 1px solid #fff;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.QoX8-W_feedback-text {
|
|
24
|
+
margin-bottom: 2em;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.QoX8-W_entity-panel {
|
|
28
|
+
max-height: 600px;
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.QoX8-W_control-panel {
|
|
33
|
+
padding: .2em .5em;
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 1em;
|
|
36
|
+
right: 1em;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.QoX8-W_entity-panel {
|
|
40
|
+
background: var(--panel-secondary-background-color);
|
|
41
|
+
min-height: 100px;
|
|
42
|
+
box-shadow: 0 0 0 1px var(--panel-border-color) inset;
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
flex: 1;
|
|
45
|
+
padding: 1em;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.QoX8-W_selection-tree {
|
|
49
|
+
margin: -1em 0;
|
|
50
|
+
padding: 1em 0;
|
|
51
|
+
width: 70% !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.QoX8-W_type-list {
|
|
55
|
+
grid-template-rows: repeat(10, auto);
|
|
56
|
+
grid-auto-flow: column;
|
|
57
|
+
gap: .2em;
|
|
58
|
+
display: grid;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.QoX8-W_type-list .QoX8-W_type-tag {
|
|
62
|
+
border-radius: .2em;
|
|
63
|
+
padding: .2em .5em;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.QoX8-W_description {
|
|
67
|
+
max-width: 300px;
|
|
68
|
+
padding: .5em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
mark {
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
border-radius: .2em;
|
|
74
|
+
color: #000 !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[role="treeitem"] {
|
|
78
|
+
width: auto !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.QoX8-W_highlight {
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
zIndex: 10;
|
|
84
|
+
border-radius: .2em;
|
|
85
|
+
padding: .2em 0;
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.QoX8-W_feedback-text-wrapper {
|
|
90
|
+
z-index: 0;
|
|
91
|
+
position: relative;
|
|
92
|
+
overflow: visible;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.QoX8-W_type-container {
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
align-items: center;
|
|
98
|
+
column-gap: 1em;
|
|
99
|
+
display: flex;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.QoX8-W_add-type {
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
align-items: center;
|
|
106
|
+
padding: 0 .5em;
|
|
107
|
+
display: flex;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.QoX8-W_add-type p {
|
|
111
|
+
margin: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.QoX8-W_overlay-container {
|
|
115
|
+
justify-content: center;
|
|
116
|
+
align-items: center;
|
|
117
|
+
width: 100vw;
|
|
118
|
+
height: 80vh;
|
|
119
|
+
display: flex;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.QoX8-W_overlay-container .QoX8-W_add-type-overlay {
|
|
123
|
+
background-color: var(--secondary-color);
|
|
124
|
+
border-radius: .2em;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 1em;
|
|
127
|
+
padding: .5em 1em;
|
|
128
|
+
display: flex;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.QoX8-W_overlay-container .QoX8-W_add-type-overlay .QoX8-W_title {
|
|
132
|
+
justify-content: space-between;
|
|
133
|
+
align-items: center;
|
|
134
|
+
display: flex;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.QoX8-W_overlay-container .QoX8-W_add-type-overlay h2 {
|
|
138
|
+
margin: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.QoX8-W_overlay-container .QoX8-W_add-type-overlay .QoX8-W_form-group {
|
|
142
|
+
gap: 3em;
|
|
143
|
+
display: flex;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.QoX8-W_overlay-container .QoX8-W_add-type-overlay .QoX8-W_form-group .QoX8-W_text-inputs {
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
gap: 1em;
|
|
149
|
+
display: flex;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.QoX8-W_icons {
|
|
153
|
+
gap: .25em;
|
|
154
|
+
display: flex;
|
|
155
|
+
}
|
|
156
|
+
/*# sourceMappingURL=feedback-components.b7d9b015.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;AAIE;;;;AAGF;;;;AAGA;;;;;AAIA;;;;AAGA;;;;AAGA;;;;;AAIA;;;;;;;AAMA;;;;;;;;;AASA;;;;;;AAKA;;;;;;;AAME;;;;;AAIF;;;;;AAIA;;;;;;AAKA;;;;AAGA;;;;;;;;AAOA;;;;;;AAKA;;;;;;;AAMA;;;;;;;;AAOE;;;;AAGF;;;;;;;;AAOE;;;;;;;;;AAQE;;;;;;AAKA;;;;AAGA;;;;;AAIE;;;;;;AAKN","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\ncircle\n cursor: pointer\n border: 1px solid black\n\n.selected\n border: 1px solid white\n \n.feedback-text\n margin-bottom: 2em\n\n.entity-panel\n position: relative\n max-height: 600px\n\n.control-panel\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 width: 70% !important\n \n.type-list\n display: grid\n grid-auto-flow: column\n grid-template-rows: repeat(10, auto)\n gap: 0.2em\n\n .type-tag\n padding: .2em .5em\n border-radius: .2em\n\n.description\n max-width: 300px\n padding: .5em\n\nmark\n border-radius: .2em\n cursor: pointer\n color: black !important\n\n[role=\"treeitem\"]\n width: auto !important\n\n.highlight\n cursor: pointer\n padding: .2em 0\n border-radius: .2em\n position: relative\n zIndex: 10\n\n.feedback-text-wrapper \n position: relative\n z-index: 0\n overflow: visible\n\n.type-container\n display: flex\n justify-content: space-between\n align-items: center\n column-gap: 1em\n\n.add-type\n cursor: pointer\n display: flex\n justify-content: space-between\n padding: 0 .5em\n align-items: center\n\n p\n margin: 0\n\n.overlay-container\n height: 80vh\n width: 100vw\n display: flex\n justify-content: center\n align-items: center\n\n .add-type-overlay\n background-color: var(--secondary-color)\n padding: .5em 1em\n display: flex\n flex-direction: column\n gap: 1em\n border-radius: .2em\n\n .title\n display: flex\n justify-content: space-between\n align-items: center\n\n h2\n margin: 0\n\n .form-group\n display: flex\n gap: 3em\n\n .text-inputs\n display: flex\n flex-direction: column\n gap: 1em\n\n.icons\n display: flex\n gap: .25em"],"names":[],"version":3,"file":"feedback-components.b7d9b015.css.map"}
|